public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6567] Fix ICE of unrecognizable insn. [PR target/104001]
@ 2022-01-14  5:02 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2022-01-14  5:02 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b77e3b4e4589e56c01511fabdbaadb029cd47f5c

commit r12-6567-gb77e3b4e4589e56c01511fabdbaadb029cd47f5c
Author: liuhongt <hongtao.liu@intel.com>
Date:   Thu Jan 13 22:51:49 2022 +0800

    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.

Diff:
---
 gcc/config/i386/i386.md                  | 11 +++++------
 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 c2acb1dbd90..9477ca9b41d 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 00000000000..4efb5936dae
--- /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));
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-14  5:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  5:02 [gcc r12-6567] Fix ICE of unrecognizable insn. [PR target/104001] hongtao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).