[PATCH, i386, AVX-512, PR68633] Fix order of operands in kunpck[bw,wd,dq] patterns.

Kirill Yukhin kirill.yukhin@gmail.com
Fri Dec 4 14:10:00 GMT 2015


Hello,
Patch in the bottom fixes miscompare issue on Spec2k6/434.zeus.
Bootstrapped & reg-tested.

If no objections - I'll commit it into GCC main trunk on Monday.

gcc/
	PR target/68633
	* config/i386/sse.md (define_insn "kunpckhi"): Fix operands order.
	(define_insn "kunpcksi"): Ditto.
	(define_insn "kunpckdi"): Ditto.
gcc/testsuite
	PR target/68633
	* gcc.target/i386/pr68633.c: New test.

--
Thanks, K

commit 2379ca2e6a65c6373dde7c3f0b778216293f229d
Author: Kirill Yukhin <kirill.yukhin@intel.com>
Date:   Tue Dec 1 14:38:22 2015 +0300

    AVX-512. Fix operands order in kunpck[bw,wd,dq].

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index cbb9ffd..5a79d04 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8800,7 +8800,7 @@
 	    (const_int 8))
 	  (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
   "TARGET_AVX512F"
-  "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
+  "kunpckbw\t{%1, %2, %0|%0, %2, %1}"
   [(set_attr "mode" "HI")
    (set_attr "type" "msklog")
    (set_attr "prefix" "vex")])
@@ -8813,7 +8813,7 @@
 	    (const_int 16))
 	  (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
   "TARGET_AVX512BW"
-  "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
+  "kunpckwd\t{%1, %2, %0|%0, %2, %1}"
   [(set_attr "mode" "SI")])
 
 (define_insn "kunpckdi"
@@ -8824,7 +8824,7 @@
 	    (const_int 32))
 	  (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
   "TARGET_AVX512BW"
-  "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
+  "kunpckdq\t{%1, %2, %0|%0, %2, %1}"
   [(set_attr "mode" "DI")])
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
diff --git a/gcc/testsuite/gcc.target/i386/pr68633.c b/gcc/testsuite/gcc.target/i386/pr68633.c
new file mode 100755
index 0000000..d7f513d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr68633.c
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-Ofast -mavx512f" } */
+/* { dg-require-effective-target avx512f } */
+
+#include <immintrin.h>
+
+#define AVX512F
+
+#include "avx512f-helper.h"
+
+void abort ();
+
+void
+TEST ()
+{
+  __mmask16 k1, k2, k3;
+
+  __asm__( "kmovw %1, %0" : "=k" (k1) : "r" (1) );
+  __asm__( "kmovw %1, %0" : "=k" (k2) : "r" (2) );
+
+  k3 = _mm512_kunpackb (k1, k2);
+  if (k3 != 0x201)
+    abort ();
+}



More information about the Gcc-patches mailing list