8000 py/asmx64: Support moving a 64-bit immediate to one of top 8 registers. · lable/micropython@3235b95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3235b95

Browse files
committed
py/asmx64: Support moving a 64-bit immediate to one of top 8 registers.
If constants (eg mp_const_none_obj) are placed in very high memory locations that require 64-bits for the pointer then the assembler must be able to emit instructions to move such pointers to one of the top 8 registers (ie r8-r15).
1 parent 016325d commit 3235b95

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

py/asmx64.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,9 @@ STATIC void asm_x64_mov_i32_to_r64(asm_x64_t *as, int src_i32, int dest_r64) {
344344
void asm_x64_mov_i64_to_r64(asm_x64_t *as, int64_t src_i64, int dest_r64) {
345345
// cpu defaults to i32 to r64
346346
// to mov i64 to r64 need to use REX prefix
347-
assert(dest_r64 < 8);
348 5AE9 -
asm_x64_write_byte_2(as, REX_PREFIX | REX_W, OPCODE_MOV_I64_TO_R64 | dest_r64);
347+
asm_x64_write_byte_2(as,
348+
REX_PREFIX | REX_W | (dest_r64 < 8 ? 0 : REX_B),
349+
OPCODE_MOV_I64_TO_R64 | (dest_r64 & 7));
349350
asm_x64_write_word64(as, src_i64);
350351
}
351352

0 commit comments

Comments
 (0)
0