1 /* { dg-require-effective-target size32plus } */
2 /* { dg-additional-options "-O2 -fopenmp -fdump-tree-vect-details" } */
3 /* { dg-additional-options "-msse2" { target sse2_runtime } } */
4 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 /* { dg-final { scan-tree-dump-times "vectorized \[2-6] loops" 2 "vect" { target sse2_runtime } } } */
7 extern void abort (void);
8 float r
= 1.0f
, a
[1024], b
[1024];
10 __attribute__((noipa
)) void
11 foo (float *a
, float *b
)
13 #pragma omp for simd reduction (inscan, *:r)
14 for (int i
= 0; i
< 1024; i
++)
17 #pragma omp scan inclusive(r)
22 __attribute__((noipa
)) float
25 float s
= -__builtin_inff ();
26 #pragma omp parallel for simd reduction (inscan, max:s)
27 for (int i
= 0; i
< 1024; i
++)
29 s
= s
> a
[i
] ? s
: a
[i
];
30 #pragma omp scan inclusive(s)
40 for (int i
= 0; i
< 1024; ++i
)
43 a
[i
] = (i
& 1) ? 0.25f
: 0.5f
;
45 a
[i
] = (i
% 3) == 0 ? 2.0f
: (i
% 3) == 1 ? 4.0f
: 1.0f
;
47 a
[i
] = (i
& 1) ? 0.25f
: 0.5f
;
49 a
[i
] = (i
% 3) == 0 ? 2.0f
: (i
% 3) == 1 ? 4.0f
: 1.0f
;
53 case 0: a
[i
] = 0.25f
; break;
54 case 1: a
[i
] = 2.0f
; break;
55 case 2: a
[i
] = -1.0f
; break;
56 case 3: a
[i
] = -4.0f
; break;
57 case 4: a
[i
] = 0.5f
; break;
58 case 5: a
[i
] = 1.0f
; break;
59 default: a
[i
] = 0.0f
; break;
66 if (r
* 16384.0f
!= 0.125f
)
69 for (int i
= 0; i
< 1024; ++i
)
76 a
[i
] = m
- ((i
% 3) == 1 ? 2.0f
: (i
% 3) == 2 ? 4.0f
: 0.0f
);
83 s
= -__builtin_inff ();
84 for (int i
= 0; i
< 1024; ++i
)