Many AVX512 vector operations can broadcast from a scalar memory source.
This patch enables memory broadcast for FP div operations.
gcc/
PR target/72782
* config/i386/sse.md (*<avx512>_div<mode>3<mask_name>_bcst): New.
gcc/testsuite/
PR target/72782
* gcc.target/i386/avx512f-div-df-zmm-1.c: New test.
* gcc.target/i386/avx512f-div-sf-zmm-1.c: Likewise.
* gcc.target/i386/avx512f-div-sf-zmm-2.c: Likewise.
* gcc.target/i386/avx512f-div-sf-zmm-3.c: Likewise.
* gcc.target/i386/avx512f-div-sf-zmm-4.c: Likewise.
* gcc.target/i386/avx512f-div-sf-zmm-5.c: Likewise.
* gcc.target/i386/avx512vl-div-sf-xmm-1.c: Likewise.
* gcc.target/i386/avx512vl-div-sf-ymm-1.c: Likewise.
From-SVN: r265345
+2018-10-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/72782
+ * config/i386/sse.md (*<avx512>_div<mode>3<mask_name>_bcst): New.
+
2018-10-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/87647
(set_attr "prefix" "<mask_prefix3>")
(set_attr "mode" "<MODE>")])
+(define_insn "*<avx512>_div<mode>3<mask_name>_bcst"
+ [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
+ (div:VF_AVX512
+ (match_operand:VF_AVX512 1 "register_operand" "v")
+ (vec_duplicate:VF_AVX512
+ (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
+ "TARGET_AVX512F && <mask_mode512bit_condition>"
+ "vdiv<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<<avx512bcst>>}"
+ [(set_attr "prefix" "evex")
+ (set_attr "type" "ssediv")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "<sse>_rcp<mode>2"
[(set (match_operand:VF1_128_256 0 "register_operand" "=x")
(unspec:VF1_128_256
+2018-10-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/72782
+ * gcc.target/i386/avx512f-div-df-zmm-1.c: New test.
+ * gcc.target/i386/avx512f-div-sf-zmm-1.c: Likewise.
+ * gcc.target/i386/avx512f-div-sf-zmm-2.c: Likewise.
+ * gcc.target/i386/avx512f-div-sf-zmm-3.c: Likewise.
+ * gcc.target/i386/avx512f-div-sf-zmm-4.c: Likewise.
+ * gcc.target/i386/avx512f-div-sf-zmm-5.c: Likewise.
+ * gcc.target/i386/avx512vl-div-sf-xmm-1.c: Likewise.
+ * gcc.target/i386/avx512vl-div-sf-ymm-1.c: Likewise.
+
2018-10-20 Marek Polacek <polacek@redhat.com>
* g++.dg/*.C: Use target c++17 instead of explicit dg-options.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vdivpd\[ \\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 div
+#define suffix pd
+#define SCALAR double
+
+#include "avx512-binop-1.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vdivps\[ \\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 div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vdivps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-2.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vdivps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-3.h"
--- /dev/null
+/* { 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 "vdivps\[ \\t\]+%zmm\[0-9\]+, %zmm\[0-9\]+, %zmm0" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-4.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vbroadcastss\[^\n\]*%zmm\[0-9\]+" 1 } } */
+/* { dg-final { scan-assembler-times "vdivps\[^\n\]*%zmm\[0-9\]+" 1 } } */
+
+#define type __m512
+#define vec 512
+#define op div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-6.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vdivps\[ \\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 div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vdivps\[ \\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 div
+#define suffix ps
+#define SCALAR float
+
+#include "avx512-binop-1.h"