github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/go1.21.ll (about) 1 ; ModuleID = 'go1.21.go' 2 source_filename = "go1.21.go" 3 target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 4 target triple = "wasm32-unknown-wasi" 5 6 %runtime._string = type { ptr, i32 } 7 8 ; Function Attrs: allockind("alloc,zeroed") allocsize(0) 9 declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0 10 11 declare void @runtime.trackPointer(ptr nocapture readonly, ptr, ptr) #1 12 13 ; Function Attrs: nounwind 14 define hidden void @main.init(ptr %context) unnamed_addr #2 { 15 entry: 16 ret void 17 } 18 19 ; Function Attrs: nounwind 20 define hidden i32 @main.min1(i32 %a, ptr %context) unnamed_addr #2 { 21 entry: 22 ret i32 %a 23 } 24 25 ; Function Attrs: nounwind 26 define hidden i32 @main.min2(i32 %a, i32 %b, ptr %context) unnamed_addr #2 { 27 entry: 28 %0 = call i32 @llvm.smin.i32(i32 %a, i32 %b) 29 ret i32 %0 30 } 31 32 ; Function Attrs: nounwind 33 define hidden i32 @main.min3(i32 %a, i32 %b, i32 %c, ptr %context) unnamed_addr #2 { 34 entry: 35 %0 = call i32 @llvm.smin.i32(i32 %a, i32 %b) 36 %1 = call i32 @llvm.smin.i32(i32 %0, i32 %c) 37 ret i32 %1 38 } 39 40 ; Function Attrs: nounwind 41 define hidden i32 @main.min4(i32 %a, i32 %b, i32 %c, i32 %d, ptr %context) unnamed_addr #2 { 42 entry: 43 %0 = call i32 @llvm.smin.i32(i32 %a, i32 %b) 44 %1 = call i32 @llvm.smin.i32(i32 %0, i32 %c) 45 %2 = call i32 @llvm.smin.i32(i32 %1, i32 %d) 46 ret i32 %2 47 } 48 49 ; Function Attrs: nounwind 50 define hidden i8 @main.minUint8(i8 %a, i8 %b, ptr %context) unnamed_addr #2 { 51 entry: 52 %0 = call i8 @llvm.umin.i8(i8 %a, i8 %b) 53 ret i8 %0 54 } 55 56 ; Function Attrs: nounwind 57 define hidden i32 @main.minUnsigned(i32 %a, i32 %b, ptr %context) unnamed_addr #2 { 58 entry: 59 %0 = call i32 @llvm.umin.i32(i32 %a, i32 %b) 60 ret i32 %0 61 } 62 63 ; Function Attrs: nounwind 64 define hidden float @main.minFloat32(float %a, float %b, ptr %context) unnamed_addr #2 { 65 entry: 66 %0 = fcmp olt float %a, %b 67 %1 = select i1 %0, float %a, float %b 68 ret float %1 69 } 70 71 ; Function Attrs: nounwind 72 define hidden double @main.minFloat64(double %a, double %b, ptr %context) unnamed_addr #2 { 73 entry: 74 %0 = fcmp olt double %a, %b 75 %1 = select i1 %0, double %a, double %b 76 ret double %1 77 } 78 79 ; Function Attrs: nounwind 80 define hidden %runtime._string @main.minString(ptr %a.data, i32 %a.len, ptr %b.data, i32 %b.len, ptr %context) unnamed_addr #2 { 81 entry: 82 %0 = insertvalue %runtime._string zeroinitializer, ptr %a.data, 0 83 %1 = insertvalue %runtime._string %0, i32 %a.len, 1 84 %2 = insertvalue %runtime._string zeroinitializer, ptr %b.data, 0 85 %3 = insertvalue %runtime._string %2, i32 %b.len, 1 86 %stackalloc = alloca i8, align 1 87 %4 = call i1 @runtime.stringLess(ptr %a.data, i32 %a.len, ptr %b.data, i32 %b.len, ptr undef) #5 88 %5 = select i1 %4, %runtime._string %1, %runtime._string %3 89 %6 = extractvalue %runtime._string %5, 0 90 call void @runtime.trackPointer(ptr %6, ptr nonnull %stackalloc, ptr undef) #5 91 ret %runtime._string %5 92 } 93 94 declare i1 @runtime.stringLess(ptr, i32, ptr, i32, ptr) #1 95 96 ; Function Attrs: nounwind 97 define hidden i32 @main.maxInt(i32 %a, i32 %b, ptr %context) unnamed_addr #2 { 98 entry: 99 %0 = call i32 @llvm.smax.i32(i32 %a, i32 %b) 100 ret i32 %0 101 } 102 103 ; Function Attrs: nounwind 104 define hidden i32 @main.maxUint(i32 %a, i32 %b, ptr %context) unnamed_addr #2 { 105 entry: 106 %0 = call i32 @llvm.umax.i32(i32 %a, i32 %b) 107 ret i32 %0 108 } 109 110 ; Function Attrs: nounwind 111 define hidden float @main.maxFloat32(float %a, float %b, ptr %context) unnamed_addr #2 { 112 entry: 113 %0 = fcmp ogt float %a, %b 114 %1 = select i1 %0, float %a, float %b 115 ret float %1 116 } 117 118 ; Function Attrs: nounwind 119 define hidden %runtime._string @main.maxString(ptr %a.data, i32 %a.len, ptr %b.data, i32 %b.len, ptr %context) unnamed_addr #2 { 120 entry: 121 %0 = insertvalue %runtime._string zeroinitializer, ptr %a.data, 0 122 %1 = insertvalue %runtime._string %0, i32 %a.len, 1 123 %2 = insertvalue %runtime._string zeroinitializer, ptr %b.data, 0 124 %3 = insertvalue %runtime._string %2, i32 %b.len, 1 125 %stackalloc = alloca i8, align 1 126 %4 = call i1 @runtime.stringLess(ptr %b.data, i32 %b.len, ptr %a.data, i32 %a.len, ptr undef) #5 127 %5 = select i1 %4, %runtime._string %1, %runtime._string %3 128 %6 = extractvalue %runtime._string %5, 0 129 call void @runtime.trackPointer(ptr %6, ptr nonnull %stackalloc, ptr undef) #5 130 ret %runtime._string %5 131 } 132 133 ; Function Attrs: nounwind 134 define hidden void @main.clearSlice(ptr %s.data, i32 %s.len, i32 %s.cap, ptr %context) unnamed_addr #2 { 135 entry: 136 %0 = shl i32 %s.len, 2 137 call void @llvm.memset.p0.i32(ptr align 4 %s.data, i8 0, i32 %0, i1 false) 138 ret void 139 } 140 141 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) 142 declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg) #3 143 144 ; Function Attrs: nounwind 145 define hidden void @main.clearZeroSizedSlice(ptr %s.data, i32 %s.len, i32 %s.cap, ptr %context) unnamed_addr #2 { 146 entry: 147 ret void 148 } 149 150 ; Function Attrs: nounwind 151 define hidden void @main.clearMap(ptr dereferenceable_or_null(40) %m, ptr %context) unnamed_addr #2 { 152 entry: 153 call void @runtime.hashmapClear(ptr %m, ptr undef) #5 154 ret void 155 } 156 157 declare void @runtime.hashmapClear(ptr dereferenceable_or_null(40), ptr) #1 158 159 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 160 declare i32 @llvm.smin.i32(i32, i32) #4 161 162 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 163 declare i8 @llvm.umin.i8(i8, i8) #4 164 165 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 166 declare i32 @llvm.umin.i32(i32, i32) #4 167 168 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 169 declare i32 @llvm.smax.i32(i32, i32) #4 170 171 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 172 declare i32 @llvm.umax.i32(i32, i32) #4 173 174 attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 175 attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 176 attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 177 attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } 178 attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 179 attributes #5 = { nounwind }