From c2bf76653625cbdac9e26160cbc532cfdc3813e3 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 8 Sep 2016 17:44:36 +0000 Subject: [PATCH] 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 --- lib/Target/AMDGPU/SIInstrInfo.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Target/AMDGPU/SIInstrInfo.cpp b/lib/Target/AMDGPU/SIInstrInfo.cpp index 5b8bbc31a73..4c69a39312e 100644 --- a/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -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(Op.getImm())); if (SubIdx == AMDGPU::sub1) - return MachineOperand::CreateImm(Op.getImm() >> 32); + return MachineOperand::CreateImm(static_cast(Op.getImm() >> 32)); llvm_unreachable("Unhandled register index for immediate"); }