llvm.org GIT mirror llvm / 48a2462
AMDGPU: Avoid code predicates for extload PatFrags Use the MemoryVT field. This will be necessary for tablegen to automatically handle patterns for GlobalISel. Doesn't handle the d16 lo/hi patterns. Those are a special case since it involvess the custom node type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366168 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 3 months ago
5 changed file(s) with 72 addition(s) and 48 deletion(s). Raw diff Collapse all Expand all
378378 AS == AMDGPUAS::GLOBAL_ADDRESS;
379379 }]>;
380380
381 class AZExtLoadBase : PatFrag<(ops node:$ptr),
382 (ld_node node:$ptr), [{
383 LoadSDNode *L = cast(N);
384 return L->getExtensionType() == ISD::ZEXTLOAD ||
385 L->getExtensionType() == ISD::EXTLOAD;
386 }]>;
387
388 def az_extload : AZExtLoadBase ;
389
390 def az_extloadi8 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
391 return cast(N)->getMemoryVT() == MVT::i8;
392 }]>;
393
394 def az_extloadi16 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
395 return cast(N)->getMemoryVT() == MVT::i16;
396 }]>;
397
398 def az_extloadi32 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
399 return cast(N)->getMemoryVT() == MVT::i32;
400 }]>;
401
402381 class PrivateLoad : LoadFrag , PrivateAddress;
403382 class PrivateStore : StoreFrag , PrivateAddress;
404383
418397
419398
420399 def load_private : PrivateLoad ;
421 def az_extloadi8_private : PrivateLoad extloadi8>;
400 def extloadi8_private : PrivateLoad <extloadi8>;
401 def zextloadi8_private : PrivateLoad ;
422402 def sextloadi8_private : PrivateLoad ;
423 def az_extloadi16_private : PrivateLoad extloadi16>;
403 def extloadi16_private : PrivateLoad <extloadi16>;
404 def zextloadi16_private : PrivateLoad ;
424405 def sextloadi16_private : PrivateLoad ;
425406
426407 def store_private : PrivateStore ;
432413
433414 def load_global : GlobalLoad ;
434415 def sextloadi8_global : GlobalLoad ;
435 def az_extloadi8_global : GlobalLoad extloadi8>;
416 def extloadi8_global : GlobalLoad <extloadi8>;
417 def zextloadi8_global : GlobalLoad ;
436418 def sextloadi16_global : GlobalLoad ;
437 def az_extloadi16_global : GlobalLoad extloadi16>;
419 def extloadi16_global : GlobalLoad <extloadi16>;
420 def zextloadi16_global : GlobalLoad ;
438421 def atomic_load_global : GlobalLoad;
439422
440423 def store_global : GlobalStore ;
478461 >;
479462
480463 def load_flat : FlatLoad ;
481 def az_extloadi8_flat : FlatLoad extloadi8>;
464 def extloadi8_flat : FlatLoad <extloadi8>;
465 def zextloadi8_flat : FlatLoad ;
482466 def sextloadi8_flat : FlatLoad ;
483 def az_extloadi16_flat : FlatLoad extloadi16>;
467 def extloadi16_flat : FlatLoad <extloadi16>;
468 def zextloadi16_flat : FlatLoad ;
484469 def sextloadi16_flat : FlatLoad ;
485470 def atomic_load_flat : FlatLoad;
486471
494479
495480 def constant_load : ConstantLoad;
496481 def sextloadi8_constant : ConstantLoad ;
497 def az_extloadi8_constant : ConstantLoad extloadi8>;
482 def extloadi8_constant : ConstantLoad <extloadi8>;
483 def zextloadi8_constant : ConstantLoad ;
498484 def sextloadi16_constant : ConstantLoad ;
499 def az_extloadi16_constant : ConstantLoad extloadi16>;
485 def extloadi16_constant : ConstantLoad <extloadi16>;
486 def zextloadi16_constant : ConstantLoad ;
500487
501488
502489 class local_binary_atomic_op :
850850 "buffer_load_dwordx4", VReg_128, v4i32
851851 >;
852852
853 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_UBYTE", i32, az_extloadi8_global>;
853 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_UBYTE", i32, extloadi8_global>;
854 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_UBYTE", i32, zextloadi8_global>;
854855 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_SBYTE", i32, sextloadi8_global>;
855 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_USHORT", i32, az_extloadi16_global>;
856 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_USHORT", i32, extloadi16_global>;
857 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_USHORT", i32, zextloadi16_global>;
856858 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_SSHORT", i32, sextloadi16_global>;
857859 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_DWORD", i32, load_global>;
858860 defm : MUBUF_Pseudo_Load_Pats<"BUFFER_LOAD_DWORDX2", v2i32, load_global>;
14361438
14371439 let SubtargetPredicate = isGFX6GFX7 in {
14381440 def : MUBUFLoad_PatternADDR64 ;
1439 def : MUBUFLoad_PatternADDR64 az_extloadi8_constant>;
1441 def : MUBUFLoad_PatternADDR64 extloadi8_constant>;
1442 def : MUBUFLoad_PatternADDR64 ;
14401443 def : MUBUFLoad_PatternADDR64 ;
1441 def : MUBUFLoad_PatternADDR64 az_extloadi16_constant>;
1444 def : MUBUFLoad_PatternADDR64 extloadi16_constant>;
1445 def : MUBUFLoad_PatternADDR64 ;
14421446
14431447 defm : MUBUFLoad_Atomic_Pattern ;
14441448 defm : MUBUFLoad_Atomic_Pattern ;
14571461 let OtherPredicates = [Has16BitInsts] in {
14581462
14591463 defm : MUBUFLoad_Pattern ;
1460 defm : MUBUFLoad_Pattern az_extloadi8_constant>;
1464 defm : MUBUFLoad_Pattern extloadi8_constant>;
1465 defm : MUBUFLoad_Pattern ;
14611466 defm : MUBUFLoad_Pattern ;
1462 defm : MUBUFLoad_Pattern az_extloadi8_global>;
1467 defm : MUBUFLoad_Pattern extloadi8_global>;
1468 defm : MUBUFLoad_Pattern ;
14631469
14641470 defm : MUBUFLoad_Pattern ;
14651471
14961502 }
14971503
14981504 defm : MUBUFScratchLoadPat ;
1499 defm : MUBUFScratchLoadPat az_extloadi8_private>;
1505 defm : MUBUFScratchLoadPat extloadi8_private>;
1506 defm : MUBUFScratchLoadPat ;
15001507 defm : MUBUFScratchLoadPat ;
1501 defm : MUBUFScratchLoadPat az_extloadi8_private>;
1508 defm : MUBUFScratchLoadPat extloadi8_private>;
1509 defm : MUBUFScratchLoadPat ;
15021510 defm : MUBUFScratchLoadPat ;
1503 defm : MUBUFScratchLoadPat az_extloadi16_private>;
1511 defm : MUBUFScratchLoadPat extloadi16_private>;
1512 defm : MUBUFScratchLoadPat ;
15041513 defm : MUBUFScratchLoadPat ;
15051514 defm : MUBUFScratchLoadPat ;
15061515 defm : MUBUFScratchLoadPat ;
2828 class EGOrCaymanPat : AMDGPUPat {
2929 let SubtargetPredicate = isEGorCayman;
3030 }
31
32 // FIXME: These are deprecated
33 def az_extloadi8_local : LocalLoad ;
34 def az_extloadi16_local : LocalLoad ;
3531
3632 //===----------------------------------------------------------------------===//
3733 // Evergreen / Cayman store instructions
766766
767767 let OtherPredicates = [HasFlatAddressSpace] in {
768768
769 def : FlatLoadPat az_extloadi8_flat, i32>;
769 def : FlatLoadPat extloadi8_flat, i32>;
770 def : FlatLoadPat ;
770771 def : FlatLoadPat ;
771 def : FlatLoadPat az_extloadi8_flat, i16>;
772 def : FlatLoadPat extloadi8_flat, i16>;
773 def : FlatLoadPat ;
772774 def : FlatLoadPat ;
773 def : FlatLoadPat az_extloadi16_flat, i32>;
775 def : FlatLoadPat extloadi16_flat, i32>;
776 def : FlatLoadPat ;
774777 def : FlatLoadPat ;
775778 def : FlatLoadPat ;
776779 def : FlatLoadPat ;
848851
849852 let OtherPredicates = [HasFlatGlobalInsts], AddedComplexity = 10 in {
850853
851 def : FlatLoadSignedPat az_extloadi8_global, i32>;
854 def : FlatLoadSignedPat extloadi8_global, i32>;
855 def : FlatLoadSignedPat ;
852856 def : FlatLoadSignedPat ;
853 def : FlatLoadSignedPat az_extloadi8_global, i16>;
857 def : FlatLoadSignedPat extloadi8_global, i16>;
858 def : FlatLoadSignedPat ;
854859 def : FlatLoadSignedPat ;
855 def : FlatLoadSignedPat az_extloadi16_global, i32>;
860 def : FlatLoadSignedPat extloadi16_global, i32>;
861 def : FlatLoadSignedPat ;
856862 def : FlatLoadSignedPat ;
857863 def : FlatLoadSignedPat ;
858864
293293
294294 let VTXInst = 1;
295295 }
296
297 // FIXME: Deprecated.
298 class AZExtLoadBase : PatFrag<(ops node:$ptr),
299 (ld_node node:$ptr), [{
300 LoadSDNode *L = cast(N);
301 return L->getExtensionType() == ISD::ZEXTLOAD ||
302 L->getExtensionType() == ISD::EXTLOAD;
303 }]>;
304
305 def az_extload : AZExtLoadBase ;
306
307 def az_extloadi8 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
308 return cast(N)->getMemoryVT() == MVT::i8;
309 }]>;
310
311 def az_extloadi16 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
312 return cast(N)->getMemoryVT() == MVT::i16;
313 }]>;
314
315 def az_extloadi32 : PatFrag<(ops node:$ptr), (az_extload node:$ptr), [{
316 return cast(N)->getMemoryVT() == MVT::i32;
317 }]>;
318
319 // FIXME: These are deprecated
320 def az_extloadi8_local : LocalLoad ;
321 def az_extloadi16_local : LocalLoad ;
296322
297323 class LoadParamFrag : PatFrag <
298324 (ops node:$ptr), (load_type node:$ptr),