Do I have to include some header files in order to use GCC built_in function?

StackOverflow https://stackoverflow.com/questions/19961118

  •  30-07-2022
  •  | 
  •  

Question

The motivation is that I want to tell the compiler that my float *U array is 64 bytes aligned so that the compiler can do the vectorizations.

If using Intel compiler, I can use the __assume_aligned(U,64);I googled and found that if I want to do the same thing using GCC, I have to define another float *U_tmp=__builtin_assume_aligned(U,64), and use U_tmp. However, when it goes to compilation with GCC, the compiler reports that "error: ‘__builtin_assume_aligned’ was not declared in this scope" I don't know if I have missed some libraries or header files containing this GCC built in function.

Était-ce utile?

La solution

This is supposed to work out of the box, without any additional headers. However, this has been added only to GCC 4.7, maybe your compiler is older than that?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top