Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/bitops-1.c

raw
1 /* PR tree-optimization/110726 */
2
3 #define DECLS(n,VOL) \
4 __attribute__((noinline,noclone)) \
5 int h##n(VOL int A, VOL int B){ \
6 return (A | B) & (A == B); \
7 } \
8 __attribute__((noinline,noclone)) \
9 int i##n(VOL int A, VOL int B){ \
10 return A | (A == B); \
11 } \
12 __attribute__((noinline,noclone)) \
13 int k##n(VOL int A, VOL int B){ \
14 return (A & B) | (A == B); \
15 } \
16
17 DECLS(0,)
18 DECLS(1,volatile)
19
20 int values[] = { 0, 1, 2, 3, -1, -2, -3, 0x10080 };
21 int numvalues = sizeof(values)/sizeof(values[0]);
22
23 int main(){
24 for(int A = 0; A < numvalues; A++)
25 for(int B = 0; B < numvalues; B++)
26 {
27 int a = values[A];
28 int b = values[B];
29 if (h0 (a, b) != h1 (a, b)) __builtin_abort();
30 if (i0 (a, b) != i1 (a, b)) __builtin_abort();
31 if (k0 (a, b) != k1 (a, b)) __builtin_abort();
32 }
33 }