Skip to content

Instantly share code, notes, and snippets.

@tmcdonell
Created February 24, 2014 22:37
Show Gist options
  • Save tmcdonell/9198757 to your computer and use it in GitHub Desktop.
Save tmcdonell/9198757 to your computer and use it in GitHub Desktop.
dotp.ll
; ModuleID = 'dotp.ll'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"
; Function Attrs: nounwind readonly ssp uwtable
define double @dotp(double* noalias nocapture readonly %xs, double* noalias nocapture readonly %ys, i32 %n) #0 {
entry:
%cmp5 = icmp sgt i32 %n, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%acc.06 = phi double [ %add, %for.body ], [ 0.000000e+00, %entry ]
%arrayidx = getelementptr inbounds double* %xs, i64 %indvars.iv
%0 = load double* %arrayidx, align 8
%arrayidx2 = getelementptr inbounds double* %ys, i64 %indvars.iv
%1 = load double* %arrayidx2, align 8
%mul = fmul fast double %0, %1
%add = fadd fast double %acc.06, %mul
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond = icmp eq i32 %lftr.wideiv, %n
br i1 %exitcond, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
%acc.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ]
ret double %acc.0.lcssa
}
attributes #0 = { nounwind readonly ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" }
!llvm.ident = !{!0}
!0 = metadata !{metadata !"clang version 3.4 (tags/RELEASE_34/final)"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment