Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / multi-versioning-internal-linkage.cpp
blob3d42c30e89074f3d0fbe99244fafb661cc97dc69
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() {
5 return 0;
7 __attribute__((target("arch=sandybridge"))) static int static_target() {
8 return 1;
11 __attribute__((cpu_dispatch(atom, generic))) static int static_dispatch() {}
13 namespace {
14 int __attribute__((target("default"))) anon_target() {
15 return 0;
17 int __attribute__((target("arch=sandybridge"))) anon_target() {
18 return 1;
20 __attribute__((cpu_dispatch(atom, generic))) static int anon_dispatch() {}
25 int usage() {
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.
31 // aliases:
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
35 // ifuncs:
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
41 // resolvers:
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"()