58 lines · c
1// RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-linux-gnu -emit-llvm %s -o - -fopenmp-version=45 | FileCheck %s --check-prefix=GENERIC2// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=45 %s3// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=45 | FileCheck %s --check-prefix=GENERIC4 5// RUN: %clang_cc1 -target-feature +avx512f -verify -fopenmp -x c -triple x86_64-linux-gnu -emit-llvm %s -o - -fopenmp-version=45 | FileCheck %s --check-prefix=WITHFEATURE6// RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -std=c++11 -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=45 %s7// RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=45 | FileCheck %s --check-prefix=WITHFEATURE8 9// RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=GENERIC10// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t %s11// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=GENERIC12 13// RUN: %clang_cc1 -target-feature +avx512f -verify -fopenmp -x c -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=WITHFEATURE14// RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -std=c++11 -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-pch -o %t %s15// RUN: %clang_cc1 -target-feature +avx512f -fopenmp -x c++ -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=WITHFEATURE16 17// expected-no-diagnostics18 19// Test taken from PR46338 (by linna su)20 21#ifndef HEADER22#define HEADER23 24void base_saxpy(int, float, float *, float *);25void avx512_saxpy(int, float, float *, float *);26 27#pragma omp declare variant(avx512_saxpy) \28 match(device = {isa(avx512f)})29void base_saxpy(int n, float s, float *x, float *y) {30#pragma omp parallel for31 for (int i = 0; i < n; i++)32 y[i] = s * x[i] + y[i];33}34 35void 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];39}40 41void caller(int n, float s, float *x, float *y) {42 // GENERIC: define {{.*}}void @{{.*}}caller43 // GENERIC: call void @{{.*}}base_saxpy44 // WITHFEATURE: define {{.*}}void @{{.*}}caller45 // WITHFEATURE: call void @{{.*}}avx512_saxpy46 base_saxpy(n, s, x, y);47}48 49__attribute__((target("avx512f"))) void variant_caller(int n, float s, float *x, float *y) {50 // GENERIC: define {{.*}}void @{{.*}}variant_caller51 // GENERIC: call void @{{.*}}avx512_saxpy52 // WITHFEATURE: define {{.*}}void @{{.*}}variant_caller53 // WITHFEATURE: call void @{{.*}}avx512_saxpy54 base_saxpy(n, s, x, y);55}56 57#endif58