[LLVMbugs] [Bug 2833] New: AtomicSwap64 not supported by x86 backend

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Sep 27 13:29:37 PDT 2008


           Summary: AtomicSwap64 not supported by x86 backend
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu

This program fails to compile:

  long long NoBarrier_AtomicExchange(volatile long long* ptr,
                                     long long new_value) {
    return __sync_lock_test_and_set(ptr, new_value);

results in:

NODE: 0x8ef333c: i64,ch = AtomicSwap64 0x8ef3198, 0x8ef377c, 0x8ef3b34
<0x8eafa20:0> <volatile> alignment=4
cc1: LegalizeDAG.cpp:5885:
void<unnamed>::SelectionDAGLegalize::ExpandOp(llvm::SDValue, llvm::SDValue&,
llvm::SDValue&): Assertion `0 && "Do not know how to expand this operator!"'

My proposed expansion uses a cmpxchg and a spin loop:

        movl (%edi), %ebx    ; something to move the 64-bit value to ecx:ebx
        movl 4(%edi), %ecx
        movl (%esi), %eax
        movl 4(%esi), %edx
        lock; cmpxchg8b (%esi)
        jnz 0b

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list