Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Algol68
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C with Coccinelle
C++ with Coccinelle
C++ (Circle)
CIRCT
Clean
Clojure
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
Helion
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Mojo
Nim
Numba
Nix
Objective-C
Objective-C++
OCaml
Odin
OpenCL C
Pascal
Pony
PTX
Python
Racket
Raku
Ruby
Rust
Sail
Snowball
Scala
Slang
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
Triton
TypeScript Native
V
Vala
Visual Basic
Vyper
WASM
Yul (Solidity IR)
Zig
Javascript
GIMPLE
Ygen
sway
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 20.1.0
clang 21.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
hexagon-clang 16.0.5
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 20.1.0
llc 21.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 20.1.0
opt 21.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
; ModuleID = 'test.cpp' source_filename = "test.cpp" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" target triple = "x86_64-sie-ps5" @n_errors = hidden local_unnamed_addr global i32 0, align 4 @.str = private unnamed_addr constant [52 x i8] c"Expected %f +/ %f but was %f (failure on line %d)\0A\00", align 1 @.str.1 = private unnamed_addr constant [31 x i8] c"Expected %f +/ %f and was %f\0A\00", align 1 @input_value = hidden local_unnamed_addr global float 0x3FD5BF80C0000000, align 4 @expected_pos_cos = hidden local_unnamed_addr global float 0x3FEE2B8E40000000, align 4 @expected_neg_cos = hidden local_unnamed_addr global float 0xBFEE2B8E40000000, align 4 @expected_neg_sin = hidden local_unnamed_addr global float 0xBFD554F860000000, align 4 @.str.2 = private unnamed_addr constant [18 x i8] c"%d error(s). %s\0A\00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"PASS\00", align 1 @.str.4 = private unnamed_addr constant [5 x i8] c"FAIL\00", align 1 ; Function Attrs: mustprogress nofree noinline nounwind uwtable define hidden void @_Z10CheckCloseRfS_S_i(ptr noundef nonnull readonly align 4 captures(none) dereferenceable(4) %computed, ptr noundef nonnull readonly align 4 captures(none) dereferenceable(4) %expected, ptr noundef nonnull readonly align 4 captures(none) dereferenceable(4) %tolerance, i32 noundef %lnum) local_unnamed_addr #0 { entry: %0 = load float, ptr %computed, align 4, !tbaa !6 %1 = load float, ptr %expected, align 4, !tbaa !6 %sub = fsub float %0, %1 %2 = tail call float @llvm.fabs.f32(float %sub) %3 = load float, ptr %tolerance, align 4, !tbaa !6 %cmp = fcmp ult float %2, %3 %conv3 = fpext float %1 to double %conv4 = fpext float %3 to double %conv5 = fpext float %0 to double br i1 %cmp, label %if.else, label %if.then if.then: ; preds = %entry %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %conv3, double noundef %conv4, double noundef %conv5, i32 noundef %lnum) %4 = load i32, ptr @n_errors, align 4, !tbaa !10 %inc = add nsw i32 %4, 1 store i32 %inc, ptr @n_errors, align 4, !tbaa !10 br label %if.end if.else: ; preds = %entry %call6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv3, double noundef %conv4, double noundef %conv5) br label %if.end if.end: ; preds = %if.else, %if.then ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr captures(none)) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare float @llvm.fabs.f32(float) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr noundef readonly captures(none), ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr captures(none)) #1 ; Function Attrs: mustprogress nofree norecurse nounwind uwtable define hidden noundef i32 @main() local_unnamed_addr #4 { entry: %close = alloca float, align 4 %computed = alloca float, align 4 %expected = alloca float, align 4 %computed1 = alloca float, align 4 %expected2 = alloca float, align 4 %computed3 = alloca float, align 4 %expected5 = alloca float, align 4 %0 = load float, ptr @input_value, align 4, !tbaa !6 %1 = tail call { float, float } @llvm.sincos.f32(float %0) %2 = extractvalue { float, float } %1, 0 %3 = extractvalue { float, float } %1, 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %close) #5 store float 0x3EE4F8B580000000, ptr %close, align 4, !tbaa !6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %computed) #5 store float %3, ptr %computed, align 4, !tbaa !6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %expected) #5 %4 = load float, ptr @expected_pos_cos, align 4, !tbaa !6 store float %4, ptr %expected, align 4, !tbaa !6 call void @_Z10CheckCloseRfS_S_i(ptr noundef nonnull align 4 dereferenceable(4) %computed, ptr noundef nonnull align 4 dereferenceable(4) %expected, ptr noundef nonnull align 4 dereferenceable(4) %close, i32 noundef 36) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %expected) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %computed) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %computed1) #5 %fneg = fneg float %2 store float %fneg, ptr %computed1, align 4, !tbaa !6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %expected2) #5 %5 = load float, ptr @expected_neg_sin, align 4, !tbaa !6 store float %5, ptr %expected2, align 4, !tbaa !6 call void @_Z10CheckCloseRfS_S_i(ptr noundef nonnull align 4 dereferenceable(4) %computed1, ptr noundef nonnull align 4 dereferenceable(4) %expected2, ptr noundef nonnull align 4 dereferenceable(4) %close, i32 noundef 41) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %expected2) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %computed1) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %computed3) #5 %fneg4 = fneg float %3 store float %fneg4, ptr %computed3, align 4, !tbaa !6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %expected5) #5 %6 = load float, ptr @expected_neg_cos, align 4, !tbaa !6 store float %6, ptr %expected5, align 4, !tbaa !6 call void @_Z10CheckCloseRfS_S_i(ptr noundef nonnull align 4 dereferenceable(4) %computed3, ptr noundef nonnull align 4 dereferenceable(4) %expected5, ptr noundef nonnull align 4 dereferenceable(4) %close, i32 noundef 46) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %expected5) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %computed3) #5 %7 = load i32, ptr @n_errors, align 4, !tbaa !10 %cmp = icmp eq i32 %7, 0 %.str.3..str.4 = select i1 %cmp, ptr @.str.3, ptr @.str.4 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7, ptr noundef nonnull %.str.3..str.4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %close) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare { float, float } @llvm.sincos.f32(float) #2 attributes #0 = { mustprogress nofree noinline nounwind uwtable "denormal-fp-math"="preserve-sign,preserve-sign" "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="znver2" "target-features"="+adx,+aes,+avx,+avx2,+bmi,+bmi2,+clflushopt,+clwb,+clzero,+crc32,+cx16,+cx8,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+mwaitx,+pclmul,+popcnt,+prfchw,+rdpid,+rdpru,+rdrnd,+rdseed,+sahf,+sha,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+sse4a,+ssse3,+wbnoinvd,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #3 = { nofree nounwind "denormal-fp-math"="preserve-sign,preserve-sign" "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="znver2" "target-features"="+adx,+aes,+avx,+avx2,+bmi,+bmi2,+clflushopt,+clwb,+clzero,+crc32,+cx16,+cx8,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+mwaitx,+pclmul,+popcnt,+prfchw,+rdpid,+rdpru,+rdrnd,+rdseed,+sahf,+sha,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+sse4a,+ssse3,+wbnoinvd,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" } attributes #4 = { mustprogress nofree norecurse nounwind uwtable "denormal-fp-math"="preserve-sign,preserve-sign" "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="znver2" "target-features"="+adx,+aes,+avx,+avx2,+bmi,+bmi2,+clflushopt,+clwb,+clzero,+crc32,+cx16,+cx8,+f16c,+fma,+fsgsbase,+fxsr,+lzcnt,+mmx,+movbe,+mwaitx,+pclmul,+popcnt,+prfchw,+rdpid,+rdpru,+rdrnd,+rdseed,+sahf,+sha,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+sse4a,+ssse3,+wbnoinvd,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3, !4} !llvm.ident = !{!5} !0 = !{i32 1, !"wchar_size", i32 2} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"uwtable", i32 2} !3 = !{i32 7, !"frame-pointer", i32 1} !4 = !{i32 1, !"MaxTLSAlign", i32 256} !5 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project.git c78e6bbd830a4633fa7c80aebb9680b6acf913c6)"} !6 = !{!7, !7, i64 0} !7 = !{!"float", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C++ TBAA"} !10 = !{!11, !11, i64 0} !11 = !{!"int", !8, i64 0}
Become a Patron
Sponsor on GitHub
Donate via PayPal
Compiler Explorer Shop
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
CE on Bluesky
Statistics
Changelog
Version tree