summary refs log tree commit diff
path: root/lisc/test
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-23 17:44:38 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-30 13:20:42 -0400
commit47a34dbd510ff890c4016d12ec8fbeaf5ae6e9c3 (patch)
tree4ed6b8e83e269dc48fafe5701a552c03c853651c /lisc/test
parent6d264a2594d286fb513ff89afc6b984033ee4cda (diff)
downloadroux-47a34dbd510ff890c4016d12ec8fbeaf5ae6e9c3.tar.gz
turn sum.ssa more C style
Diffstat (limited to 'lisc/test')
-rw-r--r--lisc/test/sum.ssa9
1 files changed, 4 insertions, 5 deletions
diff --git a/lisc/test/sum.ssa b/lisc/test/sum.ssa
index 0f8a793..3578dd7 100644
--- a/lisc/test/sum.ssa
+++ b/lisc/test/sum.ssa
@@ -2,19 +2,18 @@
 
 function w $sum(l %arr, w %num) {
 @start
-	%n0 =w sub %num, 1
 @loop
-	%n1 =w phi @start %n0, @loop1 %n2
+	%n1 =w phi @start %num, @loop1 %n2
 	%s0 =w phi @start 0, @loop1 %s1
-	%c =w cslt %n1, 0
+	%n2 =w sub %n1, 1
+	%c =w csle %n1, 0
 	jnz %c, @end, @loop1
 @loop1
-	%idx0 =l extuw %n1
+	%idx0 =l extuw %n2
 	%idx1 =l mul 4, %idx0
 	%idx2 =l add %idx1, %arr
 	%w =w loadw %idx2
 	%s1 =w add %w, %s0
-	%n2 =w sub %n1, 1
 	jmp @loop
 @end
 	ret %s0