From patchwork Fri Mar 26 16:07:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [42/48] target-arm: fix signed narrow 64->32 operation Date: Fri, 26 Mar 2010 06:07:02 -0000 From: Riku Voipio X-Patchwork-Id: 48684 Message-Id: <7d5786fe88c6fb3555cb4c24846d7cfae97994ae.1269617187.git.riku.voipio@nokia.com> To: qemu-devel@nongnu.org Cc: Riku Voipio , =?UTF-8?q?Juha=20Riihim=C3=A4ki?= From: Juha Riihimäki Signed-Off-By: Riku Voipio Signed-off-by: Juha Riihimäki --- target-arm/neon_helper.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c index 4604698..910f84a 100644 --- a/target-arm/neon_helper.c +++ b/target-arm/neon_helper.c @@ -1183,9 +1183,13 @@ uint32_t HELPER(neon_narrow_sat_u32)(CPUState *env, uint64_t x) uint32_t HELPER(neon_narrow_sat_s32)(CPUState *env, uint64_t x) { - if ((int64_t)x != (int32_t)x) { + if ((int64_t)x < -2147483648ll) { SET_QC(); - return (x >> 63) ^ 0x7fffffff; + return 0x80000000; + } + if ((int64_t)x > 2147483647ll) { + SET_QC(); + return 0x7fffffff; } return x; }