qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm


From: Frank Mehnert
Subject: [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm
Date: Thu, 29 Sep 2011 10:12:37 +0200
User-agent: KMail/1.13.7 (Linux/3.0.4; KDE/4.6.5; x86_64; ; )

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: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]