1;; Note: The checks for this test are manually generated. Please do not 2;; run a script to update these checks. 3 4; REQUIRES: asserts 5 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 18 19 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 22; of TOC entries. 23 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. 33 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. 39 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. 47 48 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 55 56define noundef double @testd1() local_unnamed_addr { 57entry: 58 ret double 3.784320e+02 59} 60 61define noundef float @testf1() local_unnamed_addr { 62entry: 63 ret float 0x40039999A0000000 64} 65 66define noundef double @testd2() local_unnamed_addr { 67entry: 68 ret double 6.920000e+00 69} 70 71define noundef <4 x i32> @testv1() local_unnamed_addr { 72entry: 73 ret <4 x i32> <i32 13, i32 78, i32 -13, i32 100> 74} 75 76define noundef double @testd3() local_unnamed_addr { 77entry: 78 %call = tail call noundef double @calleeddf(double noundef 4.582600e+01, double noundef 0x40564F0A3D70A3D7, float noundef 0x402225E360000000) 79 ret double %call 80} 81 82declare noundef double @calleeddf(double noundef, double noundef, float noundef) local_unnamed_addr 83 84define noundef i64 @testi() local_unnamed_addr { 85entry: 86 ret i64 893471915 87} 88 89define noundef double @testld1() local_unnamed_addr { 90entry: 91 ret double 0x417179806D5CDEBE 92} 93 94define noundef signext i32 @testJT(i32 noundef signext %in) { 95entry: 96 switch i32 %in, label %sw.epilog [ 97 i32 45, label %return 98 i32 86, label %sw.bb1 99 i32 91, label %sw.bb2 100 i32 101, label %sw.bb3 101 i32 107, label %sw.bb4 102 i32 76832712, label %sw.bb5 103 ] 104 105sw.bb1: ; preds = %entry 106 br label %return 107 108sw.bb2: ; preds = %entry 109 br label %return 110 111sw.bb3: ; preds = %entry 112 br label %return 113 114sw.bb4: ; preds = %entry 115 br label %return 116 117sw.bb5: ; preds = %entry 118 br label %return 119 120sw.epilog: ; preds = %entry 121 br label %return 122 123return: ; 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 ] 125 ret i32 %retval.0 126} 127 128define void @setGDouble(double noundef %a) local_unnamed_addr { 129entry: 130 store double %a, ptr @gDouble, align 8 131 ret void 132} 133 134define noundef double @getGDouble() local_unnamed_addr { 135entry: 136 %0 = load double, ptr @gDouble, align 8 137 ret double %0 138} 139 140define noundef signext i32 @testTLS(i32 noundef signext %a, i32 noundef signext %b, ptr nocapture noundef readonly %fIn) { 141entry: 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 150 ret i32 %add1 151} 152 153define float @getTLS2() local_unnamed_addr { 154entry: 155 %0 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @TLS2) 156 %1 = load float, ptr %0, align 4 157 ret float %1 158} 159 160declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) 161declare void @calleef(ptr noundef) local_unnamed_addr 162 163define noundef signext i32 @testEH(i32 noundef signext %i) personality ptr @__xlcxx_personality_v1 { 164entry: 165 %cmp = icmp slt i32 %i, 1 166 br i1 %cmp, label %if.then, label %try.cont 167 168if.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 173 174lpad: ; preds = %if.then 175 %0 = landingpad { ptr, i32 } 176 cleanup 177 catch ptr @_ZTIi 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 182 183catch: ; 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() 187 br label %try.cont 188 189try.cont: ; preds = %entry, %catch 190 %ret.0 = phi i32 [ 1, %catch ], [ 0, %entry ] 191 ret i32 %ret.0 192 193ehcleanup: ; preds = %lpad 194 resume { ptr, i32 } %0 195 196unreachable: ; preds = %if.then 197 unreachable 198} 199 200declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr 201declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr 202declare i32 @__xlcxx_personality_v1(...) 203declare i32 @llvm.eh.typeid.for(ptr) 204declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr 205declare void @__cxa_end_catch() local_unnamed_addr 206 207define noundef double @testISel1(i32 noundef signext %i) { 208entry: 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 %. 213 ret double %retval.0 214} 215 216define noundef double @testISel2(i32 noundef signext %i) { 217entry: 218 %cmp = icmp slt i32 %i, 0 219 br i1 %cmp, label %return, label %if.else 220 221if.else: ; preds = %entry 222 %cmp1 = icmp ugt i32 %i, 30 223 br i1 %cmp1, label %return, label %if.else3 224 225if.else3: ; preds = %if.else 226 %cmp4 = icmp ugt i32 %i, 5 227 %. = select i1 %cmp4, double 8.644600e+00, double 1.618030e+00 228 br label %return 229 230return: ; preds = %if.else3, %if.else, %entry 231 %retval.0 = phi double [ 3.141590e+00, %entry ], [ 2.718280e+00, %if.else ], [ %., %if.else3 ] 232 ret double %retval.0 233} 234 235 236define ptr @testBlockAddr() { 237entry: 238 br label %here 239 240here: 241 ret ptr blockaddress(@testBlockAddr, %here) 242} 243 244define noundef signext i32 @_Z5getG4v() local_unnamed_addr { 245entry: 246 %0 = load i32, ptr @_ZL2G4, align 4 247 ret i32 %0 248} 249 250define void @_Z5setG4i(i32 noundef signext %value) local_unnamed_addr { 251entry: 252 store i32 %value, ptr @_ZL2G4, align 4 253 ret void 254} 255 256define noundef signext i32 @_Z9incrementv() local_unnamed_addr { 257entry: 258 %0 = load i32, ptr @_ZZ9incrementvE7Element, align 4 259 %inc = add nsw i32 %0, 1 260 store i32 %inc, ptr @_ZZ9incrementvE7Element, align 4 261 ret i32 %inc 262} 263