ldbits.ssa 637 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # unit tests for load elimination
  2. export
  3. function $tests() {
  4. @start
  5. %p =l alloc8 16
  6. %p3 =l add %p, 3
  7. %p4 =l add %p, 4
  8. %p6 =l add %p, 6
  9. %p8 =l add %p, 8
  10. @test1
  11. storew 1, $a
  12. storel 1311768467139281697, %p
  13. storeh 255, %p8
  14. %x1 =w load %p6
  15. %c1 =w cnew %x1, 16716340
  16. jnz %c1, @fail, @test2
  17. @test2
  18. storew 2, $a
  19. %x2 =w loadub %p3
  20. %c2 =w cnew %x2, 135
  21. jnz %c2, @fail, @test3
  22. @test3
  23. storew 3, $a
  24. storew 2864434397, %p8
  25. %x3 =l load %p3
  26. %c3 =w cnel %x3, -4914310023110821753
  27. jnz %c3, @fail, @test4
  28. @test4
  29. @ok
  30. storew 0, $a
  31. @fail
  32. ret
  33. }
  34. # >>> driver
  35. # extern void tests(void);
  36. # int a;
  37. # int main() { tests(); return a; }
  38. # <<<