qbe

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

ldbits.ssa (637B)


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