re PR middle-end/83623 (ICE: in convert_move, at expr.c:248 with -march=knl and 16bit...
authorJakub Jelinek <jakub@redhat.com>
Sun, 31 Dec 2017 23:50:32 +0000 (00:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 31 Dec 2017 23:50:32 +0000 (00:50 +0100)
PR middle-end/83623
* expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
check for bswap in mode rather than HImode and use that in expand_unop
too.

* gcc.dg/pr83623.c: New test.

From-SVN: r256051

gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr83623.c [new file with mode: 0644]

index c2913d298e7321166b10075935ed14c26e6f1b03..548bb17c10c57bde4fae005e10287f2f8c81c6c1 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/83623
+       * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
+       check for bswap in mode rather than HImode and use that in expand_unop
+       too.
+
 2017-12-31  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/83536
index 6b22946f69a100a3910d88980adbcb67337a1c38..55bb353cd7591fd0e10c393237a4ca9bebfe156a 100644 (file)
@@ -2490,9 +2490,8 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted,
       && CONST_INT_P (op1)
       && INTVAL (op1) == BITS_PER_UNIT
       && GET_MODE_SIZE (scalar_mode) == 2
-      && optab_handler (bswap_optab, HImode) != CODE_FOR_nothing)
-    return expand_unop (HImode, bswap_optab, shifted, NULL_RTX,
-                                 unsignedp);
+      && optab_handler (bswap_optab, mode) != CODE_FOR_nothing)
+    return expand_unop (mode, bswap_optab, shifted, NULL_RTX, unsignedp);
 
   if (op1 == const0_rtx)
     return shifted;
index 43f137e089b95f387b80071ced97cbb4580e5006..f89ae2e549673d595f21a4f5f574c58442112322 100644 (file)
@@ -1,5 +1,8 @@
 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/83623
+       * gcc.dg/pr83623.c: New test.
+
        * gcc.target/i386/i386.exp
        (check_effective_target_avx512vpopcntdqvl): New proc.
        * gcc.target/i386/avx512vpopcntdqvl-vpopcntd-1.c: Use
diff --git a/gcc/testsuite/gcc.dg/pr83623.c b/gcc/testsuite/gcc.dg/pr83623.c
new file mode 100644 (file)
index 0000000..5d62c04
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR middle-end/83623 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mmovbe" { target i?86-*-* x86_64-*-* } } */
+
+unsigned short __attribute__ ((__vector_size__ (16))) x;
+
+void
+foo (void)
+{
+  x = x << 8 | x >> 8;
+}