diff options
author | liuhongt <hongtao.liu@intel.com> | 2022-01-13 22:51:49 +0800 |
---|---|---|
committer | liuhongt <hongtao.liu@intel.com> | 2022-01-14 13:02:26 +0800 |
commit | b77e3b4e4589e56c01511fabdbaadb029cd47f5c (patch) | |
tree | b9e980039aa9d6bc6ff6fb08b25933e707e13c89 | |
parent | b31cec9c22b8dfa40baefd4c2dd774477e8e04c5 (diff) | |
download | gcc-b77e3b4e4589e56c01511fabdbaadb029cd47f5c.zip gcc-b77e3b4e4589e56c01511fabdbaadb029cd47f5c.tar.gz gcc-b77e3b4e4589e56c01511fabdbaadb029cd47f5c.tar.bz2 |
Fix ICE of unrecognizable insn. [PR target/104001]
For define_insn_and_split "*xor2andn":
1. Refine predicate of operands[0] from nonimmediate_operand to
register_operand.
2. Remove TARGET_AVX512BW from condition to avoid kmov when TARGET_BMI
is not available.
gcc/ChangeLog:
PR target/104001
PR target/94790
PR target/104014
* config/i386/i386.md (*xor2andn): Refine predicate of
operands[0] from nonimmediate_operand to
register_operand, remove TARGET_AVX512BW from condition.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr104001.c: New test.
-rw-r--r-- | gcc/config/i386/i386.md | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr104001.c | 21 |
2 files changed, 26 insertions, 6 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index c2acb1d..9477ca9 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10453,9 +10453,9 @@ (set_attr "znver1_decode" "double") (set_attr "mode" "DI")]) -;; PR target/94790: Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b & mask) +;; Optimize a ^ ((a ^ b) & mask) to (~mask & a) | (b & mask) (define_insn_and_split "*xor2andn" - [(set (match_operand:SWI248 0 "nonimmediate_operand") + [(set (match_operand:SWI248 0 "register_operand") (xor:SWI248 (and:SWI248 (xor:SWI248 @@ -10464,8 +10464,7 @@ (match_operand:SWI248 3 "nonimmediate_operand")) (match_dup 1))) (clobber (reg:CC FLAGS_REG))] - "(TARGET_BMI || TARGET_AVX512BW) - && ix86_pre_reload_split ()" + "TARGET_BMI && ix86_pre_reload_split ()" "#" "&& 1" [(parallel [(set (match_dup 4) @@ -10476,8 +10475,8 @@ (clobber (reg:CC FLAGS_REG))]) (parallel [(set (match_dup 5) (and:SWI248 - (match_dup 2) - (match_dup 3))) + (match_dup 3) + (match_dup 2))) (clobber (reg:CC FLAGS_REG))]) (parallel [(set (match_dup 0) (ior:SWI248 diff --git a/gcc/testsuite/gcc.target/i386/pr104001.c b/gcc/testsuite/gcc.target/i386/pr104001.c new file mode 100644 index 0000000..4efb593 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr104001.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "kandn" } } */ +/* { dg-final { scan-assembler "andn" } } */ + +int b, c, d; +int r; + +void +__attribute__((target("bmi"))) +foo () +{ + r = ((b & ~d) | (c & d)); +} + +void +__attribute__((target("avx512bw"))) +bar () +{ + r = ((b & ~d) | (c & d)); +} |