27 lines · c
1// This test verifies that we produce target-cpu and target-features attributes2// on functions when they're different from the standard cpu and have written3// features.4 5// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE6// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU7// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512bw | FileCheck %s -check-prefix=TWO-AVX8// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU9// 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-FEATURES10// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU11// 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-FEATURE12// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT13// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT14// RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT15 16void foo(void) {}17 18// AVX-FEATURE: "target-features"{{.*}}+avx19// AVX-NO-CPU-NOT: target-cpu20// TWO-AVX: "target-features"={{.*}}+avx512bw{{.*}}+avx512f21// CORE-CPU: "target-cpu"="corei7"22// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"={{.*}}+avx23// X86-64-CPU: "target-cpu"="x86-64"24// AVX-MINUS-FEATURE: "target-features"={{.*}}-avx25// SOFT-FLOAT: "target-features"={{.*}}+soft-float26// NO-SOFT-FLOAT-NOT: "target-features"={{.*}}+soft-float27