tcg: Fix constant folding of INDEX_op_extract2_i32
On a 64-bit host, discard any replications of the 32-bit sign bit when performing the shift and merge. Fixes: https://bugs.launchpad.net/bugs/1834496 Tested-by: Christophe Lyon <christophe.lyon@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
1316b1ddc8
commit
80f4d7c3ae
@ -1213,8 +1213,8 @@ void tcg_optimize(TCGContext *s)
|
|||||||
if (opc == INDEX_op_extract2_i64) {
|
if (opc == INDEX_op_extract2_i64) {
|
||||||
tmp = (v1 >> op->args[3]) | (v2 << (64 - op->args[3]));
|
tmp = (v1 >> op->args[3]) | (v2 << (64 - op->args[3]));
|
||||||
} else {
|
} else {
|
||||||
tmp = (v1 >> op->args[3]) | (v2 << (32 - op->args[3]));
|
tmp = (int32_t)(((uint32_t)v1 >> op->args[3]) |
|
||||||
tmp = (int32_t)tmp;
|
((uint32_t)v2 << (32 - op->args[3])));
|
||||||
}
|
}
|
||||||
tcg_opt_gen_movi(s, op, op->args[0], tmp);
|
tcg_opt_gen_movi(s, op, op->args[0], tmp);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user