* [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm
@ 2011-09-29 8:12 Frank Mehnert
2011-09-29 20:17 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Frank Mehnert @ 2011-09-29 8:12 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2076 bytes --]
Hi,
the two functions helper_pcmpestrm() and helper_pcmpistrm() in
target-i386/ops_sse.h contain obviously typos. I think that at
all 4 marked places should increment the index 'i', not decrement
it during the loop:
void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
{
int i;
unsigned int res = pcmpxstrx(d, s, ctrl,
pcmp_elen(R_EDX, ctrl),
pcmp_elen(R_EAX, ctrl));
if ((ctrl >> 6) & 1) {
if (ctrl & 1)
for (i = 0; i <= 8; i--, res >>= 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d->W(i) = (res & 1) ? ~0 : 0;
else
for (i = 0; i <= 16; i--, res >>= 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d->B(i) = (res & 1) ? ~0 : 0;
} else {
d->Q(1) = 0;
d->Q(0) = res;
}
}
void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
{
int i;
unsigned int res = pcmpxstrx(d, s, ctrl,
pcmp_ilen(s, ctrl),
pcmp_ilen(d, ctrl));
if ((ctrl >> 6) & 1) {
if (ctrl & 1)
for (i = 0; i <= 8; i--, res >>= 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d->W(i) = (res & 1) ? ~0 : 0;
else
for (i = 0; i <= 16; i--, res >>= 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d->B(i) = (res & 1) ? ~0 : 0;
} else {
d->Q(1) = 0;
d->Q(0) = res;
}
}
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert
Senior Manager Software Development Desktop Virtualization, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm
2011-09-29 8:12 [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm Frank Mehnert
@ 2011-09-29 20:17 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2011-09-29 20:17 UTC (permalink / raw)
To: Frank Mehnert; +Cc: qemu-devel
On Thu, Sep 29, 2011 at 8:12 AM, Frank Mehnert <frank.mehnert@oracle.com> wrote:
> Hi,
>
> the two functions helper_pcmpestrm() and helper_pcmpistrm() in
> target-i386/ops_sse.h contain obviously typos. I think that at
> all 4 marked places should increment the index 'i', not decrement
> it during the loop:
>
>
> void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
> {
> int i;
> unsigned int res = pcmpxstrx(d, s, ctrl,
> pcmp_elen(R_EDX, ctrl),
> pcmp_elen(R_EAX, ctrl));
>
> if ((ctrl >> 6) & 1) {
> if (ctrl & 1)
> for (i = 0; i <= 8; i--, res >>= 1)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> d->W(i) = (res & 1) ? ~0 : 0;
I think this line will also fill the entire memory with 0xff and 0x00.
Please make a patch, http://wiki.qemu.org/Contribute/SubmitAPatch
should tell how (seems to be down ATM).
> else
> for (i = 0; i <= 16; i--, res >>= 1)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> d->B(i) = (res & 1) ? ~0 : 0;
> } else {
> d->Q(1) = 0;
> d->Q(0) = res;
> }
> }
>
>
> void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
> {
> int i;
> unsigned int res = pcmpxstrx(d, s, ctrl,
> pcmp_ilen(s, ctrl),
> pcmp_ilen(d, ctrl));
>
> if ((ctrl >> 6) & 1) {
> if (ctrl & 1)
> for (i = 0; i <= 8; i--, res >>= 1)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> d->W(i) = (res & 1) ? ~0 : 0;
> else
> for (i = 0; i <= 16; i--, res >>= 1)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> d->B(i) = (res & 1) ? ~0 : 0;
> } else {
> d->Q(1) = 0;
> d->Q(0) = res;
> }
> }
>
>
> Kind regards,
>
> Frank
> --
> Dr.-Ing. Frank Mehnert
> Senior Manager Software Development Desktop Virtualization, VirtualBox
> ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
>
> Hauptverwaltung: Riesstr. 25, D-80992 München
> Registergericht: Amtsgericht München, HRA 95603
>
> Komplementärin: ORACLE Deutschland Verwaltung B.V.
> Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
> Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
> Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-29 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 8:12 [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm Frank Mehnert
2011-09-29 20:17 ` Blue Swirl
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.