commit 44329afff582b3e6a45421cf8b29e1bb98f2ed5b
parent 29c5f508b9039af15f0485fb3555304f680e5f99
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sun, 9 Aug 2015 19:34:20 -0400
add funny little max ssa test
Diffstat:
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/lisc/test/max.ssa b/lisc/test/max.ssa
@@ -0,0 +1,25 @@
+# find the maximum value
+# in a nul-terminated array
+# of unsigned bytes
+#
+# b input array
+# a output max
+
+@start
+@loop
+ %max =w phi @start -1, @new %byt, @old %max
+ %id0 =l phi @start 0, @new %id1, @old %id1
+ %loc =l add $b, %id0
+ %byt =w loadub %loc
+ %id1 =l add 1, %id0
+ jnz %byt, @iter, @end
+@iter
+ %cmp =w csle %max, %byt
+ jnz %cmp, @new, @old
+@new
+ jmp @loop
+@old
+ jmp @loop
+@end
+ store %max, $a
+ ret