This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] A new meta intrinsic header file for current and future x86 instrinsics.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "rajagopal, dwarak" <dwarak dot rajagopal at amd dot com>
- Cc: "Uros Bizjak" <ubizjak at gmail dot com>, "Richard Guenther" <richard dot guenther at gmail dot com>, "Guo, Xuepeng" <xuepeng dot guo at intel dot com>, gcc-patches at gcc dot gnu dot org, jakub at redhat dot com, "Ye, Joey" <joey dot ye at intel dot com>, "Lin, Weiliang" <weiliang dot lin at intel dot com>, "Harle, Christophe" <christophe dot harle at amd dot com>, "Sebastian Pop" <sebpop at gmail dot com>, "Chris Lattner" <clattner at apple dot com>, "Jan Hubicka" <jh at suse dot cz>
- Date: Mon, 8 Dec 2008 09:13:24 -0800
- Subject: Re: [PATCH] A new meta intrinsic header file for current and future x86 instrinsics.
- References: <820531547ADB6847AF89CC220F6128F1737F@pdsmsx001.ccr.corp.intel.com> <9E1304B144EBEB4C97F4162BFAC4788602D3A6CD@SAUSEXMB2.amd.com> <84fc9c000811191244h1b66a720m97c05aa211d45408@mail.gmail.com> <F3FBCD4755B65C4A958DE1A4B963C499FFE4@SAUSEXMB2.amd.com> <6dc9ffc80812030806w150cd434u21c57eedc68850db@mail.gmail.com> <6dc9ffc80812031350u51f40b0bvca6a17ff7fbfdb3e@mail.gmail.com> <49382171.9010703@gmail.com> <F3FBCD4755B65C4A958DE1A4B963C4990BB53B@SAUSEXMB2.amd.com> <6dc9ffc80812080834s7d40dc6cyd45b4daff49b7f3@mail.gmail.com> <F3FBCD4755B65C4A958DE1A4B963C4990BB5A3@SAUSEXMB2.amd.com>
On Mon, Dec 8, 2008 at 8:59 AM, rajagopal, dwarak
<dwarak.rajagopal@amd.com> wrote:
>
>>
>> On Mon, Dec 8, 2008 at 8:00 AM, rajagopal, dwarak
>> <dwarak.rajagopal@amd.com> wrote:
>> >
>> >>
>> >> H.J. Lu wrote:
>> >> > On Wed, Dec 3, 2008 at 8:06 AM, H.J. Lu <hjl.tools@gmail.com>
> wrote:
>> >> >
>> >> >> On Wed, Dec 3, 2008 at 8:03 AM, rajagopal, dwarak
>> >> >> <dwarak.rajagopal@amd.com> wrote:
>> >> >>
>> >> >>>> Dwarak, can you based on the ideas in
>> >> >>>> immintrin.h
>> >> >>>> provide an implementation of x86intrin.h we can add to GCC?
>> >> >>>>
>> >> >>>>
>> >> >>> Attached is a patch that implements x86intrin.h. I'll add
>> >> "x86intrin.h"
>> >> >>> to gcc.target tests if this patch is Ok?
>> >> >>>
>> >> >>>
>> >> >> Why not just include <immintrin.h> for MMX, SSE, SSE2, SSE3,
> SSSE4
>> > and
>> >> AVX?
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> > Will this patch work?
>> >> >
>> >>
>> >> This patch is OK (with the ChangeLog) if there are no other
> objections
>> >> within 24h.
>> >>
>> >> Thanks,
>> >> Uros.
>> >>
>> >
>> > Hi Uros,
>> > Why do we need to add "immintrin.h" which contains all intrinsics
>> > supported by Intel, instead of having MMX, SSE, SSE2, SSE3, SSSE4
> and
>> > AVX in the x86intrin.h file? Why do we think this is a better
> approach
>> > than just including all the instruction set specific files in
>> > x86intrin.h? Isn't it simpler and clearer to have all the *intrin.h
>> > files included directly in x86intrin.h.
>> >
>>
>> Well, <immintrin.h> is required for AVX intrinsics, which is true for
> icc,
>> gcc
>> and MSVC. Since <immintrin.h> also supports MMX, SSE, SSE2, SSE3 and
>> SSSE4, we don't need to include other Xmmintrin.h individually.
>
> This might not be a good approach if in the future an architecture does
> not support all architectures extensions in immintrin.h. It is better to
> include Xmmintrin.h individually in that case.
If I understand it correctly, your concern is if future processors
from AMD and Intel implement one single
instruction extension, foobar, it is not certain where its intrinsic,
assuming both AMD and Intel specify the
same intrinsic for the same instruction, will be declared. If it is
declared in immintrin.h and immintrin.h is for Intel
ISA externsion only, gcc will have to declare it in a difference
header file for AMD. It has happened to popcnt
and we want to avoid it in the future. Am I correct?
> Moreover, we can remove the requirement of having only immintrin.h
> including avxintrin.h (which is the patch Uros proposed -
> http://gcc.gnu.org/ml/gcc-patches/2008-12/msg00186.html).
>
As I said you must include <immintrin.h> for AVX intrinsic. This
requirement doesn't
come from gcc. It comes to gcc.
--
H.J.