The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Biterider on December 31, 2020, 07:03:55 PM

Title: pExt Symbol
Post by: Biterider on December 31, 2020, 07:03:55 PM
Hi
I encountered a strange behavior while compiling code that contains a local symbol called pExt.
UASM 2.49.0.2 throws a syntax error, but as soon as I change the name to something else, the error is gone.
Is there anything special about this symbol?

Attached the very reduced test case.

Biterider



Title: Re: pExt Symbol
Post by: jj2007 on December 31, 2020, 10:31:57 PM
It's case-insensitivity: pext and PEXE also misbehave. So it's probably an internal or undocumented keyword.
Title: Re: pExt Symbol
Post by: nidud on December 31, 2020, 11:14:32 PM
https://www.felixcloutier.com/x86/pext
Title: Re: pExt Symbol
Post by: Vortex on December 31, 2020, 11:57:55 PM
ml.exe V6.14 from the Masm32 package can assemble Biterider's source file. Disassembling the object module :

_text   SEGMENT PARA PUBLIC 'CODE'

_start@0 PROC NEAR
        push    ebp
        mov     ebp, esp
        add     esp, -4
        leave
        ret
_start@0 ENDP

_text   ENDS
Title: Re: pExt Symbol
Post by: jj2007 on January 01, 2021, 12:06:37 AM
Quote from: nidud on December 31, 2020, 11:14:32 PM
https://www.felixcloutier.com/x86/pext

Nice find :thumbsup:

Not to be confounded with PEXTRW:
include \masm32\MasmBasic\MasmBasic.inc
src OWORD 1234567890abcdef1234567890abcdefh
  Init
  movups xmm0, src
  pextrw eax, xmm0, 0
  pextrw ebx, xmm0, 1
  pextrw ecx, xmm0, 2
  pextrw edx, xmm0, 15
  deb 4, "using pextrw", x:xmm0, x:eax, x:ebx, x:ecx, x:edx
  xor ecx, ecx
  pext eax, ebx, ecx ; illegal instruction
EndOfCode

using pextrw
x:xmm0          12345678 90ABCDEF 12345678 90ABCDEF
x:eax           0000CDEF
x:ebx           000090AB
x:ecx           00005678
x:edx           00001234


Quote from: Vortex on December 31, 2020, 11:57:55 PM
ml.exe V6.14 from the Masm32 package can assemble Biterider's source file

Yes, because it's so old that ML 6.14 does not know about the instruction... ML 10.0 says syntax error, same for 14.x :sad:

Olly doesn't know about PEXT, while the old October 2017 version of X32Dbg deciphers pext eax, ebx, ecx correctly; but it's still an illegal instruction on my trusty old Core i5 :sad:
Title: Re: pExt Symbol
Post by: Biterider on January 01, 2021, 01:09:46 AM
Thanks nidud for the clarification  :thumbsup:

Biterider