qbe

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

fold1.ssa (682B)


      1 export
      2 function w $f1() {
      3 @start
      4 	%x =w sar 2147483648, 31
      5 	ret %x
      6 }
      7 
      8 export
      9 function w $f2() {
     10 @start
     11 	%x =w div 4294967040, 8  # -256 / 8
     12 	ret %x
     13 }
     14 
     15 export
     16 function w $f3() {
     17 @start
     18 	%x =w rem 4294967284, 7  # -12 % 7
     19 	ret %x
     20 }
     21 
     22 export
     23 function w $f4() {
     24 @start
     25 	%x =w shr 4294967296, 1  # 2^32 >> 1
     26 	ret %x
     27 }
     28 
     29 export
     30 function w $f5() {
     31 @start
     32 	%x =w udiv 1, 4294967297  # 1 / (2^32 + 1)
     33 	ret %x
     34 }
     35 
     36 export
     37 function w $f6() {
     38 @start
     39 	%x =w urem 4294967296, 7  # 2^32 % 7
     40 	ret %x
     41 }
     42 
     43 # >>> driver
     44 # extern int f1(), f2(), f3(), f4(), f5(), f6();
     45 # int main() { return !(f1() == -1 && f2() == -32 && f3() == -5 &&
     46 #                       f4() == 0 && f5() == 1 && f6() == 0); }
     47 # <<<