269 lines · plain
1; ModuleID = 'matmul.c'2source_filename = "matmul.c"3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-unknown-linux-gnu"5 6%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }7%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }8 9@A = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 1610@B = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 1611@stdout = external dso_local global %struct._IO_FILE*, align 812@.str = private unnamed_addr constant [5 x i8] c"%lf \00", align 113@C = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 1614@.str.1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 115 16; Function Attrs: noinline nounwind uwtable17define dso_local void @init_array() {18entry:19 %i = alloca i32, align 420 %j = alloca i32, align 421 store i32 0, i32* %i, align 422 br label %for.cond23 24for.cond: ; preds = %for.inc17, %entry25 %0 = load i32, i32* %i, align 426 %cmp = icmp slt i32 %0, 153627 br i1 %cmp, label %for.body, label %for.end1928 29for.body: ; preds = %for.cond30 store i32 0, i32* %j, align 431 br label %for.cond132 33for.cond1: ; preds = %for.inc, %for.body34 %1 = load i32, i32* %j, align 435 %cmp2 = icmp slt i32 %1, 153636 br i1 %cmp2, label %for.body3, label %for.end37 38for.body3: ; preds = %for.cond139 %2 = load i32, i32* %i, align 440 %3 = load i32, i32* %j, align 441 %mul = mul nsw i32 %2, %342 %rem = srem i32 %mul, 102443 %add = add nsw i32 1, %rem44 %conv = sitofp i32 %add to double45 %div = fdiv double %conv, 2.000000e+0046 %conv4 = fptrunc double %div to float47 %4 = load i32, i32* %i, align 448 %idxprom = sext i32 %4 to i6449 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i64 0, i64 %idxprom50 %5 = load i32, i32* %j, align 451 %idxprom5 = sext i32 %5 to i6452 %arrayidx6 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom553 store float %conv4, float* %arrayidx6, align 454 %6 = load i32, i32* %i, align 455 %7 = load i32, i32* %j, align 456 %mul7 = mul nsw i32 %6, %757 %rem8 = srem i32 %mul7, 102458 %add9 = add nsw i32 1, %rem859 %conv10 = sitofp i32 %add9 to double60 %div11 = fdiv double %conv10, 2.000000e+0061 %conv12 = fptrunc double %div11 to float62 %8 = load i32, i32* %i, align 463 %idxprom13 = sext i32 %8 to i6464 %arrayidx14 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i64 0, i64 %idxprom1365 %9 = load i32, i32* %j, align 466 %idxprom15 = sext i32 %9 to i6467 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx14, i64 0, i64 %idxprom1568 store float %conv12, float* %arrayidx16, align 469 br label %for.inc70 71for.inc: ; preds = %for.body372 %10 = load i32, i32* %j, align 473 %inc = add nsw i32 %10, 174 store i32 %inc, i32* %j, align 475 br label %for.cond176 77for.end: ; preds = %for.cond178 br label %for.inc1779 80for.inc17: ; preds = %for.end81 %11 = load i32, i32* %i, align 482 %inc18 = add nsw i32 %11, 183 store i32 %inc18, i32* %i, align 484 br label %for.cond85 86for.end19: ; preds = %for.cond87 ret void88}89 90; Function Attrs: noinline nounwind uwtable91define dso_local void @print_array() {92entry:93 %i = alloca i32, align 494 %j = alloca i32, align 495 store i32 0, i32* %i, align 496 br label %for.cond97 98for.cond: ; preds = %for.inc10, %entry99 %0 = load i32, i32* %i, align 4100 %cmp = icmp slt i32 %0, 1536101 br i1 %cmp, label %for.body, label %for.end12102 103for.body: ; preds = %for.cond104 store i32 0, i32* %j, align 4105 br label %for.cond1106 107for.cond1: ; preds = %for.inc, %for.body108 %1 = load i32, i32* %j, align 4109 %cmp2 = icmp slt i32 %1, 1536110 br i1 %cmp2, label %for.body3, label %for.end111 112for.body3: ; preds = %for.cond1113 %2 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8114 %3 = load i32, i32* %i, align 4115 %idxprom = sext i32 %3 to i64116 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom117 %4 = load i32, i32* %j, align 4118 %idxprom4 = sext i32 %4 to i64119 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom4120 %5 = load float, float* %arrayidx5, align 4121 %conv = fpext float %5 to double122 %call = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), double %conv)123 %6 = load i32, i32* %j, align 4124 %rem = srem i32 %6, 80125 %cmp6 = icmp eq i32 %rem, 79126 br i1 %cmp6, label %if.then, label %if.end127 128if.then: ; preds = %for.body3129 %7 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8130 %call8 = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0))131 br label %if.end132 133if.end: ; preds = %if.then, %for.body3134 br label %for.inc135 136for.inc: ; preds = %if.end137 %8 = load i32, i32* %j, align 4138 %inc = add nsw i32 %8, 1139 store i32 %inc, i32* %j, align 4140 br label %for.cond1141 142for.end: ; preds = %for.cond1143 %9 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8144 %call9 = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0))145 br label %for.inc10146 147for.inc10: ; preds = %for.end148 %10 = load i32, i32* %i, align 4149 %inc11 = add nsw i32 %10, 1150 store i32 %inc11, i32* %i, align 4151 br label %for.cond152 153for.end12: ; preds = %for.cond154 ret void155}156 157declare dso_local i32 @fprintf(%struct._IO_FILE*, i8*, ...)158 159; Function Attrs: noinline nounwind uwtable160define dso_local i32 @main() {161entry:162 %retval = alloca i32, align 4163 %i = alloca i32, align 4164 %j = alloca i32, align 4165 %k = alloca i32, align 4166 %t_start = alloca double, align 8167 %t_end = alloca double, align 8168 store i32 0, i32* %retval, align 4169 call void @init_array()170 store i32 0, i32* %i, align 4171 br label %for.cond172 173for.cond: ; preds = %for.inc28, %entry174 %0 = load i32, i32* %i, align 4175 %cmp = icmp slt i32 %0, 1536176 br i1 %cmp, label %for.body, label %for.end30177 178for.body: ; preds = %for.cond179 store i32 0, i32* %j, align 4180 br label %for.cond1181 182for.cond1: ; preds = %for.inc25, %for.body183 %1 = load i32, i32* %j, align 4184 %cmp2 = icmp slt i32 %1, 1536185 br i1 %cmp2, label %for.body3, label %for.end27186 187for.body3: ; preds = %for.cond1188 %2 = load i32, i32* %i, align 4189 %idxprom = sext i32 %2 to i64190 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom191 %3 = load i32, i32* %j, align 4192 %idxprom4 = sext i32 %3 to i64193 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom4194 store float 0.000000e+00, float* %arrayidx5, align 4195 store i32 0, i32* %k, align 4196 br label %for.cond6197 198for.cond6: ; preds = %for.inc, %for.body3199 %4 = load i32, i32* %k, align 4200 %cmp7 = icmp slt i32 %4, 1536201 br i1 %cmp7, label %for.body8, label %for.end202 203for.body8: ; preds = %for.cond6204 %5 = load i32, i32* %i, align 4205 %idxprom9 = sext i32 %5 to i64206 %arrayidx10 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom9207 %6 = load i32, i32* %j, align 4208 %idxprom11 = sext i32 %6 to i64209 %arrayidx12 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx10, i64 0, i64 %idxprom11210 %7 = load float, float* %arrayidx12, align 4211 %8 = load i32, i32* %i, align 4212 %idxprom13 = sext i32 %8 to i64213 %arrayidx14 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i64 0, i64 %idxprom13214 %9 = load i32, i32* %k, align 4215 %idxprom15 = sext i32 %9 to i64216 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx14, i64 0, i64 %idxprom15217 %10 = load float, float* %arrayidx16, align 4218 %11 = load i32, i32* %k, align 4219 %idxprom17 = sext i32 %11 to i64220 %arrayidx18 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i64 0, i64 %idxprom17221 %12 = load i32, i32* %j, align 4222 %idxprom19 = sext i32 %12 to i64223 %arrayidx20 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx18, i64 0, i64 %idxprom19224 %13 = load float, float* %arrayidx20, align 4225 %mul = fmul float %10, %13226 %add = fadd float %7, %mul227 %14 = load i32, i32* %i, align 4228 %idxprom21 = sext i32 %14 to i64229 %arrayidx22 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom21230 %15 = load i32, i32* %j, align 4231 %idxprom23 = sext i32 %15 to i64232 %arrayidx24 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx22, i64 0, i64 %idxprom23233 store float %add, float* %arrayidx24, align 4234 br label %for.inc235 236for.inc: ; preds = %for.body8237 %16 = load i32, i32* %k, align 4238 %inc = add nsw i32 %16, 1239 store i32 %inc, i32* %k, align 4240 br label %for.cond6241 242for.end: ; preds = %for.cond6243 br label %for.inc25244 245for.inc25: ; preds = %for.end246 %17 = load i32, i32* %j, align 4247 %inc26 = add nsw i32 %17, 1248 store i32 %inc26, i32* %j, align 4249 br label %for.cond1250 251for.end27: ; preds = %for.cond1252 br label %for.inc28253 254for.inc28: ; preds = %for.end27255 %18 = load i32, i32* %i, align 4256 %inc29 = add nsw i32 %18, 1257 store i32 %inc29, i32* %i, align 4258 br label %for.cond259 260for.end30: ; preds = %for.cond261 ret i32 0262}263 264!llvm.module.flags = !{!0}265!llvm.ident = !{!1}266 267!0 = !{i32 1, !"wchar_size", i32 4}268!1 = !{!"clang version 8.0.0 (trunk 342834) (llvm/trunk 342856)"}269