提交 a968eb80 编写于 作者: Z Zihao Yu

riscv64,exec: fix sra with shift amount >= 32

* the LSB of funct7 may be "1" due to the shift amount can be >= 32
上级 5d0ba067
......@@ -24,8 +24,8 @@ make_EHelper(sll) {
make_EHelper(srl) {
rtl_andi(&id_src2->val, &id_src2->val, 0x3f);
if (decinfo.isa.instr.funct7 == 32) {
// the LSB of funct7 may be "1" due to the shift amount can be >= 32
if ((decinfo.isa.instr.funct7 & ~0x1) == 32) {
// sra
rtl_sar(&s0, &id_src->val, &id_src2->val);
print_asm_template3(sra);
......@@ -34,7 +34,6 @@ make_EHelper(srl) {
rtl_shr(&s0, &id_src->val, &id_src2->val);
print_asm_template3(srl);
}
rtl_sr(id_dest->reg, &s0, 4);
}
......@@ -118,6 +117,7 @@ make_EHelper(sllw) {
make_EHelper(srlw) {
rtl_andi(&id_src2->val, &id_src2->val, 0x1f);
assert((decinfo.isa.instr.funct7 & 0x1) == 0);
if (decinfo.isa.instr.funct7 == 32) {
// sraw
rtl_sext(&id_src->val, &id_src->val, 4);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册