PEXT returns wrong values, seemingly switches arguments

Bug #1605123 reported by Lenard Szolnoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

Hi,

I fiddled with BMI2 instructions and discovered that pext instructions
emulated with "qemu-x86_64 -cpu Haswell" return the wrong value. It
seemingly switches up its arguments. I suspect that the error is around the
gen_helper_pext(...) call in target-i386/translate.c. I checked helper_pext
in target-i386/int_helper.c and it works fine.

I ran my program on a CPU with BMI2 instruction set too, and it indeed
returns different values.

I didn't check pdep, it could have the same problem.

$ qemu-x86_64 --version
qemu-x86_64 version 2.6.50 (v2.6.0-2095-ge66b05e-dirty), Copyright (c) 2003-2008 Fabrice Bellard

$ uname -a
Linux lenard-hp 4.3.0-1-amd64 #1 SMP Debian 4.3.5-1 (2016-02-06) x86_64 GNU/Linux

I compiled the attached file with the command line "gcc -o main -g -mbmi2 main.c".

$ gcc --version
gcc (Debian 5.4.0-6) 5.4.0 20160609

Best regards,
Lénárd Szolnoki

Revision history for this message
Lenard Szolnoki (leni536) wrote :
Revision history for this message
Thomas Huth (th-huth) wrote :
Revision history for this message
Thomas Huth (th-huth) wrote :
Changed in qemu:
status: New → Fix Committed
Thomas Huth (th-huth)
Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.