From 50134189a434e638861f8bf27d5caab9622811c8 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 19 Nov 2020 09:23:46 +0100 Subject: [PATCH] i386: Disable *2_i387_1 for TARGET_SSE_MATH modes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- gcc/config/i386/i386.md | 2 +- gcc/testsuite/gcc.target/i386/pr97887.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr97887.c 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" } } */ -- 2.30.2