[LLVMbugs] [Bug 20456] New: [AArch64] Integer exceeds imm range

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 25 18:58:06 PDT 2014


            Bug ID: 20456
           Summary: [AArch64] Integer exceeds imm range
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-as
          Assignee: unassignedbugs at nondot.org
          Reporter: zhaoshiz at codeaurora.org
                CC: apazos at codeaurora.org, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

GCC-4.9 is able to handle the test case below and generate:

> sub w0, w0, 0x1

but LLVM is producing:

> add w0, w0, 0xffffffff

$ clang++ --target=aarch64-linux-gnu -mfpu=neon
--sysroot=$GCC64/aarch64-linux-gnu/libc --gcc-toolchain=$GCC64 -Os -c imm.cpp

/tmp/imm-c1564c.s: Assembler messages:
/tmp/imm-c1564c.s:11: Error: immediate out of range
clang-3.5: error: assembler command failed with exit code 1 (use -v to see

$ cat imm.cpp 
int ref_count_;

inline int AsmInc(volatile int* ptr,
                  /*volatile*/ int increment) {
  int result;

  __asm__ __volatile__ (
    "add %w[result], %w[result], %w[increment]\n\t"
    : [result]"=&r" (result),
      [ptr]"+Q" (*ptr)
    : [increment]"IJr" (increment)
    : "memory"

  return result;

int Release() {
  int ret = AsmInc(&ref_count_, -1);
  if (ret == 0) {
    return -1;
  return ret;

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/20140726/3c9a6227/attachment.html>

More information about the llvm-bugs mailing list