| 1 |
/* Verify that TST #imm, R0 instruction is generated when the tested reg |
| 2 |
is shifted by a constant amount. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O2" } */ |
| 5 |
/* { dg-final { scan-assembler-not "and|shl|sha|exts" } } */ |
| 6 |
|
| 7 |
/* { dg-final { scan-assembler-times "tst\t#7,r0" 3 } } */ |
| 8 |
/* { dg-final { scan-assembler-times "tst\t#12,r0" 1 } } */ |
| 9 |
/* { dg-final { scan-assembler-times "tst\t#24,r0" 6 } } */ |
| 10 |
/* { dg-final { scan-assembler-times "tst\t#13,r0" 3 } } */ |
| 11 |
/* { dg-final { scan-assembler-times "tst\t#242,r0" 3 } } */ |
| 12 |
/* { dg-final { scan-assembler-times "tst\t#252,r0" 1 } } */ |
| 13 |
|
| 14 |
/* { dg-final { scan-assembler-times "tst\t#64,r0" 6 { target { ! sh2a } } } } */ |
| 15 |
/* { dg-final { scan-assembler-times "tst\t#64,r0" 4 { target { sh2a } } } } */ |
| 16 |
/* { dg-final { scan-assembler-times "bld\t#6" 2 { target { sh2a } } } } */ |
| 17 |
|
| 18 |
int |
| 19 |
test_00 (unsigned char* x, int y, int z) |
| 20 |
{ |
| 21 |
/* 1x tst #12 */ |
| 22 |
return (x[0] << 4) & 192 ? y : z; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
test_01 (unsigned char* x, int y, int z) |
| 27 |
{ |
| 28 |
/* 1x tst #24 */ |
| 29 |
return (x[0] << 3) & 192 ? y : z; |
| 30 |
} |
| 31 |
|
| 32 |
int |
| 33 |
test_02 (unsigned char* x, int y, int z) |
| 34 |
{ |
| 35 |
/* 1x tst #24 */ |
| 36 |
return ((x[0] << 3) & 192) != 0; |
| 37 |
} |
| 38 |
|
| 39 |
int |
| 40 |
test_03 (unsigned char* x, int y, int z) |
| 41 |
{ |
| 42 |
/* 1x tst #24 */ |
| 43 |
return ((x[0] << 3) & 192) == 0; |
| 44 |
} |
| 45 |
|
| 46 |
int |
| 47 |
test_04 (unsigned char x, int y, int z) |
| 48 |
{ |
| 49 |
/* 1x tst #24 */ |
| 50 |
return (x << 3) & 192 ? y : z; |
| 51 |
} |
| 52 |
|
| 53 |
int |
| 54 |
test_05 (unsigned char x, int y, int z) |
| 55 |
{ |
| 56 |
/* 1x tst #24 */ |
| 57 |
return ((x << 3) & 192) != 0; |
| 58 |
} |
| 59 |
|
| 60 |
int |
| 61 |
test_06 (unsigned char x, int y, int z) |
| 62 |
{ |
| 63 |
/* 1x tst #24 */ |
| 64 |
return ((x << 3) & 192) == 0; |
| 65 |
} |
| 66 |
|
| 67 |
int |
| 68 |
test_07 (unsigned char x, int y, int z) |
| 69 |
{ |
| 70 |
/* 1x tst #13 */ |
| 71 |
return (x << 3) & 111 ? y : z; |
| 72 |
} |
| 73 |
|
| 74 |
int |
| 75 |
test_08 (unsigned char x, int y, int z) |
| 76 |
{ |
| 77 |
/* 1x tst #13 */ |
| 78 |
return ((x << 3) & 111) != 0; |
| 79 |
} |
| 80 |
|
| 81 |
int |
| 82 |
test_09 (unsigned char x, int y, int z) |
| 83 |
{ |
| 84 |
/* 1x tst #13 */ |
| 85 |
return ((x << 3) & 111) == 0; |
| 86 |
} |
| 87 |
|
| 88 |
int |
| 89 |
test_10 (unsigned char x, int y, int z) |
| 90 |
{ |
| 91 |
/* 1x tst #242 */ |
| 92 |
return (x << 3) & -111 ? y : z; |
| 93 |
} |
| 94 |
|
| 95 |
int |
| 96 |
test_11 (unsigned char x, int y, int z) |
| 97 |
{ |
| 98 |
/* 1x tst #242 */ |
| 99 |
return ((x << 3) & -111) != 0; |
| 100 |
} |
| 101 |
|
| 102 |
int |
| 103 |
test_12 (unsigned char x, int y, int z) |
| 104 |
{ |
| 105 |
/* 1x tst #242 */ |
| 106 |
return ((x << 3) & -111) == 0; |
| 107 |
} |
| 108 |
|
| 109 |
int |
| 110 |
test_13 (unsigned char* x, int y, int z) |
| 111 |
{ |
| 112 |
/* 1x tst #64 */ |
| 113 |
return (x[0] >> 2) & 16 ? y : z; |
| 114 |
} |
| 115 |
|
| 116 |
int |
| 117 |
test_14 (unsigned char* x, int y, int z) |
| 118 |
{ |
| 119 |
/* 1x tst #64 / 1x bld #6*/ |
| 120 |
return ((x[0] >> 2) & 16) != 0; |
| 121 |
} |
| 122 |
int |
| 123 |
test_15 (unsigned char* x, int y, int z) |
| 124 |
{ |
| 125 |
/* 1x tst #64 */ |
| 126 |
return ((x[0] >> 2) & 16) == 0; |
| 127 |
} |
| 128 |
|
| 129 |
int |
| 130 |
test_16 (unsigned char x, int y, int z) |
| 131 |
{ |
| 132 |
/* 1x tst #64 */ |
| 133 |
return (x >> 2) & 16 ? y : z; |
| 134 |
} |
| 135 |
|
| 136 |
int |
| 137 |
test_17 (unsigned char x, int y, int z) |
| 138 |
{ |
| 139 |
/* 1x tst #64 / 1x bld #6*/ |
| 140 |
return ((x >> 2) & 16) != 0; |
| 141 |
} |
| 142 |
|
| 143 |
int |
| 144 |
test_18 (unsigned char x, int y, int z) |
| 145 |
{ |
| 146 |
/* 1x tst #64 */ |
| 147 |
return ((x >> 2) & 16) == 0; |
| 148 |
} |
| 149 |
|
| 150 |
int |
| 151 |
test_19 (signed char x, int y, int z) |
| 152 |
{ |
| 153 |
/* 1x tst #7 */ |
| 154 |
return (x << 1) & 0x0F ? y : z; |
| 155 |
} |
| 156 |
|
| 157 |
int |
| 158 |
test_20 (signed char x, int y, int z) |
| 159 |
{ |
| 160 |
/* 1x tst #7 */ |
| 161 |
return ((x << 1) & 0x0F) != 0; |
| 162 |
} |
| 163 |
|
| 164 |
int |
| 165 |
test_21 (signed char x, int y, int z) |
| 166 |
{ |
| 167 |
/* 1x tst #7 */ |
| 168 |
return ((x << 1) & 0x0F) == 0; |
| 169 |
} |
| 170 |
|
| 171 |
int |
| 172 |
test_22 (unsigned char* x, int y, int z) |
| 173 |
{ |
| 174 |
/* 1x tst #252 */ |
| 175 |
return (x[0] >> 2) ? y : z; |
| 176 |
} |