News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

CRC32 encoding

Started by Biterider, January 31, 2022, 06:26:07 AM

Previous topic - Next topic

Biterider

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

johnsa

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!