]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tcg/mips: Improve the add2/sub2 command to use TCG_TARGET_REG_BITS
authorAlistair Francis <Alistair.Francis@wdc.com>
Wed, 12 Dec 2018 20:58:11 +0000 (20:58 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 17 Dec 2018 03:04:44 +0000 (06:04 +0300)
Instead of hard coding 31 for the shift right use TCG_TARGET_REG_BITS - 1.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <7dfbddf7014a595150aa79011ddb342c3cc17ec3.1544648105.git.alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/mips/tcg-target.inc.c

index a06ff257fafa663b11a3260bfe53b52e048f346b..be0bc92e8e7b0b33df45a37fa4e31670bde81bc0 100644 (file)
@@ -792,7 +792,7 @@ static void tcg_out_addsub2(TCGContext *s, TCGReg rl, TCGReg rh, TCGReg al,
             tcg_out_opc_imm(s, OPC_ADDIU, rl, al, bl);
             tcg_out_opc_imm(s, OPC_SLTIU, TCG_TMP0, rl, bl);
         } else if (rl == al && rl == bl) {
-            tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, al, 31);
+            tcg_out_opc_sa(s, OPC_SRL, TCG_TMP0, al, TCG_TARGET_REG_BITS - 1);
             tcg_out_opc_reg(s, OPC_ADDU, rl, al, bl);
         } else {
             tcg_out_opc_reg(s, OPC_ADDU, rl, al, bl);