#define IS_SET(_X) (TST (( _X )) ? 1 : 0)
#define IS_CLEAR(_X) (TST (( _X )) ? 0 : 1)
+/* Space saver macro. */
+#define INSTR(HIGH, LOW) uimm (aarch64_get_instr (cpu), (HIGH), (LOW))
+
#define HALT_UNALLOC \
do \
{ \
__LINE__, aarch64_get_PC (cpu)); \
if (! TRACE_ANY_P (cpu)) \
{ \
- fprintf (stderr, "SIM Error: Unimplemented instruction: "); \
+ sim_io_eprintf (CPU_STATE (cpu), "SIM Error: Unimplemented instruction: "); \
trace_disasm (CPU_STATE (cpu), cpu, aarch64_get_PC (cpu)); \
} \
sim_engine_halt (CPU_STATE (cpu), cpu, NULL, aarch64_get_PC (cpu),\
#define NYI_assert(HI, LO, EXPECTED) \
do \
{ \
- if (uimm (aarch64_get_instr (cpu), (HI), (LO)) != (EXPECTED)) \
+ if (INSTR ((HI), (LO)) != (EXPECTED)) \
HALT_NYI; \
} \
while (0)
-/* Space saver macro. */
-#define INSTR(HIGH, LOW) uimm (aarch64_get_instr (cpu), (HIGH), (LOW))
-
/* Helper functions used by expandLogicalImmediate. */
/* for i = 1, ... N result<i-1> = 1 other bits are zero */
{
/* instr[14,0] == type : 0 ==> method entry, 1 ==> method reentry
2 ==> exit Java, 3 ==> start next bytecode. */
- uint32_t type = uimm (aarch64_get_instr (cpu), 14, 0);
+ uint32_t type = INSTR (14, 0);
TRACE_EVENTS (cpu, "Notify Insn encountered, type = 0x%x", type);
sim_stopped, SIM_SIGTRAP);
}
- dispatch = uimm (aarch64_get_instr (cpu), 31, 15);
+ dispatch = INSTR (31, 15);
/* We do not handle callouts at the moment. */
if (dispatch == PSEUDO_CALLOUT || dispatch == PSEUDO_CALLOUTR)
static void
ldur32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u32
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldur64 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u64
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldurb32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u8
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldursb32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rt, NO_SP, (uint32_t) aarch64_get_mem_s8
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldursb64 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_s64 (cpu, rt, NO_SP, aarch64_get_mem_s8
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldurh32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, aarch64_get_mem_u16
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldursh32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, (uint32_t) aarch64_get_mem_s16
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldursh64 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_s64 (cpu, rt, NO_SP, aarch64_get_mem_s16
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
ldursw (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, (uint32_t) aarch64_get_mem_s32
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
stur32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_mem_u32 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset,
static void
stur64 (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_mem_u64 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset,
static void
sturb (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_mem_u8 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset,
static void
sturh (sim_cpu *cpu, int32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_mem_u16 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset,
static void
ldr32_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_mem_u32
static void
ldr_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_mem_u64
static void
ldrsw_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_mem_s32
static void
fldrs_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned int rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rd = INSTR (4, 0);
aarch64_set_vec_u32 (cpu, rd, 0,
aarch64_get_mem_u32
static void
fldrd_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int st = INSTR (4, 0);
aarch64_set_vec_u64 (cpu, st, 0,
aarch64_get_mem_u64
static void
fldrq_pcrel (sim_cpu *cpu, int32_t offset)
{
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int st = INSTR (4, 0);
uint64_t addr = aarch64_get_PC (cpu) + offset * 4;
FRegister a;
static void
fldrs_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
if (wb != Post)
static void
fldrb_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset;
aarch64_set_vec_u8 (cpu, rd, 0, aarch64_get_mem_u32 (cpu, addr));
static void
fldrh_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + SCALE (offset, 16);
aarch64_set_vec_u16 (cpu, rd, 0, aarch64_get_mem_u16 (cpu, addr));
static void
fldrs_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + SCALE (offset, 32);
aarch64_set_vec_u32 (cpu, rd, 0, aarch64_get_mem_u32 (cpu, addr));
static void
fldrd_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + SCALE (offset, 64);
aarch64_set_vec_u64 (cpu, rd, 0, aarch64_get_mem_u64 (cpu, addr));
static void
fldrq_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + SCALE (offset, 128);
aarch64_set_vec_u64 (cpu, rd, 0, aarch64_get_mem_u64 (cpu, addr));
static void
fldrs_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP), extension);
uint64_t displacement = OPT_SCALE (extended, 32, scaling);
static void
fldrd_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
if (wb != Post)
static void
fldrd_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
+ unsigned rm = INSTR (20, 16);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP), extension);
uint64_t displacement = OPT_SCALE (extended, 64, scaling);
fldrq_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
FRegister a;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
if (wb != Post)
static void
fldrq_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
+ unsigned rm = INSTR (20, 16);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP), extension);
uint64_t displacement = OPT_SCALE (extended, 128, scaling);
static void
ldr32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u32
static void
ldr32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldr32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldr_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u64
static void
ldr_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldr_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrb32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be
there is no scaling required for a byte load. */
static void
ldrb32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrb32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrsb_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrsb_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrh32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_u16
static void
ldrh32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrh32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrsh32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_reg_u64 (cpu, rt, NO_SP, (uint32_t) aarch64_get_mem_s16
static void
ldrsh32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrsh32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrsh_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_reg_u64 (cpu, rt, NO_SP, aarch64_get_mem_s16
static void
ldrsh64_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrsh_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
ldrsw_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
return aarch64_set_reg_s64 (cpu, rt, NO_SP, aarch64_get_mem_s32
static void
ldrsw_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
ldrsw_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
str32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_mem_u32 (cpu, (aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
str32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
str32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP), extension);
static void
str_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_mem_u64 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
str_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
str_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
strb_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be.
There is no scaling required for a byte load. */
static void
strb_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
strb_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
strh_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* The target register may not be SP but the source may be. */
aarch64_set_mem_u16 (cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
strh_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address;
if (rn == rt && wb != NoWriteBack)
static void
strh_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR */
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
10010 ==> PSTL2KEEP, 10001 ==> PSTL2STRM,
10100 ==> PSTL3KEEP, 10101 ==> PSTL3STRM,
ow ==> UNALLOC
- PrfOp prfop = prfop (aarch64_get_instr (cpu), 4, 0);
+ PrfOp prfop = prfop (instr, 4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK)
+ SCALE (offset, 64). */
10100 ==> PSTL3KEEP, 10101 ==> PSTL3STRM,
ow ==> UNALLOC
rn may reference SP, rm may only reference ZR
- PrfOp prfop = prfop (aarch64_get_instr (cpu), 4, 0);
+ PrfOp prfop = prfop (instr, 4, 0);
uint64_t base = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
extension);
10010 ==> PSTL2KEEP, 10001 ==> PSTL2STRM,
10100 ==> PSTL3KEEP, 10101 ==> PSTL3STRM,
ow ==> UNALLOC
- PrfOp prfop = prfop (aarch64_get_instr (cpu), 4, 0);
+ PrfOp prfop = prfop (instr, 4, 0);
uint64_t address = aarch64_get_PC (cpu) + offset. */
/* TODO : implement this */
static void
ldxr (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
- int size = uimm (aarch64_get_instr (cpu), 31, 30);
- /* int ordered = uimm (aarch64_get_instr (cpu), 15, 15); */
- /* int exclusive = ! uimm (aarch64_get_instr (cpu), 23, 23); */
+ int size = INSTR (31, 30);
+ /* int ordered = INSTR (15, 15); */
+ /* int exclusive = ! INSTR (23, 23); */
switch (size)
{
static void
stxr (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rs = uimm (aarch64_get_instr (cpu), 20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rt = INSTR (4, 0);
+ unsigned rs = INSTR (20, 16);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
- int size = uimm (aarch64_get_instr (cpu), 31, 30);
+ int size = INSTR (31, 30);
uint64_t data = aarch64_get_reg_u64 (cpu, rt, NO_SP);
switch (size)
instr[26] ==> V : 0 ==> GReg, 1 ==> FReg
instr[23, 5] == simm19 */
- /* unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0); */
- uint32_t dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 30) << 1)
- | uimm (aarch64_get_instr (cpu), 26, 26));
+ /* unsigned rt = INSTR (4, 0); */
+ uint32_t dispatch = ( (INSTR (31, 30) << 1)
+ | INSTR (26, 26));
int32_t imm = simm32 (aarch64_get_instr (cpu), 23, 5);
switch (dispatch)
static void
add32 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, SP_OK) + aimm);
static void
add64 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + aimm);
static void
adds32 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : do we need to worry about signs here? */
int32_t value1 = aarch64_get_reg_s32 (cpu, rn, SP_OK);
static void
adds64 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, SP_OK);
uint64_t value2 = aimm;
static void
sub32 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, SP_OK) - aimm);
static void
sub64 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, SP_OK) - aimm);
static void
subs32 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u64 (cpu, rn, SP_OK);
uint32_t value2 = aimm;
static void
subs64 (sim_cpu *cpu, uint32_t aimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, SP_OK);
uint32_t value2 = aimm;
static void
add32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
add64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
adds32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = shifted32 (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
adds64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = shifted64 (aarch64_get_reg_u64 (cpu, rm, NO_SP),
static void
sub32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
sub64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
subs32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = shifted32 (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
subs64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = shifted64 (aarch64_get_reg_u64 (cpu, rm, NO_SP),
static void
add32_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, SP_OK)
static void
add64_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
adds32_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, SP_OK);
uint32_t value2 = extreg32 (cpu, rm, extension) << shift;
static void
adds64_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, SP_OK);
uint64_t value2 = extreg64 (cpu, rm, extension) << shift;
static void
sub32_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, SP_OK)
static void
sub64_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, SP_OK)
static void
subs32_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, SP_OK);
uint32_t value2 = extreg32 (cpu, rm, extension) << shift;
static void
subs64_ext (sim_cpu *cpu, Extension extension, uint32_t shift)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, SP_OK);
uint64_t value2 = extreg64 (cpu, rm, extension) << shift;
instr[4,0] = Rd */
/* N.B. the shift is applied at decode before calling the add/sub routine. */
- uint32_t shift = uimm (aarch64_get_instr (cpu), 23, 22);
- uint32_t imm = uimm (aarch64_get_instr (cpu), 21, 10);
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ uint32_t shift = INSTR (23, 22);
+ uint32_t imm = INSTR (21, 10);
+ uint32_t dispatch = INSTR (31, 29);
NYI_assert (28, 24, 0x11);
instr[9,5] = Rn
instr[4,0] = Rd */
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- /* 32 bit operations must have count[5] = 0
- or else we have an UNALLOC. */
- uint32_t count = uimm (aarch64_get_instr (cpu), 15, 10);
- /* Shift encoded as ROR is unallocated. */
- Shift shiftType = shift (aarch64_get_instr (cpu), 22);
- /* Dispatch on size:op i.e aarch64_get_instr (cpu)[31,29]. */
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ uint32_t size = INSTR (31, 31);
+ uint32_t count = INSTR (15, 10);
+ Shift shiftType = INSTR (23, 22);
NYI_assert (28, 24, 0x0B);
NYI_assert (21, 21, 0);
+ /* Shift encoded as ROR is unallocated. */
if (shiftType == ROR)
HALT_UNALLOC;
- if (!size && uimm (count, 5, 5))
+ /* 32 bit operations must have count[5] = 0
+ or else we have an UNALLOC. */
+ if (size == 0 && uimm (count, 5, 5))
HALT_UNALLOC;
- switch (dispatch)
+ /* Dispatch on size:op i.e instr [31,29]. */
+ switch (INSTR (31, 29))
{
case 0: add32_shift (cpu, shiftType, count); break;
case 1: adds32_shift (cpu, shiftType, count); break;
instr[9,5] = Rn
instr[4,0] = Rd */
- Extension extensionType = extension (aarch64_get_instr (cpu), 13);
- uint32_t shift = uimm (aarch64_get_instr (cpu), 12, 10);
- /* dispatch on size:op:set? i.e aarch64_get_instr (cpu)[31,29] */
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ Extension extensionType = INSTR (15, 13);
+ uint32_t shift = INSTR (12, 10);
NYI_assert (28, 24, 0x0B);
NYI_assert (21, 21, 1);
if (shift > 4)
HALT_UNALLOC;
- switch (dispatch)
+ /* Dispatch on size:op:set?. */
+ switch (INSTR (31, 29))
{
case 0: add32_ext (cpu, extensionType, shift); break;
case 1: adds32_ext (cpu, extensionType, shift); break;
static void
adc32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
adc64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
adcs32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = aarch64_get_reg_u32 (cpu, rm, NO_SP);
static void
adcs64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = aarch64_get_reg_u64 (cpu, rm, NO_SP);
static void
sbc32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5); /* ngc iff rn == 31. */
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5); /* ngc iff rn == 31. */
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
sbc64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
sbcs32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = aarch64_get_reg_u32 (cpu, rm, NO_SP);
static void
sbcs64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = aarch64_get_reg_u64 (cpu, rm, NO_SP);
instr[9,5] = Rn
instr[4,0] = Rd */
- uint32_t op2 = uimm (aarch64_get_instr (cpu), 15, 10);
- /* Dispatch on size:op:set? i.e aarch64_get_instr (cpu)[31,29] */
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ uint32_t op2 = INSTR (15, 10);
NYI_assert (28, 21, 0xD0);
if (op2 != 0)
HALT_UNALLOC;
- switch (dispatch)
+ /* Dispatch on size:op:set?. */
+ switch (INSTR (31, 29))
{
case 0: adc32 (cpu); break;
case 1: adcs32 (cpu); break;
NYI_assert (10, 10, 0);
NYI_assert (4, 4, 0);
- if (! testConditionCode (cpu, uimm (aarch64_get_instr (cpu), 15, 12)))
+ if (! testConditionCode (cpu, INSTR (15, 12)))
{
- aarch64_set_CPSR (cpu, uimm (aarch64_get_instr (cpu), 3, 0));
+ aarch64_set_CPSR (cpu, INSTR (3, 0));
return;
}
- negate = uimm (aarch64_get_instr (cpu), 30, 30) ? 1 : -1;
- rm = uimm (aarch64_get_instr (cpu), 20, 16);
- rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ negate = INSTR (30, 30) ? 1 : -1;
+ rm = INSTR (20, 16);
+ rn = INSTR ( 9, 5);
- if (uimm (aarch64_get_instr (cpu), 31, 31))
+ if (INSTR (31, 31))
{
- if (uimm (aarch64_get_instr (cpu), 11, 11))
+ if (INSTR (11, 11))
set_flags_for_sub64 (cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK),
negate * (uint64_t) rm);
else
}
else
{
- if (uimm (aarch64_get_instr (cpu), 11, 11))
+ if (INSTR (11, 11))
set_flags_for_sub32 (cpu, aarch64_get_reg_u32 (cpu, rn, SP_OK),
negate * rm);
else
instr[9,5] = Vs
instr[4,0] = Vd */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
NYI_assert (29, 21, 0x075);
NYI_assert (15, 10, 0x07);
- if (uimm (aarch64_get_instr (cpu), 20, 16) != vs)
+ if (INSTR (20, 16) != vs)
HALT_NYI;
- if (uimm (aarch64_get_instr (cpu), 30, 30))
+ if (INSTR (30, 30))
aarch64_set_vec_u64 (cpu, vd, 1, aarch64_get_vec_u64 (cpu, vs, 1));
aarch64_set_vec_u64 (cpu, vd, 0, aarch64_get_vec_u64 (cpu, vs, 0));
instr[9,5] = V source
instr[4,0] = R dest */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (29, 21, 0x070);
NYI_assert (17, 10, 0x0F);
- switch (uimm (aarch64_get_instr (cpu), 20, 18))
+ switch (INSTR (20, 18))
{
case 0x2:
aarch64_set_reg_u64 (cpu, rd, NO_SP, aarch64_get_vec_u64 (cpu, vs, 0));
case 0x5:
case 0x7:
aarch64_set_reg_u64 (cpu, rd, NO_SP, aarch64_get_vec_u32
- (cpu, vs, uimm (aarch64_get_instr (cpu), 20, 19)));
+ (cpu, vs, INSTR (20, 19)));
break;
default:
instr[4,0] = V dest */
int index;
- unsigned rs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
NYI_assert (31, 21, 0x270);
NYI_assert (15, 10, 0x07);
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
{
- index = uimm (aarch64_get_instr (cpu), 20, 17);
+ index = INSTR (20, 17);
aarch64_set_vec_u8 (cpu, vd, index,
aarch64_get_reg_u8 (cpu, rs, NO_SP));
}
- else if (uimm (aarch64_get_instr (cpu), 17, 17))
+ else if (INSTR (17, 17))
{
- index = uimm (aarch64_get_instr (cpu), 20, 18);
+ index = INSTR (20, 18);
aarch64_set_vec_u16 (cpu, vd, index,
aarch64_get_reg_u16 (cpu, rs, NO_SP));
}
- else if (uimm (aarch64_get_instr (cpu), 18, 18))
+ else if (INSTR (18, 18))
{
- index = uimm (aarch64_get_instr (cpu), 20, 19);
+ index = INSTR (20, 19);
aarch64_set_vec_u32 (cpu, vd, index,
aarch64_get_reg_u32 (cpu, rs, NO_SP));
}
- else if (uimm (aarch64_get_instr (cpu), 19, 19))
+ else if (INSTR (19, 19))
{
- index = uimm (aarch64_get_instr (cpu), 20, 20);
+ index = INSTR (20, 20);
aarch64_set_vec_u64 (cpu, vd, index,
aarch64_get_reg_u64 (cpu, rs, NO_SP));
}
instr[9,5] = V source
instr[4,0] = V dest. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
int i, index;
NYI_assert (29, 21, 0x070);
NYI_assert (15, 10, 0x01);
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
{
- index = uimm (aarch64_get_instr (cpu), 20, 17);
+ index = INSTR (20, 17);
for (i = 0; i < (full ? 16 : 8); i++)
aarch64_set_vec_u8 (cpu, vd, i, aarch64_get_vec_u8 (cpu, vs, index));
}
- else if (uimm (aarch64_get_instr (cpu), 17, 17))
+ else if (INSTR (17, 17))
{
- index = uimm (aarch64_get_instr (cpu), 20, 18);
+ index = INSTR (20, 18);
for (i = 0; i < (full ? 8 : 4); i++)
aarch64_set_vec_u16 (cpu, vd, i, aarch64_get_vec_u16 (cpu, vs, index));
}
- else if (uimm (aarch64_get_instr (cpu), 18, 18))
+ else if (INSTR (18, 18))
{
- index = uimm (aarch64_get_instr (cpu), 20, 19);
+ index = INSTR (20, 19);
for (i = 0; i < (full ? 4 : 2); i++)
aarch64_set_vec_u32 (cpu, vd, i, aarch64_get_vec_u32 (cpu, vs, index));
}
else
{
- if (uimm (aarch64_get_instr (cpu), 19, 19) == 0)
+ if (INSTR (19, 19) == 0)
HALT_UNALLOC;
if (! full)
HALT_UNALLOC;
- index = uimm (aarch64_get_instr (cpu), 20, 20);
+ index = INSTR (20, 20);
for (i = 0; i < 2; i++)
aarch64_set_vec_u64 (cpu, vd, i, aarch64_get_vec_u64 (cpu, vs, index));
instr[9,5] = V start
instr[4,0] = V dest */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- int len = uimm (aarch64_get_instr (cpu), 14, 13) + 1;
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ int len = INSTR (14, 13) + 1;
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 21, 0x070);
instr[9,5] = V source
instr[4,0] = V dest. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- int second = uimm (aarch64_get_instr (cpu), 14, 14);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ int second = INSTR (14, 14);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 24, 0x0E);
NYI_assert (13, 10, 0xA);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 8 : 4); i++)
instr[4,0] = V dest. */
unsigned i;
- unsigned Vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned Rs = uimm (aarch64_get_instr (cpu), 9, 5);
- int both = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned Vd = INSTR (4, 0);
+ unsigned Rs = INSTR (9, 5);
+ int both = INSTR (30, 30);
NYI_assert (29, 20, 0x0E0);
NYI_assert (15, 10, 0x03);
- switch (uimm (aarch64_get_instr (cpu), 19, 16))
+ switch (INSTR (19, 16))
{
case 1:
for (i = 0; i < (both ? 16 : 8); i++)
instr[9,5] = Vn
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- int upper = uimm (aarch64_get_instr (cpu), 14, 14);
+ int full = INSTR (30, 30);
+ int upper = INSTR (14, 14);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
uint64_t val_m1 = aarch64_get_vec_u64 (cpu, vm, 0);
uint64_t val_m2 = aarch64_get_vec_u64 (cpu, vm, 1);
NYI_assert (15, 15, 0);
NYI_assert (13, 10, 6);
- switch (uimm (aarch64_get_instr (cpu), 23, 23))
+ switch (INSTR (23, 23))
{
case 0:
for (i = 0; i < 8; i++)
instr[9,5] = Vn
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- int upper = uimm (aarch64_get_instr (cpu), 14, 14);
+ int full = INSTR (30, 30);
+ int upper = INSTR (14, 14);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
uint64_t val_m1 = aarch64_get_vec_u64 (cpu, vm, 0);
uint64_t val_m2 = aarch64_get_vec_u64 (cpu, vm, 1);
NYI_assert (15, 15, 0);
NYI_assert (13, 10, 0xE);
- switch (uimm (aarch64_get_instr (cpu), 23, 23))
+ switch (INSTR (23, 23))
{
case 0:
val1 =
instr[9,5] = low 5-bits of uimm8
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned val = uimm (aarch64_get_instr (cpu), 18, 16) << 5
- | uimm (aarch64_get_instr (cpu), 9, 5);
+ int full = INSTR (30, 30);
+ unsigned vd = INSTR (4, 0);
+ unsigned val = INSTR (18, 16) << 5
+ | INSTR (9, 5);
unsigned i;
NYI_assert (29, 19, 0x1E0);
NYI_assert (11, 10, 1);
- switch (uimm (aarch64_get_instr (cpu), 15, 12))
+ switch (INSTR (15, 12))
{
case 0x0: /* 32-bit, no shift. */
case 0x2: /* 32-bit, shift by 8. */
case 0x4: /* 32-bit, shift by 16. */
case 0x6: /* 32-bit, shift by 24. */
- val <<= (8 * uimm (aarch64_get_instr (cpu), 14, 13));
+ val <<= (8 * INSTR (14, 13));
for (i = 0; i < (full ? 4 : 2); i++)
aarch64_set_vec_u32 (cpu, vd, i, val);
break;
instr[9,5] = low 5-bits of uimm8
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned val = uimm (aarch64_get_instr (cpu), 18, 16) << 5
- | uimm (aarch64_get_instr (cpu), 9, 5);
+ int full = INSTR (30, 30);
+ unsigned vd = INSTR (4, 0);
+ unsigned val = INSTR (18, 16) << 5
+ | INSTR (9, 5);
unsigned i;
NYI_assert (29, 19, 0x5E0);
NYI_assert (11, 10, 1);
- switch (uimm (aarch64_get_instr (cpu), 15, 12))
+ switch (INSTR (15, 12))
{
case 0x0: /* 32-bit, no shift. */
case 0x2: /* 32-bit, shift by 8. */
case 0x4: /* 32-bit, shift by 16. */
case 0x6: /* 32-bit, shift by 24. */
- val <<= (8 * uimm (aarch64_get_instr (cpu), 14, 13));
+ val <<= (8 * INSTR (14, 13));
val = ~ val;
for (i = 0; i < (full ? 4 : 2); i++)
aarch64_set_vec_u32 (cpu, vd, i, val);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
unsigned i;
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 10, 0x82E);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vm
instr[4.0] = Rd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
unsigned i;
uint64_t val = 0;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 10, 0xC6E);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[4,0] = Vd. */
unsigned elem;
- unsigned vm = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
NYI_assert (31, 21, 0x270);
NYI_assert (17, 14, 0);
NYI_assert (12, 10, 7);
- if (uimm (aarch64_get_instr (cpu), 13, 13) == 1)
+ if (INSTR (13, 13) == 1)
{
- if (uimm (aarch64_get_instr (cpu), 18, 18) == 1)
+ if (INSTR (18, 18) == 1)
{
/* 32-bit moves. */
- elem = uimm (aarch64_get_instr (cpu), 20, 19);
+ elem = INSTR (20, 19);
aarch64_set_reg_u64 (cpu, vd, NO_SP,
aarch64_get_vec_u32 (cpu, vm, elem));
}
else
{
/* 64-bit moves. */
- if (uimm (aarch64_get_instr (cpu), 19, 19) != 1)
+ if (INSTR (19, 19) != 1)
HALT_NYI;
- elem = uimm (aarch64_get_instr (cpu), 20, 20);
+ elem = INSTR (20, 20);
aarch64_set_reg_u64 (cpu, vd, NO_SP,
aarch64_get_vec_u64 (cpu, vm, elem));
}
}
else
{
- if (uimm (aarch64_get_instr (cpu), 18, 18) == 1)
+ if (INSTR (18, 18) == 1)
{
/* 32-bit moves. */
- elem = uimm (aarch64_get_instr (cpu), 20, 19);
+ elem = INSTR (20, 19);
aarch64_set_vec_u32 (cpu, vd, elem,
aarch64_get_reg_u32 (cpu, vm, NO_SP));
}
else
{
/* 64-bit moves. */
- if (uimm (aarch64_get_instr (cpu), 19, 19) != 1)
+ if (INSTR (19, 19) != 1)
HALT_NYI;
- elem = uimm (aarch64_get_instr (cpu), 20, 20);
+ elem = INSTR (20, 20);
aarch64_set_vec_u64 (cpu, vd, elem,
aarch64_get_reg_u64 (cpu, vm, NO_SP));
}
instr[9,5] = Vn
instr[4.0] = Vd. */
- int unsign = uimm (aarch64_get_instr (cpu), 29, 29);
- int bias = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int unsign = INSTR (29, 29);
+ int bias = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR ( 9, 5);
+ unsigned vd = INSTR ( 4, 0);
unsigned i;
NYI_assert (28, 24, 0x0E);
NYI_assert (15, 10, 0x30);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
if (bias)
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x35);
- if (uimm (aarch64_get_instr (cpu), 23, 23))
+ if (INSTR (23, 23))
{
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_NYI;
}
else
{
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_NYI;
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x21);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x27);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x25);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
static void
do_vec_FminmaxNMP (sim_cpu *cpu)
{
- /* aarch64_get_instr (cpu)[31] = 0
- aarch64_get_instr (cpu)[30] = half (0)/full (1)
- aarch64_get_instr (cpu)[29,24] = 10 1110
- aarch64_get_instr (cpu)[23] = max(0)/min(1)
- aarch64_get_instr (cpu)[22] = float (0)/double (1)
- aarch64_get_instr (cpu)[21] = 1
- aarch64_get_instr (cpu)[20,16] = Vn
- aarch64_get_instr (cpu)[15,10] = 1100 01
- aarch64_get_instr (cpu)[9,5] = Vm
- aarch64_get_instr (cpu)[4.0] = Vd. */
-
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ /* instr [31] = 0
+ instr [30] = half (0)/full (1)
+ instr [29,24] = 10 1110
+ instr [23] = max(0)/min(1)
+ instr [22] = float (0)/double (1)
+ instr [21] = 1
+ instr [20,16] = Vn
+ instr [15,10] = 1100 01
+ instr [9,5] = Vm
+ instr [4.0] = Vd. */
+
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ int full = INSTR (30, 30);
NYI_assert (29, 24, 0x2E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x31);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
- double (* fn)(double, double) = uimm (aarch64_get_instr (cpu), 23, 23)
+ double (* fn)(double, double) = INSTR (23, 23)
? dminnm : dmaxnm;
if (! full)
}
else
{
- float (* fn)(float, float) = uimm (aarch64_get_instr (cpu), 23, 23)
+ float (* fn)(float, float) = INSTR (23, 23)
? fminnm : fmaxnm;
aarch64_set_vec_float (cpu, vd, 0,
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x071);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x173);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x171);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned test_false = uimm (aarch64_get_instr (cpu), 22, 22);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned test_false = INSTR (22, 22);
unsigned i;
NYI_assert (29, 23, 0x5D);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x077);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x075);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 21, 0x073);
NYI_assert (15, 10, 0x07);
instr[9,5] = Vs
instr[4,0] = Vd. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned bias = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned bias = INSTR (30, 30);
unsigned i;
NYI_assert (29, 24, 0x0E);
NYI_assert (21, 10, 0x84A);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
if (bias)
instr[9,5] = V source
instr[4.0] = R dest. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
unsigned i;
NYI_assert (28, 24, 0x0E);
NYI_assert (20, 17, 8);
NYI_assert (15, 10, 0x2A);
- switch ((uimm (aarch64_get_instr (cpu), 29, 29) << 1)
- | uimm (aarch64_get_instr (cpu), 16, 16))
+ switch ((INSTR (29, 29) << 1)
+ | INSTR (16, 16))
{
case 0: /* SMAXV. */
{
int64_t smax;
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
smax = aarch64_get_vec_s8 (cpu, vs, 0);
case 1: /* SMINV. */
{
int64_t smin;
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
smin = aarch64_get_vec_s8 (cpu, vs, 0);
case 2: /* UMAXV. */
{
uint64_t umax;
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
umax = aarch64_get_vec_u8 (cpu, vs, 0);
case 3: /* UMINV. */
{
uint64_t umin;
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
umin = aarch64_get_vec_u8 (cpu, vs, 0);
instr[9,5] = V source
instr[4.0] = R dest. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
unsigned i;
float res = aarch64_get_vec_float (cpu, vs, 0);
NYI_assert (22, 14, 0x0C3);
NYI_assert (11, 10, 2);
- if (uimm (aarch64_get_instr (cpu), 23, 23))
+ if (INSTR (23, 23))
{
- switch (uimm (aarch64_get_instr (cpu), 13, 12))
+ switch (INSTR (13, 12))
{
case 0: /* FMNINNMV. */
for (i = 1; i < 4; i++)
}
else
{
- switch (uimm (aarch64_get_instr (cpu), 13, 12))
+ switch (INSTR (13, 12))
{
case 0: /* FMNAXNMV. */
for (i = 1; i < 4; i++)
instr[9,5] = Vn
instr[4,0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned min = uimm (aarch64_get_instr (cpu), 23, 23);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned min = INSTR (23, 23);
unsigned i;
NYI_assert (29, 24, 0x0E);
NYI_assert (15, 14, 3);
NYI_assert (11, 10, 1);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double (* func)(double, double);
if (! full)
HALT_NYI;
- if (uimm (aarch64_get_instr (cpu), 13, 12) == 0)
+ if (INSTR (13, 12) == 0)
func = min ? dminnm : dmaxnm;
- else if (uimm (aarch64_get_instr (cpu), 13, 12) == 3)
+ else if (INSTR (13, 12) == 3)
func = min ? fmin : fmax;
else
HALT_NYI;
{
float (* func)(float, float);
- if (uimm (aarch64_get_instr (cpu), 13, 12) == 0)
+ if (INSTR (13, 12) == 0)
func = min ? fminnm : fmaxnm;
- else if (uimm (aarch64_get_instr (cpu), 13, 12) == 3)
+ else if (INSTR (13, 12) == 3)
func = min ? fminf : fmaxf;
else
HALT_NYI;
instr[9,5] = Vn
instr[4,0] = Vd. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 22, 22);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned size = INSTR (22, 22);
unsigned i;
NYI_assert (29, 23, 0x1C);
{ \
if (vm != 0) \
HALT_NYI; \
- if (uimm (aarch64_get_instr (cpu), 22, 22)) \
+ if (INSTR (22, 22)) \
{ \
if (! full) \
HALT_NYI; \
#define VEC_FCMP(CMP) \
do \
{ \
- if (uimm (aarch64_get_instr (cpu), 22, 22)) \
+ if (INSTR (22, 22)) \
{ \
if (! full) \
HALT_NYI; \
instr[9,5] = Vn
instr[4.0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- int size = uimm (aarch64_get_instr (cpu), 23, 22);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ int size = INSTR (23, 22);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (28, 24, 0x0E);
NYI_assert (21, 21, 1);
- if ((uimm (aarch64_get_instr (cpu), 11, 11)
- && uimm (aarch64_get_instr (cpu), 14, 14))
- || ((uimm (aarch64_get_instr (cpu), 11, 11) == 0
- && uimm (aarch64_get_instr (cpu), 10, 10) == 0)))
+ if ((INSTR (11, 11)
+ && INSTR (14, 14))
+ || ((INSTR (11, 11) == 0
+ && INSTR (10, 10) == 0)))
{
/* A compare vs 0. */
if (vm != 0)
{
- if (uimm (aarch64_get_instr (cpu), 15, 10) == 0x2A)
+ if (INSTR (15, 10) == 0x2A)
do_vec_maxv (cpu);
- else if (uimm (aarch64_get_instr (cpu), 15, 10) == 0x32
- || uimm (aarch64_get_instr (cpu), 15, 10) == 0x3E)
+ else if (INSTR (15, 10) == 0x32
+ || INSTR (15, 10) == 0x3E)
do_vec_fminmaxV (cpu);
- else if (uimm (aarch64_get_instr (cpu), 29, 23) == 0x1C
- && uimm (aarch64_get_instr (cpu), 21, 10) == 0x876)
+ else if (INSTR (29, 23) == 0x1C
+ && INSTR (21, 10) == 0x876)
do_vec_SCVTF (cpu);
else
HALT_NYI;
}
}
- if (uimm (aarch64_get_instr (cpu), 14, 14))
+ if (INSTR (14, 14))
{
/* A floating point compare. */
- unsigned decode = (uimm (aarch64_get_instr (cpu), 29, 29) << 5)
- | (uimm (aarch64_get_instr (cpu), 23, 23) << 4)
- | uimm (aarch64_get_instr (cpu), 13, 10);
+ unsigned decode = (INSTR (29, 29) << 5)
+ | (INSTR (23, 23) << 4)
+ | INSTR (13, 10);
NYI_assert (15, 15, 1);
}
else
{
- unsigned decode = (uimm (aarch64_get_instr (cpu), 29, 29) << 6)
- | uimm (aarch64_get_instr (cpu), 15, 10);
+ unsigned decode = (INSTR (29, 29) << 6)
+ | INSTR (15, 10);
switch (decode)
{
instr[9,5] = Vn
instr[4,0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
signed int shift;
/* FIXME: What is a signed shift left in this context ?. */
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vn
instr[4,0] = Vd */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
signed int shift;
NYI_assert (29, 24, 0x2E);
NYI_assert (15, 10, 0x11);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 23, 0x1C);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x33);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (28, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x19);
- if (uimm (aarch64_get_instr (cpu), 29, 29))
+ if (INSTR (29, 29))
{
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
}
else
{
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vm
instr[4.0] = Vd. */
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (28, 24, 0x0E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x1B);
- if (uimm (aarch64_get_instr (cpu), 29, 29))
+ if (INSTR (29, 29))
{
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
}
else
{
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vn
instr[4,0] = V dest. */
- unsigned size = uimm (aarch64_get_instr (cpu), 23, 22);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned size = INSTR (23, 22);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned bias = 0;
unsigned i;
if (size == 3)
HALT_UNALLOC;
- switch (uimm (aarch64_get_instr (cpu), 30, 29))
+ switch (INSTR (30, 29))
{
case 2: /* SSUBL2. */
bias = 2;
FRegister copy_vn;
FRegister copy_vm;
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 23, 22);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned size = INSTR (23, 22);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i, range;
NYI_assert (29, 24, 0x0E);
instr[9,5] = V source
instr[4,0] = R dest. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
unsigned index;
NYI_assert (29, 21, 0x070);
NYI_assert (15, 10, 0x0F);
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
{
/* Byte transfer. */
- index = uimm (aarch64_get_instr (cpu), 20, 17);
+ index = INSTR (20, 17);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_vec_u8 (cpu, vs, index));
}
- else if (uimm (aarch64_get_instr (cpu), 17, 17))
+ else if (INSTR (17, 17))
{
- index = uimm (aarch64_get_instr (cpu), 20, 18);
+ index = INSTR (20, 18);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_vec_u16 (cpu, vs, index));
}
- else if (uimm (aarch64_get_instr (cpu), 18, 18))
+ else if (INSTR (18, 18))
{
- index = uimm (aarch64_get_instr (cpu), 20, 19);
+ index = INSTR (20, 19);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_vec_u32 (cpu, vs, index));
}
else
{
- if (uimm (aarch64_get_instr (cpu), 30, 30) != 1)
+ if (INSTR (30, 30) != 1)
HALT_UNALLOC;
- index = uimm (aarch64_get_instr (cpu), 20, 20);
+ index = INSTR (20, 20);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_vec_u64 (cpu, vs, index));
}
instr[9,5] = Vn
instr[4,0] = Vd. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
unsigned i;
NYI_assert (29, 23, 0x1D);
NYI_assert (21, 10, 0x83E);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_NYI;
instr[9,5] = Rn
instr[4,0] = Rd. */
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
unsigned i;
NYI_assert (31, 31, 0);
NYI_assert (29, 23, 0x1D);
NYI_assert (21, 10, 0x86E);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr[4,0] = Vd */
NYI_assert (29, 24, 0x0E);
- if (uimm (aarch64_get_instr (cpu), 21, 21) == 0)
+ if (INSTR (21, 21) == 0)
{
- if (uimm (aarch64_get_instr (cpu), 23, 22) == 0)
+ if (INSTR (23, 22) == 0)
{
- if (uimm (aarch64_get_instr (cpu), 30, 30) == 1
- && uimm (aarch64_get_instr (cpu), 17, 14) == 0
- && uimm (aarch64_get_instr (cpu), 12, 10) == 7)
+ if (INSTR (30, 30) == 1
+ && INSTR (17, 14) == 0
+ && INSTR (12, 10) == 7)
return do_vec_ins_2 (cpu);
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x01: do_vec_DUP_vector_into_vector (cpu); return;
case 0x03: do_vec_DUP_scalar_into_vector (cpu); return;
case 0x0A: do_vec_TRN (cpu); return;
case 0x0F:
- if (uimm (aarch64_get_instr (cpu), 17, 16) == 0)
+ if (INSTR (17, 16) == 0)
{
do_vec_MOV_into_scalar (cpu);
return;
}
}
- switch (uimm (aarch64_get_instr (cpu), 13, 10))
+ switch (INSTR (13, 10))
{
case 0x6: do_vec_UZP (cpu); return;
case 0xE: do_vec_ZIP (cpu); return;
}
}
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x07:
- switch (uimm (aarch64_get_instr (cpu), 23, 21))
+ switch (INSTR (23, 21))
{
case 1: do_vec_AND (cpu); return;
case 3: do_vec_BIC (cpu); return;
case 0x35: do_vec_fadd (cpu); return;
case 0x2E:
- switch (uimm (aarch64_get_instr (cpu), 20, 16))
+ switch (INSTR (20, 16))
{
case 0x00: do_vec_ABS (cpu); return;
case 0x01: do_vec_FCVTZS (cpu); return;
instr[9,5] = V source
instr[4,0] = V dest. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i, shift, bias = 0;
NYI_assert (28, 22, 0x3C);
NYI_assert (15, 10, 0x29);
- switch (uimm (aarch64_get_instr (cpu), 30, 29))
+ switch (INSTR (30, 29))
{
case 2: /* SXTL2, SSHLL2. */
bias = 2;
case 0: /* SXTL, SSHLL. */
- if (uimm (aarch64_get_instr (cpu), 21, 21))
+ if (INSTR (21, 21))
{
- shift = uimm (aarch64_get_instr (cpu), 20, 16);
+ shift = INSTR (20, 16);
aarch64_set_vec_s64
(cpu, vd, 0, aarch64_get_vec_s32 (cpu, vs, bias) << shift);
aarch64_set_vec_s64
(cpu, vd, 1, aarch64_get_vec_s32 (cpu, vs, bias + 1) << shift);
}
- else if (uimm (aarch64_get_instr (cpu), 20, 20))
+ else if (INSTR (20, 20))
{
- shift = uimm (aarch64_get_instr (cpu), 19, 16);
+ shift = INSTR (19, 16);
bias *= 2;
for (i = 0; i < 4; i++)
aarch64_set_vec_s32
{
NYI_assert (19, 19, 1);
- shift = uimm (aarch64_get_instr (cpu), 18, 16);
+ shift = INSTR (18, 16);
bias *= 3;
for (i = 0; i < 8; i++)
aarch64_set_vec_s16
case 3: /* UXTL2, USHLL2. */
bias = 2;
case 1: /* UXTL, USHLL. */
- if (uimm (aarch64_get_instr (cpu), 21, 21))
+ if (INSTR (21, 21))
{
- shift = uimm (aarch64_get_instr (cpu), 20, 16);
+ shift = INSTR (20, 16);
aarch64_set_vec_u64
(cpu, vd, 0, aarch64_get_vec_u32 (cpu, vs, bias) << shift);
aarch64_set_vec_u64
(cpu, vd, 1, aarch64_get_vec_u32 (cpu, vs, bias + 1) << shift);
}
- else if (uimm (aarch64_get_instr (cpu), 20, 20))
+ else if (INSTR (20, 20))
{
- shift = uimm (aarch64_get_instr (cpu), 19, 16);
+ shift = INSTR (19, 16);
bias *= 2;
for (i = 0; i < 4; i++)
aarch64_set_vec_u32
{
NYI_assert (19, 19, 1);
- shift = uimm (aarch64_get_instr (cpu), 18, 16);
+ shift = INSTR (18, 16);
bias *= 3;
for (i = 0; i < 8; i++)
aarch64_set_vec_u16
instr [4, 0] = Vd. */
int shift;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 23, 0x1E);
NYI_assert (15, 10, 0x15);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
- shift = uimm (aarch64_get_instr (cpu), 21, 16);
+ shift = INSTR (21, 16);
if (full == 0)
HALT_UNALLOC;
return;
}
- if (uimm (aarch64_get_instr (cpu), 21, 21))
+ if (INSTR (21, 21))
{
- shift = uimm (aarch64_get_instr (cpu), 20, 16);
+ shift = INSTR (20, 16);
for (i = 0; i < (full ? 4 : 2); i++)
{
return;
}
- if (uimm (aarch64_get_instr (cpu), 20, 20))
+ if (INSTR (20, 20))
{
- shift = uimm (aarch64_get_instr (cpu), 19, 16);
+ shift = INSTR (19, 16);
for (i = 0; i < (full ? 8 : 4); i++)
{
return;
}
- if (uimm (aarch64_get_instr (cpu), 19, 19) == 0)
+ if (INSTR (19, 19) == 0)
HALT_UNALLOC;
- shift = uimm (aarch64_get_instr (cpu), 18, 16);
+ shift = INSTR (18, 16);
for (i = 0; i < (full ? 16 : 8); i++)
{
NYI_assert (28, 23, 0x1E);
NYI_assert (15, 10, 0x01);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
shift = 128 - shift;
return;
}
- if (uimm (aarch64_get_instr (cpu), 21, 21))
+ if (INSTR (21, 21))
{
shift = 64 - shift;
return;
}
- if (uimm (aarch64_get_instr (cpu), 20, 20))
+ if (INSTR (20, 20))
{
shift = 32 - shift;
return;
}
- if (uimm (aarch64_get_instr (cpu), 19, 19) == 0)
+ if (INSTR (19, 19) == 0)
HALT_UNALLOC;
shift = 16 - shift;
instr[9,5] = Vn
instr[4,0] = Vd */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned L = uimm (aarch64_get_instr (cpu), 21, 21);
- unsigned H = uimm (aarch64_get_instr (cpu), 11, 11);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned size = uimm (aarch64_get_instr (cpu), 23, 22);
+ unsigned full = INSTR (30, 30);
+ unsigned L = INSTR (21, 21);
+ unsigned H = INSTR (11, 11);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned size = INSTR (23, 22);
unsigned index;
unsigned vm;
unsigned e;
uint16_t element1;
uint16_t element2;
- index = (H << 2) | (L << 1) | uimm (aarch64_get_instr (cpu), 20, 20);
- vm = uimm (aarch64_get_instr (cpu), 19, 16);
+ index = (H << 2) | (L << 1) | INSTR (20, 20);
+ vm = INSTR (19, 16);
element2 = aarch64_get_vec_u16 (cpu, vm, index);
for (e = 0; e < (full ? 8 : 4); e ++)
uint32_t element2;
index = (H << 1) | L;
- vm = uimm (aarch64_get_instr (cpu), 20, 16);
+ vm = INSTR (20, 16);
element2 = aarch64_get_vec_u32 (cpu, vm, index);
for (e = 0; e < (full ? 4 : 2); e ++)
NYI_assert (29, 24, 0x0F);
- if (uimm (aarch64_get_instr (cpu), 23, 23) != 0)
+ if (INSTR (23, 23) != 0)
{
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x20:
case 0x22: do_vec_MUL_by_element (cpu); return;
}
else
{
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x01: do_vec_SSHR_USHR (cpu); return;
case 0x15: do_vec_SHL (cpu); return;
instr[9,5] = Vs
instr[4,0] = Vd */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 24, 0x2E);
NYI_assert (21, 10, 0x82E);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr[9,5] = Vs
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int full = INSTR (30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 23, 0x5B);
NYI_assert (21, 10, 0x87E);
- if (uimm (aarch64_get_instr (cpu), 22, 22) == 0)
+ if (INSTR (22, 22) == 0)
for (i = 0; i < (full ? 4 : 2); i++)
aarch64_set_vec_float (cpu, vd, i,
sqrtf (aarch64_get_vec_float (cpu, vs, i)));
instr[9,5] = Vs
instr[4,0] = Vd. */
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
+ int full = INSTR (30, 30);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned vm = INSTR (20, 16);
unsigned i;
NYI_assert (15, 12, 4);
NYI_assert (10, 10, 0);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 1:
{
if (vm > 15)
HALT_NYI;
- elem = (uimm (aarch64_get_instr (cpu), 21, 20) << 1)
- | uimm (aarch64_get_instr (cpu), 11, 11);
+ elem = (INSTR (21, 20) << 1)
+ | INSTR (11, 11);
val = aarch64_get_vec_u16 (cpu, vm, elem);
for (i = 0; i < (full ? 8 : 4); i++)
case 2:
{
- unsigned elem = (uimm (aarch64_get_instr (cpu), 21, 21) << 1)
- | uimm (aarch64_get_instr (cpu), 11, 11);
+ unsigned elem = (INSTR (21, 21) << 1)
+ | INSTR (11, 11);
uint64_t val = aarch64_get_vec_u32 (cpu, vm, elem);
for (i = 0; i < (full ? 4 : 2); i++)
instr [9, 5] = Vn
instr [4, 0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 24, 0x2E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x21);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr [9, 5] = Vn
instr [4, 0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 24, 0x2E);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x25);
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0:
for (i = 0; i < (full ? 16 : 8); i++)
instr [9, 5] = Vn
instr [4, 0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 23, 0x5C);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x3F);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr [9, 5] = Vn
instr [4, 0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
NYI_assert (29, 23, 0x5C);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x37);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr [9, 5] = Vn
instr [4, 0] = Vd. */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned full = INSTR (30, 30);
+ unsigned vm = INSTR (20, 16);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
NYI_assert (29, 23, 0x5C);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x35);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
/* Extract values before adding them incase vd == vn/vm. */
double tmp1 = aarch64_get_vec_double (cpu, vn, 0);
instr[9,5] = Vsrc
instr[4,0] = Vdest. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
int i;
NYI_assert (29, 23, 0x5D);
NYI_assert (21, 10, 0x87E);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr[9,5] = Vsrc
instr[4,0] = Vdest. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
+ unsigned full = INSTR (30, 30);
int i;
NYI_assert (29, 23, 0x5D);
NYI_assert (21, 10, 0x83E);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
if (! full)
HALT_UNALLOC;
instr[9,5] = Vn
instr[4.0] = Vd. */
- unsigned vn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vn = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned i;
- int full = uimm (aarch64_get_instr (cpu), 30, 30);
+ int full = INSTR (30, 30);
NYI_assert (29, 10, 0xB8816);
instr[9,5] = Vs
instr[4.0] = Vd. */
- unsigned vs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned vs = INSTR (9, 5);
+ unsigned vd = INSTR (4, 0);
unsigned src_index;
unsigned dst_index;
NYI_assert (15, 15, 0);
NYI_assert (10, 10, 1);
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
{
/* Move a byte. */
- src_index = uimm (aarch64_get_instr (cpu), 14, 11);
- dst_index = uimm (aarch64_get_instr (cpu), 20, 17);
+ src_index = INSTR (14, 11);
+ dst_index = INSTR (20, 17);
aarch64_set_vec_u8 (cpu, vd, dst_index,
aarch64_get_vec_u8 (cpu, vs, src_index));
}
- else if (uimm (aarch64_get_instr (cpu), 17, 17))
+ else if (INSTR (17, 17))
{
/* Move 16-bits. */
NYI_assert (11, 11, 0);
- src_index = uimm (aarch64_get_instr (cpu), 14, 12);
- dst_index = uimm (aarch64_get_instr (cpu), 20, 18);
+ src_index = INSTR (14, 12);
+ dst_index = INSTR (20, 18);
aarch64_set_vec_u16 (cpu, vd, dst_index,
aarch64_get_vec_u16 (cpu, vs, src_index));
}
- else if (uimm (aarch64_get_instr (cpu), 18, 18))
+ else if (INSTR (18, 18))
{
/* Move 32-bits. */
NYI_assert (12, 11, 0);
- src_index = uimm (aarch64_get_instr (cpu), 14, 13);
- dst_index = uimm (aarch64_get_instr (cpu), 20, 19);
+ src_index = INSTR (14, 13);
+ dst_index = INSTR (20, 19);
aarch64_set_vec_u32 (cpu, vd, dst_index,
aarch64_get_vec_u32 (cpu, vs, src_index));
}
{
NYI_assert (19, 19, 1);
NYI_assert (13, 11, 0);
- src_index = uimm (aarch64_get_instr (cpu), 14, 14);
- dst_index = uimm (aarch64_get_instr (cpu), 20, 20);
+ src_index = INSTR (14, 14);
+ dst_index = INSTR (20, 20);
aarch64_set_vec_u64 (cpu, vd, dst_index,
aarch64_get_vec_u64 (cpu, vs, src_index));
}
dexAdvSIMD0 (sim_cpu *cpu)
{
/* instr [28,25] = 0 111. */
- if ( uimm (aarch64_get_instr (cpu), 15, 10) == 0x07
- && (uimm (aarch64_get_instr (cpu), 9, 5) ==
- uimm (aarch64_get_instr (cpu), 20, 16)))
+ if ( INSTR (15, 10) == 0x07
+ && (INSTR (9, 5) ==
+ INSTR (20, 16)))
{
- if (uimm (aarch64_get_instr (cpu), 31, 21) == 0x075
- || uimm (aarch64_get_instr (cpu), 31, 21) == 0x275)
+ if (INSTR (31, 21) == 0x075
+ || INSTR (31, 21) == 0x275)
{
do_vec_MOV_whole_vector (cpu);
return;
}
}
- if (uimm (aarch64_get_instr (cpu), 29, 19) == 0x1E0)
+ if (INSTR (29, 19) == 0x1E0)
{
do_vec_MOV_immediate (cpu);
return;
}
- if (uimm (aarch64_get_instr (cpu), 29, 19) == 0x5E0)
+ if (INSTR (29, 19) == 0x5E0)
{
do_vec_MVNI (cpu);
return;
}
- if (uimm (aarch64_get_instr (cpu), 29, 19) == 0x1C0
- || uimm (aarch64_get_instr (cpu), 29, 19) == 0x1C1)
+ if (INSTR (29, 19) == 0x1C0
+ || INSTR (29, 19) == 0x1C1)
{
- if (uimm (aarch64_get_instr (cpu), 15, 10) == 0x03)
+ if (INSTR (15, 10) == 0x03)
{
do_vec_DUP_scalar_into_vector (cpu);
return;
}
}
- switch (uimm (aarch64_get_instr (cpu), 29, 24))
+ switch (INSTR (29, 24))
{
case 0x0E: do_vec_op1 (cpu); return;
case 0x0F: do_vec_op2 (cpu); return;
case 0x2f:
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x01: do_vec_SSHR_USHR (cpu); return;
case 0x10:
}
case 0x2E:
- if (uimm (aarch64_get_instr (cpu), 21, 21) == 1)
+ if (INSTR (21, 21) == 1)
{
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x07:
- switch (uimm (aarch64_get_instr (cpu), 23, 22))
+ switch (INSTR (23, 22))
{
case 0: do_vec_EOR (cpu); return;
case 1: do_vec_BSL (cpu); return;
case 0x3F: do_vec_FDIV (cpu); return;
case 0x3E:
- switch (uimm (aarch64_get_instr (cpu), 20, 16))
+ switch (INSTR (20, 16))
{
case 0x00: do_vec_FNEG (cpu); return;
case 0x01: do_vec_FSQRT (cpu); return;
}
}
- if (uimm (aarch64_get_instr (cpu), 31, 21) == 0x370)
+ if (INSTR (31, 21) == 0x370)
{
do_vec_MOV_element (cpu);
return;
}
- switch (uimm (aarch64_get_instr (cpu), 21, 10))
+ switch (INSTR (21, 10))
{
case 0x82E: do_vec_neg (cpu); return;
case 0x87E: do_vec_sqrt (cpu); return;
default:
- if (uimm (aarch64_get_instr (cpu), 15, 10) == 0x30)
+ if (INSTR (15, 10) == 0x30)
{
do_vec_mull (cpu);
return;
static void
fmadds (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sa)
+ aarch64_get_FP_float (cpu, sn)
static void
fmaddd (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sa)
+ aarch64_get_FP_double (cpu, sn)
static void
fmsubs (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sa)
- aarch64_get_FP_float (cpu, sn)
static void
fmsubd (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sa)
- aarch64_get_FP_double (cpu, sn)
static void
fnmadds (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, - aarch64_get_FP_float (cpu, sa)
+ (- aarch64_get_FP_float (cpu, sn))
static void
fnmaddd (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, - aarch64_get_FP_double (cpu, sa)
+ (- aarch64_get_FP_double (cpu, sn))
static void
fnmsubs (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, - aarch64_get_FP_float (cpu, sa)
+ aarch64_get_FP_float (cpu, sn)
static void
fnmsubd (sim_cpu *cpu)
{
- unsigned sa = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sa = INSTR (14, 10);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, - aarch64_get_FP_double (cpu, sa)
+ aarch64_get_FP_double (cpu, sn)
instr[21] ==> o1 : 0 ==> unnegated, 1 ==> negated
instr[15] ==> o2 : 0 ==> ADD, 1 ==> SUB */
- uint32_t M_S = (uimm (aarch64_get_instr (cpu), 31, 31) << 1)
- | uimm (aarch64_get_instr (cpu), 29, 29);
+ uint32_t M_S = (INSTR (31, 31) << 1)
+ | INSTR (29, 29);
/* dispatch on combined type:o1:o2. */
- uint32_t dispatch = (uimm (aarch64_get_instr (cpu), 23, 21) << 1)
- | uimm (aarch64_get_instr (cpu), 15, 15);
+ uint32_t dispatch = (INSTR (23, 21) << 1)
+ | INSTR (15, 15);
if (M_S != 0)
HALT_UNALLOC;
/* Single precision. */
float val1 = aarch64_get_vec_float (cpu, rn, 0);
float val2 = aarch64_get_vec_float (cpu, rm, 0);
-
+
/* FIXME: Check for NaNs. */
if (val1 == val2)
aarch64_set_CPSR (cpu, (Z | C));
static void
fadds (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sn)
+ aarch64_get_FP_float (cpu, sm));
static void
faddd (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sn)
+ aarch64_get_FP_double (cpu, sm));
static void
fdivs (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sn)
/ aarch64_get_FP_float (cpu, sm));
static void
fdivd (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sn)
/ aarch64_get_FP_double (cpu, sm));
static void
fmuls (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sn)
* aarch64_get_FP_float (cpu, sm));
static void
fmuld (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sn)
* aarch64_get_FP_double (cpu, sm));
static void
fnmuls (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, - (aarch64_get_FP_float (cpu, sn)
* aarch64_get_FP_float (cpu, sm)));
static void
fnmuld (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, - (aarch64_get_FP_double (cpu, sn)
* aarch64_get_FP_double (cpu, sm)));
static void
fsubs (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_float (cpu, sd, aarch64_get_FP_float (cpu, sn)
- aarch64_get_FP_float (cpu, sm));
static void
fsubd (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
aarch64_set_FP_double (cpu, sd, aarch64_get_FP_double (cpu, sn)
- aarch64_get_FP_double (cpu, sm));
instr[9,5] = Sn
instr[4,0] = Cpu */
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
NYI_assert (31, 23, 0x03C);
NYI_assert (15, 10, 0x1E);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, sd,
dminnm (aarch64_get_FP_double (cpu, sn),
aarch64_get_FP_double (cpu, sm)));
instr[9,5] = Sn
instr[4,0] = Cpu */
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
NYI_assert (31, 23, 0x03C);
NYI_assert (15, 10, 0x1A);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, sd,
dmaxnm (aarch64_get_FP_double (cpu, sn),
aarch64_get_FP_double (cpu, sm)));
instr[9,5] = Vn
instr[4,0] = Vd */
- uint32_t M_S = (uimm (aarch64_get_instr (cpu), 31, 31) << 1)
- | uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t type = uimm (aarch64_get_instr (cpu), 23, 22);
+ uint32_t M_S = (INSTR (31, 31) << 1)
+ | INSTR (29, 29);
+ uint32_t type = INSTR (23, 22);
/* Dispatch on opcode. */
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 15, 12);
+ uint32_t dispatch = INSTR (15, 12);
if (type > 1)
HALT_UNALLOC;
instr[11,10] = 11
instr[9,5] = Sn
instr[4,0] = Cpu */
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
- uint32_t set = testConditionCode (cpu, uimm (aarch64_get_instr (cpu), 15, 12));
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
+ unsigned sd = INSTR ( 4, 0);
+ uint32_t set = testConditionCode (cpu, INSTR (15, 12));
NYI_assert (31, 23, 0x03C);
NYI_assert (11, 10, 0x3);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, sd, set ? sn : sm);
else
aarch64_set_FP_float (cpu, sd, set ? sn : sm);
static void
fsturs (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_mem_u32 (cpu, aarch64_get_reg_u64 (cpu, st, 1) + offset,
aarch64_get_vec_u32 (cpu, rn, 0));
static void
fsturd (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_mem_u64 (cpu, aarch64_get_reg_u64 (cpu, st, 1) + offset,
aarch64_get_vec_u64 (cpu, rn, 0));
static void
fsturq (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
FRegister a;
aarch64_get_FP_long_double (cpu, rn, & a);
static void
ffmovs (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_FP_float (cpu, st, aarch64_get_FP_float (cpu, rn));
}
static void
ffmovd (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_FP_double (cpu, st, aarch64_get_FP_double (cpu, rn));
}
static void
fgmovs (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_vec_u32 (cpu, st, 0, aarch64_get_reg_u32 (cpu, rn, NO_SP));
}
static void
fgmovd (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_vec_u64 (cpu, st, 0, aarch64_get_reg_u64 (cpu, rn, NO_SP));
}
static void
gfmovs (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, st, NO_SP, aarch64_get_vec_u32 (cpu, rn, 0));
}
static void
gfmovd (sim_cpu *cpu)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, st, NO_SP, aarch64_get_vec_u64 (cpu, rn, 0));
}
static void
fmovs (sim_cpu *cpu)
{
- unsigned int sd = uimm (aarch64_get_instr (cpu), 4, 0);
- uint32_t imm = uimm (aarch64_get_instr (cpu), 20, 13);
+ unsigned int sd = INSTR (4, 0);
+ uint32_t imm = INSTR (20, 13);
float f = fp_immediate_for_encoding_32 (imm);
aarch64_set_FP_float (cpu, sd, f);
static void
fmovd (sim_cpu *cpu)
{
- unsigned int sd = uimm (aarch64_get_instr (cpu), 4, 0);
- uint32_t imm = uimm (aarch64_get_instr (cpu), 20, 13);
+ unsigned int sd = INSTR (4, 0);
+ uint32_t imm = INSTR (20, 13);
double d = fp_immediate_for_encoding_64 (imm);
aarch64_set_FP_double (cpu, sd, d);
instr[12,10] == 100
instr[9,5] == imm5 : 00000 ==> PK, ow ==> UNALLOC
instr[4,0] == Rd */
- uint32_t imm5 = uimm (aarch64_get_instr (cpu), 9, 5);
+ uint32_t imm5 = INSTR (9, 5);
NYI_assert (31, 23, 0x3C);
if (imm5 != 0)
HALT_UNALLOC;
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
fmovd (cpu);
else
fmovs (cpu);
static void
fldurs (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_vec_u32 (cpu, st, 0, aarch64_get_mem_u32
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset));
static void
fldurd (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
aarch64_set_vec_u64 (cpu, st, 0, aarch64_get_mem_u64
(cpu, aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset));
static void
fldurq (sim_cpu *cpu, int32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int st = INSTR (4, 0);
FRegister a;
uint64_t addr = aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset;
static void
fabss (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
float value = aarch64_get_FP_float (cpu, sn);
aarch64_set_FP_float (cpu, sd, fabsf (value));
static void
fabcpu (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
double value = aarch64_get_FP_double (cpu, sn);
aarch64_set_FP_double (cpu, sd, fabs (value));
static void
fnegs (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_float (cpu, sd, - aarch64_get_FP_float (cpu, sn));
}
static void
fnegd (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_double (cpu, sd, - aarch64_get_FP_double (cpu, sn));
}
static void
fsqrts (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_float (cpu, sd, sqrt (aarch64_get_FP_float (cpu, sn)));
}
static void
fsqrtd (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_double (cpu, sd,
sqrt (aarch64_get_FP_double (cpu, sn)));
static void
fcvtds (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_float (cpu, sd, (float) aarch64_get_FP_double (cpu, sn));
}
static void
fcvtcpu (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_double (cpu, sd, (double) aarch64_get_FP_float (cpu, sn));
}
instr[4,0] = dest */
float val;
- unsigned rs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned int rmode = uimm (aarch64_get_instr (cpu), 17, 15);
+ unsigned rs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned int rmode = INSTR (17, 15);
NYI_assert (31, 23, 0x03C);
NYI_assert (21, 18, 0x9);
/* FIXME: Add support for rmode == 6 exactness check. */
rmode = uimm (aarch64_get_FPSR (cpu), 23, 22);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double val = aarch64_get_FP_double (cpu, rs);
/* Convert half to float. */
static void
-do_FCVT_half_to_single (sim_cpu * cpu)
+do_FCVT_half_to_single (sim_cpu *cpu)
{
unsigned rn = INSTR (9, 5);
unsigned rd = INSTR (4, 0);
/* Convert half to float. */
static void
-do_FCVT_half_to_double (sim_cpu * cpu)
+do_FCVT_half_to_double (sim_cpu *cpu)
{
unsigned rn = INSTR (9, 5);
unsigned rd = INSTR (4, 0);
NYI_assert (31, 10, 0x7B8B0);
-
+
aarch64_set_FP_double (cpu, rd, (double) aarch64_get_FP_half (cpu, rn));
}
static void
-do_FCVT_single_to_half (sim_cpu * cpu)
+do_FCVT_single_to_half (sim_cpu *cpu)
{
unsigned rn = INSTR (9, 5);
unsigned rd = INSTR (4, 0);
/* Convert half to float. */
static void
-do_FCVT_double_to_half (sim_cpu * cpu)
+do_FCVT_double_to_half (sim_cpu *cpu)
{
unsigned rn = INSTR (9, 5);
unsigned rd = INSTR (4, 0);
NYI_assert (31, 10, 0x798F0);
-
+
aarch64_set_FP_half (cpu, rd, (float) aarch64_get_FP_double (cpu, rn));
}
000101 ==> FCVT (half-to-double)
instr[14,10] = 10000. */
- uint32_t M_S = (uimm (aarch64_get_instr (cpu), 31, 31) << 1)
- | uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t type = uimm (aarch64_get_instr (cpu), 23, 22);
- uint32_t opcode = uimm (aarch64_get_instr (cpu), 20, 15);
+ uint32_t M_S = (INSTR (31, 31) << 1)
+ | INSTR (29, 29);
+ uint32_t type = INSTR (23, 22);
+ uint32_t opcode = INSTR (20, 15);
if (M_S != 0)
HALT_UNALLOC;
static void
scvtf32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_float
(cpu, sd, (float) aarch64_get_reg_s32 (cpu, rn, NO_SP));
static void
scvtf (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_float
(cpu, sd, (float) aarch64_get_reg_s64 (cpu, rn, NO_SP));
static void
scvtd32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_double
(cpu, sd, (double) aarch64_get_reg_s32 (cpu, rn, NO_SP));
static void
scvtd (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned sd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned sd = INSTR (4, 0);
aarch64_set_FP_double
(cpu, sd, (double) aarch64_get_reg_s64 (cpu, rn, NO_SP));
static void
fcvtszs32 (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : check that this rounds toward zero. */
float f = aarch64_get_FP_float (cpu, sn);
int32_t value = (int32_t) f;
static void
fcvtszs (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
float f = aarch64_get_FP_float (cpu, sn);
int64_t value = (int64_t) f;
static void
fcvtszd32 (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : check that this rounds toward zero. */
double d = aarch64_get_FP_double (cpu, sn);
int32_t value = (int32_t) d;
static void
fcvtszd (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : check that this rounds toward zero. */
double d = aarch64_get_FP_double (cpu, sn);
int64_t value;
instr[9,5] = Rs
instr[4,0] = Rd. */
- unsigned rs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (30, 23, 0x3C);
NYI_assert (20, 16, 0x19);
- if (uimm (aarch64_get_instr (cpu), 21, 21) != 1)
+ if (INSTR (21, 21) != 1)
/* Convert to fixed point. */
HALT_NYI;
- if (uimm (aarch64_get_instr (cpu), 31, 31))
+ if (INSTR (31, 31))
{
/* Convert to unsigned 64-bit integer. */
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double d = aarch64_get_FP_double (cpu, rs);
uint64_t value = (uint64_t) d;
uint32_t value;
/* Convert to unsigned 32-bit integer. */
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double d = aarch64_get_FP_double (cpu, rs);
instr[9,5] = Rs
instr[4,0] = Rd. */
- unsigned rs = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rs = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (30, 23, 0x3C);
NYI_assert (20, 16, 0x03);
- if (uimm (aarch64_get_instr (cpu), 21, 21) != 1)
+ if (INSTR (21, 21) != 1)
HALT_NYI;
/* FIXME: Add exception raising. */
- if (uimm (aarch64_get_instr (cpu), 31, 31))
+ if (INSTR (31, 31))
{
uint64_t value = aarch64_get_reg_u64 (cpu, rs, NO_SP);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, rd, (double) value);
else
aarch64_set_FP_float (cpu, rd, (float) value);
{
uint32_t value = aarch64_get_reg_u32 (cpu, rs, NO_SP);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, rd, (double) value);
else
aarch64_set_FP_float (cpu, rd, (float) value);
instr[9,5] ==> source
instr[4,0] ==> dest. */
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (31, 17, 0x4F57);
- if (uimm (aarch64_get_instr (cpu), 15, 10) != 0)
+ if (INSTR (15, 10) != 0)
HALT_UNALLOC;
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
aarch64_set_vec_u64 (cpu, rd, 1, aarch64_get_reg_u64 (cpu, rn, NO_SP));
else
aarch64_set_reg_u64 (cpu, rd, NO_SP, aarch64_get_vec_u64 (cpu, rn, 1));
uint32_t size;
uint32_t S;
- if (uimm (aarch64_get_instr (cpu), 31, 17) == 0x4F57)
+ if (INSTR (31, 17) == 0x4F57)
{
float_vector_move (cpu);
return;
}
- size = uimm (aarch64_get_instr (cpu), 31, 31);
- S = uimm (aarch64_get_instr (cpu), 29, 29);
+ size = INSTR (31, 31);
+ S = INSTR (29, 29);
if (S != 0)
HALT_UNALLOC;
- type = uimm (aarch64_get_instr (cpu), 23, 22);
+ type = INSTR (23, 22);
if (type > 1)
HALT_UNALLOC;
- rmode_opcode = uimm (aarch64_get_instr (cpu), 20, 16);
+ rmode_opcode = INSTR (20, 16);
size_type = (size << 1) | type; /* 0==32f, 1==32d, 2==64f, 3==64d. */
switch (rmode_opcode)
static void
fcmps (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
float fvalue1 = aarch64_get_FP_float (cpu, sn);
float fvalue2 = aarch64_get_FP_float (cpu, sm);
static void
fcmpzs (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sn = INSTR ( 9, 5);
float fvalue1 = aarch64_get_FP_float (cpu, sn);
set_flags_for_float_compare (cpu, fvalue1, 0.0f);
static void
fcmpes (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
float fvalue1 = aarch64_get_FP_float (cpu, sn);
float fvalue2 = aarch64_get_FP_float (cpu, sm);
static void
fcmpzes (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sn = INSTR ( 9, 5);
float fvalue1 = aarch64_get_FP_float (cpu, sn);
set_flags_for_float_compare (cpu, fvalue1, 0.0f);
static void
fcmpd (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
double dvalue1 = aarch64_get_FP_double (cpu, sn);
double dvalue2 = aarch64_get_FP_double (cpu, sm);
static void
fcmpzd (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sn = INSTR ( 9, 5);
double dvalue1 = aarch64_get_FP_double (cpu, sn);
set_flags_for_double_compare (cpu, dvalue1, 0.0);
static void
fcmped (sim_cpu *cpu)
{
- unsigned sm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sm = INSTR (20, 16);
+ unsigned sn = INSTR ( 9, 5);
double dvalue1 = aarch64_get_FP_double (cpu, sn);
double dvalue2 = aarch64_get_FP_double (cpu, sm);
static void
fcmpzed (sim_cpu *cpu)
{
- unsigned sn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned sn = INSTR ( 9, 5);
double dvalue1 = aarch64_get_FP_double (cpu, sn);
set_flags_for_double_compare (cpu, dvalue1, 0.0);
01000 ==> FCMPZ, 11000 ==> FCMPEZ,
ow ==> UNALLOC */
uint32_t dispatch;
- uint32_t M_S = (uimm (aarch64_get_instr (cpu), 31, 31) << 1)
- | uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t type = uimm (aarch64_get_instr (cpu), 23, 22);
- uint32_t op = uimm (aarch64_get_instr (cpu), 15, 14);
- uint32_t op2_2_0 = uimm (aarch64_get_instr (cpu), 2, 0);
+ uint32_t M_S = (INSTR (31, 31) << 1)
+ | INSTR (29, 29);
+ uint32_t type = INSTR (23, 22);
+ uint32_t op = INSTR (15, 14);
+ uint32_t op2_2_0 = INSTR (2, 0);
if (op2_2_0 != 0)
HALT_UNALLOC;
HALT_UNALLOC;
/* dispatch on type and top 2 bits of opcode. */
- dispatch = (type << 2) | uimm (aarch64_get_instr (cpu), 4, 3);
+ dispatch = (type << 2) | INSTR (4, 3);
switch (dispatch)
{
instr [9,5] = Fn
instr [4,0] = Fd. */
- unsigned Fn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned Fd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned Fn = INSTR (9, 5);
+ unsigned Fd = INSTR (4, 0);
NYI_assert (31, 23, 0x0FC);
NYI_assert (21, 10, 0xC36);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double val1 = aarch64_get_vec_double (cpu, Fn, 0);
double val2 = aarch64_get_vec_double (cpu, Fn, 1);
instr [9, 5] = Rn
instr [4, 0] = Rd. */
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (31, 23, 0x0FD);
NYI_assert (21, 21, 1);
NYI_assert (15, 10, 0x35);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
aarch64_set_FP_double (cpu, rd,
fabs (aarch64_get_FP_double (cpu, rn)
- aarch64_get_FP_double (cpu, rm)));
instr [9, 5] = Rn
instr [4, 0] = Rd. */
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (31, 21, 0x2F7);
NYI_assert (15, 10, 0x0D);
aarch64_get_vec_s64 (cpu, rn, 0) << shift);
else
aarch64_set_vec_s64 (cpu, rd, 0,
- aarch64_get_vec_s64 (cpu, rn, 0) >> - shift);
+ aarch64_get_vec_s64 (cpu, rn, 0) >> - shift);
}
static void
instr [9, 5] = Rn
instr [4, 0] = Rd. */
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned EUac = (uimm (aarch64_get_instr (cpu), 23, 23) << 2)
- | (uimm (aarch64_get_instr (cpu), 29, 29) << 1)
- | uimm (aarch64_get_instr (cpu), 11, 11);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ unsigned EUac = (INSTR (23, 23) << 2)
+ | (INSTR (29, 29) << 1)
+ | INSTR (11, 11);
unsigned result;
float val1;
float val2;
NYI_assert (15, 12, 0xE);
NYI_assert (10, 10, 1);
- if (uimm (aarch64_get_instr (cpu), 22, 22))
+ if (INSTR (22, 22))
{
double val1 = aarch64_get_FP_double (cpu, rn);
double val2 = aarch64_get_FP_double (cpu, rm);
instr [9, 5] = Rn
instr [4, 0] = Rd. */
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
unsigned index;
NYI_assert (31, 21, 0x2F0);
NYI_assert (15, 10, 0x01);
- if (uimm (aarch64_get_instr (cpu), 16, 16))
+ if (INSTR (16, 16))
{
/* 8-bit. */
- index = uimm (aarch64_get_instr (cpu), 20, 17);
+ index = INSTR (20, 17);
aarch64_set_vec_u8
(cpu, rd, 0, aarch64_get_vec_u8 (cpu, rn, index));
}
- else if (uimm (aarch64_get_instr (cpu), 17, 17))
+ else if (INSTR (17, 17))
{
/* 16-bit. */
- index = uimm (aarch64_get_instr (cpu), 20, 18);
+ index = INSTR (20, 18);
aarch64_set_vec_u16
(cpu, rd, 0, aarch64_get_vec_u16 (cpu, rn, index));
}
- else if (uimm (aarch64_get_instr (cpu), 18, 18))
+ else if (INSTR (18, 18))
{
/* 32-bit. */
- index = uimm (aarch64_get_instr (cpu), 20, 19);
+ index = INSTR (20, 19);
aarch64_set_vec_u32
(cpu, rd, 0, aarch64_get_vec_u32 (cpu, rn, index));
}
- else if (uimm (aarch64_get_instr (cpu), 19, 19))
+ else if (INSTR (19, 19))
{
/* 64-bit. */
- index = uimm (aarch64_get_instr (cpu), 20, 20);
+ index = INSTR (20, 20);
aarch64_set_vec_u64
(cpu, rd, 0, aarch64_get_vec_u64 (cpu, rn, index));
}
instr [9, 5] = Rn
instr [4, 0] = Rd. */
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
NYI_assert (31, 10, 0x1FB82E);
{
/* instr [30] = 1. */
/* instr [28,25] = 1111. */
- switch (uimm (aarch64_get_instr (cpu), 31, 23))
+ switch (INSTR (31, 23))
{
case 0xBC:
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x01: do_scalar_MOV (cpu); return;
case 0x39: do_scalar_FCM (cpu); return;
case 0xBE: do_scalar_shift (cpu); return;
case 0xFC:
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x36: do_scalar_FADDP (cpu); return;
case 0x39: do_scalar_FCM (cpu); return;
break;
case 0xFD:
- switch (uimm (aarch64_get_instr (cpu), 15, 10))
+ switch (INSTR (15, 10))
{
case 0x0D: do_scalar_CMGT (cpu); return;
case 0x11: do_scalar_USHL (cpu); return;
default:
HALT_NYI;
}
-
+
default:
HALT_NYI;
}
/* We are currently only interested in the basic
scalar fp routines which all have bit 30 = 0. */
- if (uimm (aarch64_get_instr (cpu), 30, 30))
+ if (INSTR (30, 30))
do_scalar_vec (cpu);
/* instr[24] is set for FP data processing 3-source and clear for
all other basic scalar fp instruction groups. */
- else if (uimm (aarch64_get_instr (cpu), 24, 24))
+ else if (INSTR (24, 24))
dexSimpleFPDataProc3Source (cpu);
/* instr[21] is clear for floating <-> fixed conversions and set for
all other basic scalar fp instruction groups. */
- else if (!uimm (aarch64_get_instr (cpu), 21, 21))
+ else if (!INSTR (21, 21))
dexSimpleFPFixedConvert (cpu);
/* instr[11,10] : 01 ==> cond compare, 10 ==> Data Proc 2 Source
11 ==> cond select, 00 ==> other. */
else
- switch (uimm (aarch64_get_instr (cpu), 11, 10))
+ switch (INSTR (11, 10))
{
case 1: dexSimpleFPCondCompare (cpu); return;
case 2: dexSimpleFPDataProc2Source (cpu); return;
default:
/* Now an ordered cascade of tests.
- FP immediate has aarch64_get_instr (cpu)[12] == 1.
- FP compare has aarch64_get_instr (cpu)[13] == 1.
- FP Data Proc 1 Source has aarch64_get_instr (cpu)[14] == 1.
- FP floating <--> integer conversions has aarch64_get_instr (cpu)[15] == 0. */
- if (uimm (aarch64_get_instr (cpu), 12, 12))
+ FP immediate has instr [12] == 1.
+ FP compare has instr [13] == 1.
+ FP Data Proc 1 Source has instr [14] == 1.
+ FP floating <--> integer conversions has instr [15] == 0. */
+ if (INSTR (12, 12))
dexSimpleFPImmediate (cpu);
- else if (uimm (aarch64_get_instr (cpu), 13, 13))
+ else if (INSTR (13, 13))
dexSimpleFPCompare (cpu);
- else if (uimm (aarch64_get_instr (cpu), 14, 14))
+ else if (INSTR (14, 14))
dexSimpleFPDataProc1Source (cpu);
- else if (!uimm (aarch64_get_instr (cpu), 15, 15))
+ else if (!INSTR (15, 15))
dexSimpleFPIntegerConvert (cpu);
else
instr[30,29] = immlo
instr[23,5] = immhi. */
uint64_t address;
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- uint32_t isPage = uimm (aarch64_get_instr (cpu), 31, 31);
+ unsigned rd = INSTR (4, 0);
+ uint32_t isPage = INSTR (31, 31);
union { int64_t u64; uint64_t s64; } imm;
uint64_t offset;
imm.s64 = simm64 (aarch64_get_instr (cpu), 23, 5);
offset = imm.u64;
- offset = (offset << 2) | uimm (aarch64_get_instr (cpu), 30, 29);
+ offset = (offset << 2) | INSTR (30, 29);
address = aarch64_get_PC (cpu);
static void
and32 (sim_cpu *cpu, uint32_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, NO_SP) & bimm);
static void
and64 (sim_cpu *cpu, uint64_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, NO_SP) & bimm);
static void
ands32 (sim_cpu *cpu, uint32_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = bimm;
static void
ands64 (sim_cpu *cpu, uint64_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = bimm;
static void
eor32 (sim_cpu *cpu, uint32_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, NO_SP) ^ bimm);
static void
eor64 (sim_cpu *cpu, uint64_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, NO_SP) ^ bimm);
static void
orr32 (sim_cpu *cpu, uint32_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u32 (cpu, rn, NO_SP) | bimm);
static void
orr64 (sim_cpu *cpu, uint64_t bimm)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, SP_OK,
aarch64_get_reg_u64 (cpu, rn, NO_SP) | bimm);
static void
and32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
and64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
ands32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = shifted32 (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
ands64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = shifted64 (aarch64_get_reg_u64 (cpu, rm, NO_SP),
static void
bic32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
bic64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
bics32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value1 = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t value2 = ~ shifted32 (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
bics64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t value2 = ~ shifted64 (aarch64_get_reg_u64 (cpu, rm, NO_SP),
static void
eon32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
eon64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
eor32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
eor64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
orr32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
orr64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
static void
orn32_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u32 (cpu, rn, NO_SP)
static void
orn64_shift (sim_cpu *cpu, Shift shift, uint32_t count)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, aarch64_get_reg_u64 (cpu, rn, NO_SP)
instr[4,0] = Rd */
/* 32 bit operations must have N = 0 or else we have an UNALLOC. */
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t N = uimm (aarch64_get_instr (cpu), 22, 22);
- /* uint32_t immr = uimm (aarch64_get_instr (cpu), 21, 16);. */
- /* uint32_t imms = uimm (aarch64_get_instr (cpu), 15, 10);. */
- uint32_t index = uimm (aarch64_get_instr (cpu), 22, 10);
+ uint32_t size = INSTR (31, 31);
+ uint32_t N = INSTR (22, 22);
+ /* uint32_t immr = INSTR (21, 16);. */
+ /* uint32_t imms = INSTR (15, 10);. */
+ uint32_t index = INSTR (22, 10);
uint64_t bimm64 = LITable [index];
- uint32_t dispatch = uimm (aarch64_get_instr (cpu), 30, 29);
+ uint32_t dispatch = INSTR (30, 29);
if (~size & N)
HALT_UNALLOC;
static void
movz32 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, val << (pos * 16));
}
static void
movz64 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, ((uint64_t) val) << (pos * 16));
}
static void
movn32 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, ((val << (pos * 16)) ^ 0xffffffffU));
}
static void
movn64 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, ((((uint64_t) val) << (pos * 16))
static void
movk32 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
uint32_t current = aarch64_get_reg_u32 (cpu, rd, NO_SP);
uint32_t value = val << (pos * 16);
uint32_t mask = ~(0xffffU << (pos * 16));
static void
movk64 (sim_cpu *cpu, uint32_t val, uint32_t pos)
{
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rd = INSTR (4, 0);
uint64_t current = aarch64_get_reg_u64 (cpu, rd, NO_SP);
uint64_t value = (uint64_t) val << (pos * 16);
uint64_t mask = ~(0xffffULL << (pos * 16));
we just pass the multiplier. */
uint32_t imm;
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t op = uimm (aarch64_get_instr (cpu), 30, 29);
- uint32_t shift = uimm (aarch64_get_instr (cpu), 22, 21);
+ uint32_t size = INSTR (31, 31);
+ uint32_t op = INSTR (30, 29);
+ uint32_t shift = INSTR (22, 21);
/* 32 bit can only shift 0 or 1 lot of 16.
anything else is an unallocated instruction. */
if (op == 1)
HALT_UNALLOC;
- imm = uimm (aarch64_get_instr (cpu), 20, 5);
+ imm = INSTR (20, 5);
if (size == 0)
{
ubfm32 (sim_cpu *cpu, uint32_t r, uint32_t s)
{
unsigned rd;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
/* Pick either s+1-r or s+1 consecutive bits out of the original word. */
value >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, value);
}
ubfm (sim_cpu *cpu, uint32_t r, uint32_t s)
{
unsigned rd;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
if (r <= s)
value >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, value);
}
sbfm32 (sim_cpu *cpu, uint32_t r, uint32_t s)
{
unsigned rd;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
/* as per ubfm32 but use an ASR instead of an LSR. */
int32_t value = aarch64_get_reg_s32 (cpu, rn, NO_SP);
value >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP, (uint32_t) value);
}
sbfm (sim_cpu *cpu, uint32_t r, uint32_t s)
{
unsigned rd;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
/* acpu per ubfm but use an ASR instead of an LSR. */
int64_t value = aarch64_get_reg_s64 (cpu, rn, NO_SP);
value >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
aarch64_set_reg_s64 (cpu, rd, NO_SP, value);
}
static void
bfm32 (sim_cpu *cpu, uint32_t r, uint32_t s)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t mask = -1;
unsigned rd;
mask >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
value2 = aarch64_get_reg_u32 (cpu, rd, NO_SP);
value2 &= ~mask;
bfm (sim_cpu *cpu, uint32_t r, uint32_t s)
{
unsigned rd;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t mask = 0xffffffffffffffffULL;
mask >>= r - (s + 1);
}
- rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP, (aarch64_get_reg_u64 (cpu, rd, NO_SP) & ~mask) | value);
}
/* 32 bit operations must have N = 0 or else we have an UNALLOC. */
uint32_t dispatch;
uint32_t imms;
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t N = uimm (aarch64_get_instr (cpu), 22, 22);
+ uint32_t size = INSTR (31, 31);
+ uint32_t N = INSTR (22, 22);
/* 32 bit operations must have immr[5] = 0 and imms[5] = 0. */
/* or else we have an UNALLOC. */
- uint32_t immr = uimm (aarch64_get_instr (cpu), 21, 16);
+ uint32_t immr = INSTR (21, 16);
if (~size & N)
HALT_UNALLOC;
if (!size && uimm (immr, 5, 5))
HALT_UNALLOC;
- imms = uimm (aarch64_get_instr (cpu), 15, 10);
+ imms = INSTR (15, 10);
if (!size && uimm (imms, 5, 5))
HALT_UNALLOC;
/* Switch on combined size and op. */
- dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ dispatch = INSTR (31, 29);
switch (dispatch)
{
case 0: sbfm32 (cpu, immr, imms); return;
instr[15,10] = imms : 0xxxxx for 32 bit
instr[9,5] = Rn
instr[4,0] = Rd */
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned imms = uimm (aarch64_get_instr (cpu), 15, 10) & 31;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned imms = INSTR (15, 10) & 31;
+ unsigned rn = INSTR ( 9, 5);
+ unsigned rd = INSTR ( 4, 0);
uint64_t val1;
uint64_t val2;
instr[15,10] = imms
instr[9,5] = Rn
instr[4,0] = Rd */
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned imms = uimm (aarch64_get_instr (cpu), 15, 10) & 63;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned imms = INSTR (15, 10) & 63;
+ unsigned rn = INSTR ( 9, 5);
+ unsigned rd = INSTR ( 4, 0);
uint64_t val;
val = aarch64_get_reg_u64 (cpu, rm, NO_SP);
/* 32 bit operations must have N = 0 or else we have an UNALLOC. */
/* 64 bit operations must have N = 1 or else we have an UNALLOC. */
uint32_t dispatch;
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t N = uimm (aarch64_get_instr (cpu), 22, 22);
+ uint32_t size = INSTR (31, 31);
+ uint32_t N = INSTR (22, 22);
/* 32 bit operations must have imms[5] = 0
or else we have an UNALLOC. */
- uint32_t imms = uimm (aarch64_get_instr (cpu), 15, 10);
+ uint32_t imms = INSTR (15, 10);
if (size ^ N)
HALT_UNALLOC;
HALT_UNALLOC;
/* Switch on combined size and op. */
- dispatch = uimm (aarch64_get_instr (cpu), 31, 29);
+ dispatch = INSTR (31, 29);
if (dispatch == 0)
do_EXTR_32 (cpu);
instr[23,22] = opc
instr[20,12] = simm9
instr[9,5] = rn may be SP. */
- /* unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0); */
- uint32_t V = uimm (aarch64_get_instr (cpu), 26, 26);
- uint32_t dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 30) << 2)
- | uimm (aarch64_get_instr (cpu), 23, 22));
+ /* unsigned rt = INSTR (4, 0); */
+ uint32_t V = INSTR (26, 26);
+ uint32_t dispatch = ( (INSTR (31, 30) << 2)
+ | INSTR (23, 22));
int32_t imm = simm32 (aarch64_get_instr (cpu), 20, 12);
if (!V)
static void
ldrsb32_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int rt = INSTR (4, 0);
/* The target register may not be SP but the source may be
there is no scaling required for a byte load. */
static void
ldrsb32_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned int rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rm = INSTR (20, 16);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int rt = INSTR (4, 0);
/* rn may reference SP, rm and rt must reference ZR. */
ldrsb32_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
uint64_t address;
- unsigned int rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned int rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned int rn = INSTR (9, 5);
+ unsigned int rt = INSTR (4, 0);
if (rn == rt && wb != NoWriteBack)
HALT_UNALLOC;
static void
fstrb_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned st = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
aarch64_set_mem_u8 (cpu,
aarch64_get_reg_u64 (cpu, rn, SP_OK) + offset,
static void
fstrb_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
fstrh_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned st = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
aarch64_set_mem_u16
(cpu,
static void
fstrh_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
fstrs_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned st = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
aarch64_set_mem_u32
(cpu,
static void
fstrs_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
fstrs_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
fstrd_abs (sim_cpu *cpu, uint32_t offset)
{
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned st = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
aarch64_set_mem_u64
(cpu,
static void
fstrd_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
static void
fstrd_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
fstrq_abs (sim_cpu *cpu, uint32_t offset)
{
FRegister a;
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned st = INSTR (4, 0);
+ unsigned rn = INSTR (9, 5);
uint64_t addr;
aarch64_get_FP_long_double (cpu, st, & a);
fstrq_wb (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
FRegister a;
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
if (wb != Post)
static void
fstrq_scale_ext (sim_cpu *cpu, Scaling scaling, Extension extension)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned st = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned st = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rn, SP_OK);
int64_t extended = extend (aarch64_get_reg_u32 (cpu, rm, NO_SP),
static void
dexLoadImmediatePrePost (sim_cpu *cpu)
{
- /* instr[29,24] == 111_00
- instr[21] == 0
- instr[11,10] == 00
- instr[31,30] = size
- instr[26] = V
+ /* instr[31,30] = size
+ instr[29,27] = 111
+ instr[26] = V
+ instr[25,24] = 00
instr[23,22] = opc
+ instr[21] = 0
instr[20,12] = simm9
- instr[11] = wb : 0 ==> Post, 1 ==> Pre
- instr[9,5] = rn may be SP. */
- /* unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0); */
- uint32_t V = uimm (aarch64_get_instr (cpu), 26, 26);
- uint32_t dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 30) << 2)
- | uimm (aarch64_get_instr (cpu), 23, 22));
- int32_t imm = simm32 (aarch64_get_instr (cpu), 20, 12);
- WriteBack wb = writeback (aarch64_get_instr (cpu), 11);
+ instr[11] = wb : 0 ==> Post, 1 ==> Pre
+ instr[10] = 0
+ instr[9,5] = Rn may be SP.
+ instr[4,0] = Rt */
+
+ uint32_t V = INSTR (26, 26);
+ uint32_t dispatch = ((INSTR (31, 30) << 2) | INSTR (23, 22));
+ int32_t imm = simm32 (aarch64_get_instr (cpu), 20, 12);
+ WriteBack wb = INSTR (11, 11);
if (!V)
{
instr[9,5] = rn
instr[4,0] = rt. */
- uint32_t V = uimm (aarch64_get_instr (cpu), 26,26);
- uint32_t dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 30) << 2)
- | uimm (aarch64_get_instr (cpu), 23, 22));
- Scaling scale = scaling (aarch64_get_instr (cpu), 12);
- Extension extensionType = extension (aarch64_get_instr (cpu), 13);
+ uint32_t V = INSTR (26, 26);
+ uint32_t dispatch = ((INSTR (31, 30) << 2) | INSTR (23, 22));
+ Scaling scale = INSTR (12, 12);
+ Extension extensionType = INSTR (15, 13);
/* Check for illegal extension types. */
if (uimm (extensionType, 1, 1) == 0)
instr[21,10] = uimm12 : unsigned immediate offset
instr[9,5] = rn may be SP.
instr[4,0] = rt. */
-
- uint32_t V = uimm (aarch64_get_instr (cpu), 26,26);
- uint32_t dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 30) << 2)
- | uimm (aarch64_get_instr (cpu), 23, 22));
- uint32_t imm = uimm (aarch64_get_instr (cpu), 21, 10);
+
+ uint32_t V = INSTR (26,26);
+ uint32_t dispatch = ( (INSTR (31, 30) << 2)
+ | INSTR (23, 22));
+ uint32_t imm = INSTR (21, 10);
if (!V)
{
instr[9,5] = Rn
instr[4.0] = Rt. */
- switch (uimm (aarch64_get_instr (cpu), 22, 21))
+ switch (INSTR (22, 21))
{
case 2: ldxr (cpu); return;
case 0: stxr (cpu); return;
/* instr[29,25] = 111_0
instr[24] == 0 ==> dispatch, 1 ==> ldst reg unsigned immediate
instr[21:11,10] is the secondary dispatch. */
- if (uimm (aarch64_get_instr (cpu), 24, 24))
+ if (INSTR (24, 24))
{
dexLoadUnsignedImmediate (cpu);
return;
}
- dispatch = ( (uimm (aarch64_get_instr (cpu), 21, 21) << 2)
- | uimm (aarch64_get_instr (cpu), 11, 10));
+ dispatch = ( (INSTR (21, 21) << 2)
+ | INSTR (11, 10));
switch (dispatch)
{
case 0: dexLoadUnscaledImmediate (cpu); return;
static void
store_pair_u32 (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
if ((rn == rd || rm == rd) && wb != NoWriteBack)
static void
store_pair_u64 (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
if ((rn == rd || rm == rd) && wb != NoWriteBack)
static void
load_pair_u32 (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
/* treat this as unalloc to make sure we don't do it. */
static void
load_pair_s32 (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
/* Treat this as unalloc to make sure we don't do it. */
static void
load_pair_u64 (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
/* Treat this as unalloc to make sure we don't do it. */
instr[ 9, 5] = Rd
instr[ 4, 0] = Rm. */
- uint32_t dispatch = ((uimm (aarch64_get_instr (cpu), 31, 30) << 3)
- | uimm (aarch64_get_instr (cpu), 24, 22));
+ uint32_t dispatch = ((INSTR (31, 30) << 3)
+ | INSTR (24, 22));
int32_t offset = simm32 (aarch64_get_instr (cpu), 21, 15);
switch (dispatch)
static void
store_pair_float (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
offset <<= 2;
static void
store_pair_double (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
offset <<= 3;
store_pair_long_double (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
FRegister a;
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
offset <<= 4;
static void
load_pair_float (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
if (rm == rn)
static void
load_pair_double (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
if (rm == rn)
load_pair_long_double (sim_cpu *cpu, int32_t offset, WriteBack wb)
{
FRegister a;
- unsigned rn = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rd = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rm = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (14, 10);
+ unsigned rd = INSTR (9, 5);
+ unsigned rm = INSTR (4, 0);
uint64_t address = aarch64_get_reg_u64 (cpu, rd, SP_OK);
if (rm == rn)
instr[ 9, 5] = Rd
instr[ 4, 0] = Rm */
- uint32_t dispatch = ((uimm (aarch64_get_instr (cpu), 31, 30) << 3)
- | uimm (aarch64_get_instr (cpu), 24, 22));
+ uint32_t dispatch = ((INSTR (31, 30) << 3)
+ | INSTR (24, 22));
int32_t offset = simm32 (aarch64_get_instr (cpu), 21, 15);
switch (dispatch)
static void
vec_load (sim_cpu *cpu, uint64_t address, unsigned N)
{
- int all = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 11, 10);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int all = INSTR (30, 30);
+ unsigned size = INSTR (11, 10);
+ unsigned vd = INSTR (4, 0);
unsigned i;
switch (size)
static void
LD1_1 (sim_cpu *cpu, uint64_t address)
{
- int all = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 11, 10);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int all = INSTR (30, 30);
+ unsigned size = INSTR (11, 10);
+ unsigned vd = INSTR (4, 0);
unsigned i;
switch (size)
static void
vec_store (sim_cpu *cpu, uint64_t address, unsigned N)
{
- int all = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 11, 10);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int all = INSTR (30, 30);
+ unsigned size = INSTR (11, 10);
+ unsigned vd = INSTR (4, 0);
unsigned i;
switch (size)
static void
ST1_1 (sim_cpu *cpu, uint64_t address)
{
- int all = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned size = uimm (aarch64_get_instr (cpu), 11, 10);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
+ int all = INSTR (30, 30);
+ unsigned size = INSTR (11, 10);
+ unsigned vd = INSTR (4, 0);
unsigned i;
switch (size)
instr[9,5] = address
instr[4,0] = Vd */
- unsigned full = uimm (aarch64_get_instr (cpu), 30, 30);
- unsigned vd = uimm (aarch64_get_instr (cpu), 4, 0);
- unsigned size = uimm (aarch64_get_instr (cpu), 11, 10);
+ unsigned full = INSTR (30, 30);
+ unsigned vd = INSTR (4, 0);
+ unsigned size = INSTR (11, 10);
int i;
NYI_assert (29, 24, 0x0D);
NYI_assert (15, 14, 3);
NYI_assert (12, 12, 0);
- switch ((uimm (aarch64_get_instr (cpu), 13, 13) << 1)
- | uimm (aarch64_get_instr (cpu), 21, 21))
+ switch ((INSTR (13, 13) << 1)
+ | INSTR (21, 21))
{
case 0: /* LD1R. */
switch (size)
uint64_t address;
int type;
- if (uimm (aarch64_get_instr (cpu), 31, 31) != 0
- || uimm (aarch64_get_instr (cpu), 29, 25) != 0x06)
+ if (INSTR (31, 31) != 0
+ || INSTR (29, 25) != 0x06)
HALT_NYI;
- type = uimm (aarch64_get_instr (cpu), 15, 12);
- if (type != 0xE && type != 0xE && uimm (aarch64_get_instr (cpu), 21, 21) != 0)
+ type = INSTR (15, 12);
+ if (type != 0xE && type != 0xE && INSTR (21, 21) != 0)
HALT_NYI;
- post = uimm (aarch64_get_instr (cpu), 23, 23);
- load = uimm (aarch64_get_instr (cpu), 22, 22);
- vn = uimm (aarch64_get_instr (cpu), 9, 5);
+ post = INSTR (23, 23);
+ load = INSTR (22, 22);
+ vn = INSTR (9, 5);
address = aarch64_get_reg_u64 (cpu, vn, SP_OK);
if (post)
{
- unsigned vm = uimm (aarch64_get_instr (cpu), 20, 16);
+ unsigned vm = INSTR (20, 16);
if (vm == R31)
{
case 8: sizeof_operation = 16; break;
case 0xC:
- sizeof_operation = uimm (aarch64_get_instr (cpu), 21, 21) ? 2 : 1;
- sizeof_operation <<= uimm (aarch64_get_instr (cpu), 11, 10);
+ sizeof_operation = INSTR (21, 21) ? 2 : 1;
+ sizeof_operation <<= INSTR (11, 10);
break;
case 0xE:
- sizeof_operation = uimm (aarch64_get_instr (cpu), 21, 21) ? 8 : 4;
- sizeof_operation <<= uimm (aarch64_get_instr (cpu), 11, 10);
+ sizeof_operation = INSTR (21, 21) ? 8 : 4;
+ sizeof_operation <<= INSTR (11, 10);
break;
case 7:
/* One register, immediate offset variant. */
sizeof_operation = 8;
break;
-
+
case 10:
/* Two registers, immediate offset variant. */
sizeof_operation = 16;
HALT_UNALLOC;
}
- if (uimm (aarch64_get_instr (cpu), 30, 30))
+ if (INSTR (30, 30))
sizeof_operation *= 2;
aarch64_set_reg_u64 (cpu, vn, SP_OK, address + sizeof_operation);
static void
dexLogicalShiftedRegister (sim_cpu *cpu)
{
- /* assert instr[28:24] = 01010
- instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
- instr[30,29:21] = op,N : 000 ==> AND, 001 ==> BIC,
- 010 ==> ORR, 011 ==> ORN
- 100 ==> EOR, 101 ==> EON,
- 110 ==> ANDS, 111 ==> BICS
+ /* instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
+ instr[30,29] = op
+ instr[28:24] = 01010
instr[23,22] = shift : 0 ==> LSL, 1 ==> LSR, 2 ==> ASR, 3 ==> ROR
+ instr[21] = N
+ instr[20,16] = Rm
instr[15,10] = count : must be 0xxxxx for 32 bit
- instr[9,5] = Rn
- instr[4,0] = Rd */
-
- /* unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16); */
- uint32_t dispatch;
- Shift shiftType;
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
+ instr[9,5] = Rn
+ instr[4,0] = Rd */
- /* 32 bit operations must have count[5] = 0. */
- /* or else we have an UNALLOC. */
- uint32_t count = uimm (aarch64_get_instr (cpu), 15, 10);
+ uint32_t size = INSTR (31, 31);
+ Shift shiftType = INSTR (23, 22);
+ uint32_t count = INSTR (15, 10);
- if (!size && uimm (count, 5, 5))
+ /* 32 bit operations must have count[5] = 0.
+ or else we have an UNALLOC. */
+ if (size == 0 && uimm (count, 5, 5))
HALT_UNALLOC;
- shiftType = shift (aarch64_get_instr (cpu), 22);
-
- /* dispatch on size:op:N i.e aarch64_get_instr (cpu)[31,29:21]. */
- dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 29) << 1)
- | uimm (aarch64_get_instr (cpu), 21, 21));
-
- switch (dispatch)
+ /* Dispatch on size:op:N. */
+ switch ((INSTR (31, 29) << 1) | INSTR (21, 21))
{
case 0: and32_shift (cpu, shiftType, count); return;
case 1: bic32_shift (cpu, shiftType, count); return;
case 13:eon64_shift (cpu, shiftType, count); return;
case 14:ands64_shift (cpu, shiftType, count); return;
case 15:bics64_shift (cpu, shiftType, count); return;
- default: HALT_UNALLOC;
}
}
static void
csel32 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csel64 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csinc32 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csinc64 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csinv32 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csinv64 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csneg32 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
csneg64 (sim_cpu *cpu, CondCode cc)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
testConditionCode (cpu, cc)
static void
dexCondSelect (sim_cpu *cpu)
{
- /* assert instr[28,21] = 11011011
- instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
+ /* instr[28,21] = 11011011
+ instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
instr[30:11,10] = op : 000 ==> CSEL, 001 ==> CSINC,
100 ==> CSINV, 101 ==> CSNEG,
_1_ ==> UNALLOC
instr[15,12] = cond
instr[29] = S : 0 ==> ok, 1 ==> UNALLOC */
- CondCode cc;
- uint32_t dispatch;
- uint32_t S = uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t op2 = uimm (aarch64_get_instr (cpu), 11, 10);
+ CondCode cc = INSTR (15, 12);
+ uint32_t S = INSTR (29, 29);
+ uint32_t op2 = INSTR (11, 10);
if (S == 1)
HALT_UNALLOC;
if (op2 & 0x2)
HALT_UNALLOC;
- cc = condcode (aarch64_get_instr (cpu), 12);
- dispatch = ((uimm (aarch64_get_instr (cpu), 31, 30) << 1) | op2);
-
- switch (dispatch)
+ switch ((INSTR (31, 30) << 1) | op2)
{
case 0: csel32 (cpu, cc); return;
case 1: csinc32 (cpu, cc); return;
case 5: csinc64 (cpu, cc); return;
case 6: csinv64 (cpu, cc); return;
case 7: csneg64 (cpu, cc); return;
- default: HALT_UNALLOC;
}
}
static void
cls32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. the result needs to exclude the leading bit. */
aarch64_set_reg_u64
static void
cls64 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. the result needs to exclude the leading bit. */
aarch64_set_reg_u64
static void
clz32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
/* if the sign (top) bit is set then the count is 0. */
static void
clz64 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
/* if the sign (top) bit is set then the count is 0. */
static void
rbit32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t result = 0;
int i;
static void
rbit64 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t result = 0;
int i;
static void
rev32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t result = 0;
int i;
static void
rev64 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t result = 0;
int i;
static void
revh32 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint32_t value = aarch64_get_reg_u32 (cpu, rn, NO_SP);
uint32_t result = 0;
int i;
static void
revh64 (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
uint64_t value = aarch64_get_reg_u64 (cpu, rn, NO_SP);
uint64_t result = 0;
int i;
static void
dexDataProc1Source (sim_cpu *cpu)
{
- /* assert instr[30] == 1
- aarch64_get_instr (cpu)[28,21] == 111010110
- instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
- instr[29] = S : 0 ==> ok, 1 ==> UNALLOC
+ /* instr[30] = 1
+ instr[28,21] = 111010110
+ instr[31] = size : 0 ==> 32 bit, 1 ==> 64 bit
+ instr[29] = S : 0 ==> ok, 1 ==> UNALLOC
instr[20,16] = opcode2 : 00000 ==> ok, ow ==> UNALLOC
instr[15,10] = opcode : 000000 ==> RBIT, 000001 ==> REV16,
000010 ==> REV, 000011 ==> UNALLOC
000100 ==> CLZ, 000101 ==> CLS
ow ==> UNALLOC
- instr[9,5] = rn : may not be SP
- instr[4,0] = rd : may not be SP. */
+ instr[9,5] = rn : may not be SP
+ instr[4,0] = rd : may not be SP. */
- uint32_t S = uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t opcode2 = uimm (aarch64_get_instr (cpu), 20, 16);
- uint32_t opcode = uimm (aarch64_get_instr (cpu), 15, 10);
- uint32_t dispatch = ((uimm (aarch64_get_instr (cpu), 31, 31) << 3) | opcode);
+ uint32_t S = INSTR (29, 29);
+ uint32_t opcode2 = INSTR (20, 16);
+ uint32_t opcode = INSTR (15, 10);
+ uint32_t dispatch = ((INSTR (31, 31) << 3) | opcode);
if (S == 1)
HALT_UNALLOC;
static void
asrv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
asrv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
lslv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
lslv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
lsrv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
lsrv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
rorv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
rorv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64
(cpu, rd, NO_SP,
static void
cpuiv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. the pseudo-code does the divide using 64 bit data. */
/* TODO : check that this rounds towards zero as required. */
int64_t dividend = aarch64_get_reg_s32 (cpu, rn, NO_SP);
static void
cpuiv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : check that this rounds towards zero as required. */
int64_t divisor = aarch64_get_reg_s64 (cpu, rm, NO_SP);
static void
udiv32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. the pseudo-code does the divide using 64 bit data. */
uint64_t dividend = aarch64_get_reg_u32 (cpu, rn, NO_SP);
static void
udiv64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* TODO : check that this rounds towards zero as required. */
uint64_t divisor = aarch64_get_reg_u64 (cpu, rm, NO_SP);
ow ==> UNALLOC. */
uint32_t dispatch;
- uint32_t S = uimm (aarch64_get_instr (cpu), 29, 29);
- uint32_t opcode = uimm (aarch64_get_instr (cpu), 15, 10);
+ uint32_t S = INSTR (29, 29);
+ uint32_t opcode = INSTR (15, 10);
if (S == 1)
HALT_UNALLOC;
if (opcode & 0x34)
HALT_UNALLOC;
- dispatch = ( (uimm (aarch64_get_instr (cpu), 31, 31) << 3)
+ dispatch = ( (INSTR (31, 31) << 3)
| (uimm (opcode, 3, 3) << 2)
| uimm (opcode, 1, 0));
switch (dispatch)
static void
madd32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, ra, NO_SP)
static void
madd64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, ra, NO_SP)
static void
msub32 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u32 (cpu, ra, NO_SP)
static void
msub64 (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rd, NO_SP,
aarch64_get_reg_u64 (cpu, ra, NO_SP)
static void
smaddl (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. we need to multiply the signed 32 bit values in rn, rm to
obtain a 64 bit product. */
static void
smsubl (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. we need to multiply the signed 32 bit values in rn, rm to
obtain a 64 bit product. */
smulh (sim_cpu *cpu)
{
uint64_t uresult;
- int64_t result;
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- GReg ra = greg (aarch64_get_instr (cpu), 10);
- int64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
- int64_t value2 = aarch64_get_reg_u64 (cpu, rm, NO_SP);
+ int64_t result;
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ GReg ra = INSTR (14, 10);
+ int64_t value1 = aarch64_get_reg_u64 (cpu, rn, NO_SP);
+ int64_t value2 = aarch64_get_reg_u64 (cpu, rm, NO_SP);
uint64_t uvalue1;
uint64_t uvalue2;
- int64_t signum = 1;
+ int64_t signum = 1;
if (ra != R31)
HALT_UNALLOC;
static void
umaddl (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. we need to multiply the signed 32 bit values in rn, rm to
obtain a 64 bit product. */
static void
umsubl (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned ra = uimm (aarch64_get_instr (cpu), 14, 10);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rm = INSTR (20, 16);
+ unsigned ra = INSTR (14, 10);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
/* N.B. we need to multiply the signed 32 bit values in rn, rm to
obtain a 64 bit product. */
static void
umulh (sim_cpu *cpu)
{
- unsigned rm = uimm (aarch64_get_instr (cpu), 20, 16);
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
- unsigned rd = uimm (aarch64_get_instr (cpu), 4, 0);
- GReg ra = greg (aarch64_get_instr (cpu), 10);
+ unsigned rm = INSTR (20, 16);
+ unsigned rn = INSTR (9, 5);
+ unsigned rd = INSTR (4, 0);
+ GReg ra = INSTR (14, 10);
if (ra != R31)
HALT_UNALLOC;
ow ==> UNALLOC. */
uint32_t dispatch;
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t op54 = uimm (aarch64_get_instr (cpu), 30, 29);
- uint32_t op31 = uimm (aarch64_get_instr (cpu), 23, 21);
- uint32_t o0 = uimm (aarch64_get_instr (cpu), 15, 15);
+ uint32_t size = INSTR (31, 31);
+ uint32_t op54 = INSTR (30, 29);
+ uint32_t op31 = INSTR (23, 21);
+ uint32_t o0 = INSTR (15, 15);
if (op54 != 0)
HALT_UNALLOC;
static void
br (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
aarch64_set_next_PC (cpu, aarch64_get_reg_u64 (cpu, rn, NO_SP));
}
static void
blr (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
/* The pseudo code in the spec says we update LR before fetching.
the value from the rn. */
static void
ret (sim_cpu *cpu)
{
- unsigned rn = uimm (aarch64_get_instr (cpu), 9, 5);
+ unsigned rn = INSTR (9, 5);
aarch64_set_next_PC (cpu, aarch64_get_reg_u64 (cpu, rn, NO_SP));
if (TRACE_BRANCH_P (cpu))
instr[31] ==> 0 == B, 1 == BL
instr[25,0] == imm26 branch offset counted in words. */
- uint32_t top = uimm (aarch64_get_instr (cpu), 31, 31);
+ uint32_t top = INSTR (31, 31);
/* We have a 26 byte signed word offset which we need to pass to the
execute routine as a signed byte offset. */
int32_t offset = simm32 (aarch64_get_instr (cpu), 25, 0) << 2;
static void
cbnz32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (aarch64_get_reg_u32 (cpu, rt, NO_SP) != 0)
aarch64_set_next_PC_by_offset (cpu, offset);
static void
cbnz (sim_cpu *cpu, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (aarch64_get_reg_u64 (cpu, rt, NO_SP) != 0)
aarch64_set_next_PC_by_offset (cpu, offset);
static void
cbz32 (sim_cpu *cpu, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (aarch64_get_reg_u32 (cpu, rt, NO_SP) == 0)
aarch64_set_next_PC_by_offset (cpu, offset);
static void
cbz (sim_cpu *cpu, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (aarch64_get_reg_u64 (cpu, rt, NO_SP) == 0)
aarch64_set_next_PC_by_offset (cpu, offset);
static void
tbnz (sim_cpu *cpu, uint32_t pos, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (aarch64_get_reg_u64 (cpu, rt, NO_SP) & (1 << pos))
aarch64_set_next_PC_by_offset (cpu, offset);
static void
tbz (sim_cpu *cpu, uint32_t pos, int32_t offset)
{
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
if (!(aarch64_get_reg_u64 (cpu, rt, NO_SP) & (1 << pos)))
aarch64_set_next_PC_by_offset (cpu, offset);
instr[23,5] = simm19 branch offset counted in words
instr[4,0] = rt */
- uint32_t size = uimm (aarch64_get_instr (cpu), 31, 31);
- uint32_t op = uimm (aarch64_get_instr (cpu), 24, 24);
+ uint32_t size = INSTR (31, 31);
+ uint32_t op = INSTR (24, 24);
int32_t offset = simm32 (aarch64_get_instr (cpu), 23, 5) << 2;
if (size == 0)
instr[18,5] = simm14 : signed offset counted in words
instr[4,0] = uimm5 */
- uint32_t pos = ((uimm (aarch64_get_instr (cpu), 31, 31) << 4)
- | uimm (aarch64_get_instr (cpu), 23,19));
+ uint32_t pos = ((INSTR (31, 31) << 4)
+ | INSTR (23,19));
int32_t offset = simm32 (aarch64_get_instr (cpu), 18, 5) << 2;
NYI_assert (30, 25, 0x1b);
- if (uimm (aarch64_get_instr (cpu), 24, 24) == 0)
+ if (INSTR (24, 24) == 0)
tbz (cpu, pos, offset);
else
tbnz (cpu, pos, offset);
instr[3,0] = cond */
int32_t offset;
- CondCode cc;
- uint32_t op = ((uimm (aarch64_get_instr (cpu), 24, 24) << 1)
- | uimm (aarch64_get_instr (cpu), 4, 4));
+ uint32_t op = ((INSTR (24, 24) << 1) | INSTR (4, 4));
NYI_assert (31, 25, 0x2a);
HALT_UNALLOC;
offset = simm32 (aarch64_get_instr (cpu), 23, 5) << 2;
- cc = condcode (aarch64_get_instr (cpu), 0);
- bcc (cpu, offset, cc);
+ bcc (cpu, offset, INSTR (3, 0));
}
static void
instr[15,10] = op3 : must be 000000
instr[4,0] = op2 : must be 11111. */
- uint32_t op = uimm (aarch64_get_instr (cpu), 24, 21);
- uint32_t op2 = uimm (aarch64_get_instr (cpu), 20, 16);
- uint32_t op3 = uimm (aarch64_get_instr (cpu), 15, 10);
- uint32_t op4 = uimm (aarch64_get_instr (cpu), 4, 0);
+ uint32_t op = INSTR (24, 21);
+ uint32_t op2 = INSTR (20, 16);
+ uint32_t op3 = INSTR (15, 10);
+ uint32_t op4 = INSTR (4, 0);
NYI_assert (31, 25, 0x6b);
else
{
- /* ERET and DRPS accept 0b11111 for rn = aarch64_get_instr (cpu)[4,0]. */
+ /* ERET and DRPS accept 0b11111 for rn = instr [4,0]. */
/* anything else is unallocated. */
- uint32_t rn = greg (aarch64_get_instr (cpu), 0);
+ uint32_t rn = INSTR (4, 0);
if (rn != 0x1f)
HALT_UNALLOC;
instr[4,2] = opc2 000 ==> OK, ow ==> UNALLOC
instr[1,0] = LL : discriminates opc */
- uint32_t opc = uimm (aarch64_get_instr (cpu), 23, 21);
- uint32_t imm16 = uimm (aarch64_get_instr (cpu), 20, 5);
- uint32_t opc2 = uimm (aarch64_get_instr (cpu), 4, 2);
+ uint32_t opc = INSTR (23, 21);
+ uint32_t imm16 = INSTR (20, 5);
+ uint32_t opc2 = INSTR (4, 2);
uint32_t LL;
NYI_assert (31, 24, 0xd4);
if (opc2 != 0)
HALT_UNALLOC;
- LL = uimm (aarch64_get_instr (cpu), 1, 0);
+ LL = INSTR (1, 0);
/* We only implement HLT and BRK for now. */
if (opc == 1 && LL == 0)
else
HALT_NYI;
}
-
+
static void
do_mrs (sim_cpu *cpu)
{
instr[11,8] = CRm
instr[7,5] = op2
instr[4,0] = Rt */
- unsigned sys_op0 = uimm (aarch64_get_instr (cpu), 19, 19) + 2;
- unsigned sys_op1 = uimm (aarch64_get_instr (cpu), 18, 16);
- unsigned sys_crn = uimm (aarch64_get_instr (cpu), 15, 12);
- unsigned sys_crm = uimm (aarch64_get_instr (cpu), 11, 8);
- unsigned sys_op2 = uimm (aarch64_get_instr (cpu), 7, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sys_op0 = INSTR (19, 19) + 2;
+ unsigned sys_op1 = INSTR (18, 16);
+ unsigned sys_crn = INSTR (15, 12);
+ unsigned sys_crm = INSTR (11, 8);
+ unsigned sys_op2 = INSTR (7, 5);
+ unsigned rt = INSTR (4, 0);
aarch64_set_reg_u64 (cpu, rt, NO_SP,
system_get (cpu, sys_op0, sys_op1, sys_crn, sys_crm, sys_op2));
instr[7,5] = op2
instr[4,0] = 1 1111 */
- unsigned op1 = uimm (aarch64_get_instr (cpu), 18, 16);
- /*unsigned crm = uimm (aarch64_get_instr (cpu), 11, 8);*/
- unsigned op2 = uimm (aarch64_get_instr (cpu), 7, 5);
+ unsigned op1 = INSTR (18, 16);
+ /*unsigned crm = INSTR (11, 8);*/
+ unsigned op2 = INSTR (7, 5);
NYI_assert (31, 19, 0x1AA0);
NYI_assert (15, 12, 0x4);
instr[7,5] = op2
instr[4,0] = Rt */
- unsigned sys_op0 = uimm (aarch64_get_instr (cpu), 19, 19) + 2;
- unsigned sys_op1 = uimm (aarch64_get_instr (cpu), 18, 16);
- unsigned sys_crn = uimm (aarch64_get_instr (cpu), 15, 12);
- unsigned sys_crm = uimm (aarch64_get_instr (cpu), 11, 8);
- unsigned sys_op2 = uimm (aarch64_get_instr (cpu), 7, 5);
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned sys_op0 = INSTR (19, 19) + 2;
+ unsigned sys_op1 = INSTR (18, 16);
+ unsigned sys_crn = INSTR (15, 12);
+ unsigned sys_crm = INSTR (11, 8);
+ unsigned sys_op2 = INSTR (7, 5);
+ unsigned rt = INSTR (4, 0);
NYI_assert (31, 20, 0xD51);
-
+
system_set (cpu, sys_op0, sys_op1, sys_crn, sys_crm, sys_op2,
aarch64_get_reg_u64 (cpu, rt, NO_SP));
}
static void
-do_SYS (sim_cpu * cpu)
+do_SYS (sim_cpu *cpu)
{
/* instr[31,19] = 1101 0101 0000 1
instr[18,16] = op1
/* FIXME: For now we just silently accept system ops. */
}
-
+
static void
dexSystem (sim_cpu *cpu)
{
types : 01 ==> Reads, 10 ==> Writes,
11 ==> All, 00 ==> All (domain == FullSystem). */
- unsigned rt = uimm (aarch64_get_instr (cpu), 4, 0);
+ unsigned rt = INSTR (4, 0);
NYI_assert (31, 22, 0x354);
{
/* NOP has CRm != 0000 OR. */
/* (CRm == 0000 AND (op2 == 000 OR op2 > 101)). */
- uint32_t crm = uimm (aarch64_get_instr (cpu), 11, 8);
- uint32_t op2 = uimm (aarch64_get_instr (cpu), 7, 5);
+ uint32_t crm = INSTR (11, 8);
+ uint32_t op2 = INSTR (7, 5);
if (crm != 0 || (op2 == 0 || op2 > 5))
{
case 0x033:
{
- uint32_t op2 = uimm (aarch64_get_instr (cpu), 7, 5);
+ uint32_t op2 = INSTR (7, 5);
switch (op2)
{
return;
default:
- if (uimm (aarch64_get_instr (cpu), 21, 20) == 0x1)
+ if (INSTR (21, 20) == 0x1)
do_MSR_reg (cpu);
else if (INSTR (21, 19) == 0 && INSTR (15, 12) == 0x4)
do_MSR_immediate (cpu);
case BR_IMMCMP_001:
/* Compare has bit 25 clear while test has it set. */
- if (!uimm (aarch64_get_instr (cpu), 25, 25))
+ if (!INSTR (25, 25))
dexCompareBranchImmediate (cpu);
else
dexTestBranchImmediate (cpu);
case BR_IMMCOND_010:
/* This is a conditional branch if bit 25 is clear otherwise
unallocated. */
- if (!uimm (aarch64_get_instr (cpu), 25, 25))
+ if (!INSTR (25, 25))
dexCondBranchImmediate (cpu);
else
HALT_UNALLOC;
case BR_IMMCMP_101:
/* Compare has bit 25 clear while test has it set. */
- if (!uimm (aarch64_get_instr (cpu), 25, 25))
+ if (!INSTR (25, 25))
dexCompareBranchImmediate (cpu);
else
dexTestBranchImmediate (cpu);
case BR_REG_110:
/* Unconditional branch reg has bit 25 set. */
- if (uimm (aarch64_get_instr (cpu), 25, 25))
+ if (INSTR (25, 25))
dexBranchRegister (cpu);
/* This includes both Excpn Gen, System and unalloc operations.
We need to decode the Excpn Gen operation BRK so we can plant
debugger entry points.
- Excpn Gen operations have aarch64_get_instr (cpu)[24] = 0.
+ Excpn Gen operations have instr [24] = 0.
we need to decode at least one of the System operations NOP
which is an alias for HINT #0.
- System operations have aarch64_get_instr (cpu)[24,22] = 100. */
- else if (uimm (aarch64_get_instr (cpu), 24, 24) == 0)
+ System operations have instr [24,22] = 100. */
+ else if (INSTR (24, 24) == 0)
dexExcpnGen (cpu);
- else if (uimm (aarch64_get_instr (cpu), 24, 22) == 4)
+ else if (INSTR (24, 22) == 4)
dexSystem (cpu);
else