From: Juha Riihimäki <juha.riihim...@nokia.com> Signed-Off-By: Riku Voipio <riku.voi...@nokia.com> Signed-off-by: Juha Riihimäki <juha.riihim...@nokia.com> --- 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; } -- 1.6.5