diff mbox series

[testsuite] rs6000: suboptimal code for returning bool value on target ppc.

Message ID ece2c4f5-6f01-3689-1c58-d6367dbabae0@linux.ibm.com
State New
Headers show
Series [testsuite] rs6000: suboptimal code for returning bool value on target ppc. | expand

Commit Message

Ajit Agarwal March 19, 2023, 5:20 p.m. UTC
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 mbox series

Patch

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" } } */