| 1 |
/* Check that no unnecessary zero extensions are done on values that are |
| 2 |
results of arithmetic with T bit inputs. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-O1" } */ |
| 5 |
/* { dg-final { scan-assembler-not "extu|exts" } } */ |
| 6 |
|
| 7 |
int |
| 8 |
test00 (int a, int b, int c, int d) |
| 9 |
{ |
| 10 |
int x = a == b; |
| 11 |
int y = c == 0; |
| 12 |
return x == y; |
| 13 |
} |
| 14 |
|
| 15 |
int |
| 16 |
test01 (int a, int b, int c, int d) |
| 17 |
{ |
| 18 |
int x = a == b; |
| 19 |
int y = c == d; |
| 20 |
return x == y; |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
test02 (int a, int b, int c, int d) |
| 25 |
{ |
| 26 |
int x = a != b; |
| 27 |
int y = c == d; |
| 28 |
return x == y; |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
test03 (int a, int b, int c, int d) |
| 33 |
{ |
| 34 |
int x = a != b; |
| 35 |
int y = c != d; |
| 36 |
return x == y; |
| 37 |
} |
| 38 |
|
| 39 |
int |
| 40 |
test04 (int a, int b, int c, int d) |
| 41 |
{ |
| 42 |
int x = a != b; |
| 43 |
int y = c != d; |
| 44 |
return x == y; |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
test05 (int a, int b, int c, int d) |
| 49 |
{ |
| 50 |
int x = a == b; |
| 51 |
int y = c == 0; |
| 52 |
return x != y; |
| 53 |
} |
| 54 |
|
| 55 |
int |
| 56 |
test06 (int a, int b, int c, int d) |
| 57 |
{ |
| 58 |
int x = a == b; |
| 59 |
int y = c == 0; |
| 60 |
return x ^ y; |
| 61 |
} |
| 62 |
|
| 63 |
int |
| 64 |
test07 (int a, int b, int c, int d) |
| 65 |
{ |
| 66 |
int x = a == b; |
| 67 |
int y = c == 0; |
| 68 |
return x | y; |
| 69 |
} |
| 70 |
|
| 71 |
int |
| 72 |
test08 (int a, int b, int c, int d) |
| 73 |
{ |
| 74 |
int x = a == b; |
| 75 |
int y = c == 0; |
| 76 |
return x & y; |
| 77 |
} |
| 78 |
|
| 79 |
int |
| 80 |
test09 (int a, int b, int c, int d) |
| 81 |
{ |
| 82 |
int x = a == b; |
| 83 |
int y = c == d; |
| 84 |
return x != y; |
| 85 |
} |
| 86 |
|
| 87 |
int |
| 88 |
test10 (int a, int b, int c, int d) |
| 89 |
{ |
| 90 |
int x = a != b; |
| 91 |
int y = c == d; |
| 92 |
return x != y; |
| 93 |
} |
| 94 |
|
| 95 |
int |
| 96 |
test11 (int a, int b, int c, int d) |
| 97 |
{ |
| 98 |
int x = a != b; |
| 99 |
int y = c != d; |
| 100 |
return x != y; |
| 101 |
} |
| 102 |
|
| 103 |
int |
| 104 |
test12 (int a, int b, int c, int d) |
| 105 |
{ |
| 106 |
int x = a != b; |
| 107 |
int y = c != d; |
| 108 |
return x != y; |
| 109 |
} |
| 110 |
|
| 111 |
int |
| 112 |
test13 (int a, int b, int c, int d, int e, int f) |
| 113 |
{ |
| 114 |
int x = a == b; |
| 115 |
int y = c == 0; |
| 116 |
int z = d == e; |
| 117 |
return x == y || x == z; |
| 118 |
} |
| 119 |
|
| 120 |
int |
| 121 |
test14 (int a, int b, int c, int d, int e, int f) |
| 122 |
{ |
| 123 |
int x = a == b; |
| 124 |
int y = c == 0; |
| 125 |
int z = d == e; |
| 126 |
return x == y && x == z; |
| 127 |
} |
| 128 |
|
| 129 |
int |
| 130 |
test15 (int a, int b, int c, int d, int e, int f) |
| 131 |
{ |
| 132 |
int x = a != b; |
| 133 |
int y = c == 0; |
| 134 |
int z = d == e; |
| 135 |
return x == y || x == z; |
| 136 |
} |
| 137 |
|
| 138 |
int |
| 139 |
test16 (int a, int b, int c, int d, int e, int f) |
| 140 |
{ |
| 141 |
int x = a != b; |
| 142 |
int y = c == 0; |
| 143 |
int z = d == e; |
| 144 |
return x == y && x == z; |
| 145 |
} |
| 146 |
|
| 147 |
int |
| 148 |
test17 (int a, int b, int c, int d, int e, int f) |
| 149 |
{ |
| 150 |
int x = a != b; |
| 151 |
int y = c != 0; |
| 152 |
int z = d == e; |
| 153 |
return x == y || x == z; |
| 154 |
} |
| 155 |
|
| 156 |
int |
| 157 |
test18 (int a, int b, int c, int d, int e, int f) |
| 158 |
{ |
| 159 |
int x = a != b; |
| 160 |
int y = c != 0; |
| 161 |
int z = d == e; |
| 162 |
return x == y && x == z; |
| 163 |
} |
| 164 |
|
| 165 |
int |
| 166 |
test19 (int a, int b, int c, int d, int e, int f) |
| 167 |
{ |
| 168 |
int x = a != b; |
| 169 |
int y = c != 0; |
| 170 |
int z = d == e; |
| 171 |
return x == y || x == z; |
| 172 |
} |
| 173 |
|
| 174 |
int |
| 175 |
test20 (int a, int b, int c, int d, int e, int f) |
| 176 |
{ |
| 177 |
int x = a != b; |
| 178 |
int y = c != 0; |
| 179 |
int z = d != e; |
| 180 |
return x == y && x == z; |
| 181 |
} |
| 182 |
|
| 183 |
int |
| 184 |
test21 (int a, int b, int c, int d) |
| 185 |
{ |
| 186 |
int x = a == b; |
| 187 |
int y = c == 0; |
| 188 |
return x + y; |
| 189 |
} |
| 190 |
|
| 191 |
int |
| 192 |
test22 (int a, int b, int c, int d) |
| 193 |
{ |
| 194 |
int x = a != b; |
| 195 |
int y = c == 0; |
| 196 |
return x + y; |
| 197 |
} |
| 198 |
|
| 199 |
int |
| 200 |
test23 (int a, int b, int c, int d) |
| 201 |
{ |
| 202 |
int x = a != b; |
| 203 |
int y = c != 0; |
| 204 |
return x + y; |
| 205 |
} |
| 206 |
|
| 207 |
int |
| 208 |
test24 (int a, int b, int c, int d) |
| 209 |
{ |
| 210 |
int x = a == b; |
| 211 |
int y = c == 0; |
| 212 |
return x - y; |
| 213 |
} |
| 214 |
|
| 215 |
int |
| 216 |
test25 (int a, int b, int c, int d) |
| 217 |
{ |
| 218 |
int x = a != b; |
| 219 |
int y = c == 0; |
| 220 |
return x - y; |
| 221 |
} |
| 222 |
|
| 223 |
int |
| 224 |
test26 (int a, int b, int c, int d) |
| 225 |
{ |
| 226 |
int x = a != b; |
| 227 |
int y = c != 0; |
| 228 |
return x - y; |
| 229 |
} |
| 230 |
|
| 231 |
int |
| 232 |
test27 (int a, int b, int c, int d) |
| 233 |
{ |
| 234 |
int x = a == b; |
| 235 |
int y = c == 0; |
| 236 |
return x * y; |
| 237 |
} |
| 238 |
|
| 239 |
int |
| 240 |
test28 (int a, int b, int c, int d) |
| 241 |
{ |
| 242 |
int x = a != b; |
| 243 |
int y = c == 0; |
| 244 |
return x * y; |
| 245 |
} |
| 246 |
|
| 247 |
int |
| 248 |
test29 (int a, int b, int c, int d) |
| 249 |
{ |
| 250 |
int x = a != b; |
| 251 |
int y = c != 0; |
| 252 |
return x * y; |
| 253 |
} |
| 254 |
|
| 255 |
int |
| 256 |
test30 (int a, int b) |
| 257 |
{ |
| 258 |
return ((a & 0x7F) == 1) |
| 259 |
| ((a & 0xFF00) == 0x0200) |
| 260 |
| ((a & 0xFF0000) == 0x030000); |
| 261 |
} |
| 262 |
|
| 263 |
int |
| 264 |
test31 (int a, int b) |
| 265 |
{ |
| 266 |
return ((a & 0x7F) == 1) |
| 267 |
| ((a & 0xFF00) == 0x0200) |
| 268 |
| ((a & 0xFF0000) == 0x030000) |
| 269 |
| ((a & 0xFF000000) == 0x04000000); |
| 270 |
} |
| 271 |
|
| 272 |
int |
| 273 |
test32 (int* a, int b, int c, volatile char* d) |
| 274 |
{ |
| 275 |
d[1] = a[0] != 0; |
| 276 |
return b; |
| 277 |
} |
| 278 |
|
| 279 |
int |
| 280 |
test33 (int* a, int b, int c, volatile char* d) |
| 281 |
{ |
| 282 |
d[1] = a[0] == 0; |
| 283 |
return b; |
| 284 |
} |
| 285 |
|
| 286 |
char |
| 287 |
test34 (int a, int* b) |
| 288 |
{ |
| 289 |
return (b[4] & b[0] & a) == a; |
| 290 |
} |
| 291 |
|
| 292 |
unsigned char |
| 293 |
test35 (int a, int* b) |
| 294 |
{ |
| 295 |
return (b[4] & b[0] & a) == a; |
| 296 |
} |