From da644c025dd1dc7a31cb30ca8c66a3b700e06723 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Wed, 13 Mar 2019 21:15:52 +0000 Subject: [PATCH] [AMDGPU] Silence gcc 7 warnings Differential Revision: https://reviews.llvm.org/D59330 llvm-svn: 356100 --- llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | 30 ---------------------- .../Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp | 6 ++--- .../AMDGPU/Disassembler/AMDGPUDisassembler.cpp | 4 +-- llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 3 ++- llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp | 4 +-- 5 files changed, 9 insertions(+), 38 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp index c62420e..bbe642e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp @@ -199,7 +199,6 @@ private: bool SelectVOP3PMadMixMods(SDValue In, SDValue &Src, SDValue &SrcMods) const; SDValue getHi16Elt(SDValue In) const; - bool SelectHi16Elt(SDValue In, SDValue &Src) const; void SelectADD_SUB_I64(SDNode *N); void SelectUADDO_USUBO(SDNode *N); @@ -2215,35 +2214,6 @@ SDValue AMDGPUDAGToDAGISel::getHi16Elt(SDValue In) const { return SDValue(); } -// TODO: Can we identify things like v_mad_mixhi_f16? -bool AMDGPUDAGToDAGISel::SelectHi16Elt(SDValue In, SDValue &Src) const { - if (In.isUndef()) { - Src = In; - return true; - } - - if (ConstantSDNode *C = dyn_cast(In)) { - SDLoc SL(In); - SDValue K = CurDAG->getTargetConstant(C->getZExtValue() << 16, SL, MVT::i32); - MachineSDNode *MovK = CurDAG->getMachineNode(AMDGPU::V_MOV_B32_e32, - SL, MVT::i32, K); - Src = SDValue(MovK, 0); - return true; - } - - if (ConstantFPSDNode *C = dyn_cast(In)) { - SDLoc SL(In); - SDValue K = CurDAG->getTargetConstant( - C->getValueAPF().bitcastToAPInt().getZExtValue() << 16, SL, MVT::i32); - MachineSDNode *MovK = CurDAG->getMachineNode(AMDGPU::V_MOV_B32_e32, - SL, MVT::i32, K); - Src = SDValue(MovK, 0); - return true; - } - - return isExtractHiElt(In, Src); -} - bool AMDGPUDAGToDAGISel::isVGPRImm(const SDNode * N) const { if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS) { return false; diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index 427e0c5..c5b3f34 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -102,14 +102,14 @@ public: int64_t getFPModifiersOperand() const { int64_t Operand = 0; - Operand |= Abs ? SISrcMods::ABS : 0; - Operand |= Neg ? SISrcMods::NEG : 0; + Operand |= Abs ? SISrcMods::ABS : 0u; + Operand |= Neg ? SISrcMods::NEG : 0u; return Operand; } int64_t getIntModifiersOperand() const { int64_t Operand = 0; - Operand |= Sext ? SISrcMods::SEXT : 0; + Operand |= Sext ? SISrcMods::SEXT : 0u; return Operand; } diff --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp index 72d2667..7db266f 100644 --- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp +++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp @@ -823,9 +823,9 @@ MCOperand AMDGPUDisassembler::decodeSDWASrc(const OpWidthTy Width, using namespace AMDGPU::EncValues; if (STI.getFeatureBits()[AMDGPU::FeatureGFX9]) { - // XXX: static_cast is needed to avoid stupid warning: + // XXX: cast to int is needed to avoid stupid warning: // compare with unsigned is always true - if (SDWA9EncValues::SRC_VGPR_MIN <= Val && + if (int(SDWA9EncValues::SRC_VGPR_MIN) <= int(Val) && Val <= SDWA9EncValues::SRC_VGPR_MAX) { return createRegOperand(getVgprClassId(Width), Val - SDWA9EncValues::SRC_VGPR_MIN); diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp index 9cc24ce..9361b25 100644 --- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp +++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp @@ -925,7 +925,8 @@ const MachineOperand *SIFoldOperands::isClamp(const MachineInstr &MI) const { // Having a 0 op_sel_hi would require swizzling the output in the source // instruction, which we can't do. - unsigned UnsetMods = (Op == AMDGPU::V_PK_MAX_F16) ? SISrcMods::OP_SEL_1 : 0; + unsigned UnsetMods = (Op == AMDGPU::V_PK_MAX_F16) ? SISrcMods::OP_SEL_1 + : 0u; if (Src0Mods != UnsetMods && Src1Mods != UnsetMods) return nullptr; return Src0; diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp index 547fad1..dc2e9dc 100644 --- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp +++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp @@ -347,8 +347,8 @@ uint64_t SDWASrcOperand::getSrcMods(const SIInstrInfo *TII, if (Abs || Neg) { assert(!Sext && "Float and integer src modifiers can't be set simulteniously"); - Mods |= Abs ? SISrcMods::ABS : 0; - Mods ^= Neg ? SISrcMods::NEG : 0; + Mods |= Abs ? SISrcMods::ABS : 0u; + Mods ^= Neg ? SISrcMods::NEG : 0u; } else if (Sext) { Mods |= SISrcMods::SEXT; } -- 2.7.4