Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / sh / pr51244-9.c
1 /* Check that compare-branch is inverted properly.
2    Example:
3         mov.w   .L566,r2        ->      mov.w   .L566,r2
4         add     r11,r2                  add     r11,r2
5         mov.l   @(12,r2),r7             mov.l   @(8,r2),r5
6         mov.l   @(8,r2),r5              mov.l   @(12,r2),r2
7         mov     #0,r2                   tst     r2,r2
8         cmp/hi  r2,r7                   bt      .L534
9         bf      .L534
10 */
11 /* { dg-do compile { target "sh*-*-*" } } */
12 /* { dg-options "-O2" } */
13 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
14 /* { dg-final { scan-assembler-not "mov\t#0" } } */
15 static inline unsigned int
16 test_03_00 (unsigned int x)
17 {
18   /* Return unassigned value on purpose.  */
19   unsigned int res;
20   return res;
21 }
22
23 struct S
24 {
25   unsigned int a;
26   unsigned int b;
27 };
28
29 int test_03 (struct S* i)
30 {
31  if ((i->a != 2 && i->a != 3) || i->a > test_03_00 (i->b))
32    return -5;
33
34  return -55;
35 }