aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2011-01-19 17:10:52 +0100
committerAurelien Jarno <aurelien@aurel32.net>2011-01-26 14:30:24 +0100
commit40d3c433606530ee1bb46ce95a6ca1cf2ee9d9c7 (patch)
tree9af5b8dc7e79824a78271a95f34a84a03bb7eb1b /target-arm
parente3f114f761fd44db3b33f5d704da48392fce4ce8 (diff)
downloadqemu-40d3c433606530ee1bb46ce95a6ca1cf2ee9d9c7.zip
qemu-40d3c433606530ee1bb46ce95a6ca1cf2ee9d9c7.tar.gz
qemu-40d3c433606530ee1bb46ce95a6ca1cf2ee9d9c7.tar.bz2
Support saturation with shift=0.
This patch fixes corner-case saturations, when the target range is zero. It merely removes the guard against (sh == 0), and makes: __ssat(0x87654321, 1) return 0xffffffff and set the saturation flag __usat(0x87654321, 0) return 0 and set the saturation flag Signed-off-by: Christophe Lyon <christophe.lyon@st.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/translate.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/target-arm/translate.c b/target-arm/translate.c
index c60cd18..f445c87 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -6888,27 +6888,23 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
tcg_gen_shli_i32(tmp, tmp, shift);
}
sh = (insn >> 16) & 0x1f;
- if (sh != 0) {
- tmp2 = tcg_const_i32(sh);
- if (insn & (1 << 22))
- gen_helper_usat(tmp, tmp, tmp2);
- else
- gen_helper_ssat(tmp, tmp, tmp2);
- tcg_temp_free_i32(tmp2);
- }
+ tmp2 = tcg_const_i32(sh);
+ if (insn & (1 << 22))
+ gen_helper_usat(tmp, tmp, tmp2);
+ else
+ gen_helper_ssat(tmp, tmp, tmp2);
+ tcg_temp_free_i32(tmp2);
store_reg(s, rd, tmp);
} else if ((insn & 0x00300fe0) == 0x00200f20) {
/* [us]sat16 */
tmp = load_reg(s, rm);
sh = (insn >> 16) & 0x1f;
- if (sh != 0) {
- tmp2 = tcg_const_i32(sh);
- if (insn & (1 << 22))
- gen_helper_usat16(tmp, tmp, tmp2);
- else
- gen_helper_ssat16(tmp, tmp, tmp2);
- tcg_temp_free_i32(tmp2);
- }
+ tmp2 = tcg_const_i32(sh);
+ if (insn & (1 << 22))
+ gen_helper_usat16(tmp, tmp, tmp2);
+ else
+ gen_helper_ssat16(tmp, tmp, tmp2);
+ tcg_temp_free_i32(tmp2);
store_reg(s, rd, tmp);
} else if ((insn & 0x00700fe0) == 0x00000fa0) {
/* Select bytes. */