http://llvm.org/bugs/show_bug.cgi?id=20456

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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
-no-integrated-as

/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
invocation)

$ 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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to