summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/pr51244-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/pr51244-9.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/pr51244-9.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/pr51244-9.c b/gcc/testsuite/gcc.target/sh/pr51244-9.c
new file mode 100644
index 0000000000..cca90a8439
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr51244-9.c
@@ -0,0 +1,35 @@
+/* Check that compare-branch is inverted properly.
+ Example:
+ mov.w .L566,r2 -> mov.w .L566,r2
+ add r11,r2 add r11,r2
+ mov.l @(12,r2),r7 mov.l @(8,r2),r5
+ mov.l @(8,r2),r5 mov.l @(12,r2),r2
+ mov #0,r2 tst r2,r2
+ cmp/hi r2,r7 bt .L534
+ bf .L534
+*/
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
+/* { dg-final { scan-assembler-not "mov\t#0" } } */
+static inline unsigned int
+test_03_00 (unsigned int x)
+{
+ /* Return unassigned value on purpose. */
+ unsigned int res;
+ return res;
+}
+
+struct S
+{
+ unsigned int a;
+ unsigned int b;
+};
+
+int test_03 (struct S* i)
+{
+ if ((i->a != 2 && i->a != 3) || i->a > test_03_00 (i->b))
+ return -5;
+
+ return -55;
+}