From: Ajit Agarwal <aagarwa1@linux.ibm.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>, ",
bergner"@linux.ibm.com, ", Jeff Law" <jeffreyalaw@gmail.com>, ",
Richard Biener" <richard.guenther@gmail.com>
Subject: [PATCH testsuite] rs6000: suboptimal code for returning bool value on target ppc.
Date: Sun, 19 Mar 2023 22:50:49 +0530 [thread overview]
Message-ID: <ece2c4f5-6f01-3689-1c58-d6367dbabae0@linux.ibm.com> (raw)
Hello All:
This patch add new test to check unnecessary zero extension removal.
Regtested on powerpc64-linux-gnu.
Thanks & Regards
Ajit
rs6000: suboptimal code for returning bool value on target ppc.
Tests to check unnecessary redundant zero extension removal.
2023-03-19 Ajit Kumar Agarwal <aagarwa1@linux.ibm.com>
gcc/ChangeLog:
* testsuite/g++.target/powerpc/zext-elim.C: New test.
---
gcc/testsuite/g++.target/powerpc/zext-elim.C | 30 ++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 gcc/testsuite/g++.target/powerpc/zext-elim.C
diff --git a/gcc/testsuite/g++.target/powerpc/zext-elim.C b/gcc/testsuite/g++.target/powerpc/zext-elim.C
new file mode 100644
index 00000000000..56eabbe0c19
--- /dev/null
+++ b/gcc/testsuite/g++.target/powerpc/zext-elim.C
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mcpu=power9 -O2 -free" } */
+
+#include <stddef.h>
+
+bool foo (int a, int b)
+{
+ if (a > 2)
+ return false;
+
+ if (b < 10)
+ return true;
+
+ return true;
+}
+
+int bar (int a, int b)
+{
+ if (a > 2)
+ return 0;
+
+ if (b < 10)
+ return 1;
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "rldicl" } } */
--
2.31.1
reply other threads:[~2023-03-19 17:20 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=ece2c4f5-6f01-3689-1c58-d6367dbabae0@linux.ibm.com \
--to=aagarwa1@linux.ibm.com \
--cc=", bergner"@linux.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=segher@kernel.crashing.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).