From ee6e1303781ca90a35e962c52fe0f6f83a0bc10e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Mar 2018 09:05:58 +0100 Subject: [PATCH] re PR target/84827 (ICE in extract_insn, at recog.c:2311) PR target/84827 * config/i386/i386.md (round2): For 387 fancy math, disable pattern if -ftrapping-math -fno-fp-int-builtin-inexact. * gcc.target/i386/pr84827.c: New test. From-SVN: r258477 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.md | 3 ++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr84827.c | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr84827.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dd1259351ec..20dbd41d9e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-03-13 Jakub Jelinek + PR target/84827 + * config/i386/i386.md (round2): For 387 fancy math, disable + pattern if -ftrapping-math -fno-fp-int-builtin-inexact. + PR target/84828 * reg-stack.c (change_stack): Change update_end var from int to rtx_insn *, if non-NULL don't update just BB_END (current_block), but diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index f4f01c3c0f4..bd44243cd2f 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -16311,7 +16311,8 @@ "(TARGET_USE_FANCY_MATH_387 && (!(SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH) || TARGET_MIX_SSE_I387) - && flag_unsafe_math_optimizations) + && flag_unsafe_math_optimizations + && (flag_fp_int_builtin_inexact || !flag_trapping_math)) || (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH && !flag_trapping_math && !flag_rounding_math)" { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7083c16cd24..db73151c6f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-03-13 Jakub Jelinek + PR target/84827 + * gcc.target/i386/pr84827.c: New test. + PR target/84828 * g++.dg/ext/pr84828.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr84827.c b/gcc/testsuite/gcc.target/i386/pr84827.c new file mode 100644 index 00000000000..003258c8204 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr84827.c @@ -0,0 +1,21 @@ +/* PR target/84827 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -fno-fp-int-builtin-inexact -ftrapping-math -fno-associative-math -mfpmath=387" } */ + +double +f1 (double a) +{ + return __builtin_round (a); +} + +float +f2 (float a) +{ + return __builtin_roundf (a); +} + +long double +f3 (long double a) +{ + return __builtin_roundl (a); +} -- 2.30.2