daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ModuleID = 'llvm-link'
  2. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  3. target triple = "x86_64-unknown-linux-gnu"
  4.  
  5. @ptr = global i32 0, align 4
  6. @outbuf = common global [16 x i32] zeroinitializer, align 16
  7. @STATE = common global [16 x i32] zeroinitializer, align 16
  8. @0 = private unnamed_addr constant [5 x i8] c"load\00"
  9.  
  10. ; Function Attrs: nounwind uwtable
  11. define void @salsa20(i32* %out, i32* %in) #0 {
  12. entry:
  13.   %x = alloca [16 x i32], align 16
  14.   br label %for.cond
  15.  
  16. for.cond:                                         ; preds = %for.inc, %entry
  17.   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
  18.   %cmp = icmp ult i32 %i.0, 16
  19.   br i1 %cmp, label %for.body, label %for.end
  20.  
  21. for.body:                                         ; preds = %for.cond
  22.   %idxprom = zext i32 %i.0 to i64
  23.   %arrayidx = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 %idxprom
  24.   store i32 %i.0, i32* %arrayidx, align 4
  25.   br label %for.inc
  26.  
  27. for.inc:                                          ; preds = %for.body
  28.   %inc = add i32 %i.0, 1
  29.   br label %for.cond
  30.  
  31. for.end:                                          ; preds = %for.cond
  32.   %arrayidx1 = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 0
  33.   call void @count_instruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @0, i32 0, i32 0))
  34.   %0 = load i32, i32* %arrayidx1, align 16
  35.   %arrayidx2 = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 12
  36.   call void @count_instruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @0, i32 0, i32 0))
  37.   %1 = load i32, i32* %arrayidx2, align 16
  38.   %add = add i32 %0, %1
  39.   %shl = shl i32 %add, 7
  40.   %arrayidx3 = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 0
  41.   call void @count_instruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @0, i32 0, i32 0))
  42.   %2 = load i32, i32* %arrayidx3, align 16
  43.   %arrayidx4 = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 12
  44.   call void @count_instruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @0, i32 0, i32 0))
  45.   %3 = load i32, i32* %arrayidx4, align 16
  46.   %add5 = add i32 %2, %3
  47.   %shr = lshr i32 %add5, 25
  48.   %or = or i32 %shl, %shr
  49.   %arrayidx6 = getelementptr inbounds [16 x i32], [16 x i32]* %x, i64 0, i64 4
  50.   call void @count_instruction(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @0, i32 0, i32 0))
  51.   %4 = load i32, i32* %arrayidx6, align 16
  52.   %xor = xor i32 %4, %or
  53.   store i32 %xor, i32* %arrayidx6, align 16
  54.   ret void
  55. }
  56.  
  57. declare void @count_instruction(i8*)
  58.  
  59. ; Function Attrs: nounwind uwtable
  60. define i32 @salsa() #0 {
  61. entry:
  62.   %0 = load i32, i32* @ptr, align 4
  63.   %cmp = icmp eq i32 %0, 0
  64.   br i1 %cmp, label %if.then, label %if.end
  65.  
  66. if.then:                                          ; preds = %entry
  67.   call void @salsa20(i32* getelementptr inbounds ([16 x i32], [16 x i32]* @outbuf, i32 0, i32 0), i32* getelementptr inbounds ([16 x i32], [16 x i32]* @STATE, i32 0, i32 0))
  68.   %1 = load i32, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @STATE, i64 0, i64 0), align 16
  69.   %inc = add i32 %1, 1
  70.   store i32 %inc, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @STATE, i64 0, i64 0), align 16
  71.   %conv = zext i32 %1 to i64
  72.   br label %if.end
  73.  
  74. if.end:                                           ; preds = %if.then, %entry
  75.   %2 = load i32, i32* @ptr, align 4
  76.   %add = add i32 %2, 1
  77.   %and = and i32 %add, 15
  78.   store i32 %and, i32* @ptr, align 4
  79.   %3 = load i32, i32* @ptr, align 4
  80.   %idxprom = zext i32 %3 to i64
  81.   %arrayidx = getelementptr inbounds [16 x i32], [16 x i32]* @outbuf, i64 0, i64 %idxprom
  82.   %4 = load i32, i32* %arrayidx, align 4
  83.   ret i32 %4
  84. }
  85.  
  86. ; Function Attrs: nounwind uwtable
  87. define i32 @main() #0 {
  88. entry:
  89.   call void @salsa20(i32* getelementptr inbounds ([16 x i32], [16 x i32]* @outbuf, i32 0, i32 0), i32* getelementptr inbounds ([16 x i32], [16 x i32]* @STATE, i32 0, i32 0))
  90.   call void @dump_csv()
  91.   ret i32 0
  92. }
  93.  
  94. declare void @dump_csv()
  95.  
  96. attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
  97.  
  98. !llvm.ident = !{!0}
  99.  
  100. !0 = !{!"clang version 3.8.0 (tags/RELEASE_380/final 337191)"}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top