abi6.ssa 845 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # test arm64's hfa
  2. data $dfmt = { b "double: %g\n", b 0 }
  3. type :hfa3 = { s, s, s }
  4. export
  5. function $f(:hfa3 %h1, :hfa3 %h2, d %d1, :hfa3 %h3, d %d2) {
  6. # the first three parameters should be in 7 registers
  7. # the last two should be on the stack
  8. @start
  9. call $phfa3(:hfa3 %h1)
  10. call $phfa3(:hfa3 %h2)
  11. call $phfa3(:hfa3 %h3)
  12. call $printf(l $dfmt, ..., d %d1)
  13. call $printf(l $dfmt, ..., d %d2)
  14. ret
  15. }
  16. # >>> driver
  17. # #include <stdio.h>
  18. # typedef struct { float f1, f2, f3; } hfa3;
  19. # void f(hfa3, hfa3, double, hfa3, double);
  20. # void phfa3(hfa3 h) { printf("{ %g, %g, %g }\n", h.f1, h.f2, h.f3); }
  21. # int main() {
  22. # hfa3 h1={1,2,3}, h2={2,3,4}, h3={3,4,5};
  23. # f(h1, h2, 1, h3, 2);
  24. # }
  25. # <<<
  26. # >>> output
  27. # { 1, 2, 3 }
  28. # { 2, 3, 4 }
  29. # { 3, 4, 5 }
  30. # double: 1
  31. # double: 2
  32. # <<<