Patchwork target-arm: When setting FPSCR.QC, don't clear other FPSCR bits

login
register
mail settings
Submitter Matt Craighead
Date May 7, 2012, 2:45 a.m.
Message ID <CAEn9PUrWLHTbdfQzaQLt9yWmsVqgnQXzA4ywx0mb_OU9jkwbtw@mail.gmail.com>
Download mbox | patch
Permalink /patch/157222/
State New
Headers show

Comments

Matt Craighead - May 7, 2012, 2:45 a.m.
This patch fixes a bug affecting a variety of Neon instructions, such as
VQADD.


Signed-off-by: Matt Craighead <mjcraighead@gmail.com>
---
 target-arm/neon_helper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Peter Maydell - May 8, 2012, 3:01 p.m.
On 7 May 2012 03:45, Matt Craighead <mjcraighead@gmail.com> wrote:
> diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
> -#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] = CPSR_Q
> +#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] |= CPSR_Q

Bug reproduced, fix confirmed,
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This bug has actually been in the code since 2008...
As a trivial and obvious patch I think I'll put it into a pullreq
for 1.1.

-- PMM

Patch

diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 1e02d61..e0b9dbf 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -16,7 +16,7 @@ 
 #define SIGNBIT (uint32_t)0x80000000
 #define SIGNBIT64 ((uint64_t)1 << 63)

-#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] = CPSR_Q
+#define SET_QC() env->vfp.xregs[ARM_VFP_FPSCR] |= CPSR_Q

 #define NEON_TYPE1(name, type) \
 typedef struct \