1 /* { dg-require-effective-target size32plus } */
3 extern void abort (void);
4 int r
, a
[1024], b
[1024];
5 unsigned short r2
, b2
[1024];
6 unsigned char r3
, b3
[1024];
8 __attribute__((noipa
)) void
9 foo (int *a
, int *b
, unsigned short *b2
, unsigned char *b3
)
11 #pragma omp for reduction (inscan, +:r, r2, r3)
12 for (int i
= 0; i
< 1024; i
++)
19 #pragma omp scan exclusive(r, r2, r3)
20 { r
+= a
[i
]; r2
+= a
[i
]; r3
+= a
[i
]; }
24 __attribute__((noipa
)) int
25 bar (unsigned short *s2p
, unsigned char *s3p
)
28 unsigned short s2
= 0;
31 #pragma omp for reduction (inscan, +:s, s2, s3)
32 for (int i
= 0; i
< 1024; i
++)
34 { b
[i
] = s
; b2
[i
] = s2
; b3
[i
] = s3
; }
35 #pragma omp scan exclusive(s, s2, s3)
47 __attribute__((noipa
)) void
48 baz (int *a
, int *b
, unsigned short *b2
, unsigned char *b3
)
50 #pragma omp parallel for reduction (inscan, +:r, r2, r3)
51 for (int i
= 0; i
< 1024; i
++)
58 #pragma omp scan exclusive(r, r2, r3)
67 __attribute__((noipa
)) int
68 qux (unsigned short *s2p
, unsigned char *s3p
)
71 unsigned short s2
= 0;
73 #pragma omp parallel for reduction (inscan, +:s, s2, s3)
74 for (int i
= 0; i
< 1024; i
++)
76 { b
[i
] = s
; b2
[i
] = s2
; b3
[i
] = s3
; }
77 #pragma omp scan exclusive(s, s2, s3)
78 { s
+= 2 * a
[i
]; s2
+= 2 * a
[i
]; s3
+= 2 * a
[i
]; }
91 for (int i
= 0; i
< 1024; ++i
)
101 if (r
!= 1024 * 1023 / 2
102 || r2
!= (unsigned short) r
103 || r3
!= (unsigned char) r
)
105 for (int i
= 0; i
< 1024; ++i
)
108 || b2
[i
] != (unsigned short) s
109 || b3
[i
] != (unsigned char) s
)
119 if (bar (&s2
, &s3
) != 1024 * 1023)
121 if (s2
!= (unsigned short) (1024 * 1023)
122 || s3
!= (unsigned char) (1024 * 1023))
125 for (int i
= 0; i
< 1024; ++i
)
128 || b2
[i
] != (unsigned short) s
129 || b3
[i
] != (unsigned char) s
)
143 if (r
!= 1024 * 1023 / 2
144 || r2
!= (unsigned short) r
145 || r3
!= (unsigned char) r
)
148 for (int i
= 0; i
< 1024; ++i
)
151 || b2
[i
] != (unsigned short) s
152 || b3
[i
] != (unsigned char) s
)
164 if (qux (&s2
, &s3
) != 1024 * 1023)
166 if (s2
!= (unsigned short) (1024 * 1023)
167 || s3
!= (unsigned char) (1024 * 1023))
170 for (int i
= 0; i
< 1024; ++i
)
173 || b2
[i
] != (unsigned short) s
174 || b3
[i
] != (unsigned char) s
)