Skip to content

Commit d785b08

Browse files
committed
AMDGPU/NFC: Purge SOPK_ZEXT from TSFlags
1 parent e6ecfe8 commit d785b08

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

llvm/lib/Target/AMDGPU/SIDefines.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ enum : uint64_t {
105105
WQM = UINT64_C(1) << 35,
106106
DisableWQM = UINT64_C(1) << 36,
107107
Gather4 = UINT64_C(1) << 37,
108-
SOPK_ZEXT = UINT64_C(1) << 38,
108+
109+
// Reserved, must be 0.
110+
Reserved0 = UINT64_C(1) << 38,
111+
109112
SCALAR_STORE = UINT64_C(1) << 39,
110113
FIXED_SIZE = UINT64_C(1) << 40,
111114

112115
// Reserved, must be 0.
113-
Reserved0 = UINT64_C(1) << 41,
116+
Reserved1 = UINT64_C(1) << 41,
114117

115118
VOP3_OPSEL = UINT64_C(1) << 42,
116119
maybeAtomic = UINT64_C(1) << 43,

llvm/lib/Target/AMDGPU/SIInstrFormats.td

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ class InstSI <dag outs, dag ins, string asm = "",
6969

7070
field bit Gather4 = 0;
7171

72-
// Most sopk treat the immediate as a signed 16-bit, however some
73-
// use it as unsigned.
74-
field bit SOPKZext = 0;
75-
7672
// This is an s_store_dword* instruction that requires a cache flush
7773
// on wave termination. It is necessary to distinguish from mayStore
7874
// SMEM instructions like the cache flush ones.
@@ -205,7 +201,9 @@ class InstSI <dag outs, dag ins, string asm = "",
205201
let TSFlags{36} = DisableWQM;
206202
let TSFlags{37} = Gather4;
207203

208-
let TSFlags{38} = SOPKZext;
204+
// Reserved, must be 0.
205+
let TSFlags{38} = 0;
206+
209207
let TSFlags{39} = ScalarStore;
210208
let TSFlags{40} = FixedSize;
211209

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4918,7 +4918,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
49184918
}
49194919
} else {
49204920
uint64_t Imm = Op->getImm();
4921-
if (sopkIsZext(MI)) {
4921+
if (sopkIsZext(Opcode)) {
49224922
if (!isUInt<16>(Imm)) {
49234923
ErrInfo = "invalid immediate for SOPK instruction";
49244924
return false;

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,12 +842,16 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
842842
return MI.getDesc().TSFlags & SIInstrFlags::LGKM_CNT;
843843
}
844844

845-
static bool sopkIsZext(const MachineInstr &MI) {
846-
return MI.getDesc().TSFlags & SIInstrFlags::SOPK_ZEXT;
847-
}
848-
849-
bool sopkIsZext(uint16_t Opcode) const {
850-
return get(Opcode).TSFlags & SIInstrFlags::SOPK_ZEXT;
845+
// Most sopk treat the immediate as a signed 16-bit, however some
846+
// use it as unsigned.
847+
static bool sopkIsZext(unsigned Opcode) {
848+
return Opcode == AMDGPU::S_CMPK_EQ_U32 ||
849+
Opcode == AMDGPU::S_CMPK_LG_U32 ||
850+
Opcode == AMDGPU::S_CMPK_GT_U32 ||
851+
Opcode == AMDGPU::S_CMPK_GE_U32 ||
852+
Opcode == AMDGPU::S_CMPK_LT_U32 ||
853+
Opcode == AMDGPU::S_CMPK_LE_U32 ||
854+
Opcode == AMDGPU:: S_GETREG_B32;
851855
}
852856

853857
/// \returns true if this is an s_store_dword* instruction. This is more

llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ void SIShrinkInstructions::shrinkScalarCompare(MachineInstr &MI) const {
251251

252252
const MCInstrDesc &NewDesc = TII->get(SOPKOpc);
253253

254-
if ((TII->sopkIsZext(SOPKOpc) && isKUImmOperand(Src1)) ||
255-
(!TII->sopkIsZext(SOPKOpc) && isKImmOperand(Src1))) {
256-
if (!TII->sopkIsZext(SOPKOpc))
254+
if ((SIInstrInfo::sopkIsZext(SOPKOpc) && isKUImmOperand(Src1)) ||
255+
(!SIInstrInfo::sopkIsZext(SOPKOpc) && isKImmOperand(Src1))) {
256+
if (!SIInstrInfo::sopkIsZext(SOPKOpc))
257257
Src1.setImm(SignExtend64(Src1.getImm(), 32));
258258
MI.setDesc(NewDesc);
259259
}

llvm/lib/Target/AMDGPU/SOPInstructions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,14 +1078,12 @@ def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>;
10781078
def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>;
10791079
def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>;
10801080

1081-
let SOPKZext = 1 in {
10821081
def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>;
10831082
def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>;
10841083
def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>;
10851084
def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>;
10861085
def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>;
10871086
def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>;
1088-
} // End SOPKZext = 1
10891087
} // End isCompare = 1
10901088

10911089
let isCommutable = 1, DisableEncoding = "$src0",
@@ -1111,7 +1109,6 @@ def S_GETREG_B32 : SOPK_Pseudo <
11111109
(outs SReg_32:$sdst), (ins hwreg:$simm16),
11121110
"$sdst, $simm16",
11131111
[(set i32:$sdst, (int_amdgcn_s_getreg (i32 timm:$simm16)))]> {
1114-
let SOPKZext = 1;
11151112
let hasSideEffects = 1;
11161113
}
11171114

0 commit comments

Comments
 (0)