mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 13:38:36 -07:00
tcg/optimize: Fold movcond with true and false values identical
Fold "x = cond ? y : y" to "x = y". Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
fcc54e7bf5
commit
141125e08c
1 changed files with 5 additions and 0 deletions
|
|
@ -1851,6 +1851,11 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
|
|||
{
|
||||
int i;
|
||||
|
||||
/* If true and false values are the same, eliminate the cmp. */
|
||||
if (args_are_copies(op->args[3], op->args[4])) {
|
||||
return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[3]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Canonicalize the "false" input reg to match the destination reg so
|
||||
* that the tcg backend can implement a "move if true" operation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue