Patchwork Fix ICEs with -mxop __builtin_ia32_vpermil2p[sd]{,256} and __builtin_ia32_vprot[bwdq]i intrinsics (PR target/49411)

login
register
mail settings
Submitter Quentin Neill
Date June 16, 2011, 10:57 p.m.
Message ID <BANLkTinFkjnEi-6K179rs15=37xkN7OCtg@mail.gmail.com>
Download mbox | patch
Permalink /patch/100737/
State New
Headers show

Comments

Quentin Neill - June 16, 2011, 10:57 p.m.
On Thu, Jun 16, 2011 at 3:34 PM, Quentin Neill
<quentin.neill.gnu@gmail.com> wrote:
> On Wed, Jun 15, 2011 at 11:40 AM, Quentin Neill
> <quentin.neill.gnu@gmail.com> wrote:
>> On Wed, Jun 15, 2011 at 4:54 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>>> Hi!
>>>
>>> All of these _mm{,256}_permute2_p[sd] and _mm_roti_epi{8,16,32,64}
>>> intrinsics ICE if the last argument is constant integer, but not in the
>>> expected range.
>>>
>>> I could only find MSFT documentation for these intrinsics, where for
>>> *permute2* it says that the last argument must be 0, 1, 2 or 3,
>>> for *roti* it says that the last argument is integer rotation count,
>>> preferrably constant and that if count is negative, it performs right
>>> rotation instead of left rotation.
>>> This patch adjusts the builtins to match that, if we want to instead
>>> e.g. always mandate _mm_roti_epi* last argument is constant integer,
>>> or constant integer in the range -N+1 .. N-1 where N is the number
>>> after _mm_roti_epi, or in the range 0 .. N-1, it can be easily adjusted.
>>>
>>> Regtested on x86_64-linux {-m32,-m64}, unfortunately on a SandyBridge
>>> box, so I couldn't verify if xop-rotate[12]-int.c actually succeeds
>>> on xop capable HW.
>>>
>>> [snip]
>>>
>>>        Jakub
>>>
>>
>> I will test on AMD HW.
>> --
>> Quentin
>
> Regtested on x86_64-linux on AMD Family 16h, and verified the
> xop-rotate[12]-int tests ran and passed.
> --
> Quentin

Does it need to also handle the VCVTP[SH]2P[HS] insns like this?

                      error ("last argument must be an immediate");

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 675888f..584f722 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -25571,6 +25571,10 @@  ix86_expand_multi_arg_builtin (enum insn_code
icode, tree exp, rtx target,
                case CODE_FOR_xop_vpermil2v4sf3:
                case CODE_FOR_xop_vpermil2v4df3:
                case CODE_FOR_xop_vpermil2v8sf3:
+               case CODE_FOR_vcvtph2ps:
+               case CODE_FOR_vcvtph2ps256:
+               case CODE_FOR_vcvtps2ph:
+               case CODE_FOR_vcvtps2ph256:
                  if (!CONST_INT_P (op))
                    {