i386: Fix <rounding_insn><mode>2 expander [PR95255]
authorUros Bizjak <ubizjak@gmail.com>
Fri, 22 May 2020 16:02:49 +0000 (18:02 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Fri, 22 May 2020 16:02:49 +0000 (18:02 +0200)
2020-05-22  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
PR target/95255
* config/i386/i386.md (<rounding_insn><mode>2): Do not try to
expand non-sse4 ROUND_ROUNDEVEN rounding via SSE support routines.

gcc/testsuite/ChangeLog:
PR target/95255
* gcc.target/i386/pr95255.c: New test.

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr95255.c [new file with mode: 0644]

index cef15b093149c0ed62445822353ce2b5c0ed5afc..8f80df5d6d505e0fc00c1c3dcc52f92643a821e2 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-22  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/95255
+       * config/i386/i386.md (<rounding_insn><mode>2): Do not try to
+       expand non-sse4 ROUND_ROUNDEVEN rounding via SSE support routines.
+
 2020-05-22  Jan Hubicka  <hubicka@ucw.cz>
 
        * lto-streamer-out.c (lto_output_tree): Do not stream final ref if
index e81c737b7bc671c03e2c6c972ef68cfaa0f902dc..459cf62b0deb1453d03531672bba1815e050ed2a 100644 (file)
     && (flag_fp_int_builtin_inexact || !flag_trapping_math))
    || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
        && (TARGET_SSE4_1
-         || (ROUND_<ROUNDING> != ROUND_ROUNDEVEN
-             && (flag_fp_int_builtin_inexact || !flag_trapping_math))))"
+          || (ROUND_<ROUNDING> != ROUND_ROUNDEVEN
+              && (flag_fp_int_builtin_inexact || !flag_trapping_math))))"
 {
   if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
-      && (TARGET_SSE4_1 || flag_fp_int_builtin_inexact || !flag_trapping_math))
+      && (TARGET_SSE4_1
+         || (ROUND_<ROUNDING> != ROUND_ROUNDEVEN
+             && (flag_fp_int_builtin_inexact || !flag_trapping_math))))
     {
       if (TARGET_SSE4_1)
        emit_insn (gen_sse4_1_round<mode>2
-                  (operands[0], operands[1], GEN_INT (ROUND_<ROUNDING>
-                                                      | ROUND_NO_EXC)));
+                  (operands[0], operands[1],
+                   GEN_INT (ROUND_<ROUNDING> | ROUND_NO_EXC)));
       else if (TARGET_64BIT || (<MODE>mode != DFmode))
        {
          if (ROUND_<ROUNDING> == ROUND_FLOOR)
index 7812e3f0f57281d2a6d4629bf5f51ea348aa4803..1dbdc389ab9d9b597dea6eb808a3a090ad37edaa 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-22  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/95255
+       * gcc.target/i386/pr95255.c: New test.
+
 2020-05-22  Hongtao.liu  <hongtao.liu@intel.com>
 
        * gcc.target/i386/pr92658-avx512f.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr95255.c b/gcc/testsuite/gcc.target/i386/pr95255.c
new file mode 100644 (file)
index 0000000..5b73194
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR target/95255 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-sse4.1 -mfpmath=both" } */
+
+double foo (double x)
+{
+  return __builtin_roundeven (x);
+}