1 // RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX
2 // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macos -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN
3 // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS
5 int __attribute__((target("sse4.2"))) foo_overload(int) { return 0; }
6 int __attribute__((target("arch=sandybridge"))) foo_overload(int);
7 int __attribute__((target("arch=ivybridge"))) foo_overload(int) {return 1;}
8 int __attribute__((target("default"))) foo_overload(int) { return 2; }
9 int __attribute__((target("sse4.2"))) foo_overload(void) { return 0; }
10 int __attribute__((target("arch=sandybridge"))) foo_overload(void);
11 int __attribute__((target("arch=ivybridge"))) foo_overload(void) {return 1;}
12 int __attribute__((target("default"))) foo_overload(void) { return 2; }
15 return foo_overload() + foo_overload(1);
20 // ITANIUM: @_Z12foo_overloadv.ifunc = weak_odr ifunc i32 (), ptr @_Z12foo_overloadv.resolver
21 // ITANIUM: @_Z12foo_overloadi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z12foo_overloadi.resolver
23 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadi.sse4.2(i32 noundef %0)
25 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadi.arch_ivybridge(i32 noundef %0)
27 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadi(i32 noundef %0)
29 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.sse4.2()
31 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.arch_ivybridge()
33 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv()
36 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.sse4.2"(i32 noundef %0)
38 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_ivybridge"(i32 noundef %0)
40 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z"(i32 noundef %0)
42 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.sse4.2"()
44 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_ivybridge"()
46 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ"()
49 // ITANIUM: define{{.*}} i32 @_Z4bar2v()
50 // ITANIUM: call noundef i32 @_Z12foo_overloadv.ifunc()
51 // ITANIUM: call noundef i32 @_Z12foo_overloadi.ifunc(i32 noundef 1)
53 // WINDOWS: define dso_local noundef i32 @"?bar2@@YAHXZ"()
54 // WINDOWS: call noundef i32 @"?foo_overload@@YAHXZ.resolver"()
55 // WINDOWS: call noundef i32 @"?foo_overload@@YAHH@Z.resolver"(i32 noundef 1)
57 // ITANIUM: define weak_odr ptr @_Z12foo_overloadv.resolver()
59 // ITANIUM: ret ptr @_Z12foo_overloadv.arch_sandybridge
60 // ITANIUM: ret ptr @_Z12foo_overloadv.arch_ivybridge
61 // ITANIUM: ret ptr @_Z12foo_overloadv.sse4.2
62 // ITANIUM: ret ptr @_Z12foo_overloadv
64 // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHXZ.resolver"() comdat
65 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.arch_sandybridge"
66 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.arch_ivybridge"
67 // WINDOWS: call i32 @"?foo_overload@@YAHXZ.sse4.2"
68 // WINDOWS: call i32 @"?foo_overload@@YAHXZ"
70 // ITANIUM: define weak_odr ptr @_Z12foo_overloadi.resolver()
72 // ITANIUM: ret ptr @_Z12foo_overloadi.arch_sandybridge
73 // ITANIUM: ret ptr @_Z12foo_overloadi.arch_ivybridge
74 // ITANIUM: ret ptr @_Z12foo_overloadi.sse4.2
75 // ITANIUM: ret ptr @_Z12foo_overloadi
77 // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHH@Z.resolver"(i32 %0) comdat
78 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.arch_sandybridge"
79 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.arch_ivybridge"
80 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.sse4.2"
81 // WINDOWS: call i32 @"?foo_overload@@YAHH@Z"
83 // ITANIUM: declare noundef i32 @_Z12foo_overloadv.arch_sandybridge()
84 // ITANIUM: declare noundef i32 @_Z12foo_overloadi.arch_sandybridge(i32 noundef)
86 // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_sandybridge"()
87 // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_sandybridge"(i32 noundef)