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 int __attribute__((target("sse4.2"))) foo_overload(int) { return 0; }
5 int __attribute__((target("arch=sandybridge"))) foo_overload(int);
6 int __attribute__((target("arch=ivybridge"))) foo_overload(int) {return 1;}
7 int __attribute__((target("default"))) foo_overload(int) { return 2; }
8 int __attribute__((target("sse4.2"))) foo_overload(void) { return 0; }
9 int __attribute__((target("arch=sandybridge"))) foo_overload(void);
10 int __attribute__((target("arch=ivybridge"))) foo_overload(void) {return 1;}
11 int __attribute__((target("default"))) foo_overload(void) { return 2; }
14 return foo_overload() + foo_overload(1);
17 // LINUX: @_Z12foo_overloadv.ifunc = weak_odr ifunc i32 (), i32 ()* ()* @_Z12foo_overloadv.resolver
18 // LINUX: @_Z12foo_overloadi.ifunc = weak_odr ifunc i32 (i32), i32 (i32)* ()* @_Z12foo_overloadi.resolver
20 // LINUX: define{{.*}} i32 @_Z12foo_overloadi.sse4.2(i32 noundef %0)
22 // LINUX: define{{.*}} i32 @_Z12foo_overloadi.arch_ivybridge(i32 noundef %0)
24 // LINUX: define{{.*}} i32 @_Z12foo_overloadi(i32 noundef %0)
26 // LINUX: define{{.*}} i32 @_Z12foo_overloadv.sse4.2()
28 // LINUX: define{{.*}} i32 @_Z12foo_overloadv.arch_ivybridge()
30 // LINUX: define{{.*}} i32 @_Z12foo_overloadv()
33 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.sse4.2"(i32 noundef %0)
35 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_ivybridge"(i32 noundef %0)
37 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z"(i32 noundef %0)
39 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.sse4.2"()
41 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_ivybridge"()
43 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ"()
46 // LINUX: define{{.*}} i32 @_Z4bar2v()
47 // LINUX: call noundef i32 @_Z12foo_overloadv.ifunc()
48 // LINUX: call noundef i32 @_Z12foo_overloadi.ifunc(i32 noundef 1)
50 // WINDOWS: define dso_local noundef i32 @"?bar2@@YAHXZ"()
51 // WINDOWS: call noundef i32 @"?foo_overload@@YAHXZ.resolver"()
52 // WINDOWS: call noundef i32 @"?foo_overload@@YAHH@Z.resolver"(i32 noundef 1)
54 // LINUX: define weak_odr i32 ()* @_Z12foo_overloadv.resolver() comdat
55 // LINUX: ret i32 ()* @_Z12foo_overloadv.arch_sandybridge
56 // LINUX: ret i32 ()* @_Z12foo_overloadv.arch_ivybridge
57 // LINUX: ret i32 ()* @_Z12foo_overloadv.sse4.2
58 // LINUX: ret i32 ()* @_Z12foo_overloadv
60 // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHXZ.resolver"() comdat
61 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.arch_sandybridge"
62 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.arch_ivybridge"
63 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.sse4.2"
64 // WINDOWS: call i32 @"?foo_overload@@YAHXZ"
66 // LINUX: define weak_odr i32 (i32)* @_Z12foo_overloadi.resolver() comdat
67 // LINUX: ret i32 (i32)* @_Z12foo_overloadi.arch_sandybridge
68 // LINUX: ret i32 (i32)* @_Z12foo_overloadi.arch_ivybridge
69 // LINUX: ret i32 (i32)* @_Z12foo_overloadi.sse4.2
70 // LINUX: ret i32 (i32)* @_Z12foo_overloadi
72 // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHH@Z.resolver"(i32 %0) comdat
73 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.arch_sandybridge"
74 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.arch_ivybridge"
75 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.sse4.2"
76 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z"
78 // LINUX: declare noundef i32 @_Z12foo_overloadv.arch_sandybridge()
79 // LINUX: declare noundef i32 @_Z12foo_overloadi.arch_sandybridge(i32 noundef)
81 // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_sandybridge"()
82 // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_sandybridge"(i32 noundef)