• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // REQUIRES: aarch64-registered-target
2 // -fopemp and -fopenmp-simd behavior are expected to be the same
3 
4 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve \
5 // RUN:  -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s
6 
7 // RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve \
8 // RUN:  -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s
9 
10 #pragma omp declare simd
11 #pragma omp declare simd notinbranch
12 #pragma omp declare simd simdlen(2)
13 #pragma omp declare simd simdlen(4)
14 #pragma omp declare simd simdlen(5) // not a multiple of 128-bits
15 #pragma omp declare simd simdlen(6)
16 #pragma omp declare simd simdlen(8)
17 #pragma omp declare simd simdlen(32)
18 #pragma omp declare simd simdlen(34) // requires more than 2048 bits
19 double foo(float x);
20 
21 // CHECK-DAG: "_ZGVsM2v_foo" "_ZGVsM32v_foo" "_ZGVsM4v_foo" "_ZGVsM6v_foo" "_ZGVsM8v_foo" "_ZGVsMxv_foo"
22 // CHECK-NOT: _ZGVsN
23 // CHECK-NOT: _ZGVsM5v_foo
24 // CHECK-NOT: _ZGVsM34v_foo
25 // CHECK-NOT: foo
26 
foo_loop(double * x,float * y,int N)27 void foo_loop(double *x, float *y, int N) {
28   for (int i = 0; i < N; ++i) {
29     x[i] = foo(y[i]);
30   }
31 }
32 
33   // test integers
34 
35 #pragma omp declare simd notinbranch
36 char a01_fun(int x);
37 // CHECK-DAG: _ZGVsMxv_a01_fun
38 // CHECK-NOT: a01_fun
39 
40 static int *in;
41 static char *out;
do_something()42 void do_something() {
43   *out = a01_fun(*in);
44 }
45