aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog17
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-10.c9
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-11.c46
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-12.c7
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-13.c18
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-14.c13
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-15.c15
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-16.c42
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-17.c7
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-18.c24
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-19.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-20.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-21.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-22.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-23.c21
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-24.c19
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-25.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-26.c7
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-27.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-28.c8
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-29.c40
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-3.c15
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-30.c31
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-31.c33
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-32.c10
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-33.c10
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-34.c45
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-35.c49
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-4.c12
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-6.c18
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-7.c85
-rw-r--r--gcc/testsuite/gcc.target/cris/pr93372-9.c9
32 files changed, 658 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d2fd6aa..69c564f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -2,9 +2,26 @@
* gcc.target/cris/cris.exp (check_effective_target_cc0): New.
+ PR target/93372
* gcc.target/cris/pr93372-1.c: New test.
* gcc.target/cris/pr93372-2.c, gcc.target/cris/pr93372-5.c,
gcc.target/cris/pr93372-8.c: New tests.
+ * gcc.target/cris/pr93372-3.c, gcc.target/cris/pr93372-4.c,
+ gcc.target/cris/pr93372-6.c, gcc.target/cris/pr93372-7.c,
+ gcc.target/cris/pr93372-9.c, gcc.target/cris/pr93372-10.c,
+ gcc.target/cris/pr93372-11.c, gcc.target/cris/pr93372-12.c,
+ gcc.target/cris/pr93372-13.c, gcc.target/cris/pr93372-14.c,
+ gcc.target/cris/pr93372-15.c, gcc.target/cris/pr93372-16.c,
+ gcc.target/cris/pr93372-17.c, gcc.target/cris/pr93372-18.c,
+ gcc.target/cris/pr93372-19.c, gcc.target/cris/pr93372-20.c,
+ gcc.target/cris/pr93372-21.c, gcc.target/cris/pr93372-22.c,
+ gcc.target/cris/pr93372-23.c, gcc.target/cris/pr93372-24.c,
+ gcc.target/cris/pr93372-25.c, gcc.target/cris/pr93372-26.c,
+ gcc.target/cris/pr93372-27.c, gcc.target/cris/pr93372-28.c,
+ gcc.target/cris/pr93372-29.c, gcc.target/cris/pr93372-30.c,
+ gcc.target/cris/pr93372-31.c, gcc.target/cris/pr93372-32.c,
+ gcc.target/cris/pr93372-33.c, gcc.target/cris/pr93372-34.c,
+ gcc.target/cris/pr93372-35.c: New tests.
2020-02-10 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-10.c b/gcc/testsuite/gcc.target/cris/pr93372-10.c
new file mode 100644
index 0000000..76e8fef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-10.c
@@ -0,0 +1,9 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tcmp" 1 } } */
+/* { dg-final { scan-assembler-not "\ttest" } } */
+
+#define t char
+#include "pr93372-3.c"
+#include "pr93372-7.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-11.c b/gcc/testsuite/gcc.target/cris/pr93372-11.c
new file mode 100644
index 0000000..b5eb5eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-11.c
@@ -0,0 +1,46 @@
+/* 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 int
+#endif
+
+#define eq_op(x) ((x) == 0)
+#define ne_op(x) ((x) != 0)
+#define gt_op(x) ((x) > 0)
+#define gtu_op(x) ((x) > 0)
+#define lt_op(x) ((x) < 0)
+#define ltu_op(x) ((x) < 0)
+#define ge_op(x) ((x) >= 0)
+#define geu_op(x) ((x) >= 0)
+#define le_op(x) ((x) <= 0)
+#define leu_op(x) ((x) <= 0)
+
+#define f(n, T, T2) \
+T2 f ## n(T *a, T *b, T2 *d) \
+{ \
+ T2 c = *a; \
+ *d = c; \
+ *b = n ## _op (c); \
+ return c; \
+}
+
+f(eq, t, t2)
+f(ne, t, t2)
+f(gt, t, t2)
+f(gtu, unsigned t, unsigned t2)
+f(lt, t, t2)
+#if 0
+f(ltu, unsigned t, unsigned t2)
+#endif
+f(ge, t, t2)
+#if 0
+f(geu, t, t2)
+#endif
+f(le, t, t2)
+f(leu, t, t2)
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-12.c b/gcc/testsuite/gcc.target/cris/pr93372-12.c
new file mode 100644
index 0000000..429e0b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-12.c
@@ -0,0 +1,7 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t char
+#include "pr93372-11.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-13.c b/gcc/testsuite/gcc.target/cris/pr93372-13.c
new file mode 100644
index 0000000..ff0d0f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-13.c
@@ -0,0 +1,18 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest|\tor" } } */
+
+extern void foo(void);
+
+void f(long long int a, long long int b)
+{
+ if (a + b == 0)
+ foo();
+}
+
+void g(long long int a, long long int b)
+{
+ if (a + b >= 0)
+ foo();
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-14.c b/gcc/testsuite/gcc.target/cris/pr93372-14.c
new file mode 100644
index 0000000..e0a846e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-14.c
@@ -0,0 +1,13 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tcmp|\ttest" 2 } } */
+
+extern void foo(void);
+
+void f(long long int a, long long int b)
+{
+ /* Trivial check that we don't eliminate a non-eliminable compare. */
+ if (a + b <= 0)
+ foo();
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-15.c b/gcc/testsuite/gcc.target/cris/pr93372-15.c
new file mode 100644
index 0000000..4932762
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-15.c
@@ -0,0 +1,15 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tcmp|\ttest" 1 } } */
+
+int f(int a, int b, int *d)
+{
+ int c = a + b;
+
+ *d = (c == 0);
+
+ /* See also pr93372-6.c. We should get exactly one compare
+ instruction for this condition. */
+ return c <= 0;
+}
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
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-17.c b/gcc/testsuite/gcc.target/cris/pr93372-17.c
new file mode 100644
index 0000000..05b5c31
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-17.c
@@ -0,0 +1,7 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t signed char
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-18.c b/gcc/testsuite/gcc.target/cris/pr93372-18.c
new file mode 100644
index 0000000..deb45e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-18.c
@@ -0,0 +1,24 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest|\tor" } } */
+
+#ifndef t
+#define t long long
+#endif
+#ifndef t2
+#define t2 t
+#endif
+#ifndef op
+#define op -
+#endif
+
+extern void foo(t2);
+
+void g(t a, t b)
+{
+ t2 c = a op b;
+
+ if (c >= 0)
+ foo(c);
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-19.c b/gcc/testsuite/gcc.target/cris/pr93372-19.c
new file mode 100644
index 0000000..9a4e117
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-19.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t int
+#define op -
+#include "pr93372-18.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-20.c b/gcc/testsuite/gcc.target/cris/pr93372-20.c
new file mode 100644
index 0000000..12870b3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-20.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t short int
+#define op -
+#include "pr93372-18.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-21.c b/gcc/testsuite/gcc.target/cris/pr93372-21.c
new file mode 100644
index 0000000..76845cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-21.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t signed char
+#define op -
+#include "pr93372-18.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-22.c b/gcc/testsuite/gcc.target/cris/pr93372-22.c
new file mode 100644
index 0000000..23b38f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-22.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t int
+#define op &
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-23.c b/gcc/testsuite/gcc.target/cris/pr93372-23.c
new file mode 100644
index 0000000..fcefc9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-23.c
@@ -0,0 +1,21 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* For the f2, we want an andq, not and.w. */
+/* { dg-final { scan-assembler "\tandq 20," } } */
+/* { dg-final { scan-assembler-not "\tand.w 20," } } */
+/* We don't want a move.w that sets condition codes, but it happens for
+ cc0, as the "andq" that is the last insn before the branch, is for an
+ alternative that matches -32..31 and thus marked as clobbering
+ condition codes. */
+/* { dg-final { scan-assembler-not "\tmove.w" { xfail cc0 } } } */
+
+#define op &
+#include "pr93372-16.c"
+
+#undef op
+#define op & 20 &
+#define f f2
+#define g g2
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-24.c b/gcc/testsuite/gcc.target/cris/pr93372-24.c
new file mode 100644
index 0000000..87f10e9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-24.c
@@ -0,0 +1,19 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* For the f2, we want an andq, not and.b. */
+/* { dg-final { scan-assembler "\tandq 20," } } */
+/* { dg-final { scan-assembler-not "\tand.b 20," } } */
+/* See pr93372-23.c regarding the xfail. */
+/* { dg-final { scan-assembler-not "\tmove.b" { xfail cc0 } } } */
+
+#define op &
+#define t signed char
+#include "pr93372-16.c"
+
+#undef op
+#define op & 20 &
+#define f f2
+#define g g2
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-25.c b/gcc/testsuite/gcc.target/cris/pr93372-25.c
new file mode 100644
index 0000000..448083b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-25.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t int
+#define op |
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-26.c b/gcc/testsuite/gcc.target/cris/pr93372-26.c
new file mode 100644
index 0000000..c44c918
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-26.c
@@ -0,0 +1,7 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define op |
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-27.c b/gcc/testsuite/gcc.target/cris/pr93372-27.c
new file mode 100644
index 0000000..38bfd94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-27.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define op |
+#define t signed char
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-28.c b/gcc/testsuite/gcc.target/cris/pr93372-28.c
new file mode 100644
index 0000000..3d32a7f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-28.c
@@ -0,0 +1,8 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define op ^
+#define t int
+#include "pr93372-18.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-29.c b/gcc/testsuite/gcc.target/cris/pr93372-29.c
new file mode 100644
index 0000000..7fb0fe8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-29.c
@@ -0,0 +1,40 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#ifndef t
+#define t int
+#endif
+#ifndef t2
+#define t2 t
+#endif
+#ifndef op
+#define op(x) ~(x)
+#endif
+
+extern void foo(t2);
+
+t2 f(t a, t2 *b, t2 *d)
+{
+ t2 c = op(a);
+
+ *b = c;
+
+ if (c != 0)
+ *d = c;
+
+ return c;
+}
+
+t2 g(t a, t2 *b, t2 *d)
+{
+ t2 c = op(a);
+
+ *b = c;
+
+ if (c <= 0)
+ *d = c;
+
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-3.c b/gcc/testsuite/gcc.target/cris/pr93372-3.c
new file mode 100644
index 0000000..c0fbdd8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-3.c
@@ -0,0 +1,15 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tcmp" 1 } } */
+
+#ifndef t
+#define t int
+#endif
+
+int ff(t a, t b, t *d)
+{
+ *d = (a == b);
+
+ return a > b;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-30.c b/gcc/testsuite/gcc.target/cris/pr93372-30.c
new file mode 100644
index 0000000..a61e8c4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-30.c
@@ -0,0 +1,31 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#define t int
+#define op >>
+#define f ashrtf
+
+/* If we don't disable g, it will degenerate into a test of the
+ input. */
+#define do_g 0
+
+#include "pr93372-16.c"
+#undef do_g
+
+#undef t
+#define t unsigned int
+#undef f
+#undef g
+#define f lshrtf
+#define g lshrtg
+#include "pr93372-16.c"
+
+#undef f
+#undef g
+#undef op
+#define op <<
+#define f shlf
+#define g shlg
+#include "pr93372-16.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-31.c b/gcc/testsuite/gcc.target/cris/pr93372-31.c
new file mode 100644
index 0000000..649a90a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-31.c
@@ -0,0 +1,33 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-march=v0" } { "" } } */
+/* { dg-options "-O2" { target march_option } } */
+/* { dg-options "-O2 -march=v10" { target { ! march_option } } } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#ifndef t
+#define t int
+#endif
+#ifndef t2
+#define t2 t
+#endif
+#ifndef t3
+#define t3 t
+#endif
+#ifndef op
+#define op(xx) __builtin_clz(xx)
+#endif
+
+extern t3 x;
+
+t2 f(t a, t2 *b, t2 *d)
+{
+ t2 c = op(a);
+
+ *b = c;
+
+ if (c != 0)
+ *d = c;
+
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-32.c b/gcc/testsuite/gcc.target/cris/pr93372-32.c
new file mode 100644
index 0000000..64ab678
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-32.c
@@ -0,0 +1,10 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-march=*" } { "" } } */
+/* { dg-options "-O2 -march=v10" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler "\tswapwb " } } */
+
+#define op(xx) __builtin_bswap32(xx)
+
+#include "pr93372-31.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-33.c b/gcc/testsuite/gcc.target/cris/pr93372-33.c
new file mode 100644
index 0000000..9c7d2ba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-33.c
@@ -0,0 +1,10 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler "\tbound" } } */
+
+#define t unsigned int
+#define op(xx) ((xx) < x ? (xx) : x)
+
+#include "pr93372-31.c"
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-34.c b/gcc/testsuite/gcc.target/cris/pr93372-34.c
new file mode 100644
index 0000000..8bd3b44
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-34.c
@@ -0,0 +1,45 @@
+/* Check that btst/btstq other than a field starting at bit 0, is used. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tand" } } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler-times "\tbtstq" 3 } } */
+/* { dg-final { scan-assembler-times "\tbtst " 3 } } */
+
+void foo(void);
+
+void f(int *a)
+{
+ if ((*a & 32) != 0)
+ foo();
+}
+
+void g(short int *a)
+{
+ if ((*a & 128) == 0)
+ foo();
+}
+
+void h(char *a)
+{
+ if ((*a & 64) != 0)
+ foo();
+}
+
+void i(int *a, unsigned int n)
+{
+ if ((*a & (1 << n)) != 0)
+ foo();
+}
+
+void j(short int *a, unsigned int n)
+{
+ if ((*a & (1 << n)) == 0)
+ foo();
+}
+
+void k(char *a, unsigned int n)
+{
+ if ((*a & (1 << n)) != 0)
+ foo();
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-35.c b/gcc/testsuite/gcc.target/cris/pr93372-35.c
new file mode 100644
index 0000000..4e36497
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-35.c
@@ -0,0 +1,49 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler "\tneg" } } */
+
+void foo(void);
+
+#ifndef op
+#define op(x) -(x)
+#endif
+
+#define f(k, T, T2) \
+void f ## k (T *a, T2 *b) \
+{ \
+ T2 d = op(*a); \
+ *b = d; \
+ if (d != 0) \
+ foo(); \
+}
+
+#define ff(x, y) f(x, y, y)
+
+/* For NEG, gcc prefers to test the source (before the operation), but
+ will settle for the destination. For SImode, the destination is
+ allocated to a different register than the source. Not that
+ important; just skip the "int" variant for now. */
+#ifndef do_1
+#define do_1 0
+#endif
+
+#ifndef do_2
+#define do_2 1
+#endif
+#ifndef do_3
+#define do_3 1
+#endif
+
+#if do_1
+ff(1, int)
+#endif
+
+#if do_2
+ff(2, short int)
+#endif
+
+#if do_3
+ff(3, signed char)
+#endif
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-4.c b/gcc/testsuite/gcc.target/cris/pr93372-4.c
new file mode 100644
index 0000000..e9faf9f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-4.c
@@ -0,0 +1,12 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+int f(int a, int *b)
+{
+ /* As seen in powisf2, the result of a shift is checked for zeroness. */
+ int c = a >> 1;
+ *b = (c == 0);
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-6.c b/gcc/testsuite/gcc.target/cris/pr93372-6.c
new file mode 100644
index 0000000..69ae55c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-6.c
@@ -0,0 +1,18 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+/* { dg-final { scan-assembler "\tlsr|\tsmi" } } */
+
+/* Regarding the "lsr", see pr93372-2.c; we get a shift for the
+ sign-bit. For "<", that's equally optimal to smi; we just want this
+ test to be different with the "<" instead of ">=". */
+
+int f(int a, int b, int *d)
+{
+ int c = a + b;
+
+ *d = (c == 0);
+
+ return c < 0;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-7.c b/gcc/testsuite/gcc.target/cris/pr93372-7.c
new file mode 100644
index 0000000..fb22b20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-7.c
@@ -0,0 +1,85 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
+
+#ifndef t
+#define t int
+#endif
+
+t feq(t *a, t *b)
+{
+ t c = *a;
+ *b = c == 0;
+ return c;
+}
+
+t fne(t *a, t *b)
+{
+ t c = *a;
+ *b = c != 0;
+ return c;
+}
+
+t fgt(t *a, t *b)
+{
+ t c = *a;
+ *b = c > 0;
+ return c;
+}
+
+unsigned t fgtu(unsigned t *a, unsigned t *b)
+{
+ unsigned t c = *a;
+ *b = c > 0;
+ return c;
+}
+
+t flt(t *a, t *b)
+{
+ t c = *a;
+ *b = c < 0;
+ return c;
+}
+
+#if 0
+/* Always false... */
+unsigned t fltu(unsigned t *a, unsigned t *b)
+{
+ unsigned t c = *a;
+ *b = c < 0;
+ return c;
+}
+#endif
+
+t fge(t *a, t *b)
+{
+ t c = *a;
+ *b = c >= 0;
+ return c;
+}
+
+#if 0
+/* Always true... */
+unsigned t fgeu(unsigned t *a, unsigned t *b)
+{
+ unsigned t c = *a;
+ *b = c > 0;
+ return c;
+}
+#endif
+
+t fle(t *a, t *b)
+{
+ t c = *a;
+ *b = c <= 0;
+ return c;
+}
+
+/* Same as eq... */
+unsigned t fleu(unsigned t *a, unsigned t *b)
+{
+ unsigned t c = *a;
+ *b = c <= 0;
+ return c;
+}
diff --git a/gcc/testsuite/gcc.target/cris/pr93372-9.c b/gcc/testsuite/gcc.target/cris/pr93372-9.c
new file mode 100644
index 0000000..9a11b8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/cris/pr93372-9.c
@@ -0,0 +1,9 @@
+/* Check that eliminable compare-instructions are eliminated. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "\tcmp" 1 } } */
+/* { dg-final { scan-assembler-not "\ttest" } } */
+
+#define t short int
+#include "pr93372-3.c"
+#include "pr93372-7.c"