1 /* PR rtl-optimization/97459 */
3 /* { dg-options "-O2" } */
4 /* { dg-additional-options "-DEXPENSIVE" { target run_expensive_tests } } */
6 #ifdef __SIZEOF_INT128__
9 typedef unsigned long long T
;
12 T
__attribute__((noipa
)) foo (T x
, T n
) { return x
% n
; }
13 #define C(n) T __attribute__((noipa)) foo##n (T x) { return x % (n - 10000); }
15 #define C1(n) C(n##1) C(n##3) C(n##5) C(n##7) C(n##9)
16 #define C2(n) C1(n##0) C1(n##1) C1(n##2) C1(n##3) C1(n##4) \
17 C1(n##5) C1(n##6) C1(n##7) C1(n##8) C1(n##9)
19 #define C3(n) C2(n##0) C2(n##1) C2(n##2) C2(n##3) C2(n##4) \
20 C2(n##5) C2(n##6) C2(n##7) C2(n##8) C2(n##9)
21 #define C4(n) C3(n##0) C3(n##1) C3(n##2) C3(n##3) C3(n##4) \
22 C3(n##5) C3(n##6) C3(n##7) C3(n##8) C3(n##9)
24 #define C3(n) C2(n##0) C2(n##4) C2(n##9)
25 #define C4(n) C3(n##0) C3(n##3) C3(n##7)
27 #define TESTS C4(1) C1(10010) C1(10012) C1(16144)
31 struct S
{ T x
; T (*foo
) (T
); };
34 #define C(n) { n - 10000, foo##n },
45 for (k
= 0; tests
[k
].x
; k
++)
46 for (i
= 0; i
< sizeof (T
) * __CHAR_BIT__
; i
++)
47 for (j
= -5; j
<= 5; j
++)
49 T x
= ((T
) 1 << i
) + j
;
50 if (foo (x
, tests
[k
].x
) != tests
[k
].foo (x
))