diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-10-27 21:01:37 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-12-12 22:17:03 -0500 |
commit | 8d8d551df23b5055507c501e3396dcfe3c33af2d (patch) | |
tree | 7932bf91d9d17d17d954a425ab195820d3081578 /test | |
parent | 3f147ed2e078769a71b2935fc36cb08b2b0ddb67 (diff) | |
download | roux-8d8d551df23b5055507c501e3396dcfe3c33af2d.tar.gz |
new tests for the load optimization
Diffstat (limited to 'test')
-rw-r--r-- | test/ldbits.ssa | 40 | ||||
-rw-r--r-- | test/ldhoist.ssa | 21 |
2 files changed, 61 insertions, 0 deletions
diff --git a/test/ldbits.ssa b/test/ldbits.ssa new file mode 100644 index 0000000..5e54487 --- /dev/null +++ b/test/ldbits.ssa @@ -0,0 +1,40 @@ +# unit tests for load elimination + +export +function $tests() { +@start + %p =l alloc8 16 + %p3 =l add %p, 3 + %p4 =l add %p, 4 + %p6 =l add %p, 6 + %p8 =l add %p, 8 +@test1 + storew 1, $a + storel 1311768467139281697, %p + storeh 255, %p8 + %x1 =w load %p6 + %c1 =w cnew %x1, 16716340 + jnz %c1, @fail, @test2 +@test2 + storew 2, $a + %x2 =w loadub %p3 + %c2 =w cnew %x2, 135 + jnz %c2, @fail, @test3 +@test3 + storew 3, $a + storew 2864434397, %p8 + %x3 =l load %p3 + %c3 =w cnel %x3, -4914310023110821753 + jnz %c3, @fail, @test4 +@test4 +@ok + storew 0, $a +@fail + ret +} + +# >>> driver +# extern void tests(void); +# int a; +# int main() { tests(); return a; } +# <<< diff --git a/test/ldhoist.ssa b/test/ldhoist.ssa new file mode 100644 index 0000000..d4b1b64 --- /dev/null +++ b/test/ldhoist.ssa @@ -0,0 +1,21 @@ +# loads must not be unsafely hoisted + +export +function w $f(w %n, l %p) { +@start + %r =w copy 0 +@loop + %n =w sub %n, 1 + %c =w csgew %n, 0 + jnz %c, @loop1, @end +@loop1 + %r =w loadw %p + jmp @loop +@end + ret %r +} + +# >>> driver +# extern int f(int, int *); +# int main() { return f(0, 0); } +# <<< |