blob: 6b32d3ddbcda6630965da9db7abb941e92b8fc16 [file] [log] [blame]
Eric Christopher70c16652015-03-25 23:14:47 +00001// This test verifies that we produce target-cpu and target-features attributes
2// on functions when they're different from the standard cpu and have written
3// features.
4
5// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE
6// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU
7// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512er | FileCheck %s -check-prefix=TWO-AVX
8// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU
9// 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
Eric Christopherf37ab1c2015-04-27 23:11:34 +000010// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU
Eric Christopher70c16652015-03-25 23:14:47 +000011// 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
Jacob Baungard Hansen13a49372016-05-24 08:30:08 +000012// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
Eric Christopherfb481a42015-04-29 23:32:17 +000013// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
14// RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
Eric Christopher70c16652015-03-25 23:14:47 +000015
16void foo() {}
17
Eric Christopherf37ab1c2015-04-27 23:11:34 +000018// AVX-FEATURE: "target-features"{{.*}}+avx
Eric Christopher70c16652015-03-25 23:14:47 +000019// AVX-NO-CPU-NOT: target-cpu
Eric Christopher2374a7c2015-07-01 01:07:12 +000020// TWO-AVX: "target-features"={{.*}}+avx512er{{.*}}+avx512f
Eric Christopher70c16652015-03-25 23:14:47 +000021// CORE-CPU: "target-cpu"="corei7"
Eric Christopherf37ab1c2015-04-27 23:11:34 +000022// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"={{.*}}+avx
23// X86-64-CPU: "target-cpu"="x86-64"
24// AVX-MINUS-FEATURE: "target-features"={{.*}}-avx
Eric Christopher9e172d22015-05-12 01:26:21 +000025// SOFT-FLOAT: "target-features"={{.*}}+soft-float
26// NO-SOFT-FLOAT-NOT: "target-features"={{.*}}+soft-float