summaryrefslogtreecommitdiffstats
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson2021-10-25 20:30:33 +0200
committerRichard Henderson2021-10-29 05:55:07 +0200
commit267c17e8252fd70b311871f3e936eb7cdf4abb51 (patch)
tree1e96140a7aaee56497614d9d77153df82fc42008 /tcg
parenttcg/optimize: Use fold_xi_to_x for div (diff)
downloadqemu-267c17e8252fd70b311871f3e936eb7cdf4abb51.tar.gz
qemu-267c17e8252fd70b311871f3e936eb7cdf4abb51.tar.xz
qemu-267c17e8252fd70b311871f3e936eb7cdf4abb51.zip
tcg/optimize: Use fold_xx_to_i for rem
Recognize the constant function for remainder. Suggested-by: Luis Pires <luis.pires@eldorado.org.br> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/optimize.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c
index f8b0709157..7ac63c9231 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1624,7 +1624,11 @@ static bool fold_qemu_st(OptContext *ctx, TCGOp *op)
static bool fold_remainder(OptContext *ctx, TCGOp *op)
{
- return fold_const2(ctx, op);
+ if (fold_const2(ctx, op) ||
+ fold_xx_to_i(ctx, op, 0)) {
+ return true;
+ }
+ return false;
}
static bool fold_setcond(OptContext *ctx, TCGOp *op)