1 ;; Note: The checks for this test are manually generated. Please do not
2 ;; run a script to update these checks.
6 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr8 \
7 ; RUN: --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=AIX
8 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr8 \
9 ; RUN: --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=AIX
10 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-unknown-linux -mcpu=pwr8 \
11 ; RUN: --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=LINUX
12 ; RUN: llc -verify-machineinstrs -mtriple powerpc64le-unknown-linux -mcpu=pwr8 \
13 ; RUN: --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=LINUX
14 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-unknown-linux -mcpu=pwr8 \
15 ; RUN: -code-model=large --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=LINUXLARGE
16 ; RUN: llc -verify-machineinstrs -mtriple powerpc64le-unknown-linux -mcpu=pwr8 \
17 ; RUN: -code-model=large --stats -ppc-min-jump-table-entries=4 < %s 2>&1 | FileCheck %s --check-prefix=LINUXLARGE
20 ; The purpose of this test is to check that the statistics about the TOC are
21 ; are collected correctly. This test tries to have all of the different types
24 ; AIX: Statistics Collected
25 ; AIX: 1 asmprinter - Number of Block Address TOC Entries.
26 ; AIX: 13 asmprinter - Number of Constant Pool TOC Entries.
27 ; AIX: 1 asmprinter - Number of EH Block TOC Entries.
28 ; AIX: 25 asmprinter - Number of Total TOC Entries Emitted.
29 ; AIX: 3 asmprinter - Number of External Linkage Global TOC Entries.
30 ; AIX: 2 asmprinter - Number of Internal Linkage Global TOC Entries.
31 ; AIX: 1 asmprinter - Number of Jump Table TOC Entries.
32 ; AIX: 4 asmprinter - Number of Thread Local TOC Entries.
34 ; LINUX: Statistics Collected
35 ; LINUX: 1 asmprinter - Number of Block Address TOC Entries.
36 ; LINUX: 5 asmprinter - Number of Total TOC Entries Emitted.
37 ; LINUX: 3 asmprinter - Number of External Linkage Global TOC Entries.
38 ; LINUX: 1 asmprinter - Number of Jump Table TOC Entries.
40 ; LINUXLARGE: Statistics Collected
41 ; LINUXLARGE: 1 asmprinter - Number of Block Address TOC Entries.
42 ; LINUXLARGE: 13 asmprinter - Number of Constant Pool TOC Entries.
43 ; LINUXLARGE: 20 asmprinter - Number of Total TOC Entries Emitted.
44 ; LINUXLARGE: 3 asmprinter - Number of External Linkage Global TOC Entries.
45 ; LINUXLARGE: 2 asmprinter - Number of Internal Linkage Global TOC Entries.
46 ; LINUXLARGE: 1 asmprinter - Number of Jump Table TOC Entries.
49 @gDouble = local_unnamed_addr global double 0.000000e+00, align 8
50 @TLS1 = thread_local global i32 0, align 4
51 @TLS2 = external thread_local global float, align 4
52 @_ZTIi = external constant ptr
53 @_ZL2G4 = internal unnamed_addr global i32 0, align 4
54 @_ZZ9incrementvE7Element = internal unnamed_addr global i32 0, align 4
56 define noundef double @testd1() local_unnamed_addr {
58 ret double 3.784320e+02
61 define noundef float @testf1() local_unnamed_addr {
63 ret float 0x40039999A0000000
66 define noundef double @testd2() local_unnamed_addr {
68 ret double 6.920000e+00
71 define noundef <4 x i32> @testv1() local_unnamed_addr {
73 ret <4 x i32> <i32 13, i32 78, i32 -13, i32 100>
76 define noundef double @testd3() local_unnamed_addr {
78 %call = tail call noundef double @calleeddf(double noundef 4.582600e+01, double noundef 0x40564F0A3D70A3D7, float noundef 0x402225E360000000)
82 declare noundef double @calleeddf(double noundef, double noundef, float noundef) local_unnamed_addr
84 define noundef i64 @testi() local_unnamed_addr {
89 define noundef double @testld1() local_unnamed_addr {
91 ret double 0x417179806D5CDEBE
94 define noundef signext i32 @testJT(i32 noundef signext %in) {
96 switch i32 %in, label %sw.epilog [
100 i32 101, label %sw.bb3
101 i32 107, label %sw.bb4
102 i32 76832712, label %sw.bb5
105 sw.bb1: ; preds = %entry
108 sw.bb2: ; preds = %entry
111 sw.bb3: ; preds = %entry
114 sw.bb4: ; preds = %entry
117 sw.bb5: ; preds = %entry
120 sw.epilog: ; preds = %entry
123 return: ; preds = %entry, %sw.epilog, %sw.bb5, %sw.bb4, %sw.bb3, %sw.bb2, %sw.bb1
124 %retval.0 = phi i32 [ 0, %sw.epilog ], [ 222, %sw.bb5 ], [ 15, %sw.bb4 ], [ 11, %sw.bb3 ], [ 17, %sw.bb2 ], [ 16, %sw.bb1 ], [ 19, %entry ]
128 define void @setGDouble(double noundef %a) local_unnamed_addr {
130 store double %a, ptr @gDouble, align 8
134 define noundef double @getGDouble() local_unnamed_addr {
136 %0 = load double, ptr @gDouble, align 8
140 define noundef signext i32 @testTLS(i32 noundef signext %a, i32 noundef signext %b, ptr nocapture noundef readonly %fIn) {
142 %add = add nsw i32 %b, %a
143 %0 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @TLS1)
144 store i32 %add, ptr %0, align 4
145 tail call void @calleef(ptr noundef nonnull @testJT)
146 %1 = load i32, ptr %0, align 4
147 %call = tail call noundef signext i32 %fIn(i32 noundef signext %1)
148 %2 = load i32, ptr %0, align 4
149 %add1 = add nsw i32 %2, %call
153 define float @getTLS2() local_unnamed_addr {
155 %0 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @TLS2)
156 %1 = load float, ptr %0, align 4
160 declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull)
161 declare void @calleef(ptr noundef) local_unnamed_addr
163 define noundef signext i32 @testEH(i32 noundef signext %i) personality ptr @__xlcxx_personality_v1 {
165 %cmp = icmp slt i32 %i, 1
166 br i1 %cmp, label %if.then, label %try.cont
168 if.then: ; preds = %entry
169 %exception = tail call ptr @__cxa_allocate_exception(i64 4)
170 store i32 10, ptr %exception, align 16
171 invoke void @__cxa_throw(ptr nonnull %exception, ptr nonnull @_ZTIi, ptr null)
172 to label %unreachable unwind label %lpad
174 lpad: ; preds = %if.then
175 %0 = landingpad { ptr, i32 }
178 %1 = extractvalue { ptr, i32 } %0, 1
179 %2 = tail call i32 @llvm.eh.typeid.for(ptr nonnull @_ZTIi)
180 %matches = icmp eq i32 %1, %2
181 br i1 %matches, label %catch, label %ehcleanup
183 catch: ; preds = %lpad
184 %3 = extractvalue { ptr, i32 } %0, 0
185 %4 = tail call ptr @__cxa_begin_catch(ptr %3)
186 tail call void @__cxa_end_catch()
189 try.cont: ; preds = %entry, %catch
190 %ret.0 = phi i32 [ 1, %catch ], [ 0, %entry ]
193 ehcleanup: ; preds = %lpad
194 resume { ptr, i32 } %0
196 unreachable: ; preds = %if.then
200 declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr
201 declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr
202 declare i32 @__xlcxx_personality_v1(...)
203 declare i32 @llvm.eh.typeid.for(ptr)
204 declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr
205 declare void @__cxa_end_catch() local_unnamed_addr
207 define noundef double @testISel1(i32 noundef signext %i) {
209 %cmp = icmp slt i32 %i, 0
210 %cmp1.not = icmp eq i32 %i, 0
211 %. = select i1 %cmp1.not, double 1.618030e+00, double 2.718280e+00
212 %retval.0 = select i1 %cmp, double 3.141590e+00, double %.
216 define noundef double @testISel2(i32 noundef signext %i) {
218 %cmp = icmp slt i32 %i, 0
219 br i1 %cmp, label %return, label %if.else
221 if.else: ; preds = %entry
222 %cmp1 = icmp ugt i32 %i, 30
223 br i1 %cmp1, label %return, label %if.else3
225 if.else3: ; preds = %if.else
226 %cmp4 = icmp ugt i32 %i, 5
227 %. = select i1 %cmp4, double 8.644600e+00, double 1.618030e+00
230 return: ; preds = %if.else3, %if.else, %entry
231 %retval.0 = phi double [ 3.141590e+00, %entry ], [ 2.718280e+00, %if.else ], [ %., %if.else3 ]
236 define i8* @testBlockAddr() {
241 ret i8* blockaddress(@testBlockAddr, %here)
244 define noundef signext i32 @_Z5getG4v() local_unnamed_addr {
246 %0 = load i32, ptr @_ZL2G4, align 4
250 define void @_Z5setG4i(i32 noundef signext %value) local_unnamed_addr {
252 store i32 %value, ptr @_ZL2G4, align 4
256 define noundef signext i32 @_Z9incrementv() local_unnamed_addr {
258 %0 = load i32, ptr @_ZZ9incrementvE7Element, align 4
259 %inc = add nsw i32 %0, 1
260 store i32 %inc, ptr @_ZZ9incrementvE7Element, align 4