mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
tcg-mips: Implement mulsh, muluh
With the optimization in tcg_liveness_analysis, we can avoid the MFLO when it is unused. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
03271524b6
commit
3c9a8f1756
2 changed files with 12 additions and 2 deletions
|
@ -1423,6 +1423,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
||||||
tcg_out_opc_reg(s, OPC_MFLO, args[0], 0, 0);
|
tcg_out_opc_reg(s, OPC_MFLO, args[0], 0, 0);
|
||||||
tcg_out_opc_reg(s, OPC_MFHI, args[1], 0, 0);
|
tcg_out_opc_reg(s, OPC_MFHI, args[1], 0, 0);
|
||||||
break;
|
break;
|
||||||
|
case INDEX_op_mulsh_i32:
|
||||||
|
tcg_out_opc_reg(s, OPC_MULT, 0, args[1], args[2]);
|
||||||
|
tcg_out_opc_reg(s, OPC_MFHI, args[0], 0, 0);
|
||||||
|
break;
|
||||||
|
case INDEX_op_muluh_i32:
|
||||||
|
tcg_out_opc_reg(s, OPC_MULTU, 0, args[1], args[2]);
|
||||||
|
tcg_out_opc_reg(s, OPC_MFHI, args[0], 0, 0);
|
||||||
|
break;
|
||||||
case INDEX_op_div_i32:
|
case INDEX_op_div_i32:
|
||||||
tcg_out_opc_reg(s, OPC_DIV, 0, args[1], args[2]);
|
tcg_out_opc_reg(s, OPC_DIV, 0, args[1], args[2]);
|
||||||
tcg_out_opc_reg(s, OPC_MFLO, args[0], 0, 0);
|
tcg_out_opc_reg(s, OPC_MFLO, args[0], 0, 0);
|
||||||
|
@ -1602,6 +1610,8 @@ static const TCGTargetOpDef mips_op_defs[] = {
|
||||||
{ INDEX_op_mul_i32, { "r", "rZ", "rZ" } },
|
{ INDEX_op_mul_i32, { "r", "rZ", "rZ" } },
|
||||||
{ INDEX_op_muls2_i32, { "r", "r", "rZ", "rZ" } },
|
{ INDEX_op_muls2_i32, { "r", "r", "rZ", "rZ" } },
|
||||||
{ INDEX_op_mulu2_i32, { "r", "r", "rZ", "rZ" } },
|
{ INDEX_op_mulu2_i32, { "r", "r", "rZ", "rZ" } },
|
||||||
|
{ INDEX_op_mulsh_i32, { "r", "rZ", "rZ" } },
|
||||||
|
{ INDEX_op_muluh_i32, { "r", "rZ", "rZ" } },
|
||||||
{ INDEX_op_div_i32, { "r", "rZ", "rZ" } },
|
{ INDEX_op_div_i32, { "r", "rZ", "rZ" } },
|
||||||
{ INDEX_op_divu_i32, { "r", "rZ", "rZ" } },
|
{ INDEX_op_divu_i32, { "r", "rZ", "rZ" } },
|
||||||
{ INDEX_op_rem_i32, { "r", "rZ", "rZ" } },
|
{ INDEX_op_rem_i32, { "r", "rZ", "rZ" } },
|
||||||
|
|
|
@ -89,8 +89,8 @@ typedef enum {
|
||||||
#define TCG_TARGET_HAS_eqv_i32 0
|
#define TCG_TARGET_HAS_eqv_i32 0
|
||||||
#define TCG_TARGET_HAS_nand_i32 0
|
#define TCG_TARGET_HAS_nand_i32 0
|
||||||
#define TCG_TARGET_HAS_muls2_i32 1
|
#define TCG_TARGET_HAS_muls2_i32 1
|
||||||
#define TCG_TARGET_HAS_muluh_i32 0
|
#define TCG_TARGET_HAS_muluh_i32 1
|
||||||
#define TCG_TARGET_HAS_mulsh_i32 0
|
#define TCG_TARGET_HAS_mulsh_i32 1
|
||||||
|
|
||||||
/* optional instructions only implemented on MIPS4, MIPS32 and Loongson 2 */
|
/* optional instructions only implemented on MIPS4, MIPS32 and Loongson 2 */
|
||||||
#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 1)) || \
|
#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 1)) || \
|
||||||
|
|
Loading…
Reference in a new issue