quakeforge/libs/gamecode/test/test-lea.c
Bill Currie e20aed5c5a [gamecode] Change address mode B to entity.field
It turned out that address mode B was redundant as C with 0 offset
(immediate) was the same (except for the underlying C code of course,
but adding st->b is very cheap). This allowed B to be used for
entity.field for all transfer operations. Thus instructions 0-3 are now
free as load E became load B, and other than the specifics of format
codes for statement printing, transfers+lea are unified.
2022-01-20 14:55:29 +09:00

40 lines
796 B
C

#include "head.c"
static pr_int_t lea_globals_init[] = {
// pointers
24, 26, 28, 29,
32, -4, -2, 0,
1, 4, 0xdeadbeef, 0xfeedf00d,
0, 0, 0, 0,
};
static pr_int_t lea_globals_expect[] = {
// pointers
24, 26, 28, 29,
32, -4, -2, 0,
1, 4, 0xdeadbeef, 0xfeedf00d,
7, 34, 26, 88,
};
static dstatement_t lea_statements[] = {
{OP(0, 0, 0, OP_LEA_A), 7, 9, 12},
{OP(0, 0, 0, OP_LEA_C), 2, 6, 13},
{OP(0, 0, 0, OP_LEA_D), 2, 6, 14},
{OP(0, 0, 0, OP_LEA_B), 4, 2, 15},
};
test_t tests[] = {
{
.desc = "lea",
.num_globals = num_globals (lea_globals_init, lea_globals_expect),
.num_statements = num_statements (lea_statements),
.statements = lea_statements,
.init_globals = lea_globals_init,
.expect_globals = lea_globals_expect,
.edict_area = 28,
},
};
#include "main.c"