xref: /aosp_15_r20/external/clang/test/CodeGen/function-target-features.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // This test verifies that we produce target-cpu and target-features attributes
2*67e74705SXin Li // on functions when they're different from the standard cpu and have written
3*67e74705SXin Li // features.
4*67e74705SXin Li 
5*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE
6*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU
7*67e74705SXin Li // 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*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU
9*67e74705SXin Li // 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*67e74705SXin Li // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU
11*67e74705SXin Li // 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*67e74705SXin Li // RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
13*67e74705SXin Li // RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
14*67e74705SXin Li // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm -o - %s -target-feature +soft-float | FileCheck %s -check-prefix=SOFT-FLOAT
15*67e74705SXin Li 
foo()16*67e74705SXin Li void foo() {}
17*67e74705SXin Li 
18*67e74705SXin Li // AVX-FEATURE: "target-features"{{.*}}+avx
19*67e74705SXin Li // AVX-NO-CPU-NOT: target-cpu
20*67e74705SXin Li // TWO-AVX: "target-features"={{.*}}+avx512er{{.*}}+avx512f
21*67e74705SXin Li // CORE-CPU: "target-cpu"="corei7"
22*67e74705SXin Li // CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"={{.*}}+avx
23*67e74705SXin Li // X86-64-CPU: "target-cpu"="x86-64"
24*67e74705SXin Li // AVX-MINUS-FEATURE: "target-features"={{.*}}-avx
25*67e74705SXin Li // SOFT-FLOAT: "target-features"={{.*}}+soft-float
26*67e74705SXin Li // NO-SOFT-FLOAT-NOT: "target-features"={{.*}}+soft-float
27