From 1a030003858d853f564ed354f1cb579c03db17ef Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 22 May 2020 18:02:49 +0200 Subject: [PATCH] i386: Fix 2 expander [PR95255] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2020-05-22 Uroš Bizjak gcc/ChangeLog: PR target/95255 * config/i386/i386.md (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 | 6 ++++++ gcc/config/i386/i386.md | 12 +++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr95255.c | 8 ++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr95255.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cef15b09314..8f80df5d6d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-05-22 Uroš Bizjak + + PR target/95255 + * config/i386/i386.md (2): Do not try to + expand non-sse4 ROUND_ROUNDEVEN rounding via SSE support routines. + 2020-05-22 Jan Hubicka * lto-streamer-out.c (lto_output_tree): Do not stream final ref if 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) && TARGET_SSE_MATH && (TARGET_SSE4_1 - || (ROUND_ != ROUND_ROUNDEVEN - && (flag_fp_int_builtin_inexact || !flag_trapping_math))))" + || (ROUND_ != ROUND_ROUNDEVEN + && (flag_fp_int_builtin_inexact || !flag_trapping_math))))" { if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH - && (TARGET_SSE4_1 || flag_fp_int_builtin_inexact || !flag_trapping_math)) + && (TARGET_SSE4_1 + || (ROUND_ != ROUND_ROUNDEVEN + && (flag_fp_int_builtin_inexact || !flag_trapping_math)))) { if (TARGET_SSE4_1) emit_insn (gen_sse4_1_round2 - (operands[0], operands[1], GEN_INT (ROUND_ - | ROUND_NO_EXC))); + (operands[0], operands[1], + GEN_INT (ROUND_ | ROUND_NO_EXC))); else if (TARGET_64BIT || (mode != DFmode)) { if (ROUND_ == ROUND_FLOOR) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7812e3f0f57..1dbdc389ab9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-05-22 Uroš Bizjak + + PR target/95255 + * gcc.target/i386/pr95255.c: New test. + 2020-05-22 Hongtao.liu * 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 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); +} -- 2.30.2