[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / attr-cpuspecific-outoflinedefs.cpp
blobef2498bd7e14cecf848d1fa2816ab6b5f44df1b7
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX
2 // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s | FileCheck %s --check-prefix=WINDOWS
4 struct OutOfLineDefs {
5 int foo(int);
6 int foo(int, int);
7 __attribute__((cpu_specific(atom))) int foo(int, int, int) { return 1; }
8 };
10 int __attribute__((cpu_specific(atom))) OutOfLineDefs::foo(int) {
11 return 1;
13 int __attribute__((cpu_specific(ivybridge))) OutOfLineDefs::foo(int) {
14 return 2;
16 int __attribute__((cpu_dispatch(ivybridge, atom))) OutOfLineDefs::foo(int) {
19 int __attribute__((cpu_specific(atom))) OutOfLineDefs::foo(int, int) {
20 return 1;
22 int __attribute__((cpu_specific(ivybridge))) OutOfLineDefs::foo(int, int) {
23 return 2;
25 int __attribute__((cpu_dispatch(ivybridge, atom)))
26 OutOfLineDefs::foo(int, int) {
29 int __attribute__((cpu_specific(ivybridge))) OutOfLineDefs::foo(int, int, int) {
30 return 2;
32 int __attribute__((cpu_specific(sandybridge)))
33 OutOfLineDefs::foo(int, int, int) {
34 return 3;
36 int __attribute__((cpu_dispatch(sandybridge, ivybridge, atom)))
37 OutOfLineDefs::foo(int, int, int) {
40 // IFunc definitions, Linux only.
41 // LINUX: @_ZN13OutOfLineDefs3fooEi = weak_odr alias i32 (ptr, i32), ptr @_ZN13OutOfLineDefs3fooEi.ifunc
42 // LINUX: @_ZN13OutOfLineDefs3fooEii = weak_odr alias i32 (ptr, i32, i32), ptr @_ZN13OutOfLineDefs3fooEii.ifunc
43 // LINUX: @_ZN13OutOfLineDefs3fooEiii = weak_odr alias i32 (ptr, i32, i32, i32), ptr @_ZN13OutOfLineDefs3fooEiii.ifunc
45 // LINUX: @_ZN13OutOfLineDefs3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN13OutOfLineDefs3fooEi.resolver
46 // LINUX: @_ZN13OutOfLineDefs3fooEii.ifunc = weak_odr ifunc i32 (ptr, i32, i32), ptr @_ZN13OutOfLineDefs3fooEii.resolver
47 // LINUX: @_ZN13OutOfLineDefs3fooEiii.ifunc = weak_odr ifunc i32 (ptr, i32, i32, i32), ptr @_ZN13OutOfLineDefs3fooEiii.resolver
49 // Arity 1 version:
50 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEi.O
51 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEi.S
52 // LINUX: define weak_odr ptr @_ZN13OutOfLineDefs3fooEi.resolver()
53 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEi.S
54 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEi.O
55 // LINUX: call void @llvm.trap
57 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHH@Z.O"
58 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHH@Z.S"
59 // WINDOWS: define weak_odr dso_local i32 @"?foo@OutOfLineDefs@@QEAAHH@Z"(ptr %0, i32 %1)
60 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHH@Z.S"(ptr %0, i32 %1)
61 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHH@Z.O"(ptr %0, i32 %1)
62 // WINDOWS: call void @llvm.trap
64 // Arity 2 version:
65 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEii.O
66 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEii.S
67 // LINUX: define weak_odr ptr @_ZN13OutOfLineDefs3fooEii.resolver()
68 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEii.S
69 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEii.O
70 // LINUX: call void @llvm.trap
72 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHHH@Z.O"
73 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHHH@Z.S"
74 // WINDOWS: define weak_odr dso_local i32 @"?foo@OutOfLineDefs@@QEAAHHH@Z"(ptr %0, i32 %1, i32 %2)
75 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHHH@Z.S"(ptr %0, i32 %1, i32 %2)
76 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHHH@Z.O"(ptr %0, i32 %1, i32 %2)
77 // WINDOWS: call void @llvm.trap
79 // Arity 3 version:
80 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEiii.S
81 // LINUX: define dso_local noundef i32 @_ZN13OutOfLineDefs3fooEiii.R
82 // LINUX: define weak_odr ptr @_ZN13OutOfLineDefs3fooEiii.resolver()
83 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEiii.R
84 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEiii.S
85 // LINUX: ret ptr @_ZN13OutOfLineDefs3fooEiii.O
86 // LINUX: call void @llvm.trap
87 // LINUX: define linkonce_odr noundef i32 @_ZN13OutOfLineDefs3fooEiii.O
89 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.S"
90 // WINDOWS: define dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.R"
91 // WINDOWS: define weak_odr dso_local i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z"(ptr %0, i32 %1, i32 %2, i32 %3)
92 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.R"(ptr %0, i32 %1, i32 %2, i32 %3)
93 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.S"(ptr %0, i32 %1, i32 %2, i32 %3)
94 // WINDOWS: musttail call i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.O"(ptr %0, i32 %1, i32 %2, i32 %3)
95 // WINDOWS: call void @llvm.trap
96 // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@OutOfLineDefs@@QEAAHHHH@Z.O"