[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 68/86: Add push/pop test
From: |
Andy Wingo |
Subject: |
[Guile-commits] 68/86: Add push/pop test |
Date: |
Wed, 3 Apr 2019 11:39:02 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit bf4d8b4a24930d5fc6f81af4ad09a6757a72193f
Author: Andy Wingo <address@hidden>
Date: Tue Mar 26 21:50:17 2019 +0100
Add push/pop test
---
tests/pushpop.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/tests/pushpop.c b/tests/pushpop.c
new file mode 100644
index 0000000..9a464c3
--- /dev/null
+++ b/tests/pushpop.c
@@ -0,0 +1,44 @@
+#include "test.h"
+
+static void
+run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
+{
+ const jit_gpr_t gpr[] = { JIT_R0, JIT_R1, JIT_R2, JIT_V0, JIT_V1, JIT_V2 };
+ const jit_fpr_t fpr[] = { JIT_F0, JIT_F1, JIT_F2 };
+
+ jit_begin(j, arena_base, arena_size);
+
+ const jit_arg_abi_t abi[] = { JIT_ARG_ABI_INTMAX };
+ jit_arg_t args[1];
+ const jit_anyreg_t regs[] = { { .gpr=JIT_R0 } };
+
+ jit_receive(j, 1, abi, args);
+ jit_load_args(j, 1, abi, args, regs);
+
+ for (int i=0; i<6; i++)
+ jit_pushr(j, gpr[i]);
+ for (int i=0; i<3; i++)
+ jit_pushr_d(j, fpr[i]);
+
+ // Stomple registers.
+ for (int i=0; i<6; i++)
+ jit_movi(j, gpr[i], 0xcabba9e5);
+ for (int i=0; i<3; i++)
+ jit_extr_d(j, fpr[i], gpr[i]);
+
+ for (int i=2; i>=0; i--)
+ jit_popr_d(j, fpr[i]);
+ for (int i=5; i>=0; i--)
+ jit_popr(j, gpr[i]);
+
+ jit_retr(j, JIT_R0);
+
+ intmax_t (*f)(intmax_t) = jit_end(j, NULL);
+ ASSERT(f(42) == 42);
+}
+
+int
+main (int argc, char *argv[])
+{
+ return main_helper(argc, argv, run_test);
+}
- [Guile-commits] 64/86: Add flag-checking test-and-branch tests, (continued)
- [Guile-commits] 64/86: Add flag-checking test-and-branch tests, Andy Wingo, 2019/04/03
- [Guile-commits] 69/86: Add abs/sqrt tests, Andy Wingo, 2019/04/03
- [Guile-commits] 67/86: Add some nop and jmp tests, and fix a hazard with jmpi/calli, Andy Wingo, 2019/04/03
- [Guile-commits] 62/86: Add anti-float comparison tests, Andy Wingo, 2019/04/03
- [Guile-commits] 51/86: Add str tests, Andy Wingo, 2019/04/03
- [Guile-commits] 58/86: Add bltr test, Andy Wingo, 2019/04/03
- [Guile-commits] 65/86: Add add-and-branch-on-overflow tests, Andy Wingo, 2019/04/03
- [Guile-commits] 59/86: Add more integer reg/reg branch-and-compare tests, Andy Wingo, 2019/04/03
- [Guile-commits] 80/86: Add subdir-objects option to libguile makefile., Andy Wingo, 2019/04/03
- [Guile-commits] 82/86: Merge in changes from upstream lightening, Andy Wingo, 2019/04/03
- [Guile-commits] 68/86: Add push/pop test,
Andy Wingo <=
- [Guile-commits] 70/86: Add truncr_[df]_[li] tests, Andy Wingo, 2019/04/03
- [Guile-commits] 72/86: Add int->float tests, Andy Wingo, 2019/04/03
- [Guile-commits] 54/86: Add stxi tests, Andy Wingo, 2019/04/03
- [Guile-commits] 16/86: Create beginning of stripped-down lightning interface, Andy Wingo, 2019/04/03
- [Guile-commits] 84/86: Allow users to pass custom allocators, Andy Wingo, 2019/04/03
- [Guile-commits] 85/86: Fix jit_reset to be useful, Andy Wingo, 2019/04/03
- [Guile-commits] 76/86: Implement arg shuffling for jit_call{i,r}, Andy Wingo, 2019/04/03
- [Guile-commits] 86/86: Merge from upstream Lightening, Andy Wingo, 2019/04/03
- [Guile-commits] 81/86: Change headers and files to be named "lightening" instead of "jit", Andy Wingo, 2019/04/03
- [Guile-commits] 71/86: Add float/double cast inst tests, Andy Wingo, 2019/04/03