diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-08-05 16:07:34 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-08-24 11:22:42 -0700 |
commit | e91f015b62d72158c4f69a5b1cbf87fba4599ba1 (patch) | |
tree | 63bf86f65342d2a3b381891d88d4da76973a00c2 /tcg | |
parent | 96658acafd9ade24d00526e46cc073ed8fcf2111 (diff) | |
download | qemu-e91f015b62d72158c4f69a5b1cbf87fba4599ba1.zip qemu-e91f015b62d72158c4f69a5b1cbf87fba4599ba1.tar.gz qemu-e91f015b62d72158c4f69a5b1cbf87fba4599ba1.tar.bz2 |
tcg/i386: Use shift in tcg_out_setcond
For LT/GE vs zero, shift down the sign bit.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/i386/tcg-target.c.inc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 3f3c114..16e8300 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1578,6 +1578,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; } |