The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: Biterider on January 31, 2022, 06:26:07 AM

Title: CRC32 encoding
Post by: Biterider on January 31, 2022, 06:26:07 AM
Hi John
I was experimenting with the CRC32 instruction and found something strange.
I've tried this instruction with different register sizes and inexplicable things happen when I combine a 64-bit destination register with a (d)word input.
In theory this instruction doesn't exist, but USAM seems to convert the input register into a larger one.

    CRC32 eax, cx
00007FF7F0722DAC F2 66 0F 38 F1 C1    crc32       eax,cx    OK
    CRC32 rax, cl
00007FF7F0722DB2 F2 48 0F 38 F0 C1    crc32       rax,cl    OK
    CRC32 rax, cx
00007FF7F0722DB8 F2 66 48 0F 38 F1 C1 crc32       rax,rcx    not OK
    CRC32 rax, ecx
00007FF7F0722DBF F2 48 0F 38 F1 C1    crc32       rax,rcx    not OK
    CRC32 rax, rcx
00007FF7F0722DC5 F2 48 0F 38 F1 C1    crc32       rax,rcx   OK


Biterider
Title: Re: CRC32 encoding
Post by: johnsa on February 03, 2022, 03:57:14 AM
You're correct, the instruction is probably still in the old codegen which doesn't really do a lot of validation, so it probably just takes the reg_no.. so CX=ECX=RCX etc..
Can you log this on the github issues list so I can track it? Thanks!