I came across the XADD instruction while reading about x86 assembly,
xadd eax, ecx
xadd mem, ecx
noticed it isn't listed in the help file, Intel Opcodes and Mnemonics,
that comes with MASM32 unless you go into, Bare Hex Opcodes And Mnemonics
there it lists the opcodes 0F C0 and 0F C1 and name with no explaination.
Various sites have differing descriptions.
Is it a usefull instruction ?
Are there others like it (general instructions)
that aren't listed/explained but could be usefull ?
If so, which ones, and how are they usefull ?
What instructions do you use that probably aren't well known ?
Its because the opcode.hlp file is written from the 386 days when the instruction did not exist. The intel manual says it was introduced in the 486 and it seems to be reasonably straight forward, exchange two operands and add them together.
XADD—Exchange and Add
Description
Exchanges the first operand (destination operand) with the second operand (source operand),
then loads the sum of the two values into the destination operand. The destination operand can
be a register or a memory location; the source operand is a register.
This instruction can be used with a LOCK prefix to allow the instruction to be executed atomically.
IA-32 Architecture Compatibility
IA-32 processors earlier than the Intel486 processor do not recognize this instruction. If this
instruction is used, you should provide an equivalent code sequence that runs on earlier processors.
Opcode Instruction Description
0F C0 /r XADD r/m8, r8 Exchange r8 and r/m8; load sum into r/m8.
0F C1 /r XADD r/m16, r16 Exchange r16 and r/m16; load sum into r/m16.
0F C1 /r XADD r/m32, r32 Exchange r32 and r/m32; load sum into r/m32.