github.com/goplus/llgo@v0.8.3/cl/_testrt/mask/out.ll (about) 1 ; ModuleID = 'main' 2 source_filename = "main" 3 4 %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } 5 6 @"main.init$guard" = global ptr null 7 @__llgo_argc = global ptr null 8 @__llgo_argv = global ptr null 9 @0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 10 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 11 @2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 12 @3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 13 @4 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 14 @5 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 15 @6 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 16 @7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 17 @8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 18 @9 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 19 20 define void @main.init() { 21 _llgo_0: 22 %0 = load i1, ptr @"main.init$guard", align 1 23 br i1 %0, label %_llgo_2, label %_llgo_1 24 25 _llgo_1: ; preds = %_llgo_0 26 store i1 true, ptr @"main.init$guard", align 1 27 br label %_llgo_2 28 29 _llgo_2: ; preds = %_llgo_1, %_llgo_0 30 ret void 31 } 32 33 define i32 @main(i32 %0, ptr %1) { 34 _llgo_0: 35 store i32 %0, ptr @__llgo_argc, align 4 36 store ptr %1, ptr @__llgo_argv, align 8 37 call void @"github.com/goplus/llgo/internal/runtime.init"() 38 call void @main.init() 39 %2 = call i32 @main.mask(i8 1) 40 %3 = sext i32 %2 to i64 41 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %3) 42 %4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 1) 43 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %4) 44 %5 = call i64 @main.mask_shl(i64 127, i64 5) 45 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %5) 46 %6 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 1) 47 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %6) 48 %7 = call i8 @main.mask_shl8(i8 127, i64 5) 49 %8 = sext i8 %7 to i64 50 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %8) 51 %9 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 1) 52 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %9) 53 %10 = call i8 @main.mask_shl8u(i8 127, i64 5) 54 %11 = zext i8 %10 to i64 55 call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %11) 56 %12 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 1) 57 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %12) 58 %13 = call i8 @main.mask_shl8(i8 127, i64 16) 59 %14 = sext i8 %13 to i64 60 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %14) 61 %15 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @4, i64 1) 62 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %15) 63 %16 = call i8 @main.mask_shl8u(i8 127, i64 16) 64 %17 = zext i8 %16 to i64 65 call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %17) 66 %18 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @5, i64 1) 67 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %18) 68 %19 = call i64 @main.mask_shr(i64 127, i64 5) 69 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %19) 70 %20 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @6, i64 1) 71 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %20) 72 %21 = call i8 @main.mask_shr8(i8 127, i64 5) 73 %22 = sext i8 %21 to i64 74 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %22) 75 %23 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @7, i64 1) 76 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %23) 77 %24 = call i8 @main.mask_shr8u(i8 127, i64 5) 78 %25 = zext i8 %24 to i64 79 call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %25) 80 %26 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @8, i64 1) 81 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %26) 82 %27 = call i8 @main.mask_shr8(i8 127, i64 16) 83 %28 = sext i8 %27 to i64 84 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %28) 85 %29 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @9, i64 1) 86 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %29) 87 ret i32 0 88 } 89 90 define i32 @main.mask(i8 %0) { 91 _llgo_0: 92 %1 = sext i8 %0 to i32 93 %2 = shl i32 %1, 31 94 %3 = select i1 false, i32 0, i32 %2 95 %4 = ashr i32 %3, 31 96 ret i32 %4 97 } 98 99 define i64 @main.mask_shl(i64 %0, i64 %1) { 100 _llgo_0: 101 %2 = icmp slt i64 %1, 0 102 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 103 %3 = icmp uge i64 %1, 64 104 %4 = shl i64 %0, %1 105 %5 = select i1 %3, i64 0, i64 %4 106 ret i64 %5 107 } 108 109 define i8 @main.mask_shl8(i8 %0, i64 %1) { 110 _llgo_0: 111 %2 = icmp slt i64 %1, 0 112 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 113 %3 = trunc i64 %1 to i8 114 %4 = icmp uge i8 %3, 8 115 %5 = shl i8 %0, %3 116 %6 = select i1 %4, i8 0, i8 %5 117 ret i8 %6 118 } 119 120 define i8 @main.mask_shl8u(i8 %0, i64 %1) { 121 _llgo_0: 122 %2 = icmp slt i64 %1, 0 123 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 124 %3 = trunc i64 %1 to i8 125 %4 = icmp uge i8 %3, 8 126 %5 = shl i8 %0, %3 127 %6 = select i1 %4, i8 0, i8 %5 128 ret i8 %6 129 } 130 131 define i64 @main.mask_shr(i64 %0, i64 %1) { 132 _llgo_0: 133 %2 = icmp slt i64 %1, 0 134 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 135 %3 = icmp uge i64 %1, 64 136 %4 = select i1 %3, i64 63, i64 %1 137 %5 = ashr i64 %0, %4 138 ret i64 %5 139 } 140 141 define i8 @main.mask_shr8(i8 %0, i64 %1) { 142 _llgo_0: 143 %2 = icmp slt i64 %1, 0 144 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 145 %3 = trunc i64 %1 to i8 146 %4 = icmp uge i8 %3, 8 147 %5 = select i1 %4, i8 7, i8 %3 148 %6 = ashr i8 %0, %5 149 ret i8 %6 150 } 151 152 define i8 @main.mask_shr8u(i8 %0, i64 %1) { 153 _llgo_0: 154 %2 = icmp slt i64 %1, 0 155 call void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1 %2) 156 %3 = trunc i64 %1 to i8 157 %4 = icmp uge i8 %3, 8 158 %5 = lshr i8 %0, %3 159 %6 = select i1 %4, i8 0, i8 %5 160 ret i8 %6 161 } 162 163 declare void @"github.com/goplus/llgo/internal/runtime.init"() 164 165 declare void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64) 166 167 declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String") 168 169 declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64) 170 171 declare void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64) 172 173 declare void @"github.com/goplus/llgo/internal/runtime.AssertNegativeShift"(i1)