| 1 |
/* Verify that the TST insn is used to extract a zero extended |
| 2 |
single bit into the T bit (for a following conditional branch) and into |
| 3 |
a GP register. */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-O2" } */ |
| 6 |
/* { dg-final { scan-assembler-not "exts|extu|sha|shld|subc|xor" } } */ |
| 7 |
|
| 8 |
/* { dg-final { scan-assembler-times "tst" 61 { target { ! sh2a } } } } */ |
| 9 |
/* { dg-final { scan-assembler-times "tst\t#1," 1 { target { ! sh2a } } } } */ |
| 10 |
/* { dg-final { scan-assembler-times "tst\t#2" 2 { target { ! sh2a } } } } */ |
| 11 |
/* { dg-final { scan-assembler-times "tst\t#4" 2 { target { ! sh2a } } } } */ |
| 12 |
/* { dg-final { scan-assembler-times "tst\t#8" 2 { target { ! sh2a } } } } */ |
| 13 |
/* { dg-final { scan-assembler-times "tst\t#16" 2 { target { ! sh2a } } } } */ |
| 14 |
/* { dg-final { scan-assembler-times "tst\t#32" 2 { target { ! sh2a } } } } */ |
| 15 |
/* { dg-final { scan-assembler-times "tst\t#64" 2 { target { ! sh2a } } } } */ |
| 16 |
/* { dg-final { scan-assembler-times "tst\t#128" 2 { target { ! sh2a } } } } */ |
| 17 |
|
| 18 |
/* { dg-final { scan-assembler-times "tst" 54 { target { sh2a } } } } */ |
| 19 |
/* { dg-final { scan-assembler-times "tst\t#1," 1 { target { sh2a } } } } */ |
| 20 |
/* { dg-final { scan-assembler-times "tst\t#2" 1 { target { sh2a } } } } */ |
| 21 |
/* { dg-final { scan-assembler-times "tst\t#4" 1 { target { sh2a } } } } */ |
| 22 |
/* { dg-final { scan-assembler-times "tst\t#8" 1 { target { sh2a } } } } */ |
| 23 |
/* { dg-final { scan-assembler-times "tst\t#16" 1 { target { sh2a } } } } */ |
| 24 |
/* { dg-final { scan-assembler-times "tst\t#32" 1 { target { sh2a } } } } */ |
| 25 |
/* { dg-final { scan-assembler-times "tst\t#64" 1 { target { sh2a } } } } */ |
| 26 |
/* { dg-final { scan-assembler-times "tst\t#128" 1 { target { sh2a } } } } */ |
| 27 |
/* { dg-final { scan-assembler-times "bld\t#1," 1 { target { sh2a } } } } */ |
| 28 |
/* { dg-final { scan-assembler-times "bld\t#2" 1 { target { sh2a } } } } */ |
| 29 |
/* { dg-final { scan-assembler-times "bld\t#3" 1 { target { sh2a } } } } */ |
| 30 |
/* { dg-final { scan-assembler-times "bld\t#4" 1 { target { sh2a } } } } */ |
| 31 |
/* { dg-final { scan-assembler-times "bld\t#5" 1 { target { sh2a } } } } */ |
| 32 |
/* { dg-final { scan-assembler-times "bld\t#6" 1 { target { sh2a } } } } */ |
| 33 |
/* { dg-final { scan-assembler-times "bld\t#7" 1 { target { sh2a } } } } */ |
| 34 |
|
| 35 |
/* { dg-final { scan-assembler-times "and\t#1" 1 } } */ |
| 36 |
/* { dg-final { scan-assembler-times "cmp/pz" 1 } } */ |
| 37 |
/* { dg-final { scan-assembler-times "shll" 1 } } */ |
| 38 |
|
| 39 |
typedef struct |
| 40 |
{ |
| 41 |
unsigned int b31 : 1; |
| 42 |
unsigned int b30 : 1; |
| 43 |
unsigned int b29 : 1; |
| 44 |
unsigned int b28 : 1; |
| 45 |
unsigned int b27 : 1; |
| 46 |
unsigned int b26 : 1; |
| 47 |
unsigned int b25 : 1; |
| 48 |
unsigned int b24 : 1; |
| 49 |
unsigned int b23 : 1; |
| 50 |
unsigned int b22 : 1; |
| 51 |
unsigned int b21 : 1; |
| 52 |
unsigned int b20 : 1; |
| 53 |
unsigned int b19 : 1; |
| 54 |
unsigned int b18 : 1; |
| 55 |
unsigned int b17 : 1; |
| 56 |
unsigned int b16 : 1; |
| 57 |
unsigned int b15 : 1; |
| 58 |
unsigned int b14 : 1; |
| 59 |
unsigned int b13 : 1; |
| 60 |
unsigned int b12 : 1; |
| 61 |
unsigned int b11 : 1; |
| 62 |
unsigned int b10 : 1; |
| 63 |
unsigned int b9 : 1; |
| 64 |
unsigned int b8 : 1; |
| 65 |
unsigned int b7 : 1; |
| 66 |
unsigned int b6 : 1; |
| 67 |
unsigned int b5 : 1; |
| 68 |
unsigned int b4 : 1; |
| 69 |
unsigned int b3 : 1; |
| 70 |
unsigned int b2 : 1; |
| 71 |
unsigned int b1 : 1; |
| 72 |
unsigned int b0 : 1; |
| 73 |
} S; |
| 74 |
|
| 75 |
#define make_funcs(bitpos)\ |
| 76 |
unsigned int test_b##bitpos##_0 (S s)\ |
| 77 |
{\ |
| 78 |
return s.b##bitpos;\ |
| 79 |
}\ |
| 80 |
unsigned int test_b##bitpos##_1 (S s)\ |
| 81 |
{\ |
| 82 |
return !s.b##bitpos;\ |
| 83 |
}\ |
| 84 |
|
| 85 |
make_funcs (0) |
| 86 |
make_funcs (1) |
| 87 |
make_funcs (2) |
| 88 |
make_funcs (3) |
| 89 |
make_funcs (4) |
| 90 |
make_funcs (5) |
| 91 |
make_funcs (6) |
| 92 |
make_funcs (7) |
| 93 |
make_funcs (8) |
| 94 |
make_funcs (9) |
| 95 |
make_funcs (10) |
| 96 |
make_funcs (11) |
| 97 |
make_funcs (12) |
| 98 |
make_funcs (13) |
| 99 |
make_funcs (14) |
| 100 |
make_funcs (15) |
| 101 |
make_funcs (16) |
| 102 |
make_funcs (17) |
| 103 |
make_funcs (18) |
| 104 |
make_funcs (19) |
| 105 |
make_funcs (20) |
| 106 |
make_funcs (21) |
| 107 |
make_funcs (22) |
| 108 |
make_funcs (23) |
| 109 |
make_funcs (24) |
| 110 |
make_funcs (25) |
| 111 |
make_funcs (26) |
| 112 |
make_funcs (27) |
| 113 |
make_funcs (28) |
| 114 |
make_funcs (29) |
| 115 |
make_funcs (30) |
| 116 |
make_funcs (31) |