1 // RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX
2 // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS
4 __attribute__((target("default"))) static int static_target() {
7 __attribute__((target("arch=sandybridge"))) static int static_target() {
11 __attribute__((cpu_dispatch(atom
, generic
))) static int static_dispatch() {}
14 int __attribute__((target("default"))) anon_target() {
17 int __attribute__((target("arch=sandybridge"))) anon_target() {
20 __attribute__((cpu_dispatch(atom
, generic
))) static int anon_dispatch() {}
26 return static_target() + anon_target() + static_dispatch() + anon_dispatch();
29 // Ensure that these are all 'internal'. Windows doesn't have ifuncs or aliases,
30 // since Windows doesn't support ifuncs.
32 // LINUX: @_ZL15static_dispatchv = internal alias i32 (), ptr @_ZL15static_dispatchv.ifunc
33 // LINUX: @_ZN12_GLOBAL__N_113anon_dispatchEv = internal alias i32 (), ptr @_ZN12_GLOBAL__N_113anon_dispatchEv.ifunc
36 // LINUX: @_ZL15static_dispatchv.ifunc = internal ifunc i32 (), ptr @_ZL15static_dispatchv.resolver
37 // LINUX: @_ZN12_GLOBAL__N_113anon_dispatchEv.ifunc = internal ifunc i32 (), ptr @_ZN12_GLOBAL__N_113anon_dispatchEv.resolver
38 // LINUX: @_ZL13static_targetv.ifunc = internal ifunc i32 (), ptr @_ZL13static_targetv.resolver
39 // LINUX: @_ZN12_GLOBAL__N_111anon_targetEv.ifunc = internal ifunc i32 (), ptr @_ZN12_GLOBAL__N_111anon_targetEv.resolver
42 // LINUX: define internal ptr @_ZL15static_dispatchv.resolver()
43 // WINDOWS: define internal i32 @"?static_dispatch@@YAHXZ"()
44 // LINUX: define internal ptr @_ZN12_GLOBAL__N_113anon_dispatchEv.resolver()
45 // WINDOWS: define internal i32 @"?anon_dispatch{{.*}}@@YAHXZ"()
46 // LINUX: define internal ptr @_ZL13static_targetv.resolver()
47 // WINDOWS: define internal i32 @"?static_target@@YAHXZ.resolver"()
48 // LINUX: define internal ptr @_ZN12_GLOBAL__N_111anon_targetEv.resolver()
49 // WINDOWS: define internal i32 @"?anon_target{{.*}}@@YAHXZ.resolver"()