R600/SI: Use s_movk_i32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2014-11-13 20:44:23 +00:00
parent 0fed4c6a45
commit 01ab7a869d
7 changed files with 206 additions and 7 deletions

View File

@@ -189,6 +189,19 @@ bool SIShrinkInstructions::runOnMachineFunction(MachineFunction &MF) {
Next = std::next(I);
MachineInstr &MI = *I;
// Try to use S_MOVK_I32, which will save 4 bytes for small immediates.
if (MI.getOpcode() == AMDGPU::S_MOV_B32) {
const MachineOperand &Src = MI.getOperand(1);
// TODO: Handle FPImm?
if (Src.isImm()) {
if (isInt<16>(Src.getImm()) && !TII->isInlineConstant(Src)) {
MI.setDesc(TII->get(AMDGPU::S_MOVK_I32));
continue;
}
}
}
if (!TII->hasVALU32BitEncoding(MI.getOpcode()))
continue;