mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 14:04:39 +08:00
tcg: Use umax in ussub if available
Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
1 parent
c86fbb6b2a
commit
76499fb445
1 file changed
+12
-3
+12
-3
@@ -1086,9 +1086,18 @@ void tcg_gen_ussub(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
|
||||
{
|
||||
g_autoptr(TCGTemp) tmp = tcg_temp_new_ebb(type);
|
||||
|
||||
tcg_gen_sub(type, tmp, src1, src2);
|
||||
tcg_gen_movcond(type, TCG_COND_LTU, dst, src1, src2,
|
||||
tcg_constant_internal(type, 0), tmp);
|
||||
if (tcg_op_supported(INDEX_op_umax, type, 0)) {
|
||||
tcg_gen_umax(type, tmp, src1, src2);
|
||||
tcg_gen_sub(type, dst, tmp, src2);
|
||||
} else {
|
||||
/*
|
||||
* While umax can be expanded with movcond, some hosts can
|
||||
* perform movcond with a zero source in fewer insns.
|
||||
*/
|
||||
tcg_gen_sub(type, tmp, src1, src2);
|
||||
tcg_gen_movcond(type, TCG_COND_LTU, dst, src1, src2,
|
||||
tcg_constant_internal(type, 0), tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void tcg_gen_xor(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
|
||||
|
||||
Reference in new issue
Block a user