提交 76da6b88 编写于 作者: Z Zihao Yu

x86,exec,logic: fix shld/shrd with shift bit = 0

* if it is the case, should not perform the shift
* also note that shifting 32 bit on a 32-bit value is UB
上级 59021b80
......@@ -95,6 +95,8 @@ static inline make_EHelper(not) {
}
static inline make_EHelper(shld) {
rtl_andi(s, dsrc1, dsrc1, 31);
if (*dsrc1 != 0) {
rtl_shl(s, s0, ddest, dsrc1);
rtl_li(s, s1, 32);
......@@ -106,11 +108,13 @@ static inline make_EHelper(shld) {
operand_write(s, id_dest, s0);
rtl_update_ZFSF(s, s0, id_dest->width);
// unnecessary to update CF and OF in NEMU
//difftest_skip_eflags(EFLAGS_MASK_CF | EFLAGS_MASK_OF);
}
print_asm_template3(shld);
}
static inline make_EHelper(shrd) {
rtl_andi(s, dsrc1, dsrc1, 31);
if (*dsrc1 != 0) {
rtl_shr(s, s0, ddest, dsrc1);
rtl_li(s, s1, 32);
......@@ -122,6 +126,6 @@ static inline make_EHelper(shrd) {
operand_write(s, id_dest, s0);
rtl_update_ZFSF(s, s0, id_dest->width);
// unnecessary to update CF and OF in NEMU
//difftest_skip_eflags(EFLAGS_MASK_CF | EFLAGS_MASK_OF);
}
print_asm_template3(shrd);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册