[Clang] replace 'bitfield' with 'bit-field' for consistency (#117881)
[llvm-project.git] / clang / test / CodeGenCXX / attr-target-mv-overloads.cpp
blobe30fbf4ef5027d733400b18abdd8deb42fa27077
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; }
14 int bar2() {
15 return foo_overload() + foo_overload(1);
18 // DARWIN-NOT: comdat
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)
24 // ITANIUM: ret i32 0
25 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadi.arch_ivybridge(i32 noundef %0)
26 // ITANIUM: ret i32 1
27 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadi(i32 noundef %0)
28 // ITANIUM: ret i32 2
29 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.sse4.2()
30 // ITANIUM: ret i32 0
31 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.arch_ivybridge()
32 // ITANIUM: ret i32 1
33 // ITANIUM: define{{.*}} i32 @_Z12foo_overloadv()
34 // ITANIUM: ret i32 2
36 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.sse4.2"(i32 noundef %0)
37 // WINDOWS: ret i32 0
38 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_ivybridge"(i32 noundef %0)
39 // WINDOWS: ret i32 1
40 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z"(i32 noundef %0)
41 // WINDOWS: ret i32 2
42 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.sse4.2"()
43 // WINDOWS: ret i32 0
44 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_ivybridge"()
45 // WINDOWS: ret i32 1
46 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ"()
47 // WINDOWS: ret i32 2
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()
58 // LINUX-SAME: comdat
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()
71 // LINUX-SAME: comdat
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)