From: Uros Bizjak Date: Thu, 19 Nov 2020 08:23:46 +0000 (+0100) Subject: i386: Disable *2_i387_1 for TARGET_SSE_MATH modes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50134189a434e638861f8bf27d5caab9622811c8;p=gcc.git i386: Disable *2_i387_1 for TARGET_SSE_MATH modes This pattern interferes with *2_1 when TARGET_SSE_MATH modes are active. Combine pass is able to remove (use) RTXes and transforms *2_1 to *2_i387_1 where SSE alternatives are not available. 2020-11-19 Uroš Bizjak gcc/ * config/i386/i386.md (*2_i387_1): Disable for TARGET_SSE_MATH modes. gcc/testsuite/ * gcc.target/i386/pr97887.c: New test. --- diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 52e306de00a..29935014772 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10258,7 +10258,7 @@ (absneg:X87MODEF (match_operand:X87MODEF 1 "register_operand" "0,0"))) (clobber (reg:CC FLAGS_REG))] - "TARGET_80387" + "TARGET_80387 && !(SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH)" "#") (define_split diff --git a/gcc/testsuite/gcc.target/i386/pr97887.c b/gcc/testsuite/gcc.target/i386/pr97887.c new file mode 100644 index 00000000000..b457f054bed --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97887.c @@ -0,0 +1,15 @@ +/* PR target/97887 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -mfpmath=sse" } */ + +float f (float a) +{ + return -a / a; +} + +double d (double a) +{ + return -a / a; +} + +/* { dg-final { scan-assembler-not "fchs" } } */