From b8cab8a5492e9639fc9f0ff23f5c392ac395e8a2 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 12 Dec 2016 17:02:28 +0100 Subject: [PATCH] re PR target/78738 (ICE in extract_insn, at recog.c:2311) PR target/78738 * config/i386/i386.h (X87_ENABLE_ARITH): Also enable for flag_unsafe_math_optimizations. (X87_ENABLE_FLOAT): Ditto. testsuite/ChangeLog: PR target/78738 * gcc.target/i386/pr78738.c: New test. From-SVN: r243559 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.h | 9 ++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr78738.c | 10 ++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr78738.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81b0a3b48e7..4e99e1fac86 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-12-12 Uros Bizjak + + PR target/78738 + * config/i386/i386.h (X87_ENABLE_ARITH): Also enable for + flag_unsafe_math_optimizations. + (X87_ENABLE_FLOAT): Ditto. + 2016-12-12 Marek Polacek PR middle-end/78716 diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 8bc31f9187d..4d96a4525fb 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -693,13 +693,16 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); /* Whether to allow x87 floating-point arithmetic on MODE (one of SFmode, DFmode and XFmode) in the current excess precision configuration. */ -#define X87_ENABLE_ARITH(MODE) \ - (flag_excess_precision == EXCESS_PRECISION_FAST || (MODE) == XFmode) +#define X87_ENABLE_ARITH(MODE) \ + (flag_unsafe_math_optimizations \ + || flag_excess_precision == EXCESS_PRECISION_FAST \ + || (MODE) == XFmode) /* Likewise, whether to allow direct conversions from integer mode IMODE (HImode, SImode or DImode) to MODE. */ #define X87_ENABLE_FLOAT(MODE, IMODE) \ - (flag_excess_precision == EXCESS_PRECISION_FAST \ + (flag_unsafe_math_optimizations \ + || flag_excess_precision == EXCESS_PRECISION_FAST \ || (MODE) == XFmode \ || ((MODE) == DFmode && (IMODE) == SImode) \ || (IMODE) == HImode) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 35db8198c28..51058691562 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-12 Uros Bizjak + + PR target/78738 + * gcc.target/i386/pr78738.c: New test. + 2016-12-12 Kyrylo Tkachov * lib/target-supports.exp diff --git a/gcc/testsuite/gcc.target/i386/pr78738.c b/gcc/testsuite/gcc.target/i386/pr78738.c new file mode 100644 index 00000000000..d2a2a62990b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr78738.c @@ -0,0 +1,10 @@ +/* PR middle-end/78738 */ +/* { dg-do compile } */ +/* { dg-options "-O -std=c99 -ffast-math -mfpmath=387" } */ + +double round (double); + +int foo (double a) +{ + return round (a); +} -- 2.30.2