| 1 |
/* Test the correct application of masking to autovectorized math function calls. |
| 2 |
Test is currently set to xfail pending the release of the relevant lmvec |
| 3 |
support. */ |
| 4 |
/* { dg-do compile { target { aarch64*-*-* } } } */ |
| 5 |
/* { dg-additional-options "-march=armv8.2-a+sve -fdump-tree-ifcvt-raw -Ofast" { target { aarch64*-*-* } } } */ |
| 6 |
|
| 7 |
#include <math.h> |
| 8 |
|
| 9 |
const int N = 20; |
| 10 |
const float lim = 101.0; |
| 11 |
const float cst = -1.0; |
| 12 |
float tot = 0.0; |
| 13 |
|
| 14 |
float b[20]; |
| 15 |
float a[20] = { [0 ... 9] = 1.7014118e39, /* If branch. */ |
| 16 |
[10 ... 19] = 100.0 }; /* Else branch. */ |
| 17 |
|
| 18 |
int main (void) |
| 19 |
{ |
| 20 |
#pragma omp simd |
| 21 |
for (int i = 0; i < N; i += 1) |
| 22 |
{ |
| 23 |
if (a[i] > lim) |
| 24 |
b[i] = cst; |
| 25 |
else |
| 26 |
b[i] = expf (a[i]); |
| 27 |
tot += b[i]; |
| 28 |
} |
| 29 |
return (0); |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump-not { gimple_call <expf, _2, _1>} ifcvt { xfail { aarch64*-*-* } } } } */ |
| 33 |
/* { dg-final { scan-tree-dump { gimple_call <.MASK_CALL, _2, expf, _1, _30>} ifcvt { xfail { aarch64*-*-* } } } } */ |