1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

AMDGPU: Sign extend constants when splitting them

This will confuse later passes which try to look at the
immediate value and don't truncate first.

llvm-svn: 280974
This commit is contained in:
Matt Arsenault 2016-09-08 17:44:36 +00:00
parent b779c31861
commit c2bf766536

View File

@ -1990,11 +1990,10 @@ MachineOperand SIInstrInfo::buildExtractSubRegOrImm(
unsigned SubIdx,
const TargetRegisterClass *SubRC) const {
if (Op.isImm()) {
// XXX - Is there a better way to do this?
if (SubIdx == AMDGPU::sub0)
return MachineOperand::CreateImm(Op.getImm() & 0xFFFFFFFF);
return MachineOperand::CreateImm(static_cast<int32_t>(Op.getImm()));
if (SubIdx == AMDGPU::sub1)
return MachineOperand::CreateImm(Op.getImm() >> 32);
return MachineOperand::CreateImm(static_cast<int32_t>(Op.getImm() >> 32));
llvm_unreachable("Unhandled register index for immediate");
}