aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/cris/pr93372-16.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/cris/pr93372-16.c')
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-16.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-16.c b/gcc/testsuite/gcc.target/cris/pr93372-16.c
new file mode 100644
index 0000000..7e69d86
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-16.c
@@ -0,0 +1,42 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#ifndef t
+#define t short int
+#endif
+#ifndef t2
+#define t2 t
+#endif
+#ifndef op
+#define op +
+#endif
+#ifndef do_f
+#define do_f 1
+#endif
+#ifndef do_g
+#define do_g 1
+#endif
+
+extern void foo(void);
+
+#if do_f
+void f(t a, t b)
+{
+ t2 c = a op b;
+
+ if (c == 0)
+ foo();
+}
+#endif
+
+#if do_g
+void g(t a, t b)
+{
+ t2 c = a op b;
+
+ if (c >= 0)
+ foo();
+}
+#endif