From 44329afff582b3e6a45421cf8b29e1bb98f2ed5b Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 9 Aug 2015 19:34:20 -0400 Subject: add funny little max ssa test --- lisc/test/max.ssa | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lisc/test/max.ssa (limited to 'lisc/test') diff --git a/lisc/test/max.ssa b/lisc/test/max.ssa new file mode 100644 index 0000000..d5e1d4c --- /dev/null +++ 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 -- cgit 1.4.1