[PATCH] A new meta intrinsic header file for current and future x86 instrinsics.

H.J. Lu hjl.tools@gmail.com
Fri Nov 21 18:02:00 GMT 2008


On Fri, Nov 21, 2008 at 9:31 AM, rajagopal, dwarak
<dwarak.rajagopal@amd.com> wrote:
>>
>> On Thu, Nov 20, 2008 at 11:13 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>
>> >> So I propose that AMD introduces its own intrinsic file, following
>> >> immintrin.h example. There *will be* a vendor neutral x86intrin.h
> (or
>> >> whatever the name will be agreed to), and AMDs file will be
> included
>> >> through this vendor neutral header just in the same way as Intels
>> >> file.
>> >
>> > I fail to see a compelling reason to have vendor specific headers at
>> all.
>>
>> Me too, but this is the situation we live in (bmmintrin.h vs.
>> gmmintin.h) and will always live in. Everybody wants its own sandbox
>> to play in.
>>
>> Uros.
>
> Yes. We are beginning to realize this as well.
> I'm planning to create an <x86intrin.h>, which will do the following:
>
> #ifndef _x86INTRIN_H_INCLUDED
> #define _x86INTRIN_H_INCLUDED
>
> #ifdef __MMX__
> #include <mmintrin.h>
> #endif
>
> #ifdef __SSE__
> #include <xmmintrin.h>
> #endif
>
> #ifdef __SSE2__
> #include <emmintrin.h>
> #endif
>
> #ifdef __SSE3__
> #include <pmmintrin.h>
> #endif
>
> #ifdef __SSSE3__
> #include <tmmintrin.h>
> #endif
>
> #ifdef __SSE4a__
> #include <ammintrin.h>
> #endif
>
> #if defined (__SSE4_2__) || defined (__SSE4_1__)
> #include <smmintrin.h>
> #endif
>
> #ifdef __SSE5__
> #include <bmmintrin.h>
> #endif
>
> #if defined (__AES__) || defined (__PCLMUL__)
> #include <wmmintrin.h>
> #endif
>
> #ifdef __AVX__
> #include <avxintrin.h>
> #endif
>
> #ifdef __3dNOW__
> #include <mm3dnow.h>
> #endif
>
> #endif /* _x86MMINTRIN_H_INCLUDED */
>
> Is this approach ok?

There is no need to include SSE to AVX header files separately.

#include <immintrin.h>

will just work. I would suggest you include all AMD intrinsic files from
one file, saying <AMDintrin.h>.  Then x86intrin.h becomes

#include <immintrin.h>
#include <AMDintrin.h>

Thanks.


-- 
H.J.



More information about the Gcc-patches mailing list