public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
@ 2011-06-14 22:43 qneill at gcc dot gnu.org
  2011-06-14 23:22 ` [Bug target/49411] " jakub at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: qneill at gcc dot gnu.org @ 2011-06-14 22:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

           Summary: [4.6/4.7] ICE: unrecognizable insn with -mxop in
                    _mm_roti_epi8 with negative number
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: qneill@gcc.gnu.org


Using _mm_roti_epi8 in xopintrin.h with a negative number produces an ICE in
4.6/4.7; the negative number is how you use VPROT[BWDQ] to rotate right, see 
http://support.amd.com/us/Processor_TechDocs/26568.pdf

------ testcase.c ------
#include <x86intrin.h>
void f(void)
{
        __m128 s;
        __m128i d;
        return _mm_roti_epi8(s, -1);
}
------ output ------
$ gcc -mxop -c vprotbi1.c
vprotbi1.c: In function ‘f’:
vprotbi1.c:6:2: warning: ‘return’ with a value, in function returning void
[enabled by default]
vprotbi1.c:7:1: error: unrecognizable insn:
(insn 6 5 7 3 (set (reg:V16QI 60 [ D.8650 ])
        (rotate:V16QI (reg:V16QI 59 [ D.8648 ])
            (const_int -1 [0xffffffffffffffff]))) vprotbi1.c:6 -1
     (nil))
vprotbi1.c:7:1: internal compiler error: in extract_insn, at recog.c:2113
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
@ 2011-06-14 23:22 ` jakub at gcc dot gnu.org
  2011-06-15  5:48 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-14 23:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-14 23:21:32 UTC ---
It ICEs even for positive values such as _mm_roti_epi8 (s, 76);
I think multi_arg builtin expansion needs to do constant argument checking,
at least for IX86_BUILTIN_VPROT[BWDQ]_IMM and IX86_BUILTIN_VPERMIL2P[DS]{,256}.
And for the former ones either use CODE_FOR_* of an expander that handles both
positive and negative values, where for positive one it would expand to
xop_rotl* and for negative to xop_rotr* with the shift count negated, or
the negation and choice of pattern needs to be done in
ix86_expand_multi_arg_builtin.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
  2011-06-14 23:22 ` [Bug target/49411] " jakub at gcc dot gnu.org
@ 2011-06-15  5:48 ` jakub at gcc dot gnu.org
  2011-06-15  6:33 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-15  5:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.06.15 05:48:05
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-15 05:48:05 UTC ---
I'll handle this.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
  2011-06-14 23:22 ` [Bug target/49411] " jakub at gcc dot gnu.org
  2011-06-15  5:48 ` jakub at gcc dot gnu.org
@ 2011-06-15  6:33 ` jakub at gcc dot gnu.org
  2011-06-15 15:38 ` qneill at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-15  6:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-15 06:32:20 UTC ---
Created attachment 24533
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24533
gcc47-pr49411.patch

Untested fix.  Alternatively, we could for the rotation instead just always
mask the immediate operand (the only docs I found about these intrinsics was
MSFT documentation which didn't say anything on invalid count, but even said
that the count is preferrably an integer instead of unconditionally an
integer).
Therefore, perhaps we could mask it if it is constant and expand using
rotl<mode>3 expander if it is not CONST_INT.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-06-15  6:33 ` jakub at gcc dot gnu.org
@ 2011-06-15 15:38 ` qneill at gcc dot gnu.org
  2011-06-15 15:57 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: qneill at gcc dot gnu.org @ 2011-06-15 15:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #4 from Quentin Neill <qneill at gcc dot gnu.org> 2011-06-15 15:38:27 UTC ---
Hi Jakub,

Thanks for looking at this.

I think we need an nargs==3 case for the Compare/Predicate generation
(_mm_com*) intrinsics as well.

And did you mean to test the value of INTVAL(op) in the nargs==4 vpermil case
before throwing an error?
-- 
Quentin


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-06-15 15:38 ` qneill at gcc dot gnu.org
@ 2011-06-15 15:57 ` jakub at gcc dot gnu.org
  2011-06-15 16:40 ` qneill at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-15 15:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-15 15:57:29 UTC ---
FYI, a newer patch has been posted:
http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01139.html
I don't think it is necessary to test the op of vpermil again if it is
CONST_INT, we know it is not 0..3 because otherwise
insn_data[icode].operand[i + 1].predicate (op, mode)
would be true.
_mm_com* don't seem to have an constant argument, just two vector arguments, so
there is nothing to check.  The immediate comes directly from the table and so
is known to be ok.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-06-15 15:57 ` jakub at gcc dot gnu.org
@ 2011-06-15 16:40 ` qneill at gcc dot gnu.org
  2011-06-18  6:43 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: qneill at gcc dot gnu.org @ 2011-06-15 16:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #6 from Quentin Neill <qneill at gcc dot gnu.org> 2011-06-15 16:39:47 UTC ---
(In reply to comment #5)

> newer patch has been posted
Thanks; I will test this on AMD HW.

> test the op of vpermil
Okay.

> _mm_com*
I spotted them in the opcode tables, but had forgotten how those work.

I'm looking into lwpval/ins, bextr (there is an immediate) and vcvtps*


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-06-15 16:40 ` qneill at gcc dot gnu.org
@ 2011-06-18  6:43 ` jakub at gcc dot gnu.org
  2011-06-18  9:08 ` jakub at gcc dot gnu.org
  2011-06-18  9:19 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-18  6:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-18 06:43:41 UTC ---
