Debian Codegraph @

libgomp/testsuite/libgomp.c/bitint-1.c

raw
1 /* PR middle-end/113409 */
2 /* { dg-do run { target bitint } } */
3
4 extern void abort (void);
5
6 #if __BITINT_MAXWIDTH__ >= 1023
7 typedef _BitInt(931) B931;
8 typedef _BitInt(1023) B1023;
9 #else
10 typedef _BitInt(31) B931;
11 typedef _BitInt(63) B1023;
12 #endif
13
14 __attribute__((noipa)) B931
15 bar (B931 x)
16 {
17 return x;
18 }
19
20 B931
21 foo (B931 x)
22 {
23 B931 r = 0;
24 B1023 l = 56wb;
25 #pragma omp parallel for reduction(+: r) linear(l : 3wb)
26 for (B931 i = 0; i < x; ++i)
27 {
28 r += bar (i);
29 l += 3wb;
30 }
31 if (l != (B1023) 56wb + x * 3wb)
32 abort ();
33 return r;
34 }
35
36 B931
37 baz (B931 a, B931 b, B931 c, B931 d, B931 e, B931 f)
38 {
39 B931 r = 0;
40 #pragma omp parallel for collapse (2wb) reduction(+: r)
41 for (B931 i = a; i < b; i += c)
42 for (B931 j = d; j > e; j += f)
43 {
44 r += (j - d) / f;
45 __builtin_printf ("%d\n", (int) r);
46 }
47 return r;
48 }
49
50 int
51 main ()
52 {
53 if (foo (16wb) != (B931) 15wb * 16wb / 2
54 || foo (256wb) != (B931) 255wb * 256wb / 2)
55 abort ();
56 #if __BITINT_MAXWIDTH__ >= 1023
57 if (baz (5019676379303764570412381742937286053482001129028025397398691108125646744814606405323608429353439158482254231750681261083217232780938592007150824765654203477280876662295642053702075485153212701225737143207062700602509893062044376997132415613866154761073993220684129908568716699977wb,
58 5019676379303764570412381742937286053482001129028025397398691108125646744814606405323608429353439158482254231750681261083217232780938592007150824765654203477280876662295642053702075485153212701225737143207062700602509893062044376997132415613866154761074023903103954348393149593648wb,
59 398472984732984732894723wb,
60 5145599438319070078334010989312672300490893251953772234670751860213136881221517063143096309285807356778798661066289865489661268190588670564647904159660341525674865064477335008915374460378741763629714814990575971883514175167056160470289039998140910732382754821232566561860399556131wb,
61 5145599438319070078334010989312672300490893251953772234670751860213136881221517063143096309285807356778798661066289865489661268190588670564647904159660341525674865064477335008915374460378741763629714814990575971883514175167056160470289039995725068563774878643356388697468035164019wb,
62 -89475635874365784365784365347865347856wb) != (B931) 26wb * 27wb / 2wb * 77wb)
63 abort ();
64 #endif
65 }