__builtin_ia32_rsqrtsf2 expansion generates UNSPEC_RSQRT insn pattern
also when TARGET_SSE_MATH is not set.  Enable *rsqrtsf2_sse without
TARGET_SSE_MATH to avoid ICE with unrecognizable insn.

PR target/117357

gcc/ChangeLog:

* config/i386/i386.md (*rsqrtsf2_sse):
Also enable for !TARGET_SSE_MATH.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr117357.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {-m32}.

Uros.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 03b0f548467..b2209492fa0 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -23364,7 +23364,7 @@ (define_insn "*rsqrtsf2_sse"
   [(set (match_operand:SF 0 "register_operand" "=x,x,x,x")
        (unspec:SF [(match_operand:SF 1 "nonimmediate_operand" "0,x,m,ja")]
                   UNSPEC_RSQRT))]
-  "TARGET_SSE && TARGET_SSE_MATH"
+  "TARGET_SSE"
   "@
    %vrsqrtss\t{%d1, %0|%0, %d1}
    %vrsqrtss\t{%d1, %0|%0, %d1}
diff --git a/gcc/testsuite/gcc.target/i386/pr117357.c 
b/gcc/testsuite/gcc.target/i386/pr117357.c
new file mode 100644
index 00000000000..7a27691a977
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr117357.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-msse -mfpmath=387" } */
+
+float foo (float f)
+{
+  return __builtin_ia32_rsqrtf (f);
+}

Reply via email to