diff --git a/clang/test/CodeGen/attr-cpuspecific-cpus.c b/clang/test/CodeGen/attr-cpuspecific-cpus.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/attr-cpuspecific-cpus.c @@ -0,0 +1,240 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s + +#ifdef _WIN64 +#define ATTR(X) __declspec(X) +#else +#define ATTR(X) __attribute__((X)) +#endif // _MSC_VER + +ATTR(cpu_dispatch(generic, pentium)) +void Version1(void); +ATTR(cpu_specific(generic)) +void Version1(void){} +ATTR(cpu_specific(pentium)) +void Version1(void){} + +ATTR(cpu_dispatch(generic, pentium_pro)) +void Version2(void); +ATTR(cpu_specific(generic)) +void Version2(void){} +ATTR(cpu_specific(pentium_pro)) +void Version2(void){} + +ATTR(cpu_dispatch(generic, pentium_mmx)) +void Version3(void); +ATTR(cpu_specific(generic)) +void Version3(void){} +ATTR(cpu_specific(pentium_mmx)) +void Version3(void){} + +ATTR(cpu_dispatch(generic, pentium_ii)) +void Version4(void); +ATTR(cpu_specific(generic)) +void Version4(void){} +ATTR(cpu_specific(pentium_ii)) +void Version4(void){} + +ATTR(cpu_dispatch(generic, pentium_iii)) +void Version5(void); +ATTR(cpu_specific(generic)) +void Version5(void){} +ATTR(cpu_specific(pentium_iii)) +void Version5(void){} + +ATTR(cpu_dispatch(generic, pentium_iii_no_xmm_regs)) +void Version6(void); +ATTR(cpu_specific(generic)) +void Version6(void){} +ATTR(cpu_specific(pentium_iii_no_xmm_regs)) +void Version6(void){} + +ATTR(cpu_dispatch(generic, pentium_4)) +void Version7(void); +ATTR(cpu_specific(generic)) +void Version7(void){} +ATTR(cpu_specific(pentium_4)) +void Version7(void){} + +ATTR(cpu_dispatch(generic, pentium_m)) +void Version8(void); +ATTR(cpu_specific(generic)) +void Version8(void){} +ATTR(cpu_specific(pentium_m)) +void Version8(void){} + +ATTR(cpu_dispatch(generic, pentium_4_sse3)) +void Version9(void); +ATTR(cpu_specific(generic)) +void Version9(void){} +ATTR(cpu_specific(pentium_4_sse3)) +void Version9(void){} + +ATTR(cpu_dispatch(generic, core_2_duo_ssse3)) +void Version10(void); +ATTR(cpu_specific(generic)) +void Version10(void){} +ATTR(cpu_specific(core_2_duo_ssse3)) +void Version10(void){} + +ATTR(cpu_dispatch(generic, core_2_duo_sse4_1)) +void Version11(void); +ATTR(cpu_specific(generic)) +void Version11(void){} +ATTR(cpu_specific(core_2_duo_sse4_1)) +void Version11(void){} + +ATTR(cpu_dispatch(generic, atom)) +void Version12(void); +ATTR(cpu_specific(generic)) +void Version12(void){} +ATTR(cpu_specific(atom)) +void Version12(void){} + +ATTR(cpu_dispatch(generic, atom_sse4_2)) +void Version13(void); +ATTR(cpu_specific(generic)) +void Version13(void){} +ATTR(cpu_specific(atom_sse4_2)) +void Version13(void){} + +ATTR(cpu_dispatch(generic, core_i7_sse4_2)) +void Version14(void); +ATTR(cpu_specific(generic)) +void Version14(void){} +ATTR(cpu_specific(core_i7_sse4_2)) +void Version14(void){} + +ATTR(cpu_dispatch(generic, core_aes_pclmulqdq)) +void Version15(void); +ATTR(cpu_specific(generic)) +void Version15(void){} +ATTR(cpu_specific(core_aes_pclmulqdq)) +void Version15(void){} + +ATTR(cpu_dispatch(generic, atom_sse4_2_movbe)) +void Version16(void); +ATTR(cpu_specific(generic)) +void Version16(void){} +ATTR(cpu_specific(atom_sse4_2_movbe)) +void Version16(void){} + +ATTR(cpu_dispatch(generic, goldmont)) +void Version17(void); +ATTR(cpu_specific(generic)) +void Version17(void){} +ATTR(cpu_specific(goldmont)) +void Version17(void){} + +ATTR(cpu_dispatch(generic, sandybridge)) +void Version18(void); +ATTR(cpu_specific(generic)) +void Version18(void){} +ATTR(cpu_specific(sandybridge)) +void Version18(void){} + +ATTR(cpu_dispatch(generic, core_2nd_gen_avx)) +void Version19(void); +ATTR(cpu_specific(generic)) +void Version19(void){} +ATTR(cpu_specific(core_2nd_gen_avx)) +void Version19(void){} + +ATTR(cpu_dispatch(generic, ivybridge)) +void Version20(void); +ATTR(cpu_specific(generic)) +void Version20(void){} +ATTR(cpu_specific(ivybridge)) +void Version20(void){} + +ATTR(cpu_dispatch(generic, core_3rd_gen_avx)) +void Version21(void); +ATTR(cpu_specific(generic)) +void Version21(void){} +ATTR(cpu_specific(core_3rd_gen_avx)) +void Version21(void){} + +ATTR(cpu_dispatch(generic, haswell)) +void Version22(void); +ATTR(cpu_specific(generic)) +void Version22(void){} +ATTR(cpu_specific(haswell)) +void Version22(void){} + +ATTR(cpu_dispatch(generic, core_4th_gen_avx)) +void Version23(void); +ATTR(cpu_specific(generic)) +void Version23(void){} +ATTR(cpu_specific(core_4th_gen_avx)) +void Version23(void){} + +ATTR(cpu_dispatch(generic, core_4th_gen_avx_tsx)) +void Version24(void); +ATTR(cpu_specific(generic)) +void Version24(void){} +ATTR(cpu_specific(core_4th_gen_avx_tsx)) +void Version24(void){} + +ATTR(cpu_dispatch(generic, broadwell)) +void Version25(void); +ATTR(cpu_specific(generic)) +void Version25(void){} +ATTR(cpu_specific(broadwell)) +void Version25(void){} + +ATTR(cpu_dispatch(generic, core_5th_gen_avx)) +void Version26(void); +ATTR(cpu_specific(generic)) +void Version26(void){} +ATTR(cpu_specific(core_5th_gen_avx)) +void Version26(void){} + +ATTR(cpu_dispatch(generic, core_5th_gen_avx_tsx)) +void Version27(void); +ATTR(cpu_specific(generic)) +void Version27(void){} +ATTR(cpu_specific(core_5th_gen_avx_tsx)) +void Version27(void){} + +ATTR(cpu_dispatch(generic, knl)) +void Version28(void); +ATTR(cpu_specific(generic)) +void Version28(void){} +ATTR(cpu_specific(knl)) +void Version28(void){} + +ATTR(cpu_dispatch(generic, mic_avx512)) +void Version29(void); +ATTR(cpu_specific(generic)) +void Version29(void){} +ATTR(cpu_specific(mic_avx512)) +void Version29(void){} + +ATTR(cpu_dispatch(generic, skylake)) +void Version30(void); +ATTR(cpu_specific(generic)) +void Version30(void){} +ATTR(cpu_specific(skylake)) +void Version30(void){} + +ATTR(cpu_dispatch(generic, skylake_avx512)) +void Version31(void); +ATTR(cpu_specific(generic)) +void Version31(void){} +ATTR(cpu_specific(skylake_avx512)) +void Version31(void){} + +ATTR(cpu_dispatch(generic, cannonlake)) +void Version32(void); +ATTR(cpu_specific(generic)) +void Version32(void){} +ATTR(cpu_specific(cannonlake)) +void Version32(void){} + +ATTR(cpu_dispatch(generic, knm)) +void Version33(void); +ATTR(cpu_specific(generic)) +void Version33(void){} +ATTR(cpu_specific(knm)) +void Version33(void){} +