| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */ |
| 3 |
|
| 4 |
#include <arm_sve.h> |
| 5 |
|
| 6 |
#define N __ARM_FEATURE_SVE_BITS |
| 7 |
#define FIXED_ATTR __attribute__((arm_sve_vector_bits (N))) |
| 8 |
|
| 9 |
typedef __SVInt32_t v8si FIXED_ATTR; |
| 10 |
|
| 11 |
static v8si local_vec; |
| 12 |
#pragma omp declare target link(local_vec) |
| 13 |
|
| 14 |
v8si global_vec; |
| 15 |
#pragma omp declare target link(global_vec) |
| 16 |
|
| 17 |
/* { dg-error {SVE type 'svint32_t' does not have a fixed size} "" { target *-*-* } .+1 } */ |
| 18 |
static svint32_t slocal_vec; |
| 19 |
|
| 20 |
/* { dg-error {'slocal_vec' does not have a mappable type in 'link' clause} "" { target *-*-* } .+1 } */ |
| 21 |
#pragma omp declare target link(slocal_vec) |
| 22 |
|
| 23 |
void |
| 24 |
one_get_inc2_local_vec_vls () |
| 25 |
{ |
| 26 |
v8si res, res2, tmp; |
| 27 |
|
| 28 |
#pragma omp target map(from: res, res2) |
| 29 |
{ |
| 30 |
res = local_vec; |
| 31 |
local_vec = svadd_s32_z (svptrue_b32 (), local_vec, local_vec); |
| 32 |
res2 = local_vec; |
| 33 |
} |
| 34 |
|
| 35 |
tmp = svadd_s32_z (svptrue_b32 (), res, res); |
| 36 |
svbool_t p = svcmpne_s32 (svptrue_b32 (), tmp, res2); |
| 37 |
if (svptest_any (svptrue_b32 (), p)) |
| 38 |
__builtin_abort (); |
| 39 |
} |
| 40 |
|
| 41 |
void |
| 42 |
one_get_inc3_global_vec_vls () |
| 43 |
{ |
| 44 |
v8si res, res2, tmp; |
| 45 |
|
| 46 |
#pragma omp target map(from: res, res2) |
| 47 |
{ |
| 48 |
res = global_vec; |
| 49 |
global_vec = svadd_s32_z (svptrue_b32 (), global_vec, global_vec); |
| 50 |
res2 = global_vec; |
| 51 |
} |
| 52 |
|
| 53 |
tmp = svadd_s32_z (svptrue_b32 (), res, res); |
| 54 |
svbool_t p = svcmpne_s32 (svptrue_b32 (), tmp, res2); |
| 55 |
if (svptest_any (svptrue_b32 (), p)) |
| 56 |
__builtin_abort (); |
| 57 |
} |