Created attachment 100373 [details] sample project valgrind complains about unrecognized instruction, generated by NASM assembler. A sample project is attached. YASM and NASM generate different instructions: Yasm listing: 1 %line 1+1 test_pextrw.nas 2 [bits 64] 3 [default rel] 4 5 [section .text align=16] 6 7 [global test_pextrw] 8 test_pextrw: 9 00000000 0F1007 movups xmm0, [rdi] 10 00000003 66480FC5C000 pextrw rax, xmm0, 0 11 00000009 C3 ret 12 nasm listing: 1 [bits 64] 2 [default rel] 3 4 [section .text align=16] 5 6 [global test_pextrw] 7 test_pextrw: 8 00000000 0F1007 movups xmm0, [rdi] 9 00000003 66480F3A15C000 pextrw rax, xmm0, 0 10 0000000A C3 ret 11 NASM 2.12.02rc7 (latest rc) yasm 1.3.0.28.g51af (current git) valgrind-3.12.0.SVN (current svn) yasm generates instruction that executes on Intel Celeron E3400 nasm's instruction causes "illegal hardware instruction" exception on Celeron E3400 both versions work on Core i7-4770S This might be a bug in nasm. I'll report to the nasm team too. valgrind error messages on nasm version: vex amd64->IR: unhandled instruction bytes: 0x66 0x48 0xF 0x3A 0x15 0xC0 0x0 0xC3 0x90 0x90 vex amd64->IR: REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F3A vex amd64->IR: PFX.66=1 PFX.F2=0 PFX.F3=0 ==6168== valgrind: Unrecognised instruction at address 0x400583. ==6168== at 0x400583: ??? (test_pextrw.nas:9) ==6168== by 0x4E4FCDC: (below main) (in /lib64/libc-2.12.so) ==6168== 1. Your program has a bug and erroneously jumped to a non-code ==6168== location. If you are running Memcheck and you just saw a ==6168== warning about a bad jump, it's probably your program's fault. ==6168== 2. The instruction is legitimate but Valgrind doesn't handle it, ==6168== i.e. it's Valgrind's fault. If you think this is the case or ==6168== you are not sure, please let us know and we'll try to fix it. ==6168== Either way, Valgrind will now raise a SIGILL signal which will ==6168== probably kill your program. ==6168== ==6168== Process terminating with default action of signal 4 (SIGILL) ==6168== Illegal opcode at address 0x400583 ==6168== at 0x400583: ??? (test_pextrw.nas:9) ==6168== by 0x4E4FCDC: (below main) (in /lib64/libc-2.12.so) code produced by yasm works under valgrind without errors.
It seems that nasm generates SSE4_1 version, which is not supported on Celeron E3400
This is confusing. I think what you are saying is: the nasm version doesn't work either directly, or via valgrind, on Celeron E3400. Correct? In which case I don't think this is a bug in Valgrind. I will close this now. But feel free to reopen if you have more information.
Let me rephrase. valgrind complains about instruction with opcode 66480F3A15C000 This is pretty valid PEXTRW instruction, SSE4_1 variant. valgrind does not complain about other flavor of PEXTRW instruction, that has opcode 66480FC5C000