[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/29] tcg/mips: Support TCG_COND_TST{EQ,NE}
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 15/29] tcg/mips: Support TCG_COND_TST{EQ,NE} |
|
Date: |
Wed, 25 Oct 2023 17:14:09 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/mips/tcg-target.c.inc | 41 +++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc
index 328984ccff..739a0f60b7 100644
--- a/tcg/mips/tcg-target.c.inc
+++ b/tcg/mips/tcg-target.c.inc
@@ -909,6 +909,16 @@ static void tcg_out_setcond(TCGContext *s, TCGCond cond,
TCGReg ret,
tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, arg1);
break;
+ case TCG_COND_TSTEQ:
+ tcg_out_opc_reg(s, OPC_AND, ret, arg1, arg2);
+ tcg_out_opc_imm(s, OPC_SLTIU, ret, ret, 1);
+ break;
+
+ case TCG_COND_TSTNE:
+ tcg_out_opc_reg(s, OPC_AND, ret, arg1, arg2);
+ tcg_out_opc_reg(s, OPC_SLTU, ret, TCG_REG_ZERO, ret);
+ break;
+
case TCG_COND_LT:
case TCG_COND_GE:
case TCG_COND_LE:
@@ -989,6 +999,14 @@ static void tcg_out_brcond(TCGContext *s, TCGCond cond,
TCGReg arg1,
arg2 = TCG_REG_ZERO;
break;
+ case TCG_COND_TSTEQ:
+ case TCG_COND_TSTNE:
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, arg1, arg2);
+ arg1 = TCG_TMP0;
+ arg2 = TCG_REG_ZERO;
+ b_opc = cond == TCG_COND_TSTEQ ? OPC_BEQ : OPC_BNE;
+ break;
+
default:
g_assert_not_reached();
break;
@@ -1052,6 +1070,14 @@ static void tcg_out_setcond2(TCGContext *s, TCGCond
cond, TCGReg ret,
tcg_out_setcond(s, cond, ret, tmp1, TCG_REG_ZERO);
break;
+ case TCG_COND_TSTEQ:
+ case TCG_COND_TSTNE:
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, al, bl);
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, ah, bh);
+ tcg_out_opc_reg(s, OPC_OR, ret, TCG_TMP0, TCG_TMP1);
+ tcg_out_setcond(s, tcg_eqne_cond(cond), ret, tmp1, TCG_REG_ZERO);
+ break;
+
default:
tcg_out_setcond(s, TCG_COND_EQ, tmp0, ah, bh);
tcg_out_setcond(s, tcg_unsigned_cond(cond), tmp1, al, bl);
@@ -1078,6 +1104,13 @@ static void tcg_out_brcond2(TCGContext *s, TCGCond cond,
TCGReg al, TCGReg ah,
tmp = tcg_out_reduce_eq2(s, TCG_TMP0, TCG_TMP1, al, ah, bl, bh);
break;
+ case TCG_COND_TSTEQ:
+ case TCG_COND_TSTNE:
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, al, bl);
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, ah, bh);
+ tcg_out_opc_reg(s, OPC_OR, TCG_TMP1, TCG_TMP1, TCG_TMP0);
+ break;
+
default:
/* Minimize code size by preferring a compare not requiring INV. */
if (mips_cmp_map[cond] & MIPS_CMP_INV) {
@@ -1114,6 +1147,14 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond,
TCGReg ret,
}
break;
+ case TCG_COND_TSTEQ:
+ eqz = true;
+ /* FALLTHRU */
+ case TCG_COND_TSTNE:
+ tcg_out_opc_reg(s, OPC_AND, TCG_TMP0, c1, c2);
+ c1 = TCG_TMP0;
+ break;
+
default:
/* Minimize code size by preferring a compare not requiring INV. */
if (mips_cmp_map[cond] & MIPS_CMP_INV) {
--
2.34.1
- [PATCH 07/29] tcg/aarch64: Support TCG_COND_TST{EQ,NE}, (continued)
- [PATCH 07/29] tcg/aarch64: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PATCH 08/29] tcg/aarch64: Generate TBZ, TBNZ, Richard Henderson, 2023/10/25
- [PULL 05/94] configs: Enable MTTCG for sparc, sparc64, Richard Henderson, 2023/10/25
- [PATCH 10/29] tcg/i386: Pass x86 condition codes to tcg_out_cmov, Richard Henderson, 2023/10/25
- [PATCH 12/29] tcg/i386: Add rexw argument to tcg_out_testi, Richard Henderson, 2023/10/25
- [PATCH 14/29] tcg/loongarch64: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PULL 14/94] target/sparc: Move BPr to decodetree, Richard Henderson, 2023/10/25
- [PULL 15/94] target/sparc: Move FBPfcc and FBfcc to decodetree, Richard Henderson, 2023/10/25
- [PULL 18/94] target/sparc: Merge gen_branch_[an] with only caller, Richard Henderson, 2023/10/25
- [PATCH 19/29] tcg/sparc64: Pass TCGCond to tcg_out_cmp, Richard Henderson, 2023/10/25
- [PATCH 15/29] tcg/mips: Support TCG_COND_TST{EQ,NE},
Richard Henderson <=
- [PATCH 16/29] tcg/riscv: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PULL 13/94] target/sparc: Move BPcc and Bicc to decodetree, Richard Henderson, 2023/10/25
- [PULL 11/94] target/sparc: Define AM_CHECK for sparc32, Richard Henderson, 2023/10/25
- [PULL 12/94] target/sparc: Move CALL to decodetree, Richard Henderson, 2023/10/25
- [PULL 06/94] target/sparc: Define features via cpu-feature.h.inc, Richard Henderson, 2023/10/25
- [PATCH 13/29] tcg/i386: Support TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25
- [PATCH 06/29] tcg/optimize: Handle TCG_COND_TST{EQ,NE}, Richard Henderson, 2023/10/25