1 /* { dg-require-effective-target size32plus } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4 /* { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 2 "vect" { target i?86-*-* x86_64-*-* } } } */
11 #define FLT_MIN_VALUE (-__FLT_MAX__)
13 #define FLT_MIN_VALUE (-__builtin_inff ())
16 float r
= 1.0f
, a
[1024], b
[1024];
18 __attribute__((noipa
)) void
19 foo (float *a
, float *b
)
21 #pragma omp simd reduction (inscan, *:r)
22 for (int i
= 0; i
< 1024; i
++)
25 #pragma omp scan exclusive(r)
30 __attribute__((noipa
)) float
33 float s
= FLT_MIN_VALUE
;
34 #pragma omp simd reduction (inscan, max:s)
35 for (int i
= 0; i
< 1024; i
++)
38 #pragma omp scan exclusive(s)
39 s
= s
> a
[i
] ? s
: a
[i
];
51 for (int i
= 0; i
< 1024; ++i
)
54 a
[i
] = (i
& 1) ? 0.25f
: 0.5f
;
56 a
[i
] = (i
% 3) == 0 ? 2.0f
: (i
% 3) == 1 ? 4.0f
: 1.0f
;
58 a
[i
] = (i
& 1) ? 0.25f
: 0.5f
;
60 a
[i
] = (i
% 3) == 0 ? 2.0f
: (i
% 3) == 1 ? 4.0f
: 1.0f
;
64 case 0: a
[i
] = 0.25f
; break;
65 case 1: a
[i
] = 2.0f
; break;
66 case 2: a
[i
] = -1.0f
; break;
67 case 3: a
[i
] = -4.0f
; break;
68 case 4: a
[i
] = 0.5f
; break;
69 case 5: a
[i
] = 1.0f
; break;
70 default: a
[i
] = 0.0f
; break;
76 if (r
* 16384.0f
!= 0.125f
)
80 for (int i
= 0; i
< 1024; ++i
)
87 a
[i
] = m
- ((i
% 3) == 1 ? 2.0f
: (i
% 3) == 2 ? 4.0f
: 0.0f
);
94 for (int i
= 0; i
< 1024; ++i
)