qbe

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

load2.ssa (1346B)


      1 # blit & load elimination
      2 
      3 export
      4 function $f() {
      5 @start
      6         %x =l alloc4 12
      7         %y =l alloc4 12
      8 
      9 	%x1 =l add 1, %x
     10 	%x2 =l add 1, %x1
     11 	%x3 =l add 1, %x2
     12 	%x4 =l add 1, %x3
     13 	%x5 =l add 1, %x4
     14 	%x6 =l add 1, %x5
     15 	%x7 =l add 1, %x6
     16 	%x8 =l add 1, %x7
     17 	%x9 =l add 1, %x8
     18 	%xa =l add 1, %x9
     19 	%xb =l add 1, %xa
     20 
     21 	%y1 =l add 1, %y
     22 	%y4 =l add 4, %y
     23 	
     24 	storew 287454020, %x4   # 0x11223344
     25 	storew 1432778632, %y   # 0x55667788
     26 	blit %y, %x5, 1
     27 	%n =w load %x4
     28 	call $px(w %n)          # 0x11228844
     29 
     30 	storew 287454020, %x4   # 0x11223344
     31 	storew 1432778632, %y   # 0x55667788
     32 	blit %y, %x5, 2
     33 	%n =w load %x4
     34 	call $px(w %n)          # 0x11778844
     35 
     36 	storew 287454020, %x4   # 0x11223344
     37 	storew 1432778632, %y   # 0x55667788
     38 	blit %y, %x5, 4
     39 	%n =w load %x4
     40 	call $px(w %n)          # 0x66778844
     41 
     42 	storew 287454020, %x4   # 0x11223344
     43 	storew 1432778632, %y   # 0x55667788
     44 	blit %y, %x2, 4
     45 	%n =w load %x4
     46 	call $px(w %n)          # 0x11225566
     47 
     48 	storew 287454020, %x4   # 0x11223344
     49 	storew 0, %y
     50 	storew 1432778632, %y4  # 0x55667788
     51 	blit %y1, %x2, 7
     52 	%n =w load %x4
     53 	call $px(w %n)          # 0x66778800
     54 
     55 	ret
     56 }
     57 
     58 # >>> driver
     59 # #include <stdio.h>
     60 # void px(unsigned n) {
     61 # 	printf("0x%08x\n", n);
     62 # }
     63 # int main() {
     64 # 	extern void f(void);
     65 # 	f();
     66 # }
     67 # <<<
     68 
     69 # >>> output
     70 # 0x11228844
     71 # 0x11778844
     72 # 0x66778844
     73 # 0x11225566
     74 # 0x66778800
     75 # <<<