diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-07 22:11:43 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-15 23:01:33 -0400 |
commit | a1b3e82dc9290b604151fed3682618bc09fca9cc (patch) | |
tree | 999ee363a73790a983dc51e1f5f5299178456b19 | |
parent | 87ab8941edb69a84979068fe74718f8a12b43262 (diff) | |
download | roux-a1b3e82dc9290b604151fed3682618bc09fca9cc.tar.gz |
turn test files in one function definition
-rw-r--r-- | lisc/test/align.ssa | 4 | ||||
-rw-r--r-- | lisc/test/alt.ssa | 12 | ||||
-rw-r--r-- | lisc/test/collatz.ssa | 26 | ||||
-rw-r--r-- | lisc/test/cprime.ssa | 36 | ||||
-rw-r--r-- | lisc/test/cup.ssa | 8 | ||||
-rw-r--r-- | lisc/test/eucl.ssa | 8 | ||||
-rw-r--r-- | lisc/test/fix1.ssa | 12 | ||||
-rw-r--r-- | lisc/test/fix2.ssa | 12 | ||||
-rw-r--r-- | lisc/test/live.ssa | 12 | ||||
-rw-r--r-- | lisc/test/loop.ssa | 8 | ||||
-rw-r--r-- | lisc/test/max.ssa | 14 | ||||
-rw-r--r-- | lisc/test/prime.ssa | 14 | ||||
-rw-r--r-- | lisc/test/rpo.ssa | 12 | ||||
-rw-r--r-- | lisc/test/spill.ssa | 4 | ||||
-rw-r--r-- | lisc/test/spill1.ssa | 4 | ||||
-rw-r--r-- | lisc/test/spill2.ssa | 10 |
16 files changed, 114 insertions, 82 deletions
diff --git a/lisc/test/align.ssa b/lisc/test/align.ssa index a94d668..9c0cc61 100644 --- a/lisc/test/align.ssa +++ b/lisc/test/align.ssa @@ -1,4 +1,5 @@ -@start +function $test { + @start %x =l alloc16 16 %y =l add %x, 8 %m =w rem %y, 16 @@ -6,3 +7,4 @@ %n =w load %y storew %n, $a ret +} diff --git a/lisc/test/alt.ssa b/lisc/test/alt.ssa index f96ecc2..a21ae9c 100644 --- a/lisc/test/alt.ssa +++ b/lisc/test/alt.ssa @@ -2,22 +2,24 @@ # flow graph that exposes poor # handling of looping constructs -@start +function $test { + @start %ten =w copy 10 %dum =w copy 0 # dummy live-through temporary -@loop + @loop %alt =w phi @start 0, @left %alt1, @right %alt1 %cnt =w phi @start 100, @left %cnt, @right %cnt1 %alt1 =w sub 1, %alt jnz %alt1, @right, @left -@left + @left %x =w phi @loop 10, @left %x1 %x1 =w sub %x, 1 %z =w copy %x jnz %z, @left, @loop -@right + @right %cnt1 =w sub %cnt, %ten jnz %cnt1, @loop, @end -@end + @end %ret =w add %cnt, %dum ret +} diff --git a/lisc/test/collatz.ssa b/lisc/test/collatz.ssa index f111db3..34aa953 100644 --- a/lisc/test/collatz.ssa +++ b/lisc/test/collatz.ssa @@ -3,39 +3,40 @@ # we use a fast local array to # memoize small collatz numbers -@start +function $test { + @start %mem =l alloc4 4000 -@loop + @loop %n =w phi @start 1, @newm %n9, @oldm %n9 %cmax =w phi @start 0, @newm %c, @oldm %cmax %fin =w cslt %n, 1000 jnz %fin, @cloop, @end -@cloop + @cloop %n0 =w phi @loop %n, @odd %n2, @even %n3 %c0 =w phi @loop 0, @odd %c1, @even %c1 %no1 =w cne %n0, 1 jnz %no1, @iter0, @endcl -@iter0 + @iter0 %ism =w cslt %n0, %n jnz %ism, @getmemo, @iter1 -@iter1 + @iter1 %c1 =w add %c0, 1 %p =w and %n0, 1 jnz %p, @odd, @even -@odd + @odd %n1 =w mul 3, %n0 %n2 =w add %n1, 1 jmp @cloop -@even + @even %n3 =w div %n0, 2 jmp @cloop -@getmemo # get the count for n0 in mem + @getmemo # get the count for n0 in mem %n0l =l sext %n0 %idx0 =l mul %n0l, 4 %loc0 =l add %idx0, %mem %cn0 =w load %loc0 %c2 =w add %c0, %cn0 -@endcl # store the count for n in mem + @endcl # store the count for n in mem %c =w phi @getmemo %c2, @cloop %c0 %nl =l sext %n %idx1 =l mul %nl, 4 @@ -44,10 +45,11 @@ %n9 =w add 1, %n %big =w csle %cmax, %c jnz %big, @newm, @oldm -@newm + @newm jmp @loop -@oldm + @oldm jmp @loop -@end + @end storew %cmax, $a ret +} diff --git a/lisc/test/cprime.ssa b/lisc/test/cprime.ssa index 9b953c4..1f8e972 100644 --- a/lisc/test/cprime.ssa +++ b/lisc/test/cprime.ssa @@ -2,7 +2,8 @@ # compiler from the C program # following in comments -@start +function $test { + @start %v0 =l alloc8 4 %v1 =l alloc8 4 %v2 =l alloc8 4 @@ -11,71 +12,72 @@ storew 5, %v1 storew 11, %v2 storew 12, %v3 -@L0 + @L0 %v5 =w load %v1 %v6 =w cne %v5, 10001 jnz %v6, @L8, @L1 -@L8 + @L8 storew 1, %v4 %v7 =w load %v3 %v8 =w rem %v7, 2 %v9 =w ceq %v8, 0 jnz %v9, @L9, @L5 -@L9 + @L9 storew 0, %v4 -@L5 + @L5 storew 3, %v0 -@L2 + @L2 %v10 =w load %v0 %v11 =w load %v3 %v12 =w cslt %v10, %v11 jnz %v12, @L10, @L3 -@L10 + @L10 %v13 =w load %v3 %v14 =w load %v0 %v15 =w rem %v13, %v14 %v16 =w ceq %v15, 0 jnz %v16, @L11, @L4 -@L11 + @L11 storew 0, %v4 jmp @L3 -@L4 + @L4 %v17 =w load %v0 %v18 =w add %v17, 2 storew %v18, %v0 jmp @L2 -@L3 + @L3 %v19 =w load %v4 jnz %v19, @L12, @L6 -@L12 + @L12 %v20 =w load %v3 storew %v20, %v2 %v21 =w load %v1 %v22 =w add %v21, 1 storew %v22, %v1 -@L6 + @L6 %v23 =w load %v3 %v24 =w add %v23, 1 storew %v24, %v3 jmp @L0 -@L1 + @L1 %v25 =w load %v2 %v26 =w cne %v25, 104743 jnz %v26, @L13, @L7 -@L13 + @L13 storew 1, $a ret -@L7 + @L7 storew 0, $a ret -@end + @end ret +} # int # main() # { # int i, n, p, next, isprime; -# +# # n = 5; # p = 11; # next = 12; diff --git a/lisc/test/cup.ssa b/lisc/test/cup.ssa index 184b861..f28a45f 100644 --- a/lisc/test/cup.ssa +++ b/lisc/test/cup.ssa @@ -1,10 +1,12 @@ # counts up from -1988 to 1991 -@start -@loop +function $test { + @start + @loop %n0 =l phi @start -1988, @loop %n1 %n1 =l add 1, %n0 %cmp =l csle 1991, %n1 jnz %cmp, @end, @loop -@end + @end ret +} diff --git a/lisc/test/eucl.ssa b/lisc/test/eucl.ssa index 25a2a0d..6a85bc3 100644 --- a/lisc/test/eucl.ssa +++ b/lisc/test/eucl.ssa @@ -3,14 +3,16 @@ # ssa program because of the # swap of b and a -@start +function $test { + @start -@loop + @loop %a =w phi @start 380, @loop %r %b =w phi @start 747, @loop %a %r =w rem %b, %a jnz %r, @loop, @end -@end + @end storew %a, $a ret +} diff --git a/lisc/test/fix1.ssa b/lisc/test/fix1.ssa index 61b6395..d0695c9 100644 --- a/lisc/test/fix1.ssa +++ b/lisc/test/fix1.ssa @@ -1,13 +1,15 @@ -@start +function $test { + @start %x =w copy 1 -@loop + @loop jnz %x, @noz, @isz -@noz + @noz %x =w copy 0 jmp @end -@isz + @isz %x =w copy 1 jmp @loop -@end + @end %z =w add 10, %x ret +} diff --git a/lisc/test/fix2.ssa b/lisc/test/fix2.ssa index 94f1573..5ffbd28 100644 --- a/lisc/test/fix2.ssa +++ b/lisc/test/fix2.ssa @@ -1,13 +1,15 @@ -@start +function $test { + @start %x =w copy 1 -@loop + @loop jnz %x, @noz, @isz -@noz + @noz %x =w copy 0 jnz %x, @loop, @end -@isz + @isz %x =w copy 1 jmp @loop -@end + @end %z =w add 10, %x ret +} diff --git a/lisc/test/live.ssa b/lisc/test/live.ssa index 8513fc4..03e95e8 100644 --- a/lisc/test/live.ssa +++ b/lisc/test/live.ssa @@ -5,15 +5,17 @@ # # nothing should ever be live at the entry -@start +function $test { + @start %b =w copy 0 %x =w copy 10 jnz 0, @loop, @left -@left + @left jmp @inloop -@loop + @loop %x1 =w add %x, 1 -@inloop + @inloop %b1 =w add %b, 1 -@endloop + @endloop jmp @loop +} diff --git a/lisc/test/loop.ssa b/lisc/test/loop.ssa index 7fb70a7..831fcd7 100644 --- a/lisc/test/loop.ssa +++ b/lisc/test/loop.ssa @@ -1,14 +1,16 @@ # simple looping program # sums all integers from 100 to 0 -@start +function $test { + @start -@loop + @loop %s =w phi @start 100, @loop %s1 %n =w phi @start 0, @loop %n1 %n1 =w sub %n, 1 %s1 =w add %s, %n jnz %n1, @loop, @end -@end + @end ret +} diff --git a/lisc/test/max.ssa b/lisc/test/max.ssa index 7f97de0..e2a5c87 100644 --- a/lisc/test/max.ssa +++ b/lisc/test/max.ssa @@ -5,20 +5,22 @@ # b input array # a output max -@start -@loop +function $test { + @start + @loop %max =w phi @start -1, @new %byt, @old %max %loc =l phi @start $b, @new %loc1, @old %loc1 %byt =w loadub %loc %loc1 =l add 1, %loc jnz %byt, @iter, @end -@iter + @iter %cmp =w csle %max, %byt jnz %cmp, @new, @old -@new + @new jmp @loop -@old + @old jmp @loop -@end + @end storew %max, $a ret +} diff --git a/lisc/test/prime.ssa b/lisc/test/prime.ssa index fd0b05f..673fbab 100644 --- a/lisc/test/prime.ssa +++ b/lisc/test/prime.ssa @@ -1,24 +1,26 @@ # find the 10,001st prime # store it in a -@start -@loop +function $test { + @start + @loop %n =w phi @start 5, @tloop %n, @yes %n1 %p =w phi @start 13, @tloop %p1, @yes %p1 %p1 =w add %p, 2 -@tloop + @tloop %t =w phi @loop 3, @next %t1 %r =w rem %p, %t jnz %r, @next, @loop -@next + @next %t1 =w add 2, %t %tsq =w mul %t1, %t1 %c0 =w csgt %tsq, %p jnz %c0, @yes, @tloop -@yes + @yes %n1 =w add 1, %n %c1 =w ceq 10001, %n1 jnz %c1, @end, @loop -@end + @end storew %p, $a ret +} diff --git a/lisc/test/rpo.ssa b/lisc/test/rpo.ssa index 1b63ab7..4d454dd 100644 --- a/lisc/test/rpo.ssa +++ b/lisc/test/rpo.ssa @@ -1,10 +1,12 @@ -@start +function $test { + @start jmp @foo -@baz + @baz jnz 1, @end, @foo -@bar + @bar jmp @end -@foo + @foo jnz 0, @bar, @baz -@end + @end ret +} diff --git a/lisc/test/spill.ssa b/lisc/test/spill.ssa index a504c52..ae4b935 100644 --- a/lisc/test/spill.ssa +++ b/lisc/test/spill.ssa @@ -9,7 +9,8 @@ # spill # -@start +function $test { + @start %f =w copy 0 # here %b =w copy 1 %c =w copy 2 @@ -18,3 +19,4 @@ %e =w copy %f # and there %g =w copy %a ret +} diff --git a/lisc/test/spill1.ssa b/lisc/test/spill1.ssa index 9dc5213..c9d8501 100644 --- a/lisc/test/spill1.ssa +++ b/lisc/test/spill1.ssa @@ -1,6 +1,7 @@ # stupid spilling test -@start +function $test { + @start %x1 =w copy 10 %x2 =w add %x1, %x1 %x3 =w sub %x2, %x1 @@ -18,3 +19,4 @@ %x15 =w sub %x14, %x2 %x16 =w add %x15, %x1 ret +} diff --git a/lisc/test/spill2.ssa b/lisc/test/spill2.ssa index b312295..75bfe07 100644 --- a/lisc/test/spill2.ssa +++ b/lisc/test/spill2.ssa @@ -4,11 +4,12 @@ # run with NReg == 3, or # adapt it! -@start +function $test { + @start %a =w copy 0 %b =w copy 0 -@loop + @loop %c =w phi @start 0, @loop %f %d =w phi @start 0, @loop %g %e =w phi @start 0, @loop %h @@ -17,6 +18,7 @@ %h =w add %e, %d %x =w csle %a, %b jnz %x, @loop, @end -@end - ret + @end + ret +} |