xref: /llvm-project/polly/docs/experiments/matmul/matmul.ll (revision 4ab3041acbdc274050d6c53f72619c7455cbc97a)
13b4d331dSMichael Kruse; ModuleID = 'matmul.c'
23b4d331dSMichael Krusesource_filename = "matmul.c"
33b4d331dSMichael Krusetarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
43b4d331dSMichael Krusetarget triple = "x86_64-unknown-linux-gnu"
53b4d331dSMichael Kruse
63b4d331dSMichael Kruse%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] }
73b4d331dSMichael Kruse%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
83b4d331dSMichael Kruse
93b4d331dSMichael Kruse@A = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 16
103b4d331dSMichael Kruse@B = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 16
113b4d331dSMichael Kruse@stdout = external dso_local global %struct._IO_FILE*, align 8
123b4d331dSMichael Kruse@.str = private unnamed_addr constant [5 x i8] c"%lf \00", align 1
133b4d331dSMichael Kruse@C = common dso_local global [1536 x [1536 x float]] zeroinitializer, align 16
143b4d331dSMichael Kruse@.str.1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
153b4d331dSMichael Kruse
163b4d331dSMichael Kruse; Function Attrs: noinline nounwind uwtable
173b4d331dSMichael Krusedefine dso_local void @init_array() #0 {
183b4d331dSMichael Kruseentry:
193b4d331dSMichael Kruse  %i = alloca i32, align 4
203b4d331dSMichael Kruse  %j = alloca i32, align 4
213b4d331dSMichael Kruse  store i32 0, i32* %i, align 4
223b4d331dSMichael Kruse  br label %for.cond
233b4d331dSMichael Kruse
243b4d331dSMichael Krusefor.cond:                                         ; preds = %for.inc17, %entry
253b4d331dSMichael Kruse  %0 = load i32, i32* %i, align 4
263b4d331dSMichael Kruse  %cmp = icmp slt i32 %0, 1536
273b4d331dSMichael Kruse  br i1 %cmp, label %for.body, label %for.end19
283b4d331dSMichael Kruse
293b4d331dSMichael Krusefor.body:                                         ; preds = %for.cond
303b4d331dSMichael Kruse  store i32 0, i32* %j, align 4
313b4d331dSMichael Kruse  br label %for.cond1
323b4d331dSMichael Kruse
333b4d331dSMichael Krusefor.cond1:                                        ; preds = %for.inc, %for.body
343b4d331dSMichael Kruse  %1 = load i32, i32* %j, align 4
353b4d331dSMichael Kruse  %cmp2 = icmp slt i32 %1, 1536
363b4d331dSMichael Kruse  br i1 %cmp2, label %for.body3, label %for.end
373b4d331dSMichael Kruse
383b4d331dSMichael Krusefor.body3:                                        ; preds = %for.cond1
393b4d331dSMichael Kruse  %2 = load i32, i32* %i, align 4
403b4d331dSMichael Kruse  %3 = load i32, i32* %j, align 4
413b4d331dSMichael Kruse  %mul = mul nsw i32 %2, %3
423b4d331dSMichael Kruse  %rem = srem i32 %mul, 1024
433b4d331dSMichael Kruse  %add = add nsw i32 1, %rem
443b4d331dSMichael Kruse  %conv = sitofp i32 %add to double
453b4d331dSMichael Kruse  %div = fdiv double %conv, 2.000000e+00
463b4d331dSMichael Kruse  %conv4 = fptrunc double %div to float
473b4d331dSMichael Kruse  %4 = load i32, i32* %i, align 4
483b4d331dSMichael Kruse  %idxprom = sext i32 %4 to i64
493b4d331dSMichael Kruse  %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i64 0, i64 %idxprom
503b4d331dSMichael Kruse  %5 = load i32, i32* %j, align 4
513b4d331dSMichael Kruse  %idxprom5 = sext i32 %5 to i64
523b4d331dSMichael Kruse  %arrayidx6 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom5
533b4d331dSMichael Kruse  store float %conv4, float* %arrayidx6, align 4
543b4d331dSMichael Kruse  %6 = load i32, i32* %i, align 4
553b4d331dSMichael Kruse  %7 = load i32, i32* %j, align 4
563b4d331dSMichael Kruse  %mul7 = mul nsw i32 %6, %7
573b4d331dSMichael Kruse  %rem8 = srem i32 %mul7, 1024
583b4d331dSMichael Kruse  %add9 = add nsw i32 1, %rem8
593b4d331dSMichael Kruse  %conv10 = sitofp i32 %add9 to double
603b4d331dSMichael Kruse  %div11 = fdiv double %conv10, 2.000000e+00
613b4d331dSMichael Kruse  %conv12 = fptrunc double %div11 to float
623b4d331dSMichael Kruse  %8 = load i32, i32* %i, align 4
633b4d331dSMichael Kruse  %idxprom13 = sext i32 %8 to i64
643b4d331dSMichael Kruse  %arrayidx14 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i64 0, i64 %idxprom13
653b4d331dSMichael Kruse  %9 = load i32, i32* %j, align 4
663b4d331dSMichael Kruse  %idxprom15 = sext i32 %9 to i64
673b4d331dSMichael Kruse  %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx14, i64 0, i64 %idxprom15
683b4d331dSMichael Kruse  store float %conv12, float* %arrayidx16, align 4
693b4d331dSMichael Kruse  br label %for.inc
703b4d331dSMichael Kruse
713b4d331dSMichael Krusefor.inc:                                          ; preds = %for.body3
723b4d331dSMichael Kruse  %10 = load i32, i32* %j, align 4
733b4d331dSMichael Kruse  %inc = add nsw i32 %10, 1
743b4d331dSMichael Kruse  store i32 %inc, i32* %j, align 4
753b4d331dSMichael Kruse  br label %for.cond1
763b4d331dSMichael Kruse
773b4d331dSMichael Krusefor.end:                                          ; preds = %for.cond1
783b4d331dSMichael Kruse  br label %for.inc17
793b4d331dSMichael Kruse
803b4d331dSMichael Krusefor.inc17:                                        ; preds = %for.end
813b4d331dSMichael Kruse  %11 = load i32, i32* %i, align 4
823b4d331dSMichael Kruse  %inc18 = add nsw i32 %11, 1
833b4d331dSMichael Kruse  store i32 %inc18, i32* %i, align 4
843b4d331dSMichael Kruse  br label %for.cond
853b4d331dSMichael Kruse
863b4d331dSMichael Krusefor.end19:                                        ; preds = %for.cond
873b4d331dSMichael Kruse  ret void
883b4d331dSMichael Kruse}
893b4d331dSMichael Kruse
903b4d331dSMichael Kruse; Function Attrs: noinline nounwind uwtable
913b4d331dSMichael Krusedefine dso_local void @print_array() #0 {
923b4d331dSMichael Kruseentry:
933b4d331dSMichael Kruse  %i = alloca i32, align 4
943b4d331dSMichael Kruse  %j = alloca i32, align 4
953b4d331dSMichael Kruse  store i32 0, i32* %i, align 4
963b4d331dSMichael Kruse  br label %for.cond
973b4d331dSMichael Kruse
983b4d331dSMichael Krusefor.cond:                                         ; preds = %for.inc10, %entry
993b4d331dSMichael Kruse  %0 = load i32, i32* %i, align 4
1003b4d331dSMichael Kruse  %cmp = icmp slt i32 %0, 1536
1013b4d331dSMichael Kruse  br i1 %cmp, label %for.body, label %for.end12
1023b4d331dSMichael Kruse
1033b4d331dSMichael Krusefor.body:                                         ; preds = %for.cond
1043b4d331dSMichael Kruse  store i32 0, i32* %j, align 4
1053b4d331dSMichael Kruse  br label %for.cond1
1063b4d331dSMichael Kruse
1073b4d331dSMichael Krusefor.cond1:                                        ; preds = %for.inc, %for.body
1083b4d331dSMichael Kruse  %1 = load i32, i32* %j, align 4
1093b4d331dSMichael Kruse  %cmp2 = icmp slt i32 %1, 1536
1103b4d331dSMichael Kruse  br i1 %cmp2, label %for.body3, label %for.end
1113b4d331dSMichael Kruse
1123b4d331dSMichael Krusefor.body3:                                        ; preds = %for.cond1
1133b4d331dSMichael Kruse  %2 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
1143b4d331dSMichael Kruse  %3 = load i32, i32* %i, align 4
1153b4d331dSMichael Kruse  %idxprom = sext i32 %3 to i64
1163b4d331dSMichael Kruse  %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom
1173b4d331dSMichael Kruse  %4 = load i32, i32* %j, align 4
1183b4d331dSMichael Kruse  %idxprom4 = sext i32 %4 to i64
1193b4d331dSMichael Kruse  %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom4
1203b4d331dSMichael Kruse  %5 = load float, float* %arrayidx5, align 4
1213b4d331dSMichael Kruse  %conv = fpext float %5 to double
1223b4d331dSMichael Kruse  %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)
1233b4d331dSMichael Kruse  %6 = load i32, i32* %j, align 4
1243b4d331dSMichael Kruse  %rem = srem i32 %6, 80
1253b4d331dSMichael Kruse  %cmp6 = icmp eq i32 %rem, 79
1263b4d331dSMichael Kruse  br i1 %cmp6, label %if.then, label %if.end
1273b4d331dSMichael Kruse
1283b4d331dSMichael Kruseif.then:                                          ; preds = %for.body3
1293b4d331dSMichael Kruse  %7 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
1303b4d331dSMichael Kruse  %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))
1313b4d331dSMichael Kruse  br label %if.end
1323b4d331dSMichael Kruse
1333b4d331dSMichael Kruseif.end:                                           ; preds = %if.then, %for.body3
1343b4d331dSMichael Kruse  br label %for.inc
1353b4d331dSMichael Kruse
1363b4d331dSMichael Krusefor.inc:                                          ; preds = %if.end
1373b4d331dSMichael Kruse  %8 = load i32, i32* %j, align 4
1383b4d331dSMichael Kruse  %inc = add nsw i32 %8, 1
1393b4d331dSMichael Kruse  store i32 %inc, i32* %j, align 4
1403b4d331dSMichael Kruse  br label %for.cond1
1413b4d331dSMichael Kruse
1423b4d331dSMichael Krusefor.end:                                          ; preds = %for.cond1
1433b4d331dSMichael Kruse  %9 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
1443b4d331dSMichael Kruse  %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))
1453b4d331dSMichael Kruse  br label %for.inc10
1463b4d331dSMichael Kruse
1473b4d331dSMichael Krusefor.inc10:                                        ; preds = %for.end
1483b4d331dSMichael Kruse  %10 = load i32, i32* %i, align 4
1493b4d331dSMichael Kruse  %inc11 = add nsw i32 %10, 1
1503b4d331dSMichael Kruse  store i32 %inc11, i32* %i, align 4
1513b4d331dSMichael Kruse  br label %for.cond
1523b4d331dSMichael Kruse
1533b4d331dSMichael Krusefor.end12:                                        ; preds = %for.cond
1543b4d331dSMichael Kruse  ret void
1553b4d331dSMichael Kruse}
1563b4d331dSMichael Kruse
1573b4d331dSMichael Krusedeclare dso_local i32 @fprintf(%struct._IO_FILE*, i8*, ...) #1
1583b4d331dSMichael Kruse
1593b4d331dSMichael Kruse; Function Attrs: noinline nounwind uwtable
1603b4d331dSMichael Krusedefine dso_local i32 @main() #0 {
1613b4d331dSMichael Kruseentry:
1623b4d331dSMichael Kruse  %retval = alloca i32, align 4
1633b4d331dSMichael Kruse  %i = alloca i32, align 4
1643b4d331dSMichael Kruse  %j = alloca i32, align 4
1653b4d331dSMichael Kruse  %k = alloca i32, align 4
1663b4d331dSMichael Kruse  %t_start = alloca double, align 8
1673b4d331dSMichael Kruse  %t_end = alloca double, align 8
1683b4d331dSMichael Kruse  store i32 0, i32* %retval, align 4
1693b4d331dSMichael Kruse  call void @init_array()
1703b4d331dSMichael Kruse  store i32 0, i32* %i, align 4
1713b4d331dSMichael Kruse  br label %for.cond
1723b4d331dSMichael Kruse
1733b4d331dSMichael Krusefor.cond:                                         ; preds = %for.inc28, %entry
1743b4d331dSMichael Kruse  %0 = load i32, i32* %i, align 4
1753b4d331dSMichael Kruse  %cmp = icmp slt i32 %0, 1536
1763b4d331dSMichael Kruse  br i1 %cmp, label %for.body, label %for.end30
1773b4d331dSMichael Kruse
1783b4d331dSMichael Krusefor.body:                                         ; preds = %for.cond
1793b4d331dSMichael Kruse  store i32 0, i32* %j, align 4
1803b4d331dSMichael Kruse  br label %for.cond1
1813b4d331dSMichael Kruse
1823b4d331dSMichael Krusefor.cond1:                                        ; preds = %for.inc25, %for.body
1833b4d331dSMichael Kruse  %1 = load i32, i32* %j, align 4
1843b4d331dSMichael Kruse  %cmp2 = icmp slt i32 %1, 1536
1853b4d331dSMichael Kruse  br i1 %cmp2, label %for.body3, label %for.end27
1863b4d331dSMichael Kruse
1873b4d331dSMichael Krusefor.body3:                                        ; preds = %for.cond1
1883b4d331dSMichael Kruse  %2 = load i32, i32* %i, align 4
1893b4d331dSMichael Kruse  %idxprom = sext i32 %2 to i64
1903b4d331dSMichael Kruse  %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom
1913b4d331dSMichael Kruse  %3 = load i32, i32* %j, align 4
1923b4d331dSMichael Kruse  %idxprom4 = sext i32 %3 to i64
1933b4d331dSMichael Kruse  %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i64 0, i64 %idxprom4
1943b4d331dSMichael Kruse  store float 0.000000e+00, float* %arrayidx5, align 4
1953b4d331dSMichael Kruse  store i32 0, i32* %k, align 4
1963b4d331dSMichael Kruse  br label %for.cond6
1973b4d331dSMichael Kruse
1983b4d331dSMichael Krusefor.cond6:                                        ; preds = %for.inc, %for.body3
1993b4d331dSMichael Kruse  %4 = load i32, i32* %k, align 4
2003b4d331dSMichael Kruse  %cmp7 = icmp slt i32 %4, 1536
2013b4d331dSMichael Kruse  br i1 %cmp7, label %for.body8, label %for.end
2023b4d331dSMichael Kruse
2033b4d331dSMichael Krusefor.body8:                                        ; preds = %for.cond6
2043b4d331dSMichael Kruse  %5 = load i32, i32* %i, align 4
2053b4d331dSMichael Kruse  %idxprom9 = sext i32 %5 to i64
2063b4d331dSMichael Kruse  %arrayidx10 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom9
2073b4d331dSMichael Kruse  %6 = load i32, i32* %j, align 4
2083b4d331dSMichael Kruse  %idxprom11 = sext i32 %6 to i64
2093b4d331dSMichael Kruse  %arrayidx12 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx10, i64 0, i64 %idxprom11
2103b4d331dSMichael Kruse  %7 = load float, float* %arrayidx12, align 4
2113b4d331dSMichael Kruse  %8 = load i32, i32* %i, align 4
2123b4d331dSMichael Kruse  %idxprom13 = sext i32 %8 to i64
2133b4d331dSMichael Kruse  %arrayidx14 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i64 0, i64 %idxprom13
2143b4d331dSMichael Kruse  %9 = load i32, i32* %k, align 4
2153b4d331dSMichael Kruse  %idxprom15 = sext i32 %9 to i64
2163b4d331dSMichael Kruse  %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx14, i64 0, i64 %idxprom15
2173b4d331dSMichael Kruse  %10 = load float, float* %arrayidx16, align 4
2183b4d331dSMichael Kruse  %11 = load i32, i32* %k, align 4
2193b4d331dSMichael Kruse  %idxprom17 = sext i32 %11 to i64
2203b4d331dSMichael Kruse  %arrayidx18 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i64 0, i64 %idxprom17
2213b4d331dSMichael Kruse  %12 = load i32, i32* %j, align 4
2223b4d331dSMichael Kruse  %idxprom19 = sext i32 %12 to i64
2233b4d331dSMichael Kruse  %arrayidx20 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx18, i64 0, i64 %idxprom19
2243b4d331dSMichael Kruse  %13 = load float, float* %arrayidx20, align 4
2253b4d331dSMichael Kruse  %mul = fmul float %10, %13
2263b4d331dSMichael Kruse  %add = fadd float %7, %mul
2273b4d331dSMichael Kruse  %14 = load i32, i32* %i, align 4
2283b4d331dSMichael Kruse  %idxprom21 = sext i32 %14 to i64
2293b4d331dSMichael Kruse  %arrayidx22 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i64 0, i64 %idxprom21
2303b4d331dSMichael Kruse  %15 = load i32, i32* %j, align 4
2313b4d331dSMichael Kruse  %idxprom23 = sext i32 %15 to i64
2323b4d331dSMichael Kruse  %arrayidx24 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx22, i64 0, i64 %idxprom23
2333b4d331dSMichael Kruse  store float %add, float* %arrayidx24, align 4
2343b4d331dSMichael Kruse  br label %for.inc
2353b4d331dSMichael Kruse
2363b4d331dSMichael Krusefor.inc:                                          ; preds = %for.body8
2373b4d331dSMichael Kruse  %16 = load i32, i32* %k, align 4
2383b4d331dSMichael Kruse  %inc = add nsw i32 %16, 1
2393b4d331dSMichael Kruse  store i32 %inc, i32* %k, align 4
2403b4d331dSMichael Kruse  br label %for.cond6
2413b4d331dSMichael Kruse
2423b4d331dSMichael Krusefor.end:                                          ; preds = %for.cond6
2433b4d331dSMichael Kruse  br label %for.inc25
2443b4d331dSMichael Kruse
2453b4d331dSMichael Krusefor.inc25:                                        ; preds = %for.end
2463b4d331dSMichael Kruse  %17 = load i32, i32* %j, align 4
2473b4d331dSMichael Kruse  %inc26 = add nsw i32 %17, 1
2483b4d331dSMichael Kruse  store i32 %inc26, i32* %j, align 4
2493b4d331dSMichael Kruse  br label %for.cond1
2503b4d331dSMichael Kruse
2513b4d331dSMichael Krusefor.end27:                                        ; preds = %for.cond1
2523b4d331dSMichael Kruse  br label %for.inc28
2533b4d331dSMichael Kruse
2543b4d331dSMichael Krusefor.inc28:                                        ; preds = %for.end27
2553b4d331dSMichael Kruse  %18 = load i32, i32* %i, align 4
2563b4d331dSMichael Kruse  %inc29 = add nsw i32 %18, 1
2573b4d331dSMichael Kruse  store i32 %inc29, i32* %i, align 4
2583b4d331dSMichael Kruse  br label %for.cond
2593b4d331dSMichael Kruse
2603b4d331dSMichael Krusefor.end30:                                        ; preds = %for.cond
2613b4d331dSMichael Kruse  ret i32 0
2623b4d331dSMichael Kruse}
2633b4d331dSMichael Kruse
264*4ab3041aSserge-sans-pailleattributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
265*4ab3041aSserge-sans-pailleattributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
2663b4d331dSMichael Kruse
2673b4d331dSMichael Kruse!llvm.module.flags = !{!0}
2683b4d331dSMichael Kruse!llvm.ident = !{!1}
2693b4d331dSMichael Kruse
2703b4d331dSMichael Kruse!0 = !{i32 1, !"wchar_size", i32 4}
2713b4d331dSMichael Kruse!1 = !{!"clang version 8.0.0 (trunk 342834) (llvm/trunk 342856)"}
272