public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6428] Extend predicate of operands[1] from register_operand to vector_operand for andnot insn.
@ 2022-01-11  2:13 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2022-01-11  2:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4bb79e27c02c5cd57d5781bef20e70982d898c40

commit r12-6428-g4bb79e27c02c5cd57d5781bef20e70982d898c40
Author: Haochen Jiang <haochen.jiang@intel.com>
Date:   Thu Dec 30 15:47:58 2021 +0800

    Extend predicate of operands[1] from register_operand to vector_operand for andnot insn.
    
    This can do optimization like
    
    -       pcmpeqd %xmm0, %xmm0
    -       pxor    g(%rip), %xmm0
    -       pand    %xmm1, %xmm0
    +       movdqa  g(%rip), %xmm0
    +       pandn   %xmm1, %xmm0
    
    gcc/ChangeLog:
    
            PR target/53652
            * config/i386/sse.md (*andnot<mode>3): Extend predicate of
            operands[1] from register_operand to vector_operand.
    
    gcc/testsuite/ChangeLog:
    
            PR target/53652
            * gcc.target/i386/pr53652-1.c: New test.

Diff:
---
 gcc/config/i386/sse.md                    |  2 +-
 gcc/testsuite/gcc.target/i386/pr53652-1.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index d8f303511c1..0864748875e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -16631,7 +16631,7 @@
 (define_insn "*andnot<mode>3"
   [(set (match_operand:VI 0 "register_operand" "=x,x,v")
 	(and:VI
-	  (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
+	  (not:VI (match_operand:VI 1 "vector_operand" "0,x,v"))
 	  (match_operand:VI 2 "bcst_vector_operand" "xBm,xm,vmBr")))]
   "TARGET_SSE"
 {
diff --git a/gcc/testsuite/gcc.target/i386/pr53652-1.c b/gcc/testsuite/gcc.target/i386/pr53652-1.c
new file mode 100644
index 00000000000..bd07ee29f4d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr53652-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+/* { dg-final { scan-assembler-times "pandn\[ \\t\]" 2 } } */
+/* { dg-final { scan-assembler-not "vpternlogq\[ \\t\]" } } */
+
+typedef unsigned long long vec __attribute__((vector_size (16)));
+vec g;
+vec f1 (vec a, vec b)
+{
+  return ~a&b;
+}
+vec f2 (vec a, vec b)
+{
+  return ~g&b;
+}
+


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

only message in thread, other threads:[~2022-01-11  2:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  2:13 [gcc r12-6428] Extend predicate of operands[1] from register_operand to vector_operand for andnot insn 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).