Skip to content

Commit

Permalink
i#6420 AArch64: Move LDAPR tests to ir_aarch64_v83.c. (#6433)
Browse files Browse the repository at this point in the history
There remain other tests in ir_aarch64.c that require processor
features. See i#6430.
  • Loading branch information
egrimley-arm authored Nov 10, 2023
1 parent 969e20d commit 86e8581
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 40 deletions.
35 changes: 0 additions & 35 deletions suite/tests/api/ir_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,38 +380,6 @@ test_ldar(void *dc)
test_instr_encoding(dc, OP_ldarh, instr);
}

/* TODO: Add this to a new suite/tests/api/ir_aarch64_v83.c file */
static void
test_ldapr(void *dc)
{
byte *pc;
instr_t *instr;

/* LDAPR <Wt>, [<Xn|SP>{,#0}] */
instr = INSTR_CREATE_ldapr(
dc, opnd_create_reg(DR_REG_W0),
opnd_create_base_disp_aarch64(DR_REG_X1, DR_REG_NULL, 0, false, 0, 0, OPSZ_4));
test_instr_encoding(dc, OP_ldapr, instr);

/* LDAPR <Xt>, [<Xn|SP>{,#0}] */
instr = INSTR_CREATE_ldapr(
dc, opnd_create_reg(DR_REG_X2),
opnd_create_base_disp_aarch64(DR_REG_X3, DR_REG_NULL, 0, false, 0, 0, OPSZ_8));
test_instr_encoding(dc, OP_ldapr, instr);

/* LDAPRB <Wt>, [<Xn|SP>{,#0}] */
instr = INSTR_CREATE_ldaprb(
dc, opnd_create_reg(DR_REG_W4),
opnd_create_base_disp_aarch64(DR_REG_X5, DR_REG_NULL, 0, false, 0, 0, OPSZ_1));
test_instr_encoding(dc, OP_ldaprb, instr);

/* LDAPRH <Wt>, [<Xn|SP>{,#0}] */
instr = INSTR_CREATE_ldaprh(
dc, opnd_create_reg(DR_REG_W6),
opnd_create_base_disp_aarch64(DR_REG_X7, DR_REG_NULL, 0, false, 0, 0, OPSZ_2));
test_instr_encoding(dc, OP_ldaprh, instr);
}

static void
ld2_simdfp_multiple_structures_no_offset(void *dc)
{
Expand Down Expand Up @@ -6974,9 +6942,6 @@ main(int argc, char *argv[])
test_ldar(dcontext);
print("test_ldar complete\n");

test_ldapr(dcontext);
print("test_ldapr complete\n");

test_ldur_stur(dcontext);
print("test_ldur_stur complete\n");

Expand Down
5 changes: 0 additions & 5 deletions suite/tests/api/ir_aarch64.expect
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ ldar (%x1)[8byte] -> %x0
ldarb (%x1)[1byte] -> %w0
ldarh (%x1)[2byte] -> %w0
test_ldar complete
ldapr (%x1)[4byte] -> %w0
ldapr (%x3)[8byte] -> %x2
ldaprb (%x5)[1byte] -> %w4
ldaprh (%x7)[2byte] -> %w6
test_ldapr complete
ldur (%x0)[1byte] -> %b0
ldur +0xff(%x1)[1byte] -> %b1
ldur (%x2)[2byte] -> %h2
Expand Down
50 changes: 50 additions & 0 deletions suite/tests/api/ir_aarch64_v83.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,51 @@ TEST_INSTR(fjcvtzs)
opnd_create_reg(Vdn_d_six_offset_1[i]));
}

TEST_INSTR(ldapr)
{
/* Testing LDAPR <Wt>, [<Xn|SP>{,#0}] */
const char *const expected_0_0[6] = {
"ldapr (%x0)[4byte] -> %w0", "ldapr (%x5)[4byte] -> %w6",
"ldapr (%x10)[4byte] -> %w11", "ldapr (%x15)[4byte] -> %w16",
"ldapr (%x20)[4byte] -> %w21", "ldapr (%sp)[4byte] -> %wzr",
};
TEST_LOOP(ldapr, ldapr, 6, expected_0_0[i], opnd_create_reg(Wn_six_offset_1_zr[i]),
OPND_CREATE_MEM32(Xn_six_offset_0_sp[i], 0));

/* Testing LDAPR <Xt>, [<Xn|SP>{,#0}] */
const char *const expected_1_0[6] = {
"ldapr (%x0)[8byte] -> %x0", "ldapr (%x5)[8byte] -> %x6",
"ldapr (%x10)[8byte] -> %x11", "ldapr (%x15)[8byte] -> %x16",
"ldapr (%x20)[8byte] -> %x21", "ldapr (%sp)[8byte] -> %xzr",
};
TEST_LOOP(ldapr, ldapr, 6, expected_1_0[i], opnd_create_reg(Xn_six_offset_1_zr[i]),
OPND_CREATE_MEM64(Xn_six_offset_0_sp[i], 0));
}

TEST_INSTR(ldaprb)
{
/* Testing LDAPRB <Wt>, [<Xn|SP>{,#0}] */
const char *const expected_0_0[6] = {
"ldaprb (%x0)[1byte] -> %w0", "ldaprb (%x5)[1byte] -> %w6",
"ldaprb (%x10)[1byte] -> %w11", "ldaprb (%x15)[1byte] -> %w16",
"ldaprb (%x20)[1byte] -> %w21", "ldaprb (%sp)[1byte] -> %wzr",
};
TEST_LOOP(ldaprb, ldaprb, 6, expected_0_0[i], opnd_create_reg(Wn_six_offset_1_zr[i]),
OPND_CREATE_MEM8(Xn_six_offset_0_sp[i], 0));
}

TEST_INSTR(ldaprh)
{
/* Testing LDAPRH <Wt>, [<Xn|SP>{,#0}] */
const char *const expected_0_0[6] = {
"ldaprh (%x0)[2byte] -> %w0", "ldaprh (%x5)[2byte] -> %w6",
"ldaprh (%x10)[2byte] -> %w11", "ldaprh (%x15)[2byte] -> %w16",
"ldaprh (%x20)[2byte] -> %w21", "ldaprh (%sp)[2byte] -> %wzr",
};
TEST_LOOP(ldaprh, ldaprh, 6, expected_0_0[i], opnd_create_reg(Wn_six_offset_1_zr[i]),
OPND_CREATE_MEM16(Xn_six_offset_0_sp[i], 0));
}

int
main(int argc, char *argv[])
{
Expand Down Expand Up @@ -657,6 +702,11 @@ main(int argc, char *argv[])
/* FEAT_JSCVT */
RUN_INSTR_TEST(fjcvtzs);

/* FEAT_LRCPC */
RUN_INSTR_TEST(ldapr);
RUN_INSTR_TEST(ldaprb);
RUN_INSTR_TEST(ldaprh);

print("All v8.3 tests complete.");
#ifndef STANDALONE_DECODER
dr_standalone_exit();
Expand Down

0 comments on commit 86e8581

Please sign in to comment.