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. Best regards, Lénárd Szolnoki