x86: don't use AVX512BW vmovdqu variants without -mavx512bw
authorJan Beulich <jbeulich@suse.com>
Wed, 3 Jan 2018 10:42:08 +0000 (10:42 +0000)
committerJan Beulich <jbeulich@gcc.gnu.org>
Wed, 3 Jan 2018 10:42:08 +0000 (10:42 +0000)
Simply mirror the MODE_XI logic of handling unaligned operands in
mov<mode>_internal into MODE_TI / MODE_OI handling.

gcc/
2018-01-03  Jan Beulich  <jbeulich@suse.com>

* sse.md (mov<mode>_internal): Tighten condition for when to use
vmovdqu<ssescalarsize> for TI and OI modes.

gcc/testsuite/
2018-01-03  Jan Beulich  <jbeulich@suse.com>

* gcc.target/i386/avx512vl-no-vmovdqu8.c,
gcc.target/i386/avx512vl-no-vmovdqu16.c: New.

From-SVN: r256170

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu8.c [new file with mode: 0644]

index 812a0b57039629d038252f963fb5a8cc7594c993..d9c4c6adf9789c31a1896e6527fe21d1af8568d5 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-03  Jan Beulich  <jbeulich@suse.com>
+
+       * sse.md (mov<mode>_internal): Tighten condition for when to use
+       vmovdqu<ssescalarsize> for TI and OI modes.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
index acaada28a51ff66c4499e014024e6afe5d436a51..b0ba91e6b84d8ea372206fadc6bdb75f5f9ac7df 100644 (file)
        case MODE_TI:
          if (misaligned_operand (operands[0], <MODE>mode)
              || misaligned_operand (operands[1], <MODE>mode))
-           return TARGET_AVX512VL ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
-                                  : "%vmovdqu\t{%1, %0|%0, %1}";
+           return TARGET_AVX512VL
+                  && (<MODE>mode == V4SImode
+                      || <MODE>mode == V2DImode
+                      || <MODE>mode == V8SImode
+                      || <MODE>mode == V4DImode
+                      || TARGET_AVX512BW)
+                  ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
+                  : "%vmovdqu\t{%1, %0|%0, %1}";
          else
            return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
                                   : "%vmovdqa\t{%1, %0|%0, %1}";
index 3a5b77083a6e10027bfc05b58cc625936324b8af..2c179b149640239dc594144f38d8ec37a025988e 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-03  Jan Beulich  <jbeulich@suse.com>
+
+       * gcc.target/i386/avx512vl-no-vmovdqu8.c,
+       gcc.target/i386/avx512vl-no-vmovdqu16.c: New.
+
 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        Update copyright years.
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu16.c b/gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu16.c
new file mode 100644 (file)
index 0000000..29b3141
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */
+
+typedef unsigned int __attribute__((mode(HI), vector_size(16))) v8hi_t;
+typedef unsigned int __attribute__((mode(HI), vector_size(32))) v16hi_t;
+
+struct s8hi {
+       int i;
+       v8hi_t __attribute__((packed)) v;
+};
+struct s16hi {
+       int i;
+       v16hi_t __attribute__((packed)) v;
+};
+
+void f8hi(struct s8hi*p1, const struct s8hi*p2) {
+       p1->v += p2->v;
+}
+
+void f16hi(struct s16hi*p1, const struct s16hi*p2) {
+       p1->v += p2->v;
+}
+
+/* { dg-final { scan-assembler-not "^\[ \t\]*vmovdq\[au\](8|16)" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu8.c b/gcc/testsuite/gcc.target/i386/avx512vl-no-vmovdqu8.c
new file mode 100644 (file)
index 0000000..f48d773
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */
+
+typedef unsigned int __attribute__((mode(QI), vector_size(16))) v16qi_t;
+typedef unsigned int __attribute__((mode(QI), vector_size(32))) v32qi_t;
+
+struct s16qi {
+       int i;
+       v16qi_t __attribute__((packed)) v;
+};
+struct s32qi {
+       int i;
+       v32qi_t __attribute__((packed)) v;
+};
+
+void f16qi(struct s16qi*p1, const struct s16qi*p2) {
+       p1->v += p2->v;
+}
+
+void f32qi(struct s32qi*p1, const struct s32qi*p2) {
+       p1->v += p2->v;
+}
+
+/* { dg-final { scan-assembler-not "^\[ \t\]*vmovdq\[au\](8|16)" } } */