1// 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
10// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU-NOT
11// 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
12
13void foo() {}
14
15// AVX-FEATURE: "target-features"="+avx"
16// AVX-NO-CPU-NOT: target-cpu
17// TWO-AVX: "target-features"="+avx512f,+avx512er"
18// CORE-CPU: "target-cpu"="corei7"
19// CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"="+avx"
20// X86-64-CPU-NOT: "target-cpu"
21// AVX-MINUS-FEATURE: "target-features"="-avx"
22