diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp index 5278b552a65514..024adcda0fa061 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp @@ -327,7 +327,7 @@ bool AMDGPUDAGToDAGISel::isInlineImmediate(const SDNode *N) const { return TII->isInlineConstant(C->getAPIntValue()); if (const ConstantFPSDNode *C = dyn_cast(N)) - return TII->isInlineConstant(C->getValueAPF().bitcastToAPInt()); + return TII->isInlineConstant(C->getValueAPF()); return false; } diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h index 3b42d88df0c246..f987b747c0e21b 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h @@ -105,18 +105,11 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel { private: std::pair foldFrameIndex(SDValue N) const; - bool isInlineImmediate(const SDNode *N) const; - - bool isInlineImmediate16(int64_t Imm) const { - return AMDGPU::isInlinableLiteral16(Imm, Subtarget->hasInv2PiInlineImm()); - } - bool isInlineImmediate32(int64_t Imm) const { - return AMDGPU::isInlinableLiteral32(Imm, Subtarget->hasInv2PiInlineImm()); - } + bool isInlineImmediate(const SDNode *N) const; - bool isInlineImmediate64(int64_t Imm) const { - return AMDGPU::isInlinableLiteral64(Imm, Subtarget->hasInv2PiInlineImm()); + bool isInlineImmediate(const APInt &Imm) const { + return Subtarget->getInstrInfo()->isInlineConstant(Imm); } bool isInlineImmediate(const APFloat &Imm) const { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp index 5657880279962b..14879e78175087 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp @@ -5746,16 +5746,8 @@ void AMDGPUInstructionSelector::renderFPPow2ToExponent(MachineInstrBuilder &MIB, MIB.addImm(ExpVal); } -bool AMDGPUInstructionSelector::isInlineImmediate16(int64_t Imm) const { - return AMDGPU::isInlinableLiteral16(Imm, STI.hasInv2PiInlineImm()); -} - -bool AMDGPUInstructionSelector::isInlineImmediate32(int64_t Imm) const { - return AMDGPU::isInlinableLiteral32(Imm, STI.hasInv2PiInlineImm()); -} - -bool AMDGPUInstructionSelector::isInlineImmediate64(int64_t Imm) const { - return AMDGPU::isInlinableLiteral64(Imm, STI.hasInv2PiInlineImm()); +bool AMDGPUInstructionSelector::isInlineImmediate(const APInt &Imm) const { + return TII.isInlineConstant(Imm); } bool AMDGPUInstructionSelector::isInlineImmediate(const APFloat &Imm) const { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h index ef7630f137aca6..f561d5d29efc43 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h @@ -353,9 +353,7 @@ class AMDGPUInstructionSelector final : public InstructionSelector { void renderFPPow2ToExponent(MachineInstrBuilder &MIB, const MachineInstr &MI, int OpIdx) const; - bool isInlineImmediate16(int64_t Imm) const; - bool isInlineImmediate32(int64_t Imm) const; - bool isInlineImmediate64(int64_t Imm) const; + bool isInlineImmediate(const APInt &Imm) const; bool isInlineImmediate(const APFloat &Imm) const; // Returns true if TargetOpcode::G_AND MachineInstr `MI`'s masking of the diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td index 22599773d562cb..71cae75feec226 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td @@ -797,16 +797,8 @@ def i64imm_32bit : ImmLeaf(Imm); }]>; -def InlineImm16 : ImmLeaf; - -def InlineImm32 : ImmLeaf; - def InlineImm64 : ImmLeaf(Imm))); }]>; def InlineImmFP32 : FPImmLeaf