1 // RUN: %clang_cc1 -verify -fopenmp -x c -triple %itanium_abi_triple -emit-llvm %s -o - -fopenmp-version=45 | FileCheck %s --check-prefix=GENERIC
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=45 %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=45 | FileCheck %s --check-prefix=GENERIC
5 // RUN: %clang_cc1 -target-feature +avx512f -verify -fopenmp -x c -triple %itanium_abi_triple -emit-llvm %s -o - -fopenmp-version=45 | FileCheck %s --check-prefix=WITHFEATURE
6 // RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=45 %s
7 // RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=45 | FileCheck %s --check-prefix=WITHFEATURE
9 // RUN: %clang_cc1 -verify -fopenmp -x c -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s --check-prefix=GENERIC
10 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=GENERIC
13 // RUN: %clang_cc1 -target-feature +avx512f -verify -fopenmp -x c -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s --check-prefix=WITHFEATURE
14 // RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -emit-pch -o %t %s
15 // RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -triple %itanium_abi_triple -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=WITHFEATURE
17 // expected-no-diagnostics
19 // Test taken from PR46338 (by linna su)
24 void base_saxpy(int, float, float *, float *);
25 void avx512_saxpy(int, float, float *, float *);
27 #pragma omp declare variant(avx512_saxpy) \
28 match(device = {isa(avx512f)})
29 void base_saxpy(int n
, float s
, float *x
, float *y
) {
30 #pragma omp parallel for
31 for (int i
= 0; i
< n
; i
++)
32 y
[i
] = s
* x
[i
] + y
[i
];
35 void avx512_saxpy(int n
, float s
, float *x
, float *y
) {
36 #pragma omp parallel for simd simdlen(16) aligned(x, y : 64)
37 for (int i
= 0; i
< n
; i
++)
38 y
[i
] = s
* x
[i
] + y
[i
];
41 void caller(int n
, float s
, float *x
, float *y
) {
42 // GENERIC: define {{.*}}void @{{.*}}caller
43 // GENERIC: call void @{{.*}}base_saxpy
44 // WITHFEATURE: define {{.*}}void @{{.*}}caller
45 // WITHFEATURE: call void @{{.*}}avx512_saxpy
46 base_saxpy(n
, s
, x
, y
);
49 __attribute__((target("avx512f"))) void variant_caller(int n
, float s
, float *x
, float *y
) {
50 // GENERIC: define {{.*}}void @{{.*}}variant_caller
51 // GENERIC: call void @{{.*}}avx512_saxpy
52 // WITHFEATURE: define {{.*}}void @{{.*}}variant_caller
53 // WITHFEATURE: call void @{{.*}}avx512_saxpy
54 base_saxpy(n
, s
, x
, y
);