tcg: Make use of bswap flags in tcg_gen_qemu_st_*

By removing TCG_BSWAP_IZ we indicate that the input is
not zero-extended, and thus can remove an explicit extend.
By removing TCG_BSWAP_OZ, we allow the implementation to
leave high bits set, which will be ignored by the store.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-06-13 15:53:43 -07:00
parent 359feba534
commit b53357acb4
1 changed files with 3 additions and 6 deletions

View File

@ -2915,8 +2915,7 @@ void tcg_gen_qemu_st_i32(TCGv_i32 val, TCGv addr, TCGArg idx, MemOp memop)
swap = tcg_temp_new_i32(); swap = tcg_temp_new_i32();
switch (memop & MO_SIZE) { switch (memop & MO_SIZE) {
case MO_16: case MO_16:
tcg_gen_ext16u_i32(swap, val); tcg_gen_bswap16_i32(swap, val, 0);
tcg_gen_bswap16_i32(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
break; break;
case MO_32: case MO_32:
tcg_gen_bswap32_i32(swap, val); tcg_gen_bswap32_i32(swap, val);
@ -3013,12 +3012,10 @@ void tcg_gen_qemu_st_i64(TCGv_i64 val, TCGv addr, TCGArg idx, MemOp memop)
swap = tcg_temp_new_i64(); swap = tcg_temp_new_i64();
switch (memop & MO_SIZE) { switch (memop & MO_SIZE) {
case MO_16: case MO_16:
tcg_gen_ext16u_i64(swap, val); tcg_gen_bswap16_i64(swap, val, 0);
tcg_gen_bswap16_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
break; break;
case MO_32: case MO_32:
tcg_gen_ext32u_i64(swap, val); tcg_gen_bswap32_i64(swap, val, 0);
tcg_gen_bswap32_i64(swap, swap, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
break; break;
case MO_64: case MO_64:
tcg_gen_bswap64_i64(swap, val); tcg_gen_bswap64_i64(swap, val);