tcg/mips: Use atom_and_align_for_opc
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
7658a6cf56
commit
c0cafab5a5
@ -1138,7 +1138,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TCGReg base;
|
TCGReg base;
|
||||||
MemOp align;
|
TCGAtomAlign aa;
|
||||||
} HostAddress;
|
} HostAddress;
|
||||||
|
|
||||||
bool tcg_target_has_memory_bswap(MemOp memop)
|
bool tcg_target_has_memory_bswap(MemOp memop)
|
||||||
@ -1158,11 +1158,15 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
{
|
{
|
||||||
TCGLabelQemuLdst *ldst = NULL;
|
TCGLabelQemuLdst *ldst = NULL;
|
||||||
MemOp opc = get_memop(oi);
|
MemOp opc = get_memop(oi);
|
||||||
unsigned a_bits = get_alignment_bits(opc);
|
MemOp a_bits;
|
||||||
unsigned s_bits = opc & MO_SIZE;
|
unsigned s_bits = opc & MO_SIZE;
|
||||||
unsigned a_mask = (1 << a_bits) - 1;
|
unsigned a_mask;
|
||||||
TCGReg base;
|
TCGReg base;
|
||||||
|
|
||||||
|
h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, false);
|
||||||
|
a_bits = h->aa.align;
|
||||||
|
a_mask = (1 << a_bits) - 1;
|
||||||
|
|
||||||
#ifdef CONFIG_SOFTMMU
|
#ifdef CONFIG_SOFTMMU
|
||||||
unsigned s_mask = (1 << s_bits) - 1;
|
unsigned s_mask = (1 << s_bits) - 1;
|
||||||
int mem_index = get_mmuidx(oi);
|
int mem_index = get_mmuidx(oi);
|
||||||
@ -1281,7 +1285,6 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
h->base = base;
|
h->base = base;
|
||||||
h->align = a_bits;
|
|
||||||
return ldst;
|
return ldst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,7 +1397,7 @@ static void tcg_out_qemu_ld(TCGContext *s, TCGReg datalo, TCGReg datahi,
|
|||||||
|
|
||||||
ldst = prepare_host_addr(s, &h, addrlo, addrhi, oi, true);
|
ldst = prepare_host_addr(s, &h, addrlo, addrhi, oi, true);
|
||||||
|
|
||||||
if (use_mips32r6_instructions || h.align >= (opc & MO_SIZE)) {
|
if (use_mips32r6_instructions || h.aa.align >= (opc & MO_SIZE)) {
|
||||||
tcg_out_qemu_ld_direct(s, datalo, datahi, h.base, opc, data_type);
|
tcg_out_qemu_ld_direct(s, datalo, datahi, h.base, opc, data_type);
|
||||||
} else {
|
} else {
|
||||||
tcg_out_qemu_ld_unalign(s, datalo, datahi, h.base, opc, data_type);
|
tcg_out_qemu_ld_unalign(s, datalo, datahi, h.base, opc, data_type);
|
||||||
@ -1481,7 +1484,7 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg datalo, TCGReg datahi,
|
|||||||
|
|
||||||
ldst = prepare_host_addr(s, &h, addrlo, addrhi, oi, false);
|
ldst = prepare_host_addr(s, &h, addrlo, addrhi, oi, false);
|
||||||
|
|
||||||
if (use_mips32r6_instructions || h.align >= (opc & MO_SIZE)) {
|
if (use_mips32r6_instructions || h.aa.align >= (opc & MO_SIZE)) {
|
||||||
tcg_out_qemu_st_direct(s, datalo, datahi, h.base, opc);
|
tcg_out_qemu_st_direct(s, datalo, datahi, h.base, opc);
|
||||||
} else {
|
} else {
|
||||||
tcg_out_qemu_st_unalign(s, datalo, datahi, h.base, opc);
|
tcg_out_qemu_st_unalign(s, datalo, datahi, h.base, opc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user