[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/5] ARM: Correct result in saturating cases for VQS
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 5/5] ARM: Correct result in saturating cases for VQSHL of s8/16/32 |
Date: |
Tue, 7 Dec 2010 14:13:45 +0000 |
Where VQSHL of a signed 8/16/32 bit value saturated, the result
value was not being calculated correctly (it should be either
the minimum or maximum value for the size of the signed type).
Signed-off-by: Peter Maydell <address@hidden>
---
target-arm/neon_helper.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 48b9f5b..dae063e 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -580,9 +580,15 @@ uint64_t HELPER(neon_qshl_u64)(CPUState *env, uint64_t
val, uint64_t shiftop)
int8_t tmp; \
tmp = (int8_t)src2; \
if (tmp >= (ssize_t)sizeof(src1) * 8) { \
- if (src1) \
+ if (src1) { \
SET_QC(); \
- dest = src1 >> 31; \
+ dest = (uint32_t)(1 << (sizeof(src1) * 8 - 1)); \
+ if (src1 > 0) { \
+ dest--; \
+ } \
+ } else { \
+ dest = src1; \
+ } \
} else if (tmp <= -(ssize_t)sizeof(src1) * 8) { \
dest = src1 >> 31; \
} else if (tmp < 0) { \
@@ -591,7 +597,10 @@ uint64_t HELPER(neon_qshl_u64)(CPUState *env, uint64_t
val, uint64_t shiftop)
dest = src1 << tmp; \
if ((dest >> tmp) != src1) { \
SET_QC(); \
- dest = src2 >> 31; \
+ dest = (uint32_t)(1 << (sizeof(src1) * 8 - 1)); \
+ if (src1 > 0) { \
+ dest--; \
+ } \
} \
}} while (0)
NEON_VOP_ENV(qshl_s8, neon_s8, 4)
--
1.6.3.3
- [Qemu-devel] [PATCH 0/5] ARM: fix VQSHL (register), Peter Maydell, 2010/12/07
- [Qemu-devel] [PATCH 4/5] ARM: remove pointless else clause in VQSHL of u64, Peter Maydell, 2010/12/07
- [Qemu-devel] [PATCH 5/5] ARM: Correct result in saturating cases for VQSHL of s8/16/32,
Peter Maydell <=
- [Qemu-devel] [PATCH 3/5] ARM: Fix VQSHL of signed 64 bit values by shift counts >= 64, Peter Maydell, 2010/12/07
- [Qemu-devel] [PATCH 2/5] ARM: Fix VQSHL of signed 64 bit values, Peter Maydell, 2010/12/07
- [Qemu-devel] [PATCH 1/5] ARM: Fix arguments passed to VQSHL helpers, Peter Maydell, 2010/12/07
- Re: [Qemu-devel] [PATCH 0/5] ARM: fix VQSHL (register), Aurelien Jarno, 2010/12/27