Skip to content

Commit

Permalink
tcg/optimize: improve known-zero bits for 32-bit ops
Browse files Browse the repository at this point in the history
The shl_i32 op might set some bits of the unused 32 high bits of the
mask. Fix that by clearing the unused 32 high bits for all 32-bit ops
except load/store which operate on tl values.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
  • Loading branch information
aurel32 authored and rth7680 committed Feb 17, 2014
1 parent 3031244 commit f096dc9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tcg/optimize.c
Expand Up @@ -783,6 +783,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
break;
}

/* 32-bit ops (non 64-bit ops and non load/store ops) generate 32-bit
results */
if (!(tcg_op_defs[op].flags & (TCG_OPF_CALL_CLOBBER | TCG_OPF_64BIT))) {
mask &= 0xffffffffu;
}

if (mask == 0) {
assert(def->nb_oargs == 1);
s->gen_opc_buf[op_index] = op_to_movi(op);
Expand Down

0 comments on commit f096dc9

Please sign in to comment.