diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2015-06-04 21:47:07 +0200 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2015-06-09 06:42:27 -0700 |
commit | 7e1df267a7e8b39fc0cf1d84d2afc2e88ccbfeac (patch) | |
tree | c85f3366cdd2a5bc1e5710f3af2428f838a75ed9 | |
parent | 59c4b7e8dfab0cdc41434fedbf2686222f541e57 (diff) | |
download | qemu-7e1df267a7e8b39fc0cf1d84d2afc2e88ccbfeac.zip qemu-7e1df267a7e8b39fc0cf1d84d2afc2e88ccbfeac.tar.gz qemu-7e1df267a7e8b39fc0cf1d84d2afc2e88ccbfeac.tar.bz2 |
tcg: fix register allocation with two aliased dead inputs
For TCG ops with two outputs registers (add2, sub2, div2, div2u), when
the same input temp is used for the two inputs aliased to the two
outputs, and when these inputs are both dead, the register allocation
code wrongly assigned the same register to the same output.
This happens for example with sub2 t1, t2, t3, t3, t4, t5, when t3 is
not used anymore after the TCG op. In that case the same register is
used for t1, t2 and t3.
The fix is to look for already allocated aliased input when allocating
a dead aliased input and check that the register is not already
used.
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Message-Id: <1433447228-29425-2-git-send-email-aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
-rw-r--r-- | tcg/tcg.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -2007,6 +2007,16 @@ static void tcg_reg_alloc_op(TCGContext *s, if (!IS_DEAD_ARG(i)) { goto allocate_in_reg; } + /* check if the current register has already been allocated + for another input aliased to an output */ + int k2, i2; + for (k2 = 0 ; k2 < k ; k2++) { + i2 = def->sorted_args[nb_oargs + k2]; + if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && + (new_args[i2] == ts->reg)) { + goto allocate_in_reg; + } + } } } reg = ts->reg; |