diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp | 46 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h | 1 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp | 3 |
3 files changed, 2 insertions, 48 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp index 3854a2d178f..3bd3794b110 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp @@ -1352,49 +1352,6 @@ bool AMDGPUInstructionSelector::selectG_SZA_EXT(MachineInstr &I) const { return false; } -static int64_t getFPTrueImmVal(unsigned Size, bool Signed) { - switch (Size) { - case 16: - return Signed ? 0xBC00 : 0x3C00; - case 32: - return Signed ? 0xbf800000 : 0x3f800000; - case 64: - return Signed ? 0xbff0000000000000 : 0x3ff0000000000000; - default: - llvm_unreachable("Invalid FP type size"); - } -} - -bool AMDGPUInstructionSelector::selectG_SITOFP_UITOFP(MachineInstr &I) const { - MachineBasicBlock *MBB = I.getParent(); - MachineFunction *MF = MBB->getParent(); - MachineRegisterInfo &MRI = MF->getRegInfo(); - Register Src = I.getOperand(1).getReg(); - if (!isSCC(Src, MRI)) - return selectImpl(I, *CoverageInfo); - - bool Signed = I.getOpcode() == AMDGPU::G_SITOFP; - Register DstReg = I.getOperand(0).getReg(); - const LLT DstTy = MRI.getType(DstReg); - const unsigned DstSize = DstTy.getSizeInBits(); - const DebugLoc &DL = I.getDebugLoc(); - - BuildMI(*MBB, I, DL, TII.get(AMDGPU::COPY), AMDGPU::SCC) - .addReg(Src); - - unsigned NewOpc = - DstSize > 32 ? AMDGPU::S_CSELECT_B64 : AMDGPU::S_CSELECT_B32; - auto MIB = BuildMI(*MBB, I, DL, TII.get(NewOpc), DstReg) - .addImm(0) - .addImm(getFPTrueImmVal(DstSize, Signed)); - - if (!constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI)) - return false; - - I.eraseFromParent(); - return true; -} - bool AMDGPUInstructionSelector::selectG_CONSTANT(MachineInstr &I) const { MachineBasicBlock *BB = I.getParent(); MachineOperand &ImmOp = I.getOperand(1); @@ -1748,9 +1705,6 @@ bool AMDGPUInstructionSelector::select(MachineInstr &I) { case TargetOpcode::G_ZEXT: case TargetOpcode::G_ANYEXT: return selectG_SZA_EXT(I); - case TargetOpcode::G_SITOFP: - case TargetOpcode::G_UITOFP: - return selectG_SITOFP_UITOFP(I); case TargetOpcode::G_BRCOND: return selectG_BRCOND(I); case TargetOpcode::G_FRAME_INDEX: diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h index cc9701c99ec..dfb023f5bbb 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h @@ -79,7 +79,6 @@ private: bool selectPHI(MachineInstr &I) const; bool selectG_TRUNC(MachineInstr &I) const; bool selectG_SZA_EXT(MachineInstr &I) const; - bool selectG_SITOFP_UITOFP(MachineInstr &I) const; bool selectG_CONSTANT(MachineInstr &I) const; bool selectG_AND_OR_XOR(MachineInstr &I) const; bool selectG_ADD_SUB(MachineInstr &I) const; diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp index 136f0351ce7..a76e0917abe 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp @@ -443,8 +443,9 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_, // TODO: Split s1->s64 during regbankselect for VALU. auto &IToFP = getActionDefinitionsBuilder({G_SITOFP, G_UITOFP}) - .legalFor({{S32, S32}, {S64, S32}, {S16, S32}, {S32, S1}, {S16, S1}, {S64, S1}}) + .legalFor({{S32, S32}, {S64, S32}, {S16, S32}}) .lowerFor({{S32, S64}}) + .lowerIf(typeIs(1, S1)) .customFor({{S64, S64}}); if (ST.has16BitInsts()) IToFP.legalFor({{S16, S16}}); |