qbe

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

abi2.ssa (413B)


      1 type :fps = { s, b, s }
      2 
      3 export
      4 function s $sum(:fps %p) {
      5 @start
      6 	%f1 =s load %p
      7 	%p8 =l add 8, %p
      8 	%f2 =s load %p8
      9 	%s =s add %f1, %f2
     10 	ret %s
     11 }
     12 
     13 # >>> driver
     14 # typedef struct { float f1; char b; float f2; } fps;
     15 # extern float sum(fps);
     16 # int main() { fps x = { 1.23, -1, 2.34 }; return !(sum(x) == 1.23f+2.34f); }
     17 # /* Note the f suffixes above are important
     18 #  * otherwise C does double operations. */
     19 # <<<