[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/50] target/i386: fix packusdw in-place operation
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 03/50] target/i386: fix packusdw in-place operation |
Date: |
Tue, 19 Sep 2017 14:28:52 +0200 |
From: Joseph Myers <address@hidden>
The SSE4.1 packusdw instruction combines source and destination
vectors of signed 32-bit integers into a single vector of unsigned
16-bit integers, with unsigned saturation. When the source and
destination are the same register, this means each 32-bit element of
that register is used twice as an input, to produce two of the 16-bit
output elements, and so if the operation is carried out
element-by-element in-place, no matter what the order in which it is
applied to the elements, the first element's operation will overwrite
some future input. The helper for packssdw avoids this issue by
computing the result in a local temporary and copying it to the
destination at the end; this patch fixes the packusdw helper to do
likewise. This fixes three gcc test failures in my GCC 6-based
testing.
Signed-off-by: Joseph Myers <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/ops_sse.h | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h
index d578216..05b1701 100644
--- a/target/i386/ops_sse.h
+++ b/target/i386/ops_sse.h
@@ -1655,14 +1655,17 @@ SSE_HELPER_Q(helper_pcmpeqq, FCMPEQQ)
void glue(helper_packusdw, SUFFIX)(CPUX86State *env, Reg *d, Reg *s)
{
- d->W(0) = satuw((int32_t) d->L(0));
- d->W(1) = satuw((int32_t) d->L(1));
- d->W(2) = satuw((int32_t) d->L(2));
- d->W(3) = satuw((int32_t) d->L(3));
- d->W(4) = satuw((int32_t) s->L(0));
- d->W(5) = satuw((int32_t) s->L(1));
- d->W(6) = satuw((int32_t) s->L(2));
- d->W(7) = satuw((int32_t) s->L(3));
+ Reg r;
+
+ r.W(0) = satuw((int32_t) d->L(0));
+ r.W(1) = satuw((int32_t) d->L(1));
+ r.W(2) = satuw((int32_t) d->L(2));
+ r.W(3) = satuw((int32_t) d->L(3));
+ r.W(4) = satuw((int32_t) s->L(0));
+ r.W(5) = satuw((int32_t) s->L(1));
+ r.W(6) = satuw((int32_t) s->L(2));
+ r.W(7) = satuw((int32_t) s->L(3));
+ *d = r;
}
#define FMINSB(d, s) MIN((int8_t)d, (int8_t)s)
--
1.8.3.1
- [Qemu-devel] [PULL 00/50] Misc patches for 2017-09-19, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 02/50] target/i386: set rip_offset for further SSE instructions, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 05/50] target/i386: fix phminposuw in-place operation, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 04/50] target/i386: fix pcmpxstrx substring search, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 03/50] target/i386: fix packusdw in-place operation,
Paolo Bonzini <=
- [Qemu-devel] [PULL 01/50] target/i386: fix pmovsx/pmovzx in-place operations, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 06/50] virtio-scsi: Add virtqueue_size parameter allowing virtqueue size to be set., Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 09/50] scsi: Improve scsi_sense_to_errno, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 08/50] scsi: Refactor scsi sense interpreting code, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 11/50] scsi-block: Support rerror/werror, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 14/50] scsi: introduce scsi_build_sense, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 10/50] scsi: Introduce scsi_sense_buf_to_errno, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 07/50] scsi-bus: correct responses for INQUIRY and REQUEST SENSE, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 12/50] scsi: rename scsi_build_sense to scsi_convert_sense, Paolo Bonzini, 2017/09/19
- [Qemu-devel] [PULL 15/50] scsi: introduce sg_io_sense_from_errno, Paolo Bonzini, 2017/09/19