[Sparc] Fix incorrect MI insertion position for spilling f128.
authorJim Lin <tclin914@gmail.com>
Wed, 10 Apr 2019 01:56:32 +0000 (01:56 +0000)
committerJim Lin <tclin914@gmail.com>
Wed, 10 Apr 2019 01:56:32 +0000 (01:56 +0000)
commita49c95e02aac8189670afffaf33be47072eb7ac0
tree63fe025df16a62b51b892232a9412da2f795a21e
parent9ca3a95f79879468e3cb903a3947bcbe017e72ea
[Sparc] Fix incorrect MI insertion position for spilling f128.

Summary:
Obviously, new built MI (sethi+add or sethi+xor+add) for constructing large offset
should be inserted before new created MI for storing even register into memory.
So the insertion position should be *StMI instead of II.

before fixed:

std %f0, [%g1+80]
sethi 4, %g1        <<<
add %g1, %sp, %g1   <<< this two instructions should be put before "std %f0, [%g1+80]".
sethi 4, %g1
add %g1, %sp, %g1
std %f2, [%g1+88]

after fixed:

sethi 4, %g1
add %g1, %sp, %g1
std %f0, [%g1+80]
sethi 4, %g1
add %g1, %sp, %g1
std %f2, [%g1+88]

Reviewers: venkatra, jyknight

Reviewed By: jyknight

Subscribers: jyknight, fedor.sergeev, jrtc27, llvm-commits

Tags: #llvm

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

llvm-svn: 358042
llvm/lib/Target/Sparc/SparcRegisterInfo.cpp
llvm/test/CodeGen/SPARC/fp128.ll