blob: 322821b5accffe8071704499c1301329e6e4665d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* Testcase to check generation of a SH2A specific instruction
'BSET #imm3,Rn'. */
/* { dg-do assemble } */
/* { dg-options "-O1" } */
/* { dg-skip-if "" { "sh*-*-*" } "*" "-m2a -m2a-nofpu -m2a-single -m2a-single-only" } */
/* { dg-final { scan-assembler "bset"} } */
struct a
{
char a, b;
short c;
};
/* This function generates the instruction "BSET #imm3,Rn" only
on using optimization option "-O1" and above. */
int
a2 ()
{
volatile int j;
volatile static struct a x = {1, 66, ~1}, y = {1, 2, ~2};
if (j > 1)
return (x.a == y.a && (x.b | 1) == y.b);
if (j > 2)
return (x.a == y.a && (x.b | 2) == y.b);
if (j > 3)
return (x.a == y.a && (x.b | 4) == y.b);
if (j > 4)
return (x.a == y.a && (x.b | 8) == y.b);
if (j > 5)
return (x.a == y.a && (x.b | 16) == y.b);
if (j > 6)
return (x.a == y.a && (x.b | 32) == y.b);
if (j > 7)
return (x.a == y.a && (x.b | 64) == y.b);
if (j > 8)
return (x.a == y.a && (x.b | 128) == y.b);
}
int
main ()
{
volatile unsigned char x;
x |= 0x1;
x |= 0x2;
x |= 0x4;
x |= 0x8;
x |= 0x16;
x |= 0x32;
x |= 0x64;
x |= 0x128;
if (!a2 ())
return 0;
}
|