diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2025-01-13 20:21:09 -0800 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2025-04-28 13:40:17 -0700 |
commit | 3db22914ced9bb3683bffa03729608be0c42f666 (patch) | |
tree | cc8cc7dfbcf620b7c33f98679bafb25464f4a887 | |
parent | 3ff7e44ef35924f76dbe36510c54c27e72af9121 (diff) | |
download | qemu-3db22914ced9bb3683bffa03729608be0c42f666.zip qemu-3db22914ced9bb3683bffa03729608be0c42f666.tar.gz qemu-3db22914ced9bb3683bffa03729608be0c42f666.tar.bz2 |
tcg: Expand fallback sub2 with 32-bit operations
No need to expand to i64 to perform the subtract.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | tcg/tcg-op.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 8b1356c..127338b 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -1123,14 +1123,15 @@ void tcg_gen_sub2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al, if (TCG_TARGET_HAS_sub2_i32) { tcg_gen_op6_i32(INDEX_op_sub2_i32, rl, rh, al, ah, bl, bh); } else { - TCGv_i64 t0 = tcg_temp_ebb_new_i64(); - TCGv_i64 t1 = tcg_temp_ebb_new_i64(); - tcg_gen_concat_i32_i64(t0, al, ah); - tcg_gen_concat_i32_i64(t1, bl, bh); - tcg_gen_sub_i64(t0, t0, t1); - tcg_gen_extr_i64_i32(rl, rh, t0); - tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); + TCGv_i32 t0 = tcg_temp_ebb_new_i32(); + TCGv_i32 t1 = tcg_temp_ebb_new_i32(); + tcg_gen_sub_i32(t0, al, bl); + tcg_gen_setcond_i32(TCG_COND_LTU, t1, al, bl); + tcg_gen_sub_i32(rh, ah, bh); + tcg_gen_sub_i32(rh, rh, t1); + tcg_gen_mov_i32(rl, t0); + tcg_temp_free_i32(t0); + tcg_temp_free_i32(t1); } } |