]> granicus.if.org Git - llvm/commit
PowerPC: Optimize SPE double parameter calling setup
authorJustin Hibbits <jrh29@alumni.cwru.edu>
Mon, 17 Jun 2019 03:15:23 +0000 (03:15 +0000)
committerJustin Hibbits <jrh29@alumni.cwru.edu>
Mon, 17 Jun 2019 03:15:23 +0000 (03:15 +0000)
commit05b9698f31b026b7d17b4c38c9b03e67c4ddfd0b
tree194da7a7314399cf2906651ab4fa68b64bbb2691
parentf99a09c3b08d5727c9b217ecdee2b79c433fc580
PowerPC: Optimize SPE double parameter calling setup

Summary:
SPE passes doubles the same as soft-float, in register pairs as i32
types.  This is all handled by the target-independent layer.  However,
this is not optimal when splitting or reforming the doubles, as it
pushes to the stack and loads from, on either side.

For instance, to pass a double argument to a function, assuming the
double value is in r5, the sequence currently looks like this:

    evstdd      5, X(1)
    lwz         3, X(1)
    lwz         4, X+4(1)

Likewise, to form a double into r5 from args in r3 and r4:

    stw         3, X(1)
    stw         4, X+4(1)
    evldd       5, X(1)

This optimizes the fence to use SPE instructions.  Now, to pass a double
to a function:

    mr          4, 5
    evmergehi   3, 5, 5

And to form a double into r5 from args in r3 and r4:

    evmergelo   5, 3, 4

This is comparable to the way that gcc generates the double splits.

This also fixes a bug with expanding builtins to libcalls, where the
LowerCallTo() code path was generating intermediate illegal type nodes.

Reviewers: nemanjai, hfinkel, joerg

Subscribers: kbarton, jfb, jsji, llvm-commits

Differential Revision: https://reviews.llvm.org/D54583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363526 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCCallingConv.cpp
lib/Target/PowerPC/PPCCallingConv.td
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
lib/Target/PowerPC/PPCInstrInfo.td
lib/Target/PowerPC/PPCInstrSPE.td
test/CodeGen/PowerPC/spe.ll