Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Zig
Javascript
GIMPLE
Ygen
llvm source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
clang (assertions trunk)
clang (trunk)
clang 10.0.0
clang 10.0.1
clang 11.0.0
clang 11.0.1
clang 12.0.0
clang 12.0.1
clang 13.0.0
clang 14.0.0
clang 15.0.0
clang 16.0.0
clang 17.0.1
clang 18.1.0
clang 19.1.0
clang 4.0.1
clang 5.0.0
clang 6.0.0
clang 7.0.0
clang 8.0.0
clang 9.0.0
llc (assertions trunk)
llc (trunk)
llc 10.0.0
llc 10.0.1
llc 11.0.0
llc 11.0.1
llc 12.0.0
llc 12.0.1
llc 13.0.0
llc 14.0.0
llc 15.0.0
llc 16.0.0
llc 17.0.1
llc 18.1.0
llc 19.1.0
llc 3.2
llc 3.3
llc 3.9.1
llc 4.0.0
llc 4.0.1
llc 5.0.0
llc 6.0.0
llc 7.0.0
llc 8.0.0
llc 9.0.0
opt (assertions trunk)
opt (trunk)
opt 10.0.0
opt 10.0.1
opt 11.0.0
opt 11.0.1
opt 12.0.0
opt 12.0.1
opt 13.0.0
opt 14.0.0
opt 15.0.0
opt 16.0.0
opt 17.0.1
opt 18.1.0
opt 19.1.0
opt 3.2
opt 3.3
opt 3.9.1
opt 4.0.0
opt 4.0.1
opt 5.0.0
opt 6.0.0
opt 7.0.0
opt 8.0.0
opt 9.0.0
Options
Source code
%struct.Matrix = type { [4 x [4 x float]] } @.str = private unnamed_addr constant [17 x i8] c"Value Check: %f\0A\00", align 1 @.str.1 = private unnamed_addr constant [21 x i8] c"Time in seconds: %f\0A\00", align 1 define dso_local i32 @main() #0 { %1 = alloca i32, align 4 %2 = alloca %struct.Matrix, align 4 %3 = alloca i32, align 4 %4 = alloca %struct.Matrix*, align 8 %5 = alloca i64, align 8 %6 = alloca i32, align 4 %7 = alloca i32, align 4 %8 = alloca i64, align 8 store i32 0, i32* %1, align 4 %9 = bitcast %struct.Matrix* %2 to i8* call void @llvm.memset.p0i8.i64(i8* align 4 %9, i8 0, i64 64, i1 false) %10 = bitcast i8* %9 to %struct.Matrix* %11 = getelementptr inbounds %struct.Matrix, %struct.Matrix* %10, i32 0, i32 0 %12 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i32 0, i32 0 %13 = getelementptr inbounds [4 x float], [4 x float]* %12, i32 0, i32 0 store float 1.000000e+00, float* %13, align 4 %14 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i32 0, i32 1 %15 = getelementptr inbounds [4 x float], [4 x float]* %14, i32 0, i32 1 store float 1.000000e+00, float* %15, align 4 %16 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i32 0, i32 2 %17 = getelementptr inbounds [4 x float], [4 x float]* %16, i32 0, i32 2 store float 1.000000e+00, float* %17, align 4 %18 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %11, i32 0, i32 3 %19 = getelementptr inbounds [4 x float], [4 x float]* %18, i32 0, i32 3 store float 1.000000e+00, float* %19, align 4 store i32 10000000, i32* %3, align 4 %20 = load i32, i32* %3, align 4 %21 = sext i32 %20 to i64 %22 = mul i64 %21, 64 %23 = call noalias i8* @malloc(i64 %22) #4 %24 = bitcast i8* %23 to %struct.Matrix* store %struct.Matrix* %24, %struct.Matrix** %4, align 8 %25 = call i64 @clock() #4 store i64 %25, i64* %5, align 8 store i32 0, i32* %6, align 4 br label %26 26: ; preds = %45, %0 %27 = load i32, i32* %6, align 4 %28 = icmp slt i32 %27, 25 br i1 %28, label %29, label %48 29: ; preds = %26 store i32 0, i32* %7, align 4 br label %30 30: ; preds = %41, %29 %31 = load i32, i32* %7, align 4 %32 = load i32, i32* %3, align 4 %33 = icmp slt i32 %31, %32 br i1 %33, label %34, label %44 34: ; preds = %30 %35 = load %struct.Matrix*, %struct.Matrix** %4, align 8 %36 = load i32, i32* %7, align 4 %37 = sext i32 %36 to i64 %38 = getelementptr inbounds %struct.Matrix, %struct.Matrix* %35, i64 %37 %39 = bitcast %struct.Matrix* %38 to i8* %40 = bitcast %struct.Matrix* %2 to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %39, i8* align 4 %40, i64 64, i1 false) br label %41 41: ; preds = %34 %42 = load i32, i32* %7, align 4 %43 = add nsw i32 %42, 1 store i32 %43, i32* %7, align 4 br label %30 44: ; preds = %30 br label %45 45: ; preds = %44 %46 = load i32, i32* %6, align 4 %47 = add nsw i32 %46, 1 store i32 %47, i32* %6, align 4 br label %26 48: ; preds = %26 %49 = call i64 @clock() #4 store i64 %49, i64* %8, align 8 %50 = load %struct.Matrix*, %struct.Matrix** %4, align 8 %51 = load i32, i32* %3, align 4 %52 = sdiv i32 %51, 2 %53 = sext i32 %52 to i64 %54 = getelementptr inbounds %struct.Matrix, %struct.Matrix* %50, i64 %53 %55 = getelementptr inbounds %struct.Matrix, %struct.Matrix* %54, i32 0, i32 0 %56 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %55, i64 0, i64 2 %57 = getelementptr inbounds [4 x float], [4 x float]* %56, i64 0, i64 2 %58 = load float, float* %57, align 4 %59 = fpext float %58 to double %60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %59) %61 = load i64, i64* %8, align 8 %62 = load i64, i64* %5, align 8 %63 = sub nsw i64 %61, %62 %64 = sitofp i64 %63 to double %65 = fdiv double %64, 1.000000e+06 %66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %65) %67 = load i32, i32* %1, align 4 ret i32 %67 } declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1 declare dso_local noalias i8* @malloc(i64) #2 declare dso_local i64 @clock() #2 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1 declare dso_local i32 @printf(i8*, ...) #3 attributes #0 = { noinline norecurse uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { argmemonly nounwind willreturn } attributes #2 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #4 = { nounwind }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
About the author
Statistics
Changelog
Version tree