public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH testsuite] rs6000: suboptimal code for returning bool value on target ppc.
@ 2023-03-19 17:20 Ajit Agarwal
  0 siblings, 0 replies; only message in thread
From: Ajit Agarwal @ 2023-03-19 17:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, , bergner, , Jeff Law, , Richard Biener

	
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


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

only message in thread, other threads:[~2023-03-19 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-19 17:20 [PATCH testsuite] rs6000: suboptimal code for returning bool value on target ppc Ajit Agarwal

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).