From fc2e8e423f34f2163b0e3b49b4f37c77b5ead922 Mon Sep 17 00:00:00 2001 From: Kirill Yukhin Date: Mon, 7 Dec 2015 11:05:40 +0000 Subject: [PATCH] re PR target/68633 ([i386, AVX-512] Spec2006/434.zeus miscompares when executed on KNL) PR target/68633 gcc/ * config/i386/sse.md (define_insn "kunpckhi"): Fix operands order. (define_insn "kunpcksi"): Ditto. (define_insn "kunpckdi"): Ditto. gcc/testsuite * gcc.target/i386/pr68633.c: New test. From-SVN: r231359 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.md | 6 +++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr68633.c | 24 ++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr68633.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be756206c41..2c7c82356e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-12-07 Kirill Yukhin + + PR target/68633 + * config/i386/sse.md (define_insn "kunpckhi"): Fix operands order. + (define_insn "kunpcksi"): Ditto. + (define_insn "kunpckdi"): Ditto. + 2015-12-06 Kaz Kojima * config/sh/sh.md (rsqrtsf2): Adjust for canonical form with unspec. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index fd0a706217c..49b221665fd 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -8803,7 +8803,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")]) @@ -8816,7 +8816,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" @@ -8827,7 +8827,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/ChangeLog b/gcc/testsuite/ChangeLog index 682272fc6e9..583baa92741 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-07 Kirill Yukhin + + PR target/68633 + * gcc.target/i386/pr68633.c: New test. + 2015-12-06 Victoria Stepanyan * gcc.target/i386/clzero.c: New. diff --git a/gcc/testsuite/gcc.target/i386/pr68633.c b/gcc/testsuite/gcc.target/i386/pr68633.c new file mode 100644 index 00000000000..d7f513d276a --- /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 + +#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 (); +} -- 2.30.2