[LLVMdev] Adding xadd instruction to X86
Brent Monroe
bmmonroe at uiuc.edu
Thu Dec 2 13:40:16 PST 2004
Hi,
I'm trying to add the xadd instruction to the X86 back end.
xadd r/m32, r32
exchanges r/m32 and r32, and loads the sum into r/m32. I'm
interested in the case where the destination operand is a
memory location.
I've added the following entry to X86InstrInfo.td:
def XADD32mr : I<0x87, MRMDestMem,
(ops i32mem:$src1, R32:$src2),
"xadd{l} {$src1|$src2}, {$src2|$src1}">;
The xadd is emitted for the intrinsic function:
call int (<integer type>*, <integer type>)*
%llvm.atomic_fetch_add_store(<integer type>* <pointer>,
<integer type> <value>)
I currently have the following code (PtrReg contains the
pointer argument, ValReg the value arg, and TmpReg an unused
register.):
addDirectMem(BuildMI(BB, X86::XADD32mr, 4,
TmpReg).addReg(TwoReg), ValReg);
This fails the assertion isMem. Any help with this would be
appreciated.
Thanks,
Brent
More information about the llvm-dev
mailing list