diff options
author | Vince Weaver <vince@csl.cornell.edu> | 2009-09-17 15:28:52 -0400 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2009-09-18 17:22:47 +0200 |
commit | 6fd6e9f0bd997e421dbdf4b4c651d74b05b67792 (patch) | |
tree | 48d4e1c5223b00b1b3fee04b426df5451810028f | |
parent | 868136d4e36a4e7383c23393bda20c7ef0c5d131 (diff) |
target-alpha: fix extlh instruction
The extlh instruction on Alpha currently doesn't work properly.
It's a combination of a cut/paste bug (16 where it should be 32) as well
as a "shift by 64" bug.
Signed-off-by: Vince Weaver <vince@csl.cornell.edu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | target-alpha/translate.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 1fc5119cb5..049c2cdf6f 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -526,14 +526,15 @@ static always_inline void gen_ext_h(void (*tcg_gen_ext_i64)(TCGv t0, TCGv t1), else tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]); } else { - TCGv tmp1, tmp2; + TCGv tmp1; tmp1 = tcg_temp_new(); + tcg_gen_andi_i64(tmp1, cpu_ir[rb], 7); tcg_gen_shli_i64(tmp1, tmp1, 3); - tmp2 = tcg_const_i64(64); - tcg_gen_sub_i64(tmp1, tmp2, tmp1); - tcg_temp_free(tmp2); + tcg_gen_neg_i64(tmp1, tmp1); + tcg_gen_andi_i64(tmp1, tmp1, 0x3f); tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], tmp1); + tcg_temp_free(tmp1); } if (tcg_gen_ext_i64) @@ -1320,7 +1321,7 @@ static always_inline int translate_one (DisasContext *ctx, uint32_t insn) break; case 0x6A: /* EXTLH */ - gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit); + gen_ext_h(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit); break; case 0x72: /* MSKQH */ |