From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id EB0A638930F9; Mon, 29 Nov 2021 08:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB0A638930F9 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9331] i386: Fix up x86 atomic_bit_test* expanders for !TARGET_HIMODE_MATH [PR103205] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: c479d98137fb589718570258547c6bea4f27d1d5 X-Git-Newrev: 5950a9c5ff3a324d82883983032a32504f4c56fe Message-Id: <20211129084947.EB0A638930F9@sourceware.org> Date: Mon, 29 Nov 2021 08:49:47 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 08:49:48 -0000 https://gcc.gnu.org/g:5950a9c5ff3a324d82883983032a32504f4c56fe commit r11-9331-g5950a9c5ff3a324d82883983032a32504f4c56fe Author: Jakub Jelinek Date: Mon Nov 15 09:30:08 2021 +0100 i386: Fix up x86 atomic_bit_test* expanders for !TARGET_HIMODE_MATH [PR103205] With !TARGET_HIMODE_MATH, the OPTAB_DIRECT expand_simple_binop fail and so we ICE. We don't really care if they are done promoted in SImode instead. 2021-11-15 Jakub Jelinek PR target/103205 * config/i386/sync.md (atomic_bit_test_and_set, atomic_bit_test_and_complement, atomic_bit_test_and_reset): Use OPTAB_WIDEN instead of OPTAB_DIRECT. * gcc.target/i386/pr103205.c: New test. (cherry picked from commit 625eef42e32e65b3da0e65e23a706d228896d01c) Diff: --- gcc/config/i386/sync.md | 6 +++--- gcc/testsuite/gcc.target/i386/pr103205.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index 05a835256bb..9716a0b2f2c 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -726,7 +726,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; @@ -763,7 +763,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; @@ -801,7 +801,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; diff --git a/gcc/testsuite/gcc.target/i386/pr103205.c b/gcc/testsuite/gcc.target/i386/pr103205.c new file mode 100644 index 00000000000..eaeea82fee2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103205.c @@ -0,0 +1,11 @@ +/* PR target/103205 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune-ctrl=^himode_math" } */ + +unsigned short a; + +unsigned short +foo (void) +{ + return __sync_fetch_and_and (&a, ~1) & 1; +}