Skip to content

Commit d6201fc

Browse files
peterhinchdpgeorge
authored andcommitted
py: In inline asm, vldr and vstr offsets now in bytes not words.
As per ARM convention.
1 parent 1657345 commit d6201fc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

py/emitinlinethumb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ STATIC void emit_inline_thumb_op(emit_inline_asm_t *emit, qstr op, mp_uint_t n_a
473473
if (get_arg_addr(emit, op_str, pn_args[1], &pn_base, &pn_offset)) {
474474
mp_uint_t rlo_base = get_arg_reg(emit, op_str, pn_base, 7);
475475
mp_uint_t i8;
476-
i8 = get_arg_i(emit, op_str, pn_offset, 0xff);
476+
i8 = get_arg_i(emit, op_str, pn_offset, 0x3fc) >> 2;
477477
asm_thumb_op32(emit->as,
478478
op_code_hi | rlo_base | ((vd & 1) << 6),
479479
0x0a00 | ((vd & 0x1e) << 11) | i8);

tests/inlineasm/asmfpldrstr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
@micropython.asm_thumb # test vldr, vstr
33
def arrayadd(r0):
44
vldr(s0, [r0, 0])
5-
vldr(s1, [r0, 1])
5+
vldr(s1, [r0, 4])
66
vadd(s2, s0, s1)
7-
vstr(s2, [r0, 2])
7+
vstr(s2, [r0, 8])
88

99
z = array.array("f", [2, 4, 10])
1010
arrayadd(z)

0 commit comments

Comments
 (0)