i386: Enable AVX512 memory broadcast for FP add
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 19 Oct 2018 09:13:34 +0000 (09:13 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 19 Oct 2018 09:13:34 +0000 (02:13 -0700)
Many AVX512 vector operations can broadcast from a scalar memory source.
This patch enables memory broadcast for FP add operations.

gcc/

PR target/72782
* config/i386/sse.md
(*<plusminus_insn><mode>3<mask_name>_bcst_1): New.
(*add<mode>3<mask_name>_bcst_2): Likewise.

gcc/testsuite/

PR target/72782
* gcc.target/i386/avx512-binop-1.h: New file.
* gcc.target/i386/avx512-binop-2.h: Likewise.
* gcc.target/i386/avx512-binop-3.h: Likewise.
* gcc.target/i386/avx512-binop-4.h: Likewise.
* gcc.target/i386/avx512-binop-5.h: Likewise.
* gcc.target/i386/avx512-binop-6.h: Likewise.
* gcc.target/i386/avx512f-add-df-zmm-1.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-1.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-2.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-3.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-4.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-5.c: Likewise.
* gcc.target/i386/avx512f-add-sf-zmm-6.c: Likewise.
* gcc.target/i386/avx512f-sub-df-zmm-1.c: Likewise.
* gcc.target/i386/avx512f-sub-sf-zmm-1.c: Likewise.
* gcc.target/i386/avx512f-sub-sf-zmm-2.c: Likewise.
* gcc.target/i386/avx512f-sub-sf-zmm-3.c: Likewise.
* gcc.target/i386/avx512f-sub-sf-zmm-4.c: Likewise.
* gcc.target/i386/avx512f-sub-sf-zmm-5.c: Likewise.
* gcc.target/i386/avx512vl-add-sf-xmm-1.c: Likewise.
* gcc.target/i386/avx512vl-add-sf-ymm-1.c: Likewise.
* gcc.target/i386/avx512vl-sub-sf-xmm-1.c: Likewise.
* gcc.target/i386/avx512vl-sub-sf-ymm-1.c: Likewise.

From-SVN: r265311

26 files changed:
gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512-binop-1.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-binop-2.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-binop-3.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-binop-4.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-binop-5.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-binop-6.h [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-df-zmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-df-zmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-add-sf-xmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-add-sf-ymm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-xmm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-ymm-1.c [new file with mode: 0644]

index ee08f80154c73b90810ac67ff4d13b16976ea9cf..50f8d785911381475610720b4c285836eeb6338b 100644 (file)
@@ -1,3 +1,10 @@
+2018-10-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/72782
+       * config/i386/sse.md
+       (*<plusminus_insn><mode>3<mask_name>_bcst_1): New.
+       (*add<mode>3<mask_name>_bcst_2): Likewise.
+
 2018-10-19  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/sse.md
index 06144dc466223ce76dc818320453921d45a91793..411c78ae8d3f153dcc1c019edf8062405af2edbd 100644 (file)
    (set_attr "prefix" "<mask_prefix3>")
    (set_attr "mode" "<MODE>")])
 
