aboutsummaryrefslogtreecommitdiff
path: root/tcg/sparc/tcg-target.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-03-06 16:06:24 -0800
committerRichard Henderson <rth@twiddle.net>2014-04-28 11:06:35 -0700
commit035b2398264d4b8838d66a8360ca6091f1a107e9 (patch)
treecc5f93484be07745bfcaa15b2b2b1135ec0f2845 /tcg/sparc/tcg-target.c
parent35e2da1556555b1d56816dfcea4306f5c41c6dbe (diff)
tcg-sparc: Fix small 32-bit movi
We tested imm13 before discarding garbage high bits. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/sparc/tcg-target.c')
-rw-r--r--tcg/sparc/tcg-target.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index a977c57d2b..1526f2c2e7 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -432,6 +432,11 @@ static void tcg_out_movi(TCGContext *s, TCGType type,
{
tcg_target_long hi, lo = (int32_t)arg;
+ /* Make sure we test 32-bit constants for imm13 properly. */
+ if (type == TCG_TYPE_I32) {
+ arg = lo;
+ }
+
/* A 13-bit constant sign-extended to 64-bits. */
if (check_fit_tl(arg, 13)) {
tcg_out_movi_imm13(s, ret, arg);