Author: jakub
Date: Sat Jun 18 06:43:38 2011
New Revision: 175165

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175165
Log:
    PR target/49411
    * config/i386/i386.c (ix86_expand_multi_arg_builtins): If
    last_arg_constant and last argument doesn't match its predicate,
    for xop_vpermil2<mode>3 error out and for xop_rotl<mode>3
    if it is CONST_INT, mask it, otherwise expand using rotl<mode>3.
    (ix86_expand_sse_pcmpestr, ix86_expand_sse_pcmpistr): Fix
    spelling of error message.
    * config/i386/sse.md (sse4a_extrqi, sse4a_insertqi,
    vcvtps2ph, *vcvtps2ph, *vcvtps2ph_store, vcvtps2ph256): Use
    const_0_to_255_operand instead of const_int_operand.

    Revert:
    2011-05-09  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/sse.md (blendbits): Remove mode attribute.
    (<sse4_1>_blend<ssemodesuffix><avxsizesuffix>): Use const_int_operand
    instead of const_0_to_<blendbits>_operand for operand 3 predicate.
    Check integer value of operand 3 in insn constraint.

    * gcc.target/i386/testimm-1.c: New test.
    * gcc.target/i386/testimm-2.c: New test.
    * gcc.target/i386/testimm-3.c: New test.
    * gcc.target/i386/testimm-4.c: New test.
    * gcc.target/i386/testimm-5.c: New test.
    * gcc.target/i386/testimm-6.c: New test.
    * gcc.target/i386/testimm-7.c: New test.
    * gcc.target/i386/testimm-8.c: New test.
    * gcc.target/i386/xop-vpermil2px-2.c: New test.
    * gcc.target/i386/xop-rotate1-int.c: New test.
    * gcc.target/i386/xop-rotate2-int.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/testimm-1.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-2.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-3.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-4.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-5.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-6.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-7.c
    trunk/gcc/testsuite/gcc.target/i386/testimm-8.c
    trunk/gcc/testsuite/gcc.target/i386/xop-rotate1-int.c
    trunk/gcc/testsuite/gcc.target/i386/xop-rotate2-int.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/sse.md
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2011-06-18  6:43 ` jakub at gcc dot gnu.org
@ 2011-06-18  9:08 ` jakub at gcc dot gnu.org
  2011-06-18  9:19 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-18  9:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-18 09:07:24 UTC ---
Author: jakub
Date: Sat Jun 18 09:07:20 2011
New Revision: 175170

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175170
Log:
    PR target/49411
    * config/i386/i386.c (ix86_expand_multi_arg_builtins): If
    last_arg_constant and last argument doesn't match its predicate,
    for xop_vpermil2<mode>3 error out and for xop_rotl<mode>3
    if it is CONST_INT, mask it, otherwise expand using rotl<mode>3.
    (ix86_expand_sse_pcmpestr, ix86_expand_sse_pcmpistr): Fix
    spelling of error message.
    * config/i386/sse.md (sse4a_extrqi, sse4a_insertqi,
    vcvtps2ph, *vcvtps2ph, *vcvtps2ph_store, vcvtps2ph256): Use
    const_0_to_255_operand instead of const_int_operand.

    * gcc.target/i386/testimm-1.c: New test.
    * gcc.target/i386/testimm-2.c: New test.
    * gcc.target/i386/testimm-3.c: New test.
    * gcc.target/i386/testimm-4.c: New test.
    * gcc.target/i386/testimm-5.c: New test.
    * gcc.target/i386/testimm-6.c: New test.
    * gcc.target/i386/testimm-7.c: New test.
    * gcc.target/i386/testimm-8.c: New test.
    * gcc.target/i386/xop-vpermil2px-2.c: New test.
    * gcc.target/i386/xop-rotate1-int.c: New test.
    * gcc.target/i386/xop-rotate2-int.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-1.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-2.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-3.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-4.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-5.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-6.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-7.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/testimm-8.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/xop-rotate1-int.c
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/i386/xop-rotate2-int.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/i386/i386.c
    branches/gcc-4_6-branch/gcc/config/i386/sse.md
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/49411] [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number
  2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2011-06-18  9:08 ` jakub at gcc dot gnu.org
@ 2011-06-18  9:19 ` jakub at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-18  9:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49411

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-18 09:18:55 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-18  9:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-14 22:43 [Bug target/49411] New: [4.6/4.7] ICE: unrecognizable insn with -mxop in _mm_roti_epi8 with negative number qneill at gcc dot gnu.org
2011-06-14 23:22 ` [Bug target/49411] " jakub at gcc dot gnu.org
2011-06-15  5:48 ` jakub at gcc dot gnu.org
2011-06-15  6:33 ` jakub at gcc dot gnu.org
2011-06-15 15:38 ` qneill at gcc dot gnu.org
2011-06-15 15:57 ` jakub at gcc dot gnu.org
2011-06-15 16:40 ` qneill at gcc dot gnu.org
2011-06-18  6:43 ` jakub at gcc dot gnu.org
2011-06-18  9:08 ` jakub at gcc dot gnu.org
2011-06-18  9:19 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).