NO

Author Topic: A surprise for me  (Read 173 times)

Offline HellOfMice

  • Member
  • *
  • Posts: 362
  • Never be pleased, always improve
A surprise for me
« on: January 19, 2025, 05:33:49 PM »
Hello,

I thought that using a 32 bits register used less bits than a 64 bits register, look at:

00023DE7 66 67 45 13 02           | ADC R8W,[R10D]
00023DEC 66 45 13 02              | ADC R8W,[R10]

00023F7F 66 67 45 13 04 24        | ADC R8W,[R12D]
00023F85 66 45 13 04 24           | ADC R8W,[R12]

Except the second prefix the opcode are the same.
It is better to use the instruction with 64 bits register, less time for decoding and less size.

If you search register don't forget SIL and DIL 8 bits versions of SI and DI

0002C7C5 40 12 34 42              | ADC SIL,BYTE PTR [RDX + 2 * RAX]
0002C7C9 40 12 34 6A              | ADC SIL,BYTE PTR [RDX + 2 * RBP]
0002C7CD 40 12 34 5A              | ADC SIL,BYTE PTR [RDX + 2 * RBX]
0002C7D1 40 12 34 4A              | ADC SIL,BYTE PTR [RDX + 2 * RCX]
0002C7D5 40 12 34 7A              | ADC SIL,BYTE PTR [RDX + 2 * RDI]
0002C7D9 40 12 34 52              | ADC SIL,BYTE PTR [RDX + 2 * RDX]
0002C7DD 40 12 34 72              | ADC SIL,BYTE PTR [RDX + 2 * RSI]
0002C7E1 42 12 34 92              | ADC SIL,BYTE PTR [RDX + 4 * R10]
0002C7E5 42 12 34 9A              | ADC SIL,BYTE PTR [RDX + 4 * R11]
0002C7E9 42 12 34 A2              | ADC SIL,BYTE PTR [RDX + 4 * R12]
0002C7ED 42 12 34 AA              | ADC SIL,BYTE PTR [RDX + 4 * R13]
0002C7F1 42 12 34 B2              | ADC SIL,BYTE PTR [RDX + 4 * R14]
0002C7F5 42 12 34 BA              | ADC SIL,BYTE PTR [RDX + 4 * R15]
0002C7F9 42 12 34 82              | ADC SIL,BYTE PTR [RDX + 4 * R8]
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 362
  • Never be pleased, always improve
Re: A surprise for me
« Reply #1 on: January 19, 2025, 05:45:34 PM »
An other


000000DA 34 00                    | XOR AL,0
000000DE 30 C0                    | XOR AL,AL
0001034A 83 F0 00                 | XOR EAX,0
00010F47 31 C0                    | XOR EAX,EAX
00027D89 48 31 C0                 | XOR RAX,RAX
000270F7 48 83 F0 00              | XOR RAX,0
00010F47 31 C0                    | XOR EAX,EAX

000270F3 48 83 F0 FF              | XOR RAX,-1

Same size, same speed? I don't know
« Last Edit: January 19, 2025, 06:23:10 PM by HellOfMice »
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 362
  • Never be pleased, always improve
If you are curious
« Reply #2 on: January 19, 2025, 06:36:19 PM »
I made a lst file with all the XOR I found. It is joint to this post

Attention: There are two special registers: AH & DH which you can't find in an instruction, in 64 bits, sorry I have not the example but the assembler will creates an error.

one can find three prefixes so the instruction size is 18 bytes.

00034DF8 F0 66 67 33 82 BE BE FE CA | LOCK XOR AX,WORD PTR [EDX + 0CAFEBEBEH]
« Last Edit: January 19, 2025, 08:13:28 PM by HellOfMice »
--------------------------------
Kenavo