+(define_insn "*<plusminus_insn><mode>3<mask_name>_bcst_1"
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
+       (plusminus:VF_AVX512
+         (match_operand:VF_AVX512 1 "register_operand" "v")
+         (vec_duplicate:VF_AVX512
+           (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
+  "TARGET_AVX512F
+   && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
+   && <mask_mode512bit_condition>"
+  "v<plusminus_mnemonic><ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<avx512bcst>}"
+  [(set_attr "prefix" "evex")
+   (set_attr "type" "sseadd")
+   (set_attr "mode" "<MODE>")])
+
+(define_insn "*add<mode>3<mask_name>_bcst_2"
+  [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
+       (plus:VF_AVX512
+         (vec_duplicate:VF_AVX512
+           (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
+         (match_operand:VF_AVX512 2 "register_operand" "v")))]
+  "TARGET_AVX512F
+   && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)
+   && <mask_mode512bit_condition>"
+  "vadd<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
+  [(set_attr "prefix" "evex")
+   (set_attr "type" "sseadd")
+   (set_attr "mode" "<MODE>")])
+
 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
   [(set (match_operand:VF_128 0 "register_operand" "=x,v")
        (vec_merge:VF_128
index 705d745a2d4a586cfac4db35afdd2fd668651fed..5f216f054257ed831a6cc6806f31227a6c390ad7 100644 (file)
@@ -1,3 +1,30 @@
+2018-10-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/72782
+       * gcc.target/i386/avx512-binop-1.h: New file.
+       * gcc.target/i386/avx512-binop-2.h: Likewise.
+       * gcc.target/i386/avx512-binop-3.h: Likewise.
+       * gcc.target/i386/avx512-binop-4.h: Likewise.
+       * gcc.target/i386/avx512-binop-5.h: Likewise.
+       * gcc.target/i386/avx512-binop-6.h: Likewise.
+       * gcc.target/i386/avx512f-add-df-zmm-1.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-1.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-2.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-3.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-4.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-5.c: Likewise.
+       * gcc.target/i386/avx512f-add-sf-zmm-6.c: Likewise.
+       * gcc.target/i386/avx512f-sub-df-zmm-1.c: Likewise.
+       * gcc.target/i386/avx512f-sub-sf-zmm-1.c: Likewise.
+       * gcc.target/i386/avx512f-sub-sf-zmm-2.c: Likewise.
+       * gcc.target/i386/avx512f-sub-sf-zmm-3.c: Likewise.
+       * gcc.target/i386/avx512f-sub-sf-zmm-4.c: Likewise.
+       * gcc.target/i386/avx512f-sub-sf-zmm-5.c: Likewise.
+       * gcc.target/i386/avx512vl-add-sf-xmm-1.c: Likewise.
+       * gcc.target/i386/avx512vl-add-sf-ymm-1.c: Likewise.
+       * gcc.target/i386/avx512vl-sub-sf-xmm-1.c: Likewise.
+       * gcc.target/i386/avx512vl-sub-sf-ymm-1.c: Likewise.
+
 2018-10-19  Ilya Leoshkevich  <iii@linux.ibm.com>
 
        PR rtl-optimization/87596
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-1.h b/gcc/testsuite/gcc.target/i386/avx512-binop-1.h
new file mode 100644 (file)
index 0000000..5bfacd3
--- /dev/null
@@ -0,0 +1,12 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+type
+foo (type x, SCALAR *f)
+{
+  return OP (vec, op, suffix) (x , DUP (vec, suffix, *f));
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-2.h b/gcc/testsuite/gcc.target/i386/avx512-binop-2.h
new file mode 100644 (file)
index 0000000..2e02ede
--- /dev/null
@@ -0,0 +1,12 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+type
+foo (type x, SCALAR *f)
+{
+  return OP (vec, op, suffix) (DUP (vec, suffix, *f), x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-3.h b/gcc/testsuite/gcc.target/i386/avx512-binop-3.h
new file mode 100644 (file)
index 0000000..b1b7e88
--- /dev/null
@@ -0,0 +1,15 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+extern SCALAR bar (void);
+
+type
+foo (type x)
+{
+  SCALAR f = bar ();
+  return OP (vec, op, suffix) (DUP (vec, suffix, f), x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-4.h b/gcc/testsuite/gcc.target/i386/avx512-binop-4.h
new file mode 100644 (file)
index 0000000..4cf4088
--- /dev/null
@@ -0,0 +1,12 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+type
+foo (type x, SCALAR f)
+{
+  return OP (vec, op, suffix) (DUP (vec, suffix, f), x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-5.h b/gcc/testsuite/gcc.target/i386/avx512-binop-5.h
new file mode 100644 (file)
index 0000000..dd59a33
--- /dev/null
@@ -0,0 +1,14 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+extern SCALAR f;
+
+type
+foo (type x)
+{
+  return OP (vec, op, suffix) (x , DUP (vec, suffix, f));
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512-binop-6.h b/gcc/testsuite/gcc.target/i386/avx512-binop-6.h
new file mode 100644 (file)
index 0000000..9e4afc9
--- /dev/null
@@ -0,0 +1,14 @@
+#include <immintrin.h>
+
+#define PASTER2(x,y)           x##y
+#define PASTER3(x,y,z)         _mm##x##_##y##_##z
+#define OP(vec, op, suffix)    PASTER3 (vec, op, suffix)
+#define DUP(vec, suffix, val)  PASTER3 (vec, set1, suffix) (val)
+
+extern SCALAR f;
+
+type
+foo (type x)
+{
+  return OP (vec, op, suffix) (DUP (vec, suffix, f), x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-df-zmm-1.c b/gcc/testsuite/gcc.target/i386/avx512f-add-df-zmm-1.c
new file mode 100644 (file)
index 0000000..d2f6651
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vaddpd\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastsd\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512d
+#define vec 512
+#define op add
+#define suffix pd
+#define SCALAR double
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-1.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-1.c
new file mode 100644 (file)
index 0000000..b664ea9
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-2.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-2.c
new file mode 100644 (file)
index 0000000..a2da306
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-2.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-3.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-3.c
new file mode 100644 (file)
index 0000000..163da1f
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vaddps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-3.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-4.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-4.c
new file mode 100644 (file)
index 0000000..8d46cfb
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+%zmm\[0-9\]+, %zmm\[0-9\]+, %zmm0" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-4.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-5.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-5.c
new file mode 100644 (file)
index 0000000..7ba296b
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\[^\n\]*\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-5.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-6.c b/gcc/testsuite/gcc.target/i386/avx512f-add-sf-zmm-6.c
new file mode 100644 (file)
index 0000000..42b05aa
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\[^\n\]*\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512
+#define vec 512
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-6.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-df-zmm-1.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-df-zmm-1.c
new file mode 100644 (file)
index 0000000..39d668d
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vsubpd\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastsd\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512d
+#define vec 512
+#define op sub
+#define suffix pd
+#define SCALAR double
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-1.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-1.c
new file mode 100644 (file)
index 0000000..4dfb3b9
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vsubps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %zmm\[0-9\]+, %zmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%zmm\[0-9\]+" } } */
+
+#define type __m512
+#define vec 512
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-2.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-2.c
new file mode 100644 (file)
index 0000000..28b4b4d
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vsubps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-2.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-3.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-3.c
new file mode 100644 (file)
index 0000000..62d3058
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vsubps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-3.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-4.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-4.c
new file mode 100644 (file)
index 0000000..f546986
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vsubps\[ \\t\]+%zmm\[0-9\]+, %zmm\[0-9\]+, %zmm0" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-4.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-5.c b/gcc/testsuite/gcc.target/i386/avx512f-sub-sf-zmm-5.c
new file mode 100644 (file)
index 0000000..148873e
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vsubps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-6.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-add-sf-xmm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-add-sf-xmm-1.c
new file mode 100644 (file)
index 0000000..86f37e7
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mfma -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %xmm\[0-9\]+, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%xmm\[0-9\]+" } } */
+
+#define type __m128
+#define vec
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-add-sf-ymm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-add-sf-ymm-1.c
new file mode 100644 (file)
index 0000000..7e00bc8
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mfma -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vaddps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %ymm\[0-9\]+, %ymm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%ymm\[0-9\]+" } } */
+
+#define type __m256
+#define vec 256
+#define op add
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-xmm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-xmm-1.c
new file mode 100644 (file)
index 0000000..7228e07
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mfma -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vsubps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %xmm\[0-9\]+, %xmm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%xmm\[0-9\]+" } } */
+
+#define type __m128
+#define vec
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-ymm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-sub-sf-ymm-1.c
new file mode 100644 (file)
index 0000000..93c5362
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mfma -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vsubps\[ \\t\]+\\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}, %ymm\[0-9\]+, %ymm0" 1 } } */
+/* { dg-final { scan-assembler-not "vbroadcastss\[^\n\]*%ymm\[0-9\]+" } } */
+
+#define type __m256
+#define vec 256
+#define op sub
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"