Skip to content

Commit f14cb53

Browse files
committed
[AMDGPU] Remove unused functions for checking 16-bit inline literals
This patch removes unused functions that check if an immediate is a 16-bit inline literals. This serves as prime patches to fix llvm#79369.
1 parent 1a98886 commit f14cb53

File tree

5 files changed

+8
-33
lines changed

5 files changed

+8
-33
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ bool AMDGPUDAGToDAGISel::isInlineImmediate(const SDNode *N) const {
327327
return TII->isInlineConstant(C->getAPIntValue());
328328

329329
if (const ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(N))
330-
return TII->isInlineConstant(C->getValueAPF().bitcastToAPInt());
330+
return TII->isInlineConstant(C->getValueAPF());
331331

332332
return false;
333333
}

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,11 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel {
105105

106106
private:
107107
std::pair<SDValue, SDValue> foldFrameIndex(SDValue N) const;
108-
bool isInlineImmediate(const SDNode *N) const;
109-
110-
bool isInlineImmediate16(int64_t Imm) const {
111-
return AMDGPU::isInlinableLiteral16(Imm, Subtarget->hasInv2PiInlineImm());
112-
}
113108

114-
bool isInlineImmediate32(int64_t Imm) const {
115-
return AMDGPU::isInlinableLiteral32(Imm, Subtarget->hasInv2PiInlineImm());
116-
}
109+
bool isInlineImmediate(const SDNode *N) const;
117110

118-
bool isInlineImmediate64(int64_t Imm) const {
119-
return AMDGPU::isInlinableLiteral64(Imm, Subtarget->hasInv2PiInlineImm());
111+
bool isInlineImmediate(const APInt &Imm) const {
112+
return Subtarget->getInstrInfo()->isInlineConstant(Imm);
120113
}
121114

122115
bool isInlineImmediate(const APFloat &Imm) const {

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,16 +5746,8 @@ void AMDGPUInstructionSelector::renderFPPow2ToExponent(MachineInstrBuilder &MIB,
57465746
MIB.addImm(ExpVal);
57475747
}
57485748

5749-
bool AMDGPUInstructionSelector::isInlineImmediate16(int64_t Imm) const {
5750-
return AMDGPU::isInlinableLiteral16(Imm, STI.hasInv2PiInlineImm());
5751-
}
5752-
5753-
bool AMDGPUInstructionSelector::isInlineImmediate32(int64_t Imm) const {
5754-
return AMDGPU::isInlinableLiteral32(Imm, STI.hasInv2PiInlineImm());
5755-
}
5756-
5757-
bool AMDGPUInstructionSelector::isInlineImmediate64(int64_t Imm) const {
5758-
return AMDGPU::isInlinableLiteral64(Imm, STI.hasInv2PiInlineImm());
5749+
bool AMDGPUInstructionSelector::isInlineImmediate(const APInt &Imm) const {
5750+
return TII.isInlineConstant(Imm);
57595751
}
57605752

57615753
bool AMDGPUInstructionSelector::isInlineImmediate(const APFloat &Imm) const {

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,7 @@ class AMDGPUInstructionSelector final : public InstructionSelector {
353353
void renderFPPow2ToExponent(MachineInstrBuilder &MIB, const MachineInstr &MI,
354354
int OpIdx) const;
355355

356-
bool isInlineImmediate16(int64_t Imm) const;
357-
bool isInlineImmediate32(int64_t Imm) const;
358-
bool isInlineImmediate64(int64_t Imm) const;
356+
bool isInlineImmediate(const APInt &Imm) const;
359357
bool isInlineImmediate(const APFloat &Imm) const;
360358

361359
// Returns true if TargetOpcode::G_AND MachineInstr `MI`'s masking of the

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -797,16 +797,8 @@ def i64imm_32bit : ImmLeaf<i64, [{
797797
return (Imm & 0xffffffffULL) == static_cast<uint64_t>(Imm);
798798
}]>;
799799

800-
def InlineImm16 : ImmLeaf<i16, [{
801-
return isInlineImmediate16(Imm);
802-
}]>;
803-
804-
def InlineImm32 : ImmLeaf<i32, [{
805-
return isInlineImmediate32(Imm);
806-
}]>;
807-
808800
def InlineImm64 : ImmLeaf<i64, [{
809-
return isInlineImmediate64(Imm);
801+
return isInlineImmediate(APInt(64, static_cast<uint64_t>(Imm)));
810802
}]>;
811803

812804
def InlineImmFP32 : FPImmLeaf<f32, [{

0 commit comments

Comments
 (0)