[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 15/20: Add test for JIT callee with many args
From: |
Andy Wingo |
Subject: |
[Guile-commits] 15/20: Add test for JIT callee with many args |
Date: |
Sun, 28 Apr 2019 07:54:21 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit d8bdefbd2f5c5f7a8fa66aa6219dc0d06c3e899a
Author: Andy Wingo <address@hidden>
Date: Sat Apr 27 23:11:13 2019 +0200
Add test for JIT callee with many args
---
tests/callee_9.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/tests/callee_9.c b/tests/callee_9.c
new file mode 100644
index 0000000..b7f1a46
--- /dev/null
+++ b/tests/callee_9.c
@@ -0,0 +1,68 @@
+#include "test.h"
+
+struct args
+{
+ int8_t a;
+ int16_t b;
+ int32_t c;
+ jit_word_t d;
+ uint16_t e;
+ float f;
+ double g;
+ float h;
+};
+
+static void
+run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
+{
+ jit_begin(j, arena_base, arena_size);
+ size_t align = jit_enter_jit_abi(j, 3, 0, 0);
+
+ jit_operand_t args[9] = {
+ jit_operand_gpr(JIT_OPERAND_ABI_POINTER, JIT_R0),
+ jit_operand_gpr(JIT_OPERAND_ABI_INT8, JIT_R1),
+ jit_operand_gpr(JIT_OPERAND_ABI_INT16, JIT_R2),
+ jit_operand_gpr(JIT_OPERAND_ABI_INT32, JIT_V0),
+ jit_operand_gpr(JIT_OPERAND_ABI_WORD, JIT_V1),
+ jit_operand_gpr(JIT_OPERAND_ABI_UINT16, JIT_V2),
+ jit_operand_fpr(JIT_OPERAND_ABI_FLOAT, JIT_F0),
+ jit_operand_fpr(JIT_OPERAND_ABI_DOUBLE, JIT_F1),
+ jit_operand_fpr(JIT_OPERAND_ABI_FLOAT, JIT_F2),
+ };
+ jit_load_args(j, 9, args);
+ jit_stxi_c(j, offsetof(struct args, a), JIT_R0, JIT_R1); // a
+ jit_stxi_s(j, offsetof(struct args, b), JIT_R0, JIT_R2); // b
+ jit_stxi_i(j, offsetof(struct args, c), JIT_R0, JIT_V0); // c
+ jit_stxi(j, offsetof(struct args, d), JIT_R0, JIT_V1); // d
+ jit_stxi_s(j, offsetof(struct args, e), JIT_R0, JIT_V2); // e
+ jit_stxi_f(j, offsetof(struct args, f), JIT_R0, JIT_F0); // f
+ jit_stxi_d(j, offsetof(struct args, g), JIT_R0, JIT_F1); // g
+ jit_stxi_f(j, offsetof(struct args, h), JIT_R0, JIT_F2); // h
+
+ jit_leave_jit_abi(j, 3, 0, align);
+ jit_retr(j, JIT_R0);
+
+ size_t size = 0;
+ void* ret = jit_end(j, &size);
+
+ struct args* (*f)(struct args*, int8_t, int16_t, int32_t, jit_word_t,
+ uint16_t, float, double, float) = ret;
+
+ struct args in = { 0, 1, 2, 3, 4, 5, 6, 7 };
+ struct args out;
+ ASSERT(f(&out, in.a, in.b, in.c, in.d, in.e, in.f, in.g, in.h) == &out);
+ ASSERT(in.a == out.a);
+ ASSERT(in.b == out.b);
+ ASSERT(in.c == out.c);
+ ASSERT(in.d == out.d);
+ ASSERT(in.e == out.e);
+ ASSERT(in.f == out.f);
+ ASSERT(in.g == out.g);
+ ASSERT(in.h == out.h);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
- [Guile-commits] branch lightening updated (14e64a8 -> 51618e7), Andy Wingo, 2019/04/28
- [Guile-commits] 04/20: Use jit_word_t for register-sized values instead of intmax_t, Andy Wingo, 2019/04/28
- [Guile-commits] 19/20: Stack alignment takes saved return address into account, Andy Wingo, 2019/04/28
- [Guile-commits] 20/20: Merge from upstream lightening, Andy Wingo, 2019/04/28
- [Guile-commits] 18/20: Merge branch 'x86-32-ci' into 'master', Andy Wingo, 2019/04/28
- [Guile-commits] 16/20: Mark test files as precious to prevent them from being deleted by make, Andy Wingo, 2019/04/28
- [Guile-commits] 17/20: Add x86-32 tests to default test target, Andy Wingo, 2019/04/28
- [Guile-commits] 15/20: Add test for JIT callee with many args,
Andy Wingo <=
- [Guile-commits] 14/20: Add {enter,leave}_jit_abi calls in tests, Andy Wingo, 2019/04/28
- [Guile-commits] 09/20: Remove most __X64_32 code, Andy Wingo, 2019/04/28
- [Guile-commits] 10/20: Add facility to enter and leave JIT ABI, Andy Wingo, 2019/04/28
- [Guile-commits] 03/20: Fix lightening to compile on 32-bit x86, Andy Wingo, 2019/04/28
- [Guile-commits] 13/20: Fix ABI of arg to extr_d_f test, Andy Wingo, 2019/04/28
- [Guile-commits] 12/20: Fix jit_leave_jit_abi to pop correct registers, Andy Wingo, 2019/04/28
- [Guile-commits] 08/20: Simplify 64/32 concerns in x86-cpu.c, Andy Wingo, 2019/04/28
- [Guile-commits] 07/20: Make jit_cpu private, Andy Wingo, 2019/04/28
- [Guile-commits] 11/20: Small bug fixes for ia32, Andy Wingo, 2019/04/28
- [Guile-commits] 01/20: Inline some internal definitions into backend-specific files, Andy Wingo, 2019/04/28