From 018248ef6d03ca0088d5928928f966df99af134c Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 2 Dec 2020 08:15:03 +0100 Subject: [PATCH] i386: Fix abs an maxmin expanders for TARGET_PARTIAL_REG_STALL [PR98079]. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit QImode shold be enabled only for !TARGET_PARTIAL_REG_STALL 2020-12-02 Uroš Bizjak PR target/98079 gcc/ * config/i386/i386.md (abs2): Enable QImode only for !TARGET_PARTIAL_REG_STALL. (*abs2_1): Ditto. (3): Ditto. (*3_1): Ditto. gcc/testsuite/ * gcc.target/i386/pr98079.c: New test. --- gcc/config/i386/i386.md | 8 ++++++-- gcc/testsuite/gcc.target/i386/pr98079.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr98079.c diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 7c25ae2078d..76e9499ad74 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10184,7 +10184,8 @@ (abs:SDWIM (match_operand:SDWIM 1 "general_operand"))) (clobber (reg:CC FLAGS_REG))])] - "TARGET_CMOVE" + "TARGET_CMOVE + && (mode != QImode || !TARGET_PARTIAL_REG_STALL)" { if (TARGET_EXPAND_ABS) { @@ -10257,6 +10258,7 @@ (match_operand:SWI 1 "general_operand"))) (clobber (reg:CC FLAGS_REG))] "TARGET_CMOVE + && (mode != QImode || !TARGET_PARTIAL_REG_STALL) && ix86_pre_reload_split ()" "#" "&& 1" @@ -18972,7 +18974,8 @@ (match_operand:SDWIM 1 "register_operand") (match_operand:SDWIM 2 "general_operand"))) (clobber (reg:CC FLAGS_REG))])] - "TARGET_CMOVE") + "TARGET_CMOVE + && (mode != QImode || !TARGET_PARTIAL_REG_STALL)") (define_insn_and_split "*3_doubleword" [(set (match_operand: 0 "register_operand") @@ -19039,6 +19042,7 @@ (match_operand:SWI 2 "general_operand"))) (clobber (reg:CC FLAGS_REG))] "TARGET_CMOVE + && (mode != QImode || !TARGET_PARTIAL_REG_STALL) && ix86_pre_reload_split ()" "#" "&& 1" diff --git a/gcc/testsuite/gcc.target/i386/pr98079.c b/gcc/testsuite/gcc.target/i386/pr98079.c new file mode 100644 index 00000000000..8de0ec34dfa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98079.c @@ -0,0 +1,13 @@ +/* PR target/98079 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -march=pentium3" } */ + +typedef __UINT8_TYPE__ uint8_t; + +uint8_t foo (uint8_t x) +{ + if (x & 0x80) + x = -x; + + return x; +} -- 2.30.2