abi2.ssa 413 B

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