summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/function-target-features.c
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
committerdim <dim@FreeBSD.org>2015-05-27 18:47:56 +0000
commit3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65 (patch)
treedbbd4047878da71c1a706e26ce05b4e7791b14cc /test/CodeGen/function-target-features.c
parent38d6f2e7f2ce51a5b3836d26596c6c34a3288752 (diff)
downloadFreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.zip
FreeBSD-src-3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65.tar.gz
Vendor import of clang trunk r238337:
https://llvm.org/svn/llvm-project/cfe/trunk@238337
Diffstat (limited to 'test/CodeGen/function-target-features.c')
-rw-r--r--test/CodeGen/function-target-features.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGen/function-target-features.c b/test/CodeGen/function-target-features.c
new file mode 100644
index 0000000..351c7f1
--- /dev/null
+++ b/test/CodeGen/function-target-features.c
@@ -0,0 +1,26 @@
+// 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
+// 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
+// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=NO-SOFT-FLOAT
+// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
+// RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
+
+void foo() {}
+
+// AVX-FEATURE: "target-features"{{.*}}+avx
+// AVX-NO-CPU-NOT: target-cpu
+// TWO-AVX: "target-features"={{.*}}+avx512er{{.*}}+avx512f
+// CORE-CPU: "target-cpu"="corei7"
+// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"={{.*}}+avx
+// X86-64-CPU: "target-cpu"="x86-64"
+// AVX-MINUS-FEATURE: "target-features"={{.*}}-avx
+// SOFT-FLOAT: "target-features"={{.*}}+soft-float
+// NO-SOFT-FLOAT-NOT: "target-features"={{.*}}+soft-float
OpenPOWER on IntegriCloud