summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ifcvt-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ifcvt-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/ifcvt-3.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ifcvt-3.c b/gcc/testsuite/gcc.dg/ifcvt-3.c
new file mode 100644
index 00000000000..2e104a4ffd5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ifcvt-3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target aarch64*-*-* x86_64-*-* } } */
+/* { dg-options "-fdump-rtl-ce1 -O2" } */
+
+typedef long long s64;
+
+int
+foo (s64 a, s64 b, s64 c)
+{
+ s64 d = a - b;
+
+ if (d == 0)
+ return a + c;
+ else
+ return b + d + c;
+}
+
+/* This test can be reduced to just return a + c; */
+/* { dg-final { scan-rtl-dump "3 true changes made" "ce1" } } */
+/* { dg-final { scan-assembler-not "sub\.*\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+\.*" { target { aarch64*-*-* } } } } */