Skip to content

Commit 2da497f

Browse files
rth7680Michael Tokarev
authored andcommitted
target/avr: Improve decode of LDS, STS
The comment about not being able to define a field with zero bits is out of date since 94597b6 ("decodetree: Allow !function with no input bits"). This fixes the missing load of imm in the disassembler. Cc: [email protected] Fixes: 9d8caa6 ("target/avr: Add support for disassembling via option '-d in_asm'") Reviewed-by: Pierrick Bouvier <[email protected]> Signed-off-by: Richard Henderson <[email protected]> (cherry picked from commit 6b661b7) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 00a5dc2 commit 2da497f

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

target/avr/insn.decode

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,8 @@ BRBC 1111 01 ....... ... @op_bit_imm
118118
@io_rd_imm .... . .. ..... .... &rd_imm rd=%rd imm=%io_imm
119119
@ldst_d .. . . .. . rd:5 . ... &rd_imm imm=%ldst_d_imm
120120

121-
# The 16-bit immediate is completely in the next word.
122-
# Fields cannot be defined with no bits, so we cannot play
123-
# the same trick and append to a zero-bit value.
124-
# Defer reading the immediate until trans_{LDS,STS}.
125-
@ldst_s .... ... rd:5 .... imm=0
121+
%ldst_imm !function=next_word
122+
@ldst_s .... ... rd:5 .... imm=%ldst_imm
126123

127124
MOV 0010 11 . ..... .... @op_rd_rr
128125
MOVW 0000 0001 .... .... &rd_rr rd=%rd_d rr=%rr_d

target/avr/translate.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,6 @@ static bool trans_LDS(DisasContext *ctx, arg_LDS *a)
15781578
TCGv Rd = cpu_r[a->rd];
15791579
TCGv addr = tcg_temp_new_i32();
15801580
TCGv H = cpu_rampD;
1581-
a->imm = next_word(ctx);
15821581

15831582
tcg_gen_mov_tl(addr, H); /* addr = H:M:L */
15841583
tcg_gen_shli_tl(addr, addr, 16);
@@ -1783,7 +1782,6 @@ static bool trans_STS(DisasContext *ctx, arg_STS *a)
17831782
TCGv Rd = cpu_r[a->rd];
17841783
TCGv addr = tcg_temp_new_i32();
17851784
TCGv H = cpu_rampD;
1786-
a->imm = next_word(ctx);
17871785

17881786
tcg_gen_mov_tl(addr, H); /* addr = H:M:L */
17891787
tcg_gen_shli_tl(addr, addr, 16);

0 commit comments

Comments
 (0)