mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
Add ldxr tests
This commit is contained in:
parent
c6067dd8cb
commit
d917dc2147
9 changed files with 283 additions and 0 deletions
33
tests/ldxr_l.c
Normal file
33
tests/ldxr_l.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include "test.h"
|
||||
|
||||
static uint64_t data[] = { 0xffffffffffffffff, 0, 0x4242424212345678 };
|
||||
|
||||
static void
|
||||
run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
|
||||
{
|
||||
#if __WORDSIZE > 32
|
||||
jit_begin(j, arena_base, arena_size);
|
||||
|
||||
const jit_arg_abi_t abi[] = { JIT_ARG_ABI_POINTER, JIT_ARG_ABI_INTMAX };
|
||||
jit_arg_t args[2];
|
||||
const jit_anyreg_t regs[] = { { .gpr=JIT_R0 }, { .gpr=JIT_R1 } };
|
||||
|
||||
jit_receive(j, 2, abi, args);
|
||||
jit_load_args(j, 2, abi, args, regs);
|
||||
|
||||
jit_ldxr_l(j, JIT_R0, JIT_R0, JIT_R1);
|
||||
jit_retr(j, JIT_R0);
|
||||
|
||||
uintmax_t (*f)(void*, uintmax_t) = jit_end(j, NULL);
|
||||
|
||||
ASSERT(f(data, 0) == -1);
|
||||
ASSERT(f(data, 8) == 0);
|
||||
ASSERT(f(data, 16) == data[2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
return main_helper(argc, argv, run_test);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue