[LLVMbugs] [Bug 17728] New: inline asm fails with -O2 for aarch64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 29 10:58:13 PDT 2013


            Bug ID: 17728
           Summary: inline asm fails with -O2 for aarch64
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: charlebm at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11440
  --> http://llvm.org/bugs/attachment.cgi?id=11440&action=edit
Test file

The attached code will compile with gcc and clang with no optimization but will
generate the following error when compiled with clang with -O2 optimization

(CROSS_COMPILE=aarch64-linux-gnu- ../../../toolchain/clang/install/bin/clang
-isystem ../../../toolchain/clang/install/bin/../lib/clang/3.4/include -I.
-target aarch64-none-linux-gnueabi -no-integrated-as
-O2 -o t4 t4.c )
t4.c:15:23: error: invalid operand in inline asm: '// atomic_add
1:    ldxr    ${0:w}, [$3]
    add    ${0:w}, ${0:w}, ${4:w}
    stxr    ${1:w}, ${0:w}, [$3]
    cbnz    ${1:w}, 1b'
        __asm__ __volatile__("// atomic_add\n"
t4.c:30:15: error: invalid operand in inline asm: '// atomic_sub
1:    ldxr    ${0:w}, [$3]
    sub    ${0:w}, ${0:w}, ${4:w}
    stxr    ${1:w}, ${0:w}, [$3]
    cbnz    ${1:w}, 1b'
        asm volatile("// atomic_sub\n"
2 errors generated.
make: *** [t4] Error 1

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131029/7a8795c0/attachment.html>

More information about the llvm-bugs mailing list