qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

load3.ssa (685B)


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