This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Prototypes for builtin functions


Hi,

I would like to hear how other architectures organize their builtin/intrinsic headers.

Until recently we had a header that would look like:

/* Types */
typedef char	   V8B  __attribute__ ((vector_size (8)));
...

/* Prototypes */
extern V8B __vec_put_v8b (V8B B, char C, unsigned char D);
...

The problem with this approach (I found out) is that GCC after seeing the prototype changes the location of the definition of the builtin from BUILTINS_LOCATION to the headerfile/linenumber and then when calling DECL_IS_BUILTIN on __vec_put_v8b tree it returns 0. This blocks a few optimizations (I noticed this when specifically checking why some functions were not being unrolled properly).

So, I commented out the prototypes from the intrinsics header and left only the type definitions, however, tests on intrinsics fail because if I do:
V8B put_v8b_test (V8B a, char value, char index)
{
 V8B b = __vec_put_v8b (a, value, index);
 return b;
}

GCC complains with:
error: incompatible type for argument 1 of '__vec_put_v8b'
note: expected '__vector(8) signed char' but argument is of type 'V8B'

What's the correct way to create the intrinsics header?

-- 
Paulo Matos


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]