diff options
| author | Eric Christopher <echristo@gmail.com> | 2015-03-25 23:14:47 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2015-03-25 23:14:47 +0000 |
| commit | 70c1665d83861e35ddd5c3a1b665992e1738b7e2 (patch) | |
| tree | 81ae5f5574bde5733ac510322e512e33a72290cc /clang/test/CodeGen/function-target-features.c | |
| parent | cf07c65be3094e023dfa45e555918782ccdcc1e7 (diff) | |
Reapply r232888 after applying a fix for -msse4 code generation.
As a note, any target that uses fake target features via command
line options will have similar problems.
llvm-svn: 233227
Diffstat (limited to 'clang/test/CodeGen/function-target-features.c')
| -rw-r--r-- | clang/test/CodeGen/function-target-features.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/function-target-features.c b/clang/test/CodeGen/function-target-features.c new file mode 100644 index 000000000000..5665b1f841f4 --- /dev/null +++ b/clang/test/CodeGen/function-target-features.c @@ -0,0 +1,21 @@ +// This test verifies that we produce target-cpu and target-features attributes +// on functions when they're different from the standard cpu and have written +// features. + +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512er | FileCheck %s -check-prefix=TWO-AVX +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 -target-feature +avx | FileCheck %s -check-prefix=CORE-CPU-AND-FEATURES +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU-NOT +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7-avx -target-feature -avx | FileCheck %s -check-prefix=AVX-MINUS-FEATURE + +void foo() {} + +// AVX-FEATURE: "target-features"="+avx" +// AVX-NO-CPU-NOT: target-cpu +// TWO-AVX: "target-features"="+avx512f,+avx512er" +// CORE-CPU: "target-cpu"="corei7" +// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"="+avx" +// X86-64-CPU-NOT: "target-cpu" +// AVX-MINUS-FEATURE: "target-features"="-avx" |
