[PowerPC] Reduce register pressure by not materializing a constant just for use as...
authorLei Huang <lei@ca.ibm.com>
Mon, 10 Jul 2017 16:44:45 +0000 (16:44 +0000)
committerLei Huang <lei@ca.ibm.com>
Mon, 10 Jul 2017 16:44:45 +0000 (16:44 +0000)
commit168d14b143d04466984db81d50e6e5db8cb5d5bd
treefad8db0881c6743af77a8be34a48470a110d8e01
parentae9d6db769428eb3a1ef95ac56bc0df6da614cd0
[PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores.

For this example:
float test (int *arr) {
    return arr[2];
}

We currently generate the following code:
  li r4, 8
  lxsiwax f0, r3, r4
  xscvsxdsp f1, f0

With this patch, we will now generate:
  addi r3, r3, 8
  lxsiwax f0, 0, r3
  xscvsxdsp f1, f0

Originally reported in: https://bugs.llvm.org/show_bug.cgi?id=27204
Differential Revision: https://reviews.llvm.org/D35027

llvm-svn: 307553
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/test/CodeGen/PowerPC/build-vector-tests.ll
llvm/test/CodeGen/PowerPC/ppc64le-smallarg.ll
llvm/test/CodeGen/PowerPC/select-addrRegRegOnly.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/vsx-partword-int-loads-and-stores.ll