Skip to content

Commit

Permalink
AArch64: Slightly simplify code for reading 64 bits
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorng committed Dec 19, 2024
1 parent c23441a commit 30e3369
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions erts/emulator/beam/jit/arm/instr_bs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,7 @@ void BeamModuleAssembler::emit_read_bits(Uint bits,
Label read_done = a.newLabel();

bool need_rev64 = false;
bool need_shift = true;

const a64::Gp bin_byte_ptr = TMP2;
const a64::Gp bit_offset = TMP4;
Expand Down Expand Up @@ -2888,7 +2889,12 @@ void BeamModuleAssembler::emit_read_bits(Uint bits,
a.lsl(bitdata, bitdata, bit_offset);
a.lsl(tmp, tmp, bit_offset);
a.orr(bitdata, bitdata, tmp, arm::lsr(8));
a.b(read_done);
if (bits == 64) {
need_rev64 = need_shift = false;
comment("simplified reading of 64-bit word");
} else {
a.b(read_done);
}
}
}

Expand All @@ -2900,7 +2906,9 @@ void BeamModuleAssembler::emit_read_bits(Uint bits,
/* Shift the read data into the most significant bits of the
* word. */
a.bind(shift);
a.lsl(bitdata, bitdata, bit_offset);
if (need_shift) {
a.lsl(bitdata, bitdata, bit_offset);
}

a.bind(read_done);
}
Expand Down

0 comments on commit 30e3369

Please sign in to comment.