diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp @@ -1281,7 +1281,7 @@ Ptr = N2; VAddr = N3; } - Offset = CurDAG->getTargetConstant(0, DL, MVT::i16); + Offset = CurDAG->getTargetConstant(0, DL, MVT::i32); } else if (N0->isDivergent()) { // N0 is divergent. Use it as the addr64, and construct the resource from a // 0 address. @@ -1297,18 +1297,18 @@ if (!C1) { // No offset. - Offset = CurDAG->getTargetConstant(0, DL, MVT::i16); + Offset = CurDAG->getTargetConstant(0, DL, MVT::i32); return true; } if (SIInstrInfo::isLegalMUBUFImmOffset(C1->getZExtValue())) { // Legal offset for instruction. - Offset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i16); + Offset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i32); return true; } // Illegal offset, store it in soffset. - Offset = CurDAG->getTargetConstant(0, DL, MVT::i16); + Offset = CurDAG->getTargetConstant(0, DL, MVT::i32); SOffset = SDValue(CurDAG->getMachineNode( AMDGPU::S_MOV_B32, DL, MVT::i32, @@ -1383,7 +1383,7 @@ VAddr = SDValue(MovHighBits, 0); SOffset = CurDAG->getTargetConstant(0, DL, MVT::i32); - ImmOffset = CurDAG->getTargetConstant(Imm & MaxOffset, DL, MVT::i16); + ImmOffset = CurDAG->getTargetConstant(Imm & MaxOffset, DL, MVT::i32); return true; } } @@ -1414,14 +1414,14 @@ (!Subtarget->privateMemoryResourceIsRangeChecked() || CurDAG->SignBitIsZero(N0))) { std::tie(VAddr, SOffset) = foldFrameIndex(N0); - ImmOffset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i16); + ImmOffset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i32); return true; } } // (node) std::tie(VAddr, SOffset) = foldFrameIndex(Addr); - ImmOffset = CurDAG->getTargetConstant(0, DL, MVT::i16); + ImmOffset = CurDAG->getTargetConstant(0, DL, MVT::i32); return true; } @@ -1450,7 +1450,7 @@ if (IsCopyFromSGPR(*TRI, Addr)) { SRsrc = CurDAG->getRegister(Info->getScratchRSrcReg(), MVT::v4i32); SOffset = Addr; - Offset = CurDAG->getTargetConstant(0, DL, MVT::i16); + Offset = CurDAG->getTargetConstant(0, DL, MVT::i32); return true; } @@ -1474,7 +1474,7 @@ SRsrc = CurDAG->getRegister(Info->getScratchRSrcReg(), MVT::v4i32); - Offset = CurDAG->getTargetConstant(CAddr->getZExtValue(), DL, MVT::i16); + Offset = CurDAG->getTargetConstant(CAddr->getZExtValue(), DL, MVT::i32); return true; } diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td --- a/llvm/lib/Target/AMDGPU/BUFInstructions.td +++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td @@ -1220,21 +1220,21 @@ def : GCNPat< (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, timm:$auxiliary, 0)), - (!cast(opcode # _OFFSET) SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _OFFSET) SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; def : GCNPat< (vt (st v4i32:$rsrc, 0, i32:$voffset, i32:$soffset, timm:$offset, timm:$auxiliary, 0)), - (!cast(opcode # _OFFEN) VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _OFFEN) VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; def : GCNPat< (vt (st v4i32:$rsrc, i32:$vindex, 0, i32:$soffset, timm:$offset, timm:$auxiliary, timm)), - (!cast(opcode # _IDXEN) VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _IDXEN) VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1243,7 +1243,7 @@ timm:$auxiliary, timm)), (!cast(opcode # _BOTHEN) (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; } @@ -1307,7 +1307,7 @@ def : GCNPat< (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, timm:$auxiliary, 0), - (!cast(opcode # _OFFSET_exact) getVregSrcForVT.ret:$vdata, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _OFFSET_exact) getVregSrcForVT.ret:$vdata, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1315,14 +1315,14 @@ (st vt:$vdata, v4i32:$rsrc, 0, i32:$voffset, i32:$soffset, timm:$offset, timm:$auxiliary, 0), (!cast(opcode # _OFFEN_exact) getVregSrcForVT.ret:$vdata, VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), (extract_cpol $auxiliary), (extract_swz $auxiliary)) + timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; def : GCNPat< (st vt:$vdata, v4i32:$rsrc, i32:$vindex, 0, i32:$soffset, timm:$offset, timm:$auxiliary, timm), (!cast(opcode # _IDXEN_exact) getVregSrcForVT.ret:$vdata, VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), (extract_cpol $auxiliary), (extract_swz $auxiliary)) + timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; def : GCNPat< @@ -1331,7 +1331,7 @@ (!cast(opcode # _BOTHEN_exact) getVregSrcForVT.ret:$vdata, (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), (extract_cpol $auxiliary), + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; } @@ -1490,7 +1490,7 @@ timm:$offset, timm:$cachepolicy, 0)), (!cast(Inst # "_OFFSET" # InstSuffix) getVregSrcForVT.ret:$vdata_in, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), CachePolicy) + timm:$offset, CachePolicy) >; def : GCNPat< @@ -1498,7 +1498,7 @@ timm:$offset, timm:$cachepolicy, timm)), (!cast(Inst # "_IDXEN" # InstSuffix) getVregSrcForVT.ret:$vdata_in, VGPR_32:$vindex, SReg_128:$rsrc, - SCSrc_b32:$soffset, (as_i16timm $offset), CachePolicy) + SCSrc_b32:$soffset, timm:$offset, CachePolicy) >; def : GCNPat< @@ -1506,7 +1506,7 @@ i32:$soffset, timm:$offset, timm:$cachepolicy, 0)), (!cast(Inst # "_OFFEN" # InstSuffix) getVregSrcForVT.ret:$vdata_in, VGPR_32:$voffset, SReg_128:$rsrc, - SCSrc_b32:$soffset, (as_i16timm $offset), CachePolicy) + SCSrc_b32:$soffset, timm:$offset, CachePolicy) >; def : GCNPat< @@ -1515,7 +1515,7 @@ (!cast(Inst # "_BOTHEN" # InstSuffix) getVregSrcForVT.ret:$vdata_in, (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), CachePolicy) + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, CachePolicy) >; } // end let AddedComplexity @@ -1571,7 +1571,7 @@ 0, i32:$soffset, timm:$offset, timm:$cachepolicy, 0), (!cast(opcode # _OFFSET) getVregSrcForVT.ret:$vdata_in, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), timm:$cachepolicy) + timm:$offset, timm:$cachepolicy) >; def : GCNPat< @@ -1579,7 +1579,7 @@ 0, i32:$soffset, timm:$offset, timm:$cachepolicy, timm), (!cast(opcode # _IDXEN) getVregSrcForVT.ret:$vdata_in, VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), timm:$cachepolicy) + timm:$offset, timm:$cachepolicy) >; def : GCNPat< @@ -1587,7 +1587,7 @@ i32:$voffset, i32:$soffset, timm:$offset, timm:$cachepolicy, 0), (!cast(opcode # _OFFEN) getVregSrcForVT.ret:$vdata_in, VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), timm:$cachepolicy) + timm:$offset, timm:$cachepolicy) >; def : GCNPat< @@ -1597,7 +1597,7 @@ (!cast(opcode # _BOTHEN) getVregSrcForVT.ret:$vdata_in, (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), timm:$cachepolicy) + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, timm:$cachepolicy) >; } @@ -1628,7 +1628,7 @@ defvar OffsetResDag = (!cast("BUFFER_ATOMIC_CMPSWAP_OFFSET" # InstSuffix) (REG_SEQUENCE VReg_64, VGPR_32:$data, sub0, VGPR_32:$cmp, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), CachePolicy); + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, CachePolicy); def : GCNPat< (Op i32:$data, i32:$cmp, v4i32:$rsrc, 0, 0, i32:$soffset, @@ -1640,7 +1640,7 @@ defvar IdxenResDag = (!cast("BUFFER_ATOMIC_CMPSWAP_IDXEN" # InstSuffix) (REG_SEQUENCE VReg_64, VGPR_32:$data, sub0, VGPR_32:$cmp, sub1), - VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, CachePolicy); def : GCNPat< (Op @@ -1654,7 +1654,7 @@ defvar OffenResDag = (!cast("BUFFER_ATOMIC_CMPSWAP_OFFEN" # InstSuffix) (REG_SEQUENCE VReg_64, VGPR_32:$data, sub0, VGPR_32:$cmp, sub1), - VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, CachePolicy); def : GCNPat< (Op @@ -1669,7 +1669,7 @@ defvar BothenResDag = (!cast("BUFFER_ATOMIC_CMPSWAP_BOTHEN" # InstSuffix) (REG_SEQUENCE VReg_64, VGPR_32:$data, sub0, VGPR_32:$cmp, sub1), (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), CachePolicy); + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, CachePolicy); def : GCNPat< (Op i32:$data, i32:$cmp, v4i32:$rsrc, i32:$vindex, @@ -1895,7 +1895,7 @@ def : GCNPat< (vt (st v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, 0)), - (!cast(opcode # _OFFSET) SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _OFFSET) SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1903,7 +1903,7 @@ def : GCNPat< (vt (st v4i32:$rsrc, i32:$vindex, 0, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, timm)), - (!cast(opcode # _IDXEN) VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _IDXEN) VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1911,7 +1911,7 @@ def : GCNPat< (vt (st v4i32:$rsrc, 0, i32:$voffset, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, 0)), - (!cast(opcode # _OFFEN) VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + (!cast(opcode # _OFFEN) VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1921,7 +1921,7 @@ timm:$format, timm:$auxiliary, timm)), (!cast(opcode # _BOTHEN) (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1960,7 +1960,7 @@ (st vt:$vdata, v4i32:$rsrc, 0, 0, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, 0), (!cast(opcode # _OFFSET_exact) getVregSrcForVT.ret:$vdata, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), (as_i8timm $format), + timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1968,7 +1968,7 @@ (st vt:$vdata, v4i32:$rsrc, i32:$vindex, 0, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, timm), (!cast(opcode # _IDXEN_exact) getVregSrcForVT.ret:$vdata, VGPR_32:$vindex, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), (as_i8timm $format), + timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1976,7 +1976,7 @@ (st vt:$vdata, v4i32:$rsrc, 0, i32:$voffset, i32:$soffset, timm:$offset, timm:$format, timm:$auxiliary, 0), (!cast(opcode # _OFFEN_exact) getVregSrcForVT.ret:$vdata, VGPR_32:$voffset, SReg_128:$rsrc, SCSrc_b32:$soffset, - (as_i16timm $offset), (as_i8timm $format), + timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; @@ -1986,7 +1986,7 @@ (!cast(opcode # _BOTHEN_exact) getVregSrcForVT.ret:$vdata, (REG_SEQUENCE VReg_64, VGPR_32:$vindex, sub0, VGPR_32:$voffset, sub1), - SReg_128:$rsrc, SCSrc_b32:$soffset, (as_i16timm $offset), (as_i8timm $format), + SReg_128:$rsrc, SCSrc_b32:$soffset, timm:$offset, (as_i8timm $format), (extract_cpol $auxiliary), (extract_swz $auxiliary)) >; }