Teach the addressing mode stuff to fold "%lo" into 'ri' addressing modes,
authorChris Lattner <sabre@nondot.org>
Sun, 18 Dec 2005 02:27:00 +0000 (02:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 18 Dec 2005 02:27:00 +0000 (02:27 +0000)
commite1389ad43afa6b4f7449013fec7ad37fe8ca2bbd
tree8e45109fdc698c1747c5c2efd6d10890e04dbdb3
parente357246c6b2f71fda64764b85e32d2004f5dd603
Teach the addressing mode stuff to fold "%lo" into 'ri' addressing modes,
allowing us to compile this:

to this:

%G1 = external global int
%G2 = external global int
void %test() {
        %X = load int* %G1
        store int %X, int* %G2
        ret void
}

test:
        save -96, %sp, %sp
        sethi %hi(G1), %l0
        ld [%l0+%lo(G1)], %l0
        sethi %hi(G2), %l1
        st %l0, [%l1+%lo(G2)]
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

test:
        save -96, %sp, %sp
        sethi %hi(G1), %l0
        or %g0, %lo(G1), %l1
        ld [%l1+%l0], %l0
        sethi %hi(G2), %l1
        or %g0, %lo(G2), %l2
        st %l0, [%l2+%l1]
        restore %g0, %g0, %g0
        retl
        nop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24812 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Sparc/SparcAsmPrinter.cpp
lib/Target/Sparc/SparcISelDAGToDAG.cpp
lib/Target/SparcV8/SparcV8AsmPrinter.cpp
lib/Target/SparcV8/SparcV8ISelDAGToDAG.cpp