Skip to content

Commit d43ce35

Browse files
authored
[TableGen][GISel] Allow isTrivialOperatorNode to import patterns with isStore and a memory VT. (#137080)
This removes the need to explicitly set isTruncStore on truncstorei8 and other similar PatFrags that include truncstore in their frags DAG. This allows some new patterns to be imported for AMDGPU as you can see in the changed test. The extra isTruncStore were added in ae2b36e, along with some other tablegen changes to look for MemoryVT along with isTruncStore. I did not remove the code, because I'm not sure if any out of tree users have become dependent on it. It's no longer exercised in tree.
1 parent 0fcc9ff commit d43ce35

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

llvm/include/llvm/Target/TargetSelectionDAG.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,25 +1324,21 @@ def truncstorei8 : PatFrag<(ops node:$val, node:$ptr),
13241324
(truncstore node:$val, node:$ptr)> {
13251325
let IsStore = true;
13261326
let MemoryVT = i8;
1327-
let IsTruncStore = true;
13281327
}
13291328
def truncstorei16 : PatFrag<(ops node:$val, node:$ptr),
13301329
(truncstore node:$val, node:$ptr)> {
13311330
let IsStore = true;
13321331
let MemoryVT = i16;
1333-
let IsTruncStore = true;
13341332
}
13351333
def truncstorei32 : PatFrag<(ops node:$val, node:$ptr),
13361334
(truncstore node:$val, node:$ptr)> {
13371335
let IsStore = true;
13381336
let MemoryVT = i32;
1339-
let IsTruncStore = true;
13401337
}
13411338
def truncstorei64 : PatFrag<(ops node:$val, node:$ptr),
13421339
(truncstore node:$val, node:$ptr)> {
13431340
let IsStore = true;
13441341
let MemoryVT = i64;
1345-
let IsTruncStore = true;
13461342
}
13471343
def truncstoref16 : PatFrag<(ops node:$val, node:$ptr),
13481344
(truncstore node:$val, node:$ptr)> {

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,12 @@ def truncstorei8_glue : PatFrag<(ops node:$val, node:$ptr),
544544
(truncstore_glue node:$val, node:$ptr)> {
545545
let IsStore = 1;
546546
let MemoryVT = i8;
547-
let IsTruncStore = 1;
548547
}
549548

550549
def truncstorei16_glue : PatFrag<(ops node:$val, node:$ptr),
551550
(truncstore_glue node:$val, node:$ptr)> {
552551
let IsStore = 1;
553552
let MemoryVT = i16;
554-
let IsTruncStore = 1;
555553
}
556554

557555
let IsStore = 1, AddressSpaces = StoreAddress_local.AddrSpaces in {

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.raw.tbuffer.store.d16.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ define amdgpu_kernel void @tbuffer_store_d16_xyz(<4 x i32> %rsrc, <4 x half> %da
189189
; GFX12-PACKED-GISEL-NEXT: s_wait_kmcnt 0x0
190190
; GFX12-PACKED-GISEL-NEXT: v_mov_b32_e32 v0, s6
191191
; GFX12-PACKED-GISEL-NEXT: v_mov_b32_e32 v1, s7
192-
; GFX12-PACKED-GISEL-NEXT: tbuffer_store_d16_format_xyzw v[0:1], off, s[0:3], null format:[BUF_FMT_10_10_10_2_SNORM]
192+
; GFX12-PACKED-GISEL-NEXT: tbuffer_store_d16_format_xyz v[0:1], off, s[0:3], null format:[BUF_FMT_10_10_10_2_SNORM]
193193
; GFX12-PACKED-GISEL-NEXT: s_endpgm
194194
main_body:
195195
%data_subvec = shufflevector <4 x half> %data, <4 x half> poison, <3 x i32> <i32 0, i32 1, i32 2>

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.tbuffer.store.d16.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ define amdgpu_kernel void @tbuffer_store_d16_xyz(<4 x i32> %rsrc, <4 x half> %da
211211
; GFX12-PACKED-GISEL-NEXT: v_mov_b32_e32 v0, s8
212212
; GFX12-PACKED-GISEL-NEXT: v_mov_b32_e32 v1, s9
213213
; GFX12-PACKED-GISEL-NEXT: v_mov_b32_e32 v2, s10
214-
; GFX12-PACKED-GISEL-NEXT: tbuffer_store_d16_format_xyzw v[0:1], v2, s[0:3], null format:[BUF_FMT_10_10_10_2_SNORM] idxen
214+
; GFX12-PACKED-GISEL-NEXT: tbuffer_store_d16_format_xyz v[0:1], v2, s[0:3], null format:[BUF_FMT_10_10_10_2_SNORM] idxen
215215
; GFX12-PACKED-GISEL-NEXT: s_endpgm
216216
main_body:
217217
%data_subvec = shufflevector <4 x half> %data, <4 x half> poison, <3 x i32> <i32 0, i32 1, i32 2>

llvm/utils/TableGen/GlobalISelEmitter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ static Error isTrivialOperatorNode(const TreePatternNode &N) {
219219
if (Predicate.isLoad() && Predicate.getMemoryVT())
220220
continue;
221221

222+
if (Predicate.isStore() && Predicate.getMemoryVT())
223+
continue;
224+
222225
if (Predicate.isLoad() || Predicate.isStore()) {
223226
if (Predicate.isUnindexed())
224227
continue;

0 commit comments

Comments
 (0)