x86: Rename VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 13 Jul 2020 16:07:00 +0000 (09:07 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 17 Jul 2020 12:29:30 +0000 (05:29 -0700)
Since ix86_emit_swsqrtsf shouldn't be called with DF vector modes, rename
VF_AVX512VL_VF1_128_256 to VF1_AVX512ER_128_256 and drop DF vector modes.

gcc/

PR target/96186
PR target/88713
* config/i386/sse.md (VF_AVX512VL_VF1_128_256): Renamed to ...
(VF1_AVX512ER_128_256): This.  Drop DF vector modes.
(rsqrt<mode>2): Replace VF_AVX512VL_VF1_128_256 with
VF1_AVX512ER_128_256.

gcc/testsuite/

PR target/96186
PR target/88713
* gcc.target/i386/pr88713-3.c: New test.

gcc/config/i386/sse.md
gcc/testsuite/gcc.target/i386/pr88713-3.c [new file with mode: 0644]

index d3ad5833e1f32bbb90ae11921507b9c6f7a34133..b6348de67cb7dcd4da852a89ccf0029ce031dd15 100644 (file)
   [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
    V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
 
-;; AVX512VL SF/DF plus 128- and 256-bit SF vector modes
-(define_mode_iterator VF_AVX512VL_VF1_128_256
-  [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
-   (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX512VL")
-   (V2DF "TARGET_AVX512VL")])
+;; AVX512ER SF plus 128- and 256-bit SF vector modes
+(define_mode_iterator VF1_AVX512ER_128_256
+  [(V16SF "TARGET_AVX512ER") (V8SF "TARGET_AVX") V4SF])
 
 (define_mode_iterator VF2_AVX512VL
   [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
    (set_attr "mode" "<ssescalarmode>")])
 
 (define_expand "rsqrt<mode>2"
-  [(set (match_operand:VF_AVX512VL_VF1_128_256 0 "register_operand")
-       (unspec:VF_AVX512VL_VF1_128_256
-         [(match_operand:VF_AVX512VL_VF1_128_256 1 "vector_operand")]
+  [(set (match_operand:VF1_AVX512ER_128_256 0 "register_operand")
+       (unspec:VF1_AVX512ER_128_256
+         [(match_operand:VF1_AVX512ER_128_256 1 "vector_operand")]
          UNSPEC_RSQRT))]
   "TARGET_SSE && TARGET_SSE_MATH"
 {
diff --git a/gcc/testsuite/gcc.target/i386/pr88713-3.c b/gcc/testsuite/gcc.target/i386/pr88713-3.c
new file mode 100644 (file)
index 0000000..85b6cf8
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -mno-avx512er -march=skylake-avx512" } */
+
+#include <math.h>
+
+double square(double d[3], double rad)
+{
+  double res[3];
+
+  for (int i = 0; i < 3; i++)
+    {
+      res[i] = d[i] * d[i];
+      res[i] *= rad/sqrt(res[i]);
+    }
+
+  return res[0];
+}