summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2017-04-08 21:52:09 -0400
committerQuentin Carbonneaux <quentin@c9x.me>2017-04-08 22:10:01 -0400
commit5c5aaeb932d247e65ca64259ecf0873c7c5b7ad3 (patch)
tree4a6c8b9e302392ec94a38e727344edadbe3a64b2
parentf4ddc9e54ed589b8d168cd39ebf2a5572b32431b (diff)
downloadroux-5c5aaeb932d247e65ca64259ecf0873c7c5b7ad3.tar.gz
new abi test for arm64 HFAs
-rw-r--r--test/abi6.ssa38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/abi6.ssa b/test/abi6.ssa
new file mode 100644
index 0000000..b90bd34
--- /dev/null
+++ b/test/abi6.ssa
@@ -0,0 +1,38 @@
+# test arm64's hfa
+
+data $dfmt = { b "double: %g\n", b 0 }
+
+type :hfa3 = { s, s, s }
+
+export
+function $f(:hfa3 %h1, :hfa3 %h2, d %d1, :hfa3 %h3, d %d2) {
+        # the first three parameters should be in 7 registers
+        # the last two should be on the stack
+@start
+
+        call $phfa3(:hfa3 %h1)
+        call $phfa3(:hfa3 %h2)
+        call $phfa3(:hfa3 %h3)
+        call $printf(l $dfmt, d %d1)
+        call $printf(l $dfmt, d %d2)
+        ret
+}
+
+# >>> driver
+# #include <stdio.h>
+# typedef struct { float f1, f2, f3; } hfa3;
+# void f(hfa3, hfa3, double, hfa3, double);
+# void phfa3(hfa3 h) { printf("{ %g, %g, %g }\n", h.f1, h.f2, h.f3); }
+# int main() {
+#       hfa3 h1={1,2,3}, h2={2,3,4}, h3={3,4,5};
+#       f(h1, h2, 1, h3, 2);
+# }
+# <<<
+
+# >>> output
+# { 1, 2, 3 }
+# { 2, 3, 4 }
+# { 3, 4, 5 }
+# double: 1
+# double: 2
+# <<<