[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/24] tcg/i386: Merge tcg_out_setcond{32,64}
From: |
Richard Henderson |
Subject: |
[PATCH 18/24] tcg/i386: Merge tcg_out_setcond{32,64} |
Date: |
Mon, 7 Aug 2023 20:11:37 -0700 |
Pass a rexw parameter instead of duplicating the functions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index b9673b55bd..ec3c7012d4 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1524,23 +1524,16 @@ static void tcg_out_brcond2(TCGContext *s, const TCGArg
*args,
}
#endif
-static void tcg_out_setcond32(TCGContext *s, TCGCond cond, TCGArg dest,
- TCGArg arg1, TCGArg arg2, int const_arg2)
+static void tcg_out_setcond(TCGContext *s, int rexw, TCGCond cond,
+ TCGArg dest, TCGArg arg1, TCGArg arg2,
+ int const_arg2)
{
- tcg_out_cmp(s, arg1, arg2, const_arg2, 0);
+ tcg_out_cmp(s, arg1, arg2, const_arg2, rexw);
tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest);
tcg_out_ext8u(s, dest, dest);
}
-#if TCG_TARGET_REG_BITS == 64
-static void tcg_out_setcond64(TCGContext *s, TCGCond cond, TCGArg dest,
- TCGArg arg1, TCGArg arg2, int const_arg2)
-{
- tcg_out_cmp(s, arg1, arg2, const_arg2, P_REXW);
- tcg_out_modrm(s, OPC_SETCC | tcg_cond_to_jcc[cond], 0, dest);
- tcg_out_ext8u(s, dest, dest);
-}
-#else
+#if TCG_TARGET_REG_BITS == 32
static void tcg_out_setcond2(TCGContext *s, const TCGArg *args,
const int *const_args)
{
@@ -2565,8 +2558,8 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
tcg_out_brcond(s, rexw, a2, a0, a1, const_args[1],
arg_label(args[3]), 0);
break;
- case INDEX_op_setcond_i32:
- tcg_out_setcond32(s, args[3], a0, a1, a2, const_a2);
+ OP_32_64(setcond):
+ tcg_out_setcond(s, rexw, args[3], a0, a1, a2, const_a2);
break;
case INDEX_op_movcond_i32:
tcg_out_movcond32(s, args[5], a0, a1, a2, const_a2, args[3]);
@@ -2718,9 +2711,6 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
}
break;
- case INDEX_op_setcond_i64:
- tcg_out_setcond64(s, args[3], a0, a1, a2, const_a2);
- break;
case INDEX_op_movcond_i64:
tcg_out_movcond64(s, args[5], a0, a1, a2, const_a2, args[3]);
break;
--
2.34.1
- [PATCH 14/24] tcg/riscv: Implement negsetcond_*, (continued)
- [PATCH 14/24] tcg/riscv: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 17/24] tcg/i386: Merge tcg_out_brcond{32,64}, Richard Henderson, 2023/08/07
- [PATCH 24/24] tcg/i386: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 16/24] tcg/sparc64: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 19/24] tcg/i386: Merge tcg_out_movcond{32,64}, Richard Henderson, 2023/08/07
- [PATCH 18/24] tcg/i386: Merge tcg_out_setcond{32,64},
Richard Henderson <=
- [PATCH 21/24] tcg/i386: Use CMP+SBB in tcg_out_setcond, Richard Henderson, 2023/08/07
- [PATCH 22/24] tcg/i386: Clear dest first in tcg_out_setcond if possible, Richard Henderson, 2023/08/07
- [PATCH 23/24] tcg/i386: Use shift in tcg_out_setcond, Richard Henderson, 2023/08/07
- [PATCH 20/24] tcg/i386: Add cf parameter to tcg_out_cmp, Richard Henderson, 2023/08/07