public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ajit Kumar Agarwal <aagarwa@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-4079] rs6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index
Date: Sun, 17 Sep 2023 17:29:42 +0000 (GMT)	[thread overview]
Message-ID: <20230917172942.8B8103858D32@sourceware.org> (raw)

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

commit r14-4079-gb34f8e705d961260adc2bea95db4361b2e70d565
Author: Ajit Kumar Agarwal <aagarwa1@linux.ibm.com>
Date:   Sun Sep 17 12:27:10 2023 -0500

    rs6000: unnecessary clear after vctzlsbb in vec_first_match_or_eos_index
    
    For rs6000 target we dont need zero_extend after vctzlsbb as vctzlsbb
    already zero extend.
    
    2023-09-17  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>
    
    gcc/ChangeLog:
    
            * config/rs6000/vsx.md (*vctzlsbb_zext_<mode>): New define_insn.
    
    gcc/testsuite/ChangeLog:
    
            * g++.target/powerpc/altivec-19.C: New testcase.

Diff:
---
 gcc/config/rs6000/vsx.md                      | 17 ++++++++++++++---
 gcc/testsuite/g++.target/powerpc/altivec-19.C | 10 ++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 19abfeb565a..4de41e78d51 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -5846,11 +5846,22 @@
   [(set_attr "type" "vecsimple")])
 
 ;; Vector Count Trailing Zero Least-Significant Bits Byte
-(define_insn "vctzlsbb_<mode>"
-  [(set (match_operand:SI 0 "register_operand" "=r")
+(define_insn "*vctzlsbb_zext_<mode>"
+  [(set (match_operand:DI 0 "register_operand" "=r")
+	(zero_extend:DI
 	(unspec:SI
 	 [(match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v")]
-	 UNSPEC_VCTZLSBB))]
+	 UNSPEC_VCTZLSBB)))]
+  "TARGET_P9_VECTOR"
+  "vctzlsbb %0,%1"
+  [(set_attr "type" "vecsimple")])
+
+;; Vector Count Trailing Zero Least-Significant Bits Byte
+(define_insn "vctzlsbb_<mode>"
+  [(set (match_operand:SI 0 "register_operand" "=r")
+        (unspec:SI
+         [(match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v")]
+         UNSPEC_VCTZLSBB))]
   "TARGET_P9_VECTOR"
   "vctzlsbb %0,%1"
   [(set_attr "type" "vecsimple")])
diff --git a/gcc/testsuite/g++.target/powerpc/altivec-19.C b/gcc/testsuite/g++.target/powerpc/altivec-19.C
new file mode 100644
index 00000000000..5879e72dfd2
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/altivec-19.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */ 
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mdejagnu-cpu=power9 -O2 " } */ 
+
+#include <altivec.h>
+
+unsigned int foo (vector unsigned char a, vector unsigned char b) {
+  return vec_first_match_or_eos_index (a, b);
+}
+/* { dg-final { scan-assembler-not {\mrldicl\M} } } */

                 reply	other threads:[~2023-09-17 17:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230917172942.8B8103858D32@sourceware.org \
    --to=aagarwa@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).