diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2013-09-03 08:27:38 +0200 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2014-02-17 10:12:28 -0600 |
commit | 3031244b01492528fd7b5e46b23eeb2124dc780a (patch) | |
tree | b923a98d504020eead17850b8fb455ac093a7ce0 /tcg/optimize.c | |
parent | e46b225a3137e62c975c49aaae7bb5f9583cc428 (diff) | |
download | qemu-3031244b01492528fd7b5e46b23eeb2124dc780a.zip qemu-3031244b01492528fd7b5e46b23eeb2124dc780a.tar.gz qemu-3031244b01492528fd7b5e46b23eeb2124dc780a.tar.bz2 |
tcg/optimize: fix known-zero bits optimization
Known-zero bits optimization is a great idea that helps to generate more
optimized code. However the current implementation only works in very few
cases as the computed mask is not saved.
Fix this to make it really working.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r-- | tcg/optimize.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index c5cdde2..7838be2 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -691,7 +691,8 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, break; } - /* Simplify using known-zero bits */ + /* Simplify using known-zero bits. Currently only ops with a single + output argument is supported. */ mask = -1; affected = -1; switch (op) { @@ -1149,6 +1150,11 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, } else { for (i = 0; i < def->nb_oargs; i++) { reset_temp(args[i]); + /* Save the corresponding known-zero bits mask for the + first output argument (only one supported so far). */ + if (i == 0) { + temps[args[i]].mask = mask; + } } } for (i = 0; i < def->nb_args; i++) { |