提交 523fdc08 编写于 作者: R Richard Henderson

tcg-aarch64: Simplify tcg_out_ldst_9 encoding

At first glance the code appears to be using 1's compliment encoding,
a-la AArch32.  Except that the constant is "off", creating a complicated
split field 2's compliment encoding.

Much clearer to just use a normal mask and shift.
Reviewed-by: NClaudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: NRichard Henderson <rth@twiddle.net>
上级 017a86f7
......@@ -305,18 +305,8 @@ static inline void tcg_out_ldst_9(TCGContext *s,
TCGReg rd, TCGReg rn, tcg_target_long offset)
{
/* use LDUR with BASE register with 9bit signed unscaled offset */
unsigned int mod, off;
if (offset < 0) {
off = (256 + offset);
mod = 0x1;
} else {
off = offset;
mod = 0x0;
}
mod |= op_type;
tcg_out32(s, op_data << 24 | mod << 20 | off << 12 | rn << 5 | rd);
tcg_out32(s, op_data << 24 | op_type << 20
| (offset & 0x1ff) << 12 | rn << 5 | rd);
}
/* tcg_out_ldst_12 expects a scaled unsigned immediate offset */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册