1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s
4 // REQUIRES: aarch64-registered-target
5 // Note: -fopemp and -fopenmp-simd behavior are expected to be the same.
7 // This test checks the values of Widest Data Size (WDS), as defined
8 // in https://github.com/ARM-software/abi-aa/tree/main/vfabia64
10 // WDS is used to check the accepted values <N> of `simdlen(<N>)` when
11 // targeting fixed-length SVE vector function names. The values of
12 // `<N>` that are accepted are such that for X = WDS * <N> * 8,
13 // 128-bit <= X <= 2048-bit and X is a multiple of 128-bit.
15 #pragma omp declare simd simdlen(8)
16 #pragma omp declare simd simdlen(16)
17 #pragma omp declare simd simdlen(256)
18 #pragma omp declare simd simdlen(272)
19 char WDS_is_sizeof_char(char in
);
20 // WDS = 1, simdlen(8) and simdlen(272) are not generated.
21 // CHECK-DAG: _ZGVsM16v_WDS_is_sizeof_char
22 // CHECK-DAG: _ZGVsM256v_WDS_is_sizeof_char
23 // CHECK-NOT: _ZGV{{.*}}_WDS_is_sizeof_char
25 #pragma omp declare simd simdlen(4)
26 #pragma omp declare simd simdlen(8)
27 #pragma omp declare simd simdlen(128)
28 #pragma omp declare simd simdlen(136)
29 char WDS_is_sizeof_short(short in
);
30 // WDS = 2, simdlen(4) and simdlen(136) are not generated.
31 // CHECK-DAG: _ZGVsM8v_WDS_is_sizeof_short
32 // CHECK-DAG: _ZGVsM128v_WDS_is_sizeof_short
33 // CHECK-NOT: _ZGV{{.*}}_WDS_is_sizeof_short
35 #pragma omp declare simd linear(sin) notinbranch simdlen(2)
36 #pragma omp declare simd linear(sin) notinbranch simdlen(4)
37 #pragma omp declare simd linear(sin) notinbranch simdlen(64)
38 #pragma omp declare simd linear(sin) notinbranch simdlen(68)
39 void WDS_is_sizeof_float_pointee(float in
, float *sin
);
40 // WDS = 4, simdlen(2) and simdlen(68) are not generated.
41 // CHECK-DAG: _ZGVsM4vl4_WDS_is_sizeof_float_pointee
42 // CHECK-DAG: _ZGVsM64vl4_WDS_is_sizeof_float_pointee
43 // CHECK-NOT: _ZGV{{.*}}_WDS_is_sizeof_float_pointee
45 #pragma omp declare simd linear(sin) notinbranch simdlen(2)
46 #pragma omp declare simd linear(sin) notinbranch simdlen(4)
47 #pragma omp declare simd linear(sin) notinbranch simdlen(32)
48 #pragma omp declare simd linear(sin) notinbranch simdlen(34)
49 void WDS_is_sizeof_double_pointee(float in
, double *sin
);
50 // WDS = 8 because of the linear clause, simdlen(34) is not generated.
51 // CHECK-DAG: _ZGVsM2vl8_WDS_is_sizeof_double_pointee
52 // CHECK-DAG: _ZGVsM4vl8_WDS_is_sizeof_double_pointee
53 // CHECK-DAG: _ZGVsM32vl8_WDS_is_sizeof_double_pointee
54 // CHECK-NOT: _ZGV{{.*}}_WDS_is_sizeof_double_pointee
56 #pragma omp declare simd simdlen(2)
57 #pragma omp declare simd simdlen(4)
58 #pragma omp declare simd simdlen(32)
59 #pragma omp declare simd simdlen(34)
60 double WDS_is_sizeof_double(double in
);
61 // WDS = 8, simdlen(34) is not generated.
62 // CHECK-DAG: _ZGVsM2v_WDS_is_sizeof_double
63 // CHECK-DAG: _ZGVsM4v_WDS_is_sizeof_double
64 // CHECK-DAG: _ZGVsM32v_WDS_is_sizeof_double
65 // CHECK-NOT: _ZGV{{.*}}_WDS_is_sizeof_double
73 C
= WDS_is_sizeof_char(C
);
74 C
= WDS_is_sizeof_short(S
);
75 WDS_is_sizeof_float_pointee(F
, &F
);
76 WDS_is_sizeof_double_pointee(F
, &D
);
77 D
= WDS_is_sizeof_double(D
);