* [Qemu-devel] [PATCH v2] target-arm: fix VSHLL Neon instruction.
@ 2011-02-09 12:19 Christophe Lyon
2011-02-09 14:23 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Lyon @ 2011-02-09 12:19 UTC (permalink / raw)
To: qemu-devel
Fix bit mask used when widening the result of shift on narrow input.
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
---
target-arm/translate.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index b694eed..16c61f1 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -4882,16 +4882,28 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
/* The shift is less than the width of the source
type, so we can just shift the whole register. */
tcg_gen_shli_i64(cpu_V0, cpu_V0, shift);
+ /* Widen the result of shift: we need to clear
+ * the potential overflow bits resulting from
+ * left bits of the narrow input appearing as
+ * right bits of left the neighbour narrow
+ * input. */
if (size < 2 || !u) {
uint64_t imm64;
if (size == 0) {
imm = (0xffu >> (8 - shift));
imm |= imm << 16;
- } else {
+ } else if (size == 1) {
imm = 0xffff >> (16 - shift);
+ } else {
+ /* size == 2 */
+ imm = 0xffffffff >> (32 - shift);
+ }
+ if (size < 2) {
+ imm64 = imm | (((uint64_t)imm) << 32);
+ } else {
+ imm64 = imm;
}
- imm64 = imm | (((uint64_t)imm) << 32);
- tcg_gen_andi_i64(cpu_V0, cpu_V0, imm64);
+ tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64);
}
}
neon_store_reg64(cpu_V0, rd + pass);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target-arm: fix VSHLL Neon instruction.
2011-02-09 12:19 [Qemu-devel] [PATCH v2] target-arm: fix VSHLL Neon instruction Christophe Lyon
@ 2011-02-09 14:23 ` Peter Maydell
2011-02-09 18:48 ` Aurelien Jarno
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2011-02-09 14:23 UTC (permalink / raw)
To: Christophe Lyon; +Cc: qemu-devel
On 9 February 2011 12:19, Christophe Lyon <christophe.lyon@st.com> wrote:
>
> Fix bit mask used when widening the result of shift on narrow input.
>
> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
Confirmed with random instruction testing that this patch fixes VSHLL.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] target-arm: fix VSHLL Neon instruction.
2011-02-09 14:23 ` Peter Maydell
@ 2011-02-09 18:48 ` Aurelien Jarno
0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2011-02-09 18:48 UTC (permalink / raw)
To: Peter Maydell; +Cc: Christophe Lyon, qemu-devel
On Wed, Feb 09, 2011 at 02:23:24PM +0000, Peter Maydell wrote:
> On 9 February 2011 12:19, Christophe Lyon <christophe.lyon@st.com> wrote:
> >
> > Fix bit mask used when widening the result of shift on narrow input.
> >
> > Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
>
> Confirmed with random instruction testing that this patch fixes VSHLL.
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
Thanks, applied.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-09 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 12:19 [Qemu-devel] [PATCH v2] target-arm: fix VSHLL Neon instruction Christophe Lyon
2011-02-09 14:23 ` Peter Maydell
2011-02-09 18:48 ` Aurelien Jarno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.