提交 f9cb5045 编写于 作者: M Max Filippov 提交者: malc

target-xtensa: fix extui shift amount

extui opcode only uses lowermost op1 bit for sa4.
Reported-by: Nmalc <av1474@comtv.ru>
Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Nmalc <av1474@comtv.ru>
上级 a2550660
......@@ -1778,12 +1778,30 @@ static void disas_xtensa_insn(DisasContext *dc)
case 5:
gen_window_check2(dc, RRR_R, RRR_T);
{
int shiftimm = RRR_S | (OP1 << 4);
int shiftimm = RRR_S | ((OP1 & 1) << 4);
int maskimm = (1 << (OP2 + 1)) - 1;
TCGv_i32 tmp = tcg_temp_new_i32();
tcg_gen_shri_i32(tmp, cpu_R[RRR_T], shiftimm);
tcg_gen_andi_i32(cpu_R[RRR_R], tmp, maskimm);
if (shiftimm) {
tcg_gen_shri_i32(tmp, cpu_R[RRR_T], shiftimm);
} else {
tcg_gen_mov_i32(tmp, cpu_R[RRR_T]);
}
switch (maskimm) {
case 0xff:
tcg_gen_ext8u_i32(cpu_R[RRR_R], tmp);
break;
case 0xffff:
tcg_gen_ext16u_i32(cpu_R[RRR_R], tmp);
break;
default:
tcg_gen_andi_i32(cpu_R[RRR_R], tmp, maskimm);
break;
}
tcg_temp_free(tmp);
}
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册