1 /* PR rtl-optimization/97459 */
3 /* { dg-options "-O2" } */
4 /* { dg-additional-options "-DEXPENSIVE" { target run_expensive_tests } } */
6 #ifdef __SIZEOF_INT128__
11 typedef unsigned long long U
;
14 T
__attribute__((noipa
)) foo (T x
, T n
) { return x
% n
; }
15 #define C(n) T __attribute__((noipa)) foo##n (T x) { return x % (n - 10000); }
17 #define C1(n) C(n##1) C(n##3) C(n##5) C(n##7) C(n##9)
18 #define C2(n) C1(n##0) C1(n##1) C1(n##2) C1(n##3) C1(n##4) \
19 C1(n##5) C1(n##6) C1(n##7) C1(n##8) C1(n##9)
21 #define C3(n) C2(n##0) C2(n##1) C2(n##2) C2(n##3) C2(n##4) \
22 C2(n##5) C2(n##6) C2(n##7) C2(n##8) C2(n##9)
23 #define C4(n) C3(n##0) C3(n##1) C3(n##2) C3(n##3) C3(n##4) \
24 C3(n##5) C3(n##6) C3(n##7) C3(n##8) C3(n##9)
26 #define C3(n) C2(n##0) C2(n##4) C2(n##9)
27 #define C4(n) C3(n##0) C3(n##3) C3(n##7)
29 #define TESTS C4(1) C1(10010) C1(10012) C1(16144)
33 struct S
{ T x
; T (*foo
) (T
); };
36 #define C(n) { n - 10000, foo##n },
47 for (k
= 0; tests
[k
].x
; k
++)
48 for (i
= 0; i
< sizeof (T
) * __CHAR_BIT__
; i
++)
49 for (j
= -5; j
<= 5; j
++)
51 U x
= ((U
) 1 << i
) + j
;
52 if (foo ((T
) x
, tests
[k
].x
) != tests
[k
].foo ((T
) x
)
53 || foo ((T
) -x
, tests
[k
].x
) != tests
[k
].foo ((T
) -x
))