qbe

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

abi6.ssa (845B)


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