[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 23/24] tcg/i386: Use shift in tcg_out_setcond
From: |
Richard Henderson |
Subject: |
[PATCH 23/24] tcg/i386: Use shift in tcg_out_setcond |
Date: |
Mon, 7 Aug 2023 20:11:42 -0700 |
For LT/GE vs zero, shift down the sign bit.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index cca49fe63a..f68722b8a5 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1575,6 +1575,21 @@ static void tcg_out_setcond(TCGContext *s, int rexw,
TCGCond cond,
}
return;
+ case TCG_COND_GE:
+ inv = true;
+ /* fall through */
+ case TCG_COND_LT:
+ /* If arg2 is 0, extract the sign bit. */
+ if (const_arg2 && arg2 == 0) {
+ tcg_out_mov(s, rexw ? TCG_TYPE_I64 : TCG_TYPE_I32, dest, arg1);
+ if (inv) {
+ tcg_out_modrm(s, OPC_GRP3_Ev + rexw, EXT3_NOT, dest);
+ }
+ tcg_out_shifti(s, SHIFT_SHR + rexw, dest, rexw ? 63 : 31);
+ return;
+ }
+ break;
+
default:
break;
}
--
2.34.1
- Re: [PATCH 14/24] tcg/riscv: Implement negsetcond_*, (continued)
- [PATCH 15/24] tcg/s390x: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 16/24] tcg/sparc64: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 17/24] tcg/i386: Merge tcg_out_brcond{32,64}, Richard Henderson, 2023/08/07
- [PATCH 18/24] tcg/i386: Merge tcg_out_setcond{32,64}, Richard Henderson, 2023/08/07
- [PATCH 19/24] tcg/i386: Merge tcg_out_movcond{32,64}, Richard Henderson, 2023/08/07
- [PATCH 23/24] tcg/i386: Use shift in tcg_out_setcond,
Richard Henderson <=
- [PATCH 22/24] tcg/i386: Clear dest first in tcg_out_setcond if possible, Richard Henderson, 2023/08/07
- [PATCH 24/24] tcg/i386: Implement negsetcond_*, Richard Henderson, 2023/08/07
- [PATCH 20/24] tcg/i386: Add cf parameter to tcg_out_cmp, Richard Henderson, 2023/08/07