This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Restricting arguments to intrinsic functions
- From: Charles Baylis <charles dot baylis at linaro dot org>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Tejas Belagod <tejas dot belagod at arm dot com>, Segher Boessenkool <segher at kernel dot crashing dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 24 Oct 2014 18:25:29 +0100
- Subject: Re: Restricting arguments to intrinsic functions
- Authentication-results: sourceware.org; auth=none
- References: <CADnVucA8f3zHOY_UaFvxNAR-j3D7EDvTPiYpoLEUNJL+8TYZzw at mail dot gmail dot com> <20141024144446 dot GA23124 at gate dot crashing dot org> <544A6C08 dot 4020809 at arm dot com> <CA+=Sn1mabrzY1G4hdLgMx6Mn_2xZh54R0kYLOwjhxAbAP9AgoA at mail dot gmail dot com>
On 24 October 2014 17:05, Andrew Pinski <pinskia@gmail.com> wrote:
> On Fri, Oct 24, 2014 at 8:11 AM, Tejas Belagod <tejas.belagod@arm.com> wrote:
>> The diagnostic issued points to the line in arm_neon.h, but we expect this
>> to point to the line in cr.c. I suspect we need something closer to the
>> front-end?
>
>
> You need to change arm_neon.h to use the __artificial__ attribute as I
> mentioned before. Also please move away from "static inline" since
> they cannot be used from templates in C++98/03.
The __artificial__ attribute seems like it would improve the debug
view, but it does not seem to affect the location of error reporting.
As an example (static inline from current code - will fix later)
=== t_artificial.h ===
/* extracted from arm_neon.h */
typedef float float32_t;
typedef __builtin_neon_sf float32x2_t __attribute__ ((__vector_size__ (8)));
__extension__ static __inline float32_t __attribute__
((__always_inline__,__artificial__)) vget_lane_f32 (float32x2_t __a,
const int __b)
{
return (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 3);
}
=== t_artificial.c ===
#include "t_artificial.h"
int f(float32x2_t x) {
int i = 3;
float a = vget_lane_f32(x, i);
}
=== end ===
$ arm-unknown-linux-gnueabihf-gcc -c - t_artificial.c -mfpu=neon
In file included from t_artificial.c:1:0:
t_artificial.h: In function âfâ:
t_artificial.h:7:10: error: argument must be a constant
return (float32_t)__builtin_neon_vget_lanev2sf (__a, __b, 3);
^
(...followed by an ICE because we allow this to result in an invalid
insn, Jakub has explained how to address this)
The error is reported in t_artificial.h, rather than t_artificial.c:5
which is where the user has made the mistake.
https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html says that
the artificial attribute affects generated debug info and doesn't
mention error reporting at all.
Thanks
Charles