OSDN Git Service

PR middle-end/29274
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / sh / sh2a-bclr.c
1 /* Testcase to check generation of a SH2A specific instruction
2    'BCLR #imm3,Rn'.  */
3 /* { dg-do assemble {target sh*-*-*}}  */
4 /* { dg-options "-O1" }  */
5 /* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" }  */
6 /* { dg-final { scan-assembler "bclr"} }  */
7
8 struct a
9 {
10   char a, b;
11   short c;
12 };
13
14 /* This function generates the instruction "BCLR #imm3,Rn" only
15    on using optimization option "-O1" and above.  */
16
17 int
18 a2 ()
19 {
20   volatile int j;
21   volatile static struct a x = {1, 66, ~1}, y = {1, 2, ~2};
22
23   if (j > 1)
24     return (x.a == y.a && (x.b & ~1) == y.b);
25   if (j > 2)
26     return (x.a == y.a && (x.b & ~2) == y.b);
27   if (j > 3)
28     return (x.a == y.a && (x.b & ~4) == y.b);
29   if (j > 4)
30     return (x.a == y.a && (x.b & ~8) == y.b);
31   if (j > 5)
32     return (x.a == y.a && (x.b & ~16) == y.b);
33   if (j > 6)
34     return (x.a == y.a && (x.b & ~32) == y.b);
35   if (j > 7)
36     return (x.a == y.a && (x.b & ~64) == y.b);
37   if (j > 8)
38     return (x.a == y.a && (x.b & ~128) == y.b);
39 }
40
41 int
42 main ()
43 {
44   volatile unsigned char x;
45
46   x &= 0xFE;
47   x &= 0xFD;
48   x &= 0xFB;
49   x &= 0xF7;
50   x &= 0xEF;
51   x &= 0xDF;
52   x &= 0xBF;
53   x &= 0x7F;
54
55   if (!a2 ())
56     return 0;
57 }