Skip to content

Commit

Permalink
i#4532: aarch64 decode: remove incorrect clrex todo (#5275)
Browse files Browse the repository at this point in the history
This patch removes the TODO note for clrex which stated it had a superfluous
operand. The spec states that it is a real operand but is ignored and defaults
to a value of 15. The instr_create.h macros have been updated to reflect this.

Fixes: #4532
  • Loading branch information
joshua-warburton authored Jan 12, 2022
1 parent adcc46a commit 8e1c9f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions core/ir/aarch64/instr_create_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,9 @@
* Creates a CLREX instruction.
* \param dc The void * dcontext used to allocate memory for the instr_t.
*/
/* TODO i#4532: Remove this superfluous operand. */
#define INSTR_CREATE_clrex(dc) instr_create_0dst_1src(dc, OP_clrex, OPND_CREATE_INT(0))
#define INSTR_CREATE_clrex(dc) instr_create_0dst_1src(dc, OP_clrex, OPND_CREATE_INT(15))
#define INSTR_CREATE_clrex_imm(dc, imm) \
instr_create_0dst_1src(dc, OP_clrex, OPND_CREATE_INT(imm))

/* FIXME i#1569: these two should perhaps not be provided */
#define INSTR_CREATE_add_shimm(dc, rd, rn, rm_or_imm, sht, sha) \
Expand Down
4 changes: 4 additions & 0 deletions suite/tests/api/ir_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -5515,6 +5515,10 @@ test_exclusive_memops(void *dc)
instr = INSTR_CREATE_clrex(dc);
ASSERT(!instr_is_exclusive_store(instr) && !instr_is_exclusive_load(instr));
test_instr_encoding(dc, OP_clrex, instr);

instr = INSTR_CREATE_clrex_imm(dc, 2);
ASSERT(!instr_is_exclusive_store(instr) && !instr_is_exclusive_load(instr));
test_instr_encoding(dc, OP_clrex, instr);
}

static void
Expand Down
3 changes: 2 additions & 1 deletion suite/tests/api/ir_aarch64.expect
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,8 @@ stlxr %x0 -> (%x1)[8byte] %w2
stlxrb %w0 -> (%x1)[1byte] %w2
stlxrh %w0 -> (%x1)[2byte] %w2
stlxp %w0 %w1 -> (%x2)[8byte] %w3
clrex $0x0000000000000000
clrex $0x000000000000000f
clrex $0x0000000000000002
test_exclusive_memops complete
ldp (%x2)[8byte] -> %w0 %w1
stp %w0 %w1 -> (%x2)[8byte]
Expand Down

0 comments on commit 8e1c9f0

Please sign in to comment.