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#
Go
Haskell
HLSL
Hook
Hylo
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
Zig
Javascript
GIMPLE
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 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 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 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 = 'a64.c' source_filename = "a64.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %struct.int16likething = type { i16, i16 } ; Function Attrs: nofree norecurse nosync nounwind uwtable define dso_local i32 @thetestfn(i16 noundef zeroext %m, i16 noundef zeroext %n, %struct.int16likething* noalias nocapture noundef readonly %p_src_a, %struct.int16likething* noalias nocapture noundef readonly %p_src_x, %struct.int16likething* nocapture noundef writeonly %p_dst) local_unnamed_addr #0 { entry: %0 = and i16 %m, 1 %tobool.not = icmp eq i16 %0, 0 br i1 %tobool.not, label %if.end, label %if.then if.then: ; preds = %entry %1 = and i16 %n, 3 %cmp.not72 = icmp eq i16 %1, 0 br i1 %cmp.not72, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %if.then %2 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_a, i64 0, i32 0 %3 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_x, i64 0, i32 0 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %p_in1.079 = phi i16* [ %add.ptr19, %while.body ], [ %2, %while.body.preheader ] %p_in2.078 = phi i16* [ %add.ptr20, %while.body ], [ %3, %while.body.preheader ] %sum_real1_ext.077 = phi i64 [ %add12, %while.body ], [ 0, %while.body.preheader ] %sum_imag1_ext.076 = phi i64 [ %add18, %while.body ], [ 0, %while.body.preheader ] %col_cnt.075 = phi i16 [ %dec, %while.body ], [ %1, %while.body.preheader ] %sum_imag2_ext.074 = phi i64 [ %add31, %while.body ], [ 0, %while.body.preheader ] %sum_real2_ext.073 = phi i64 [ %sub, %while.body ], [ 0, %while.body.preheader ] %4 = load i16, i16* %p_in1.079, align 2, !tbaa !3 %5 = load i16, i16* %p_in2.078, align 2, !tbaa !3 %add.ptr = getelementptr inbounds i16, i16* %p_in1.079, i64 1 %6 = load i16, i16* %add.ptr, align 2, !tbaa !3 %add.ptr8 = getelementptr inbounds i16, i16* %p_in2.078, i64 1 %7 = load i16, i16* %add.ptr8, align 2, !tbaa !3 %conv983 = zext i16 %4 to i32 %conv1084 = zext i16 %5 to i32 %add = add nuw nsw i32 %conv1084, 1 %mul = mul nuw i32 %add, %conv983 %conv1185 = zext i32 %mul to i64 %add12 = add i64 %sum_real1_ext.077, %conv1185 %conv1386 = zext i16 %6 to i32 %add15 = add nuw nsw i32 %conv1084, 2 %mul16 = mul nuw i32 %add15, %conv1386 %conv1787 = zext i32 %mul16 to i64 %add18 = add i64 %sum_imag1_ext.076, %conv1787 %add.ptr19 = getelementptr inbounds i16, i16* %p_in1.079, i64 2 %add.ptr20 = getelementptr inbounds i16, i16* %p_in2.078, i64 2 %conv2288 = zext i16 %7 to i32 %add23 = add nuw nsw i32 %conv2288, 1 %mul24 = mul nuw i32 %add23, %conv1386 %conv2589 = zext i32 %mul24 to i64 %sub = sub i64 %sum_real2_ext.073, %conv2589 %add28 = add nuw nsw i32 %conv2288, 2 %mul29 = mul nuw i32 %add28, %conv983 %conv3090 = zext i32 %mul29 to i64 %add31 = add i64 %sum_imag2_ext.074, %conv3090 %dec = add nsw i16 %col_cnt.075, -1 %cmp.not = icmp eq i16 %dec, 0 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !7 while.end.loopexit: ; preds = %while.body %8 = add i64 %add12, %sub %9 = add i64 %add18, %add31 %phi.cast = trunc i64 %8 to i16 %phi.cast91 = trunc i64 %9 to i16 br label %while.end while.end: ; preds = %while.end.loopexit, %if.then %add32 = phi i16 [ 0, %if.then ], [ %phi.cast, %while.end.loopexit ] %add33 = phi i16 [ 0, %if.then ], [ %phi.cast91, %while.end.loopexit ] %re = getelementptr inbounds %struct.int16likething, %struct.int16likething* %p_dst, i64 0, i32 0 store i16 %add32, i16* %re, align 2, !tbaa !9 %im = getelementptr inbounds %struct.int16likething, %struct.int16likething* %p_dst, i64 0, i32 1 store i16 %add33, i16* %im, align 2, !tbaa !11 br label %if.end if.end: ; preds = %while.end, %entry ret i32 0 } attributes #0 = { nofree norecurse nosync nounwind uwtable "approx-func-fp-math"="true" "denormal-fp-math"="preserve-sign,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" "frame-pointer"="none" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="skylake" "target-features"="+adx,+aes,+avx,+avx2,+bmi,+bmi2,+clflushopt,+crc32,+cx16,+cx8,+f16c,+fma,+fsgsbase,+fxsr,+invpcid,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prfchw,+rdrnd,+rdseed,+sahf,+sgx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" "unsafe-fp-math"="true" } !llvm.module.flags = !{!0, !1} !llvm.ident = !{!2} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 7, !"uwtable", i32 1} !2 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project 3fd30958b79293f64545c7328c58982f959feb51)"} !3 = !{!4, !4, i64 0} !4 = !{!"short", !5, i64 0} !5 = !{!"omnipotent char", !6, i64 0} !6 = !{!"Simple C/C++ TBAA"} !7 = distinct !{!7, !8} !8 = !{!"llvm.loop.mustprogress"} !9 = !{!10, !4, i64 0} !10 = !{!"", !4, i64 0, !4, i64 2} !11 = !{!10, !4, i64 2}
llvm source #2
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 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 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 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 = '<stdin>' source_filename = "a64.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" %struct.int16likething = type { i16, i16 } ; Function Attrs: nofree norecurse nosync nounwind uwtable define dso_local i32 @thetestfn(i16 noundef zeroext %m, i16 noundef zeroext %n, %struct.int16likething* noalias nocapture noundef readonly %p_src_a, %struct.int16likething* noalias nocapture noundef readonly %p_src_x, %struct.int16likething* nocapture noundef writeonly %p_dst) local_unnamed_addr #0 { entry: %0 = and i16 %m, 1 %tobool.not = icmp eq i16 %0, 0 br i1 %tobool.not, label %if.end, label %if.then if.then: ; preds = %entry %1 = and i16 %n, 3 %cmp.not72 = icmp eq i16 %1, 0 br i1 %cmp.not72, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %if.then %2 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_a, i64 0, i32 0 %3 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_x, i64 0, i32 0 %4 = add nsw i16 %1, -1 %5 = zext i16 %4 to i64 %broadcast.splatinsert = insertelement <4 x i64> poison, i64 %5, i64 0 %broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer %6 = icmp uge <4 x i64> %broadcast.splat, <i64 0, i64 1, i64 2, i64 3> %7 = extractelement <4 x i1> %6, i64 0 br i1 %7, label %pred.load.if, label %pred.load.continue pred.load.if: ; preds = %while.body.preheader %8 = load i16, i16* %2, align 2, !tbaa !3 %9 = insertelement <4 x i16> poison, i16 %8, i64 0 %10 = load i16, i16* %3, align 2, !tbaa !3 %11 = insertelement <4 x i16> poison, i16 %10, i64 0 %12 = getelementptr inbounds i16, i16* %2, i64 1 %13 = load i16, i16* %12, align 2, !tbaa !3 %14 = insertelement <4 x i16> poison, i16 %13, i64 0 %15 = getelementptr inbounds i16, i16* %3, i64 1 %16 = load i16, i16* %15, align 2, !tbaa !3 %17 = insertelement <4 x i16> poison, i16 %16, i64 0 br label %pred.load.continue pred.load.continue: ; preds = %pred.load.if, %while.body.preheader %18 = phi <4 x i16> [ poison, %while.body.preheader ], [ %9, %pred.load.if ] %19 = phi <4 x i16> [ poison, %while.body.preheader ], [ %11, %pred.load.if ] %20 = phi <4 x i16> [ poison, %while.body.preheader ], [ %14, %pred.load.if ] %21 = phi <4 x i16> [ poison, %while.body.preheader ], [ %17, %pred.load.if ] %22 = extractelement <4 x i1> %6, i64 1 br i1 %22, label %pred.load.if17, label %pred.load.continue18 pred.load.if17: ; preds = %pred.load.continue %next.gep9 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_x, i64 1, i32 0 %next.gep5 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_a, i64 1, i32 0 %23 = load i16, i16* %next.gep5, align 2, !tbaa !3 %24 = insertelement <4 x i16> %18, i16 %23, i64 1 %25 = load i16, i16* %next.gep9, align 2, !tbaa !3 %26 = insertelement <4 x i16> %19, i16 %25, i64 1 %27 = getelementptr inbounds i16, i16* %next.gep5, i64 1 %28 = load i16, i16* %27, align 2, !tbaa !3 %29 = insertelement <4 x i16> %20, i16 %28, i64 1 %30 = getelementptr inbounds i16, i16* %next.gep9, i64 1 %31 = load i16, i16* %30, align 2, !tbaa !3 %32 = insertelement <4 x i16> %21, i16 %31, i64 1 br label %pred.load.continue18 pred.load.continue18: ; preds = %pred.load.if17, %pred.load.continue %33 = phi <4 x i16> [ %18, %pred.load.continue ], [ %24, %pred.load.if17 ] %34 = phi <4 x i16> [ %19, %pred.load.continue ], [ %26, %pred.load.if17 ] %35 = phi <4 x i16> [ %20, %pred.load.continue ], [ %29, %pred.load.if17 ] %36 = phi <4 x i16> [ %21, %pred.load.continue ], [ %32, %pred.load.if17 ] %37 = extractelement <4 x i1> %6, i64 2 br i1 %37, label %pred.load.if19, label %pred.load.continue20 pred.load.if19: ; preds = %pred.load.continue18 %next.gep10 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_x, i64 2, i32 0 %next.gep6 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_a, i64 2, i32 0 %38 = load i16, i16* %next.gep6, align 2, !tbaa !3 %39 = insertelement <4 x i16> %33, i16 %38, i64 2 %40 = load i16, i16* %next.gep10, align 2, !tbaa !3 %41 = insertelement <4 x i16> %34, i16 %40, i64 2 %42 = getelementptr inbounds i16, i16* %next.gep6, i64 1 %43 = load i16, i16* %42, align 2, !tbaa !3 %44 = insertelement <4 x i16> %35, i16 %43, i64 2 %45 = getelementptr inbounds i16, i16* %next.gep10, i64 1 %46 = load i16, i16* %45, align 2, !tbaa !3 %47 = insertelement <4 x i16> %36, i16 %46, i64 2 br label %pred.load.continue20 pred.load.continue20: ; preds = %pred.load.if19, %pred.load.continue18 %48 = phi <4 x i16> [ %33, %pred.load.continue18 ], [ %39, %pred.load.if19 ] %49 = phi <4 x i16> [ %34, %pred.load.continue18 ], [ %41, %pred.load.if19 ] %50 = phi <4 x i16> [ %35, %pred.load.continue18 ], [ %44, %pred.load.if19 ] %51 = phi <4 x i16> [ %36, %pred.load.continue18 ], [ %47, %pred.load.if19 ] %52 = extractelement <4 x i1> %6, i64 3 br i1 %52, label %pred.load.if21, label %pred.load.continue22 pred.load.if21: ; preds = %pred.load.continue20 %next.gep11 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_x, i64 3, i32 0 %next.gep7 = getelementptr %struct.int16likething, %struct.int16likething* %p_src_a, i64 3, i32 0 %53 = load i16, i16* %next.gep7, align 2, !tbaa !3 %54 = insertelement <4 x i16> %48, i16 %53, i64 3 %55 = load i16, i16* %next.gep11, align 2, !tbaa !3 %56 = insertelement <4 x i16> %49, i16 %55, i64 3 %57 = getelementptr inbounds i16, i16* %next.gep7, i64 1 %58 = load i16, i16* %57, align 2, !tbaa !3 %59 = insertelement <4 x i16> %50, i16 %58, i64 3 %60 = getelementptr inbounds i16, i16* %next.gep11, i64 1 %61 = load i16, i16* %60, align 2, !tbaa !3 %62 = insertelement <4 x i16> %51, i16 %61, i64 3 br label %pred.load.continue22 pred.load.continue22: ; preds = %pred.load.if21, %pred.load.continue20 %63 = phi <4 x i16> [ %48, %pred.load.continue20 ], [ %54, %pred.load.if21 ] %64 = phi <4 x i16> [ %49, %pred.load.continue20 ], [ %56, %pred.load.if21 ] %65 = phi <4 x i16> [ %50, %pred.load.continue20 ], [ %59, %pred.load.if21 ] %66 = phi <4 x i16> [ %51, %pred.load.continue20 ], [ %62, %pred.load.if21 ] %67 = zext <4 x i16> %63 to <4 x i32> %68 = zext <4 x i16> %64 to <4 x i32> %69 = add nuw nsw <4 x i32> %68, <i32 1, i32 1, i32 1, i32 1> %70 = mul nuw <4 x i32> %69, %67 %71 = zext <4 x i32> %70 to <4 x i64> %72 = zext <4 x i16> %65 to <4 x i32> %73 = add nuw nsw <4 x i32> %68, <i32 2, i32 2, i32 2, i32 2> %74 = mul nuw <4 x i32> %73, %72 %75 = zext <4 x i32> %74 to <4 x i64> %76 = zext <4 x i16> %66 to <4 x i32> %77 = add nuw nsw <4 x i32> %76, <i32 1, i32 1, i32 1, i32 1> %78 = mul nuw <4 x i32> %77, %72 %79 = zext <4 x i32> %78 to <4 x i64> %80 = sub nsw <4 x i64> zeroinitializer, %79 %81 = add nuw nsw <4 x i32> %76, <i32 2, i32 2, i32 2, i32 2> %82 = mul nuw <4 x i32> %81, %67 %83 = zext <4 x i32> %82 to <4 x i64> %84 = select <4 x i1> %6, <4 x i64> %80, <4 x i64> zeroinitializer %85 = select <4 x i1> %6, <4 x i64> %83, <4 x i64> zeroinitializer %86 = select <4 x i1> %6, <4 x i64> %75, <4 x i64> zeroinitializer %87 = select <4 x i1> %6, <4 x i64> %71, <4 x i64> zeroinitializer %88 = tail call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %84) %89 = tail call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %85) %90 = tail call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %86) %91 = tail call i64 @llvm.vector.reduce.add.v4i64(<4 x i64> %87) %92 = add i64 %91, %88 %93 = add i64 %90, %89 %phi.cast = trunc i64 %92 to i16 %phi.cast91 = trunc i64 %93 to i16 br label %while.end while.end: ; preds = %pred.load.continue22, %if.then %add32 = phi i16 [ 0, %if.then ], [ %phi.cast, %pred.load.continue22 ] %add33 = phi i16 [ 0, %if.then ], [ %phi.cast91, %pred.load.continue22 ] %re = getelementptr inbounds %struct.int16likething, %struct.int16likething* %p_dst, i64 0, i32 0 store i16 %add32, i16* %re, align 2, !tbaa !7 %im = getelementptr inbounds %struct.int16likething, %struct.int16likething* %p_dst, i64 0, i32 1 store i16 %add33, i16* %im, align 2, !tbaa !9 br label %if.end if.end: ; preds = %while.end, %entry ret i32 0 } ; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>) #1 attributes #0 = { nofree norecurse nosync nounwind uwtable "approx-func-fp-math"="true" "denormal-fp-math"="preserve-sign,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" "frame-pointer"="none" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="skylake" "target-features"="+adx,+aes,+avx,+avx2,+bmi,+bmi2,+clflushopt,+crc32,+cx16,+cx8,+f16c,+fma,+fsgsbase,+fxsr,+invpcid,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prfchw,+rdrnd,+rdseed,+sahf,+sgx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsavec,+xsaveopt,+xsaves" "unsafe-fp-math"="true" } attributes #1 = { mustprogress nofree nosync nounwind readnone willreturn } !llvm.module.flags = !{!0, !1} !llvm.ident = !{!2} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 7, !"uwtable", i32 1} !2 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project 3fd30958b79293f64545c7328c58982f959feb51)"} !3 = !{!4, !4, i64 0} !4 = !{!"short", !5, i64 0} !5 = !{!"omnipotent char", !6, i64 0} !6 = !{!"Simple C/C++ TBAA"} !7 = !{!8, !4, i64 0} !8 = !{!"", !4, i64 0, !4, i64 2} !9 = !{!8, !4, i64 2}
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
About the author
Statistics
Changelog
Version tree