2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / sh2a-bset.c
blob27e04b46fa2ffbd6d494956126662084cd15346b
1 /* Testcase to check generation of a SH2A specific instruction
2 'BSET #imm3,Rn'. */
3 /* { dg-do compile { target { sh2a } } } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler "bset"} } */
7 struct a
9 char a, b;
10 short c;
13 /* This function generates the instruction "BSET #imm3,Rn" only
14 on using optimization option "-O1" and above. */
16 int
17 a2 ()
19 volatile int j;
20 volatile static struct a x = {1, 66, ~1}, y = {1, 2, ~2};
22 if (j > 1)
23 return (x.a == y.a && (x.b | 1) == y.b);
24 if (j > 2)
25 return (x.a == y.a && (x.b | 2) == y.b);
26 if (j > 3)
27 return (x.a == y.a && (x.b | 4) == y.b);
28 if (j > 4)
29 return (x.a == y.a && (x.b | 8) == y.b);
30 if (j > 5)
31 return (x.a == y.a && (x.b | 16) == y.b);
32 if (j > 6)
33 return (x.a == y.a && (x.b | 32) == y.b);
34 if (j > 7)
35 return (x.a == y.a && (x.b | 64) == y.b);
36 if (j > 8)
37 return (x.a == y.a && (x.b | 128) == y.b);
40 int
41 main ()
43 volatile unsigned char x;
45 x |= 0x1;
46 x |= 0x2;
47 x |= 0x4;
48 x |= 0x8;
49 x |= 0x16;
50 x |= 0x32;
51 x |= 0x64;
52 x |= 0x128;
54 if (!a2 ())
55 return 0;