[LLVMbugs] [Bug 20853] New: ARM: Negative offset support problem

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 5 01:12:11 PDT 2014


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

            Bug ID: 20853
           Summary: ARM: Negative offset support problem
           Product: tools
           Version: trunk
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: ioblakov at dev.rtsoft.ru
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

ARM compiler can use negative offset (imm12) only for a frame access. 

The following example (n.c) shows problem:

int sum(int *p)
{
    return p[-4] + p[-2] + p[0] + p[2] + p[4];
}

clang --target=arm -mcpu=cortex-a9 -S -mfloat-abi=soft -O3 n.c

sum:
    sub    r1, r0, #16 <<< instead of using [r0, #-16] to load a p[-4]
    sub    r2, r0, #8  <<< instead of using [r0, #-8] to load a p[-2]
    ldr    r1, [r1]
    ldr    r2, [r2]
    ldr    r3, [r0, #8]
    add    r1, r2, r1
    ldr    r2, [r0]
    ldr    r0, [r0, #16]
    add    r1, r1, r2
    add    r1, r1, r3
    add    r0, r1, r0
    bx    lr

-- 
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/20140905/e03e1538/attachment.html>


More information about the llvm-bugs mailing list