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>
This commit is contained in:
Richard Henderson 2021-10-25 11:30:33 -07:00
parent 2f9d9a3422
commit 267c17e825

View file

@ -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)