2020-05-22 Uroš Bizjak <ubiz...@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.
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); +}