public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] i386: Fix <rounding_insn><mode>2 expander [PR95255]
@ 2020-05-22 16:05 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2020-05-22 16:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

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.

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

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1580 bytes --]

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e81c737b7bc..459cf62b0de 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -17115,16 +17115,18 @@
     && (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)
diff --git a/gcc/testsuite/gcc.target/i386/pr95255.c b/gcc/testsuite/gcc.target/i386/pr95255.c
new file mode 100644
index 00000000000..5b731941f72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95255.c
@@ -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);
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-22 16:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 16:05 [committed] i386: Fix <rounding_insn><mode>2 expander [PR95255] Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).