Bug 33482 - Invalid operands for pshifts with -O1
Summary: Invalid operands for pshifts with -O1
Status: RESOLVED DUPLICATE of bug 33369
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-18 20:54 UTC by Dwarak Rajagopal
Modified: 2007-09-19 06:20 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dwarak Rajagopal 2007-09-18 20:54:25 UTC
Testcase (test1.c):

#include <emmintrin.h>
__m128i test_fn1(__m128i x)
{
  __m128i y;
  return _mm_srl_epi64(x,_mm_set_epi32(0,0,31,31));
}

gcc -O1 -c test1.c
/tmp/ccBc8BO7.s: Assembler messages:
/tmp/ccBc8BO7.s:7: Error: suffix or operands invalid for `psrlq'

gcc -O1 -S test1.s

test_fn1:
.LFB501:
        psrlq   $133143986207, %xmm0
        ret

As we can see that the operands are invalid for psrlq. Similar errors occur for other pshifts instructions such as psra*, psrl*, and psll*.

A patch to fix this issue is as follows, basically having the right output modifier for these insns in sse.md.

diff -purwN gcc-4.2.2-RC-20070909/gcc/config/i386/sse.md gcc-4.2.2-RC-20070909-fix/gcc/config/i386/sse.md
--- gcc-4.2.2-RC-20070909/gcc/config/i386/sse.md        2007-09-01 10:28:30.000000000 -0500
+++ gcc-4.2.2-RC-20070909-fix/gcc/config/i386/sse.md    2007-09-17 16:33:26.790117000 -0500
@@ -2724,7 +2724,7 @@
   [(set (match_operand:SSEMODE24 0 "register_operand" "=x")
        (ashiftrt:SSEMODE24
          (match_operand:SSEMODE24 1 "register_operand" "0")
-         (match_operand:TI 2 "nonmemory_operand" "xn")))]
+         (match_operand:TI 2 "nonmemory_operand" "xN")))]
   "TARGET_SSE2"
   "psra<ssevecsize>\t{%2, %0|%0, %2}"
   [(set_attr "type" "sseishft")
@@ -2734,7 +2734,7 @@
   [(set (match_operand:SSEMODE248 0 "register_operand" "=x")
        (lshiftrt:SSEMODE248
          (match_operand:SSEMODE248 1 "register_operand" "0")
-         (match_operand:TI 2 "nonmemory_operand" "xn")))]
+         (match_operand:TI 2 "nonmemory_operand" "xN")))]
   "TARGET_SSE2"
   "psrl<ssevecsize>\t{%2, %0|%0, %2}"
   [(set_attr "type" "sseishft")
@@ -2744,7 +2744,7 @@
   [(set (match_operand:SSEMODE248 0 "register_operand" "=x")
        (ashift:SSEMODE248
          (match_operand:SSEMODE248 1 "register_operand" "0")
-         (match_operand:TI 2 "nonmemory_operand" "xn")))]
+         (match_operand:TI 2 "nonmemory_operand" "xN")))]
   "TARGET_SSE2"
   "psll<ssevecsize>\t{%2, %0|%0, %2}"
   [(set_attr "type" "sseishft")

Is this ok?

- Dwarak
Comment 1 Uroš Bizjak 2007-09-19 06:20:04 UTC
I'll backport http://gcc.gnu.org/viewcvs?view=rev&revision=128328 from PR target/33369 to fix this issue.

*** This bug has been marked as a duplicate of 33369 ***