load3.ssa 685 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # regression test for load()
  2. # see comment below
  3. function w $rand() {
  4. @start
  5. ret 0
  6. }
  7. function w $chk(w %a, w %b) {
  8. @start
  9. %ok =w ceqw %a, 1
  10. %ok1 =w ceqw %b, 0
  11. %ok2 =w and %ok, %ok1
  12. %ret =w xor %ok2, 1
  13. ret %ret
  14. }
  15. export
  16. function w $main() {
  17. @start
  18. %s0 =l alloc4 8
  19. %s1 =l alloc4 8
  20. storew 1, %s0
  21. %s04 =l add 4, %s0
  22. storew 0, %s04
  23. %rnd =w call $rand()
  24. jnz %rnd, @tt, @ff
  25. @tt
  26. jmp @blit
  27. @ff
  28. jmp @blit
  29. @blit
  30. # we make sure def() checks
  31. # offsets correctly when
  32. # processing inserted phis;
  33. # if not, %w1 will bogusly
  34. # have the same value as %w0
  35. blit %s0, %s1, 8
  36. %w0 =w load %s1
  37. %s14 =l add 4, %s1
  38. %w1 =w load %s14
  39. %ret =w call $chk(w %w0, w %w1)
  40. ret %ret
  41. }