1 //===-- AMDGPU.td - AMDGPU Tablegen files --------*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===------------------------------------------------------------===//
9 include "llvm/TableGen/SearchableTable.td"
10 include "llvm/Target/Target.td"
11 include "AMDGPUFeatures.td"
13 def p0 : PtrValueType<i64, 0>;
14 def p1 : PtrValueType<i64, 1>;
15 def p2 : PtrValueType<i32, 2>;
16 def p3 : PtrValueType<i32, 3>;
17 def p4 : PtrValueType<i64, 4>;
18 def p5 : PtrValueType<i32, 5>;
19 def p6 : PtrValueType<i32, 6>;
22 class BoolToList<bit Value> {
23 list<int> ret = !if(Value, [1]<int>, []<int>);
26 //===------------------------------------------------------------===//
27 // Subtarget Features (device properties)
28 //===------------------------------------------------------------===//
30 def FeatureFastFMAF32 : SubtargetFeature<"fast-fmaf",
33 "Assuming f32 fma is at least as fast as mul + add"
36 def FeatureMIMG_R128 : SubtargetFeature<"mimg-r128",
39 "Support 128-bit texture resources"
42 def HalfRate64Ops : SubtargetFeature<"half-rate-64-ops",
45 "Most fp64 instructions are half rate instead of quarter"
48 def FeatureFlatAddressSpace : SubtargetFeature<"flat-address-space",
51 "Support flat address space"
54 def FeatureFlatInstOffsets : SubtargetFeature<"flat-inst-offsets",
57 "Flat instructions have immediate offset addressing mode"
60 def FeatureFlatGlobalInsts : SubtargetFeature<"flat-global-insts",
63 "Have global_* flat memory instructions"
66 def FeatureFlatScratchInsts : SubtargetFeature<"flat-scratch-insts",
69 "Have scratch_* flat memory instructions"
72 def FeatureScalarFlatScratchInsts : SubtargetFeature<"scalar-flat-scratch-insts",
73 "ScalarFlatScratchInsts",
75 "Have s_scratch_* flat memory instructions"
78 def FeatureAddNoCarryInsts : SubtargetFeature<"add-no-carry-insts",
81 "Have VALU add/sub instructions without carry out"
84 def FeatureUnalignedBufferAccess : SubtargetFeature<"unaligned-buffer-access",
85 "UnalignedBufferAccess",
87 "Support unaligned global loads and stores"
90 def FeatureTrapHandler: SubtargetFeature<"trap-handler",
93 "Trap handler support"
96 def FeatureUnalignedScratchAccess : SubtargetFeature<"unaligned-scratch-access",
97 "UnalignedScratchAccess",
99 "Support unaligned scratch loads and stores"
102 def FeatureApertureRegs : SubtargetFeature<"aperture-regs",
105 "Has Memory Aperture Base and Size Registers"
108 def FeatureMadMixInsts : SubtargetFeature<"mad-mix-insts",
111 "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions"
114 def FeatureFmaMixInsts : SubtargetFeature<"fma-mix-insts",
117 "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions"
120 def FeatureDoesNotSupportXNACK : SubtargetFeature<"no-xnack-support",
121 "DoesNotSupportXNACK",
123 "Hardware does not support XNACK"
126 // XNACK is disabled if SH_MEM_CONFIG.ADDRESS_MODE = GPUVM on chips that support
127 // XNACK. The current default kernel driver setting is:
128 // - graphics ring: XNACK disabled
129 // - compute ring: XNACK enabled
131 // If XNACK is enabled, the VMEM latency can be worse.
132 // If XNACK is disabled, the 2 SGPRs can be used for general purposes.
133 def FeatureXNACK : SubtargetFeature<"xnack",
136 "Enable XNACK support"
139 def FeatureCuMode : SubtargetFeature<"cumode",
142 "Enable CU wavefront execution mode"
145 def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
148 "VI SGPR initialization bug requiring a fixed SGPR allocation size"
151 def FeatureLdsMisalignedBug : SubtargetFeature<"lds-misaligned-bug",
154 "Some GFX10 bug with misaligned multi-dword LDS access in WGP mode"
157 def FeatureMFMAInlineLiteralBug : SubtargetFeature<"mfma-inline-literal-bug",
158 "HasMFMAInlineLiteralBug",
160 "MFMA cannot use inline literal as SrcC"
163 def FeatureVcmpxPermlaneHazard : SubtargetFeature<"vcmpx-permlane-hazard",
164 "HasVcmpxPermlaneHazard",
169 def FeatureVMEMtoScalarWriteHazard : SubtargetFeature<"vmem-to-scalar-write-hazard",
170 "HasVMEMtoScalarWriteHazard",
172 "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution."
175 def FeatureSMEMtoVectorWriteHazard : SubtargetFeature<"smem-to-vector-write-hazard",
176 "HasSMEMtoVectorWriteHazard",
178 "s_load_dword followed by v_cmp page faults"
181 def FeatureInstFwdPrefetchBug : SubtargetFeature<"inst-fwd-prefetch-bug",
182 "HasInstFwdPrefetchBug",
184 "S_INST_PREFETCH instruction causes shader to hang"
187 def FeatureVcmpxExecWARHazard : SubtargetFeature<"vcmpx-exec-war-hazard",
188 "HasVcmpxExecWARHazard",
190 "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)"
193 def FeatureLdsBranchVmemWARHazard : SubtargetFeature<"lds-branch-vmem-war-hazard",
194 "HasLdsBranchVmemWARHazard",
196 "Switching between LDS and VMEM-tex not waiting VM_VSRC=0"
199 def FeatureNSAtoVMEMBug : SubtargetFeature<"nsa-to-vmem-bug",
202 "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero"
205 def FeatureFlatSegmentOffsetBug : SubtargetFeature<"flat-segment-offset-bug",
206 "HasFlatSegmentOffsetBug",
208 "GFX10 bug, inst_offset ignored in flat segment"
211 def FeatureOffset3fBug : SubtargetFeature<"offset-3f-bug",
214 "Branch offset of 3f hardware bug"
217 class SubtargetFeatureLDSBankCount <int Value> : SubtargetFeature <
218 "ldsbankcount"#Value,
220 !cast<string>(Value),
221 "The number of LDS banks per compute unit."
224 def FeatureLDSBankCount16 : SubtargetFeatureLDSBankCount<16>;
225 def FeatureLDSBankCount32 : SubtargetFeatureLDSBankCount<32>;
227 def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
230 "Encoding format for VI"
233 def FeatureCIInsts : SubtargetFeature<"ci-insts",
236 "Additional instructions for CI+"
239 def FeatureGFX8Insts : SubtargetFeature<"gfx8-insts",
242 "Additional instructions for GFX8+"
245 def FeatureGFX9Insts : SubtargetFeature<"gfx9-insts",
248 "Additional instructions for GFX9+"
251 def FeatureGFX10Insts : SubtargetFeature<"gfx10-insts",
254 "Additional instructions for GFX10+"
257 def FeatureGFX7GFX8GFX9Insts : SubtargetFeature<"gfx7-gfx8-gfx9-insts",
260 "Instructions shared in GFX7, GFX8, GFX9"
263 def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
266 "Has s_memrealtime instruction"
269 def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
270 "HasInv2PiInlineImm",
272 "Has 1 / (2 * pi) as inline immediate"
275 def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
278 "Has i16/f16 instructions"
281 def FeatureVOP3P : SubtargetFeature<"vop3p",
284 "Has VOP3P packed instructions"
287 def FeatureMovrel : SubtargetFeature<"movrel",
290 "Has v_movrel*_b32 instructions"
293 def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
296 "Has VGPR mode register indexing"
299 def FeatureScalarStores : SubtargetFeature<"scalar-stores",
302 "Has store scalar memory instructions"
305 def FeatureScalarAtomics : SubtargetFeature<"scalar-atomics",
308 "Has atomic scalar memory instructions"
311 def FeatureSDWA : SubtargetFeature<"sdwa",
314 "Support SDWA (Sub-DWORD Addressing) extension"
317 def FeatureSDWAOmod : SubtargetFeature<"sdwa-omod",
320 "Support OMod with SDWA (Sub-DWORD Addressing) extension"
323 def FeatureSDWAScalar : SubtargetFeature<"sdwa-scalar",
326 "Support scalar register with SDWA (Sub-DWORD Addressing) extension"
329 def FeatureSDWASdst : SubtargetFeature<"sdwa-sdst",
332 "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension"
335 def FeatureSDWAMac : SubtargetFeature<"sdwa-mav",
338 "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension"
341 def FeatureSDWAOutModsVOPC : SubtargetFeature<"sdwa-out-mods-vopc",
342 "HasSDWAOutModsVOPC",
344 "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension"
347 def FeatureDPP : SubtargetFeature<"dpp",
350 "Support DPP (Data Parallel Primitives) extension"
353 // DPP8 allows arbitrary cross-lane swizzling withing groups of 8 lanes.
354 def FeatureDPP8 : SubtargetFeature<"dpp8",
357 "Support DPP8 (Data Parallel Primitives) extension"
360 def FeatureR128A16 : SubtargetFeature<"r128-a16",
363 "Support 16 bit coordindates/gradients/lod/clamp/mip types on gfx9"
366 def FeatureNSAEncoding : SubtargetFeature<"nsa-encoding",
369 "Support NSA encoding for image instructions"
372 def FeatureIntClamp : SubtargetFeature<"int-clamp-insts",
375 "Support clamp for integer destination"
378 def FeatureUnpackedD16VMem : SubtargetFeature<"unpacked-d16-vmem",
379 "HasUnpackedD16VMem",
381 "Has unpacked d16 vmem instructions"
384 def FeatureDLInsts : SubtargetFeature<"dl-insts",
387 "Has v_fmac_f32 and v_xnor_b32 instructions"
390 def FeatureDot1Insts : SubtargetFeature<"dot1-insts",
393 "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions"
396 def FeatureDot2Insts : SubtargetFeature<"dot2-insts",
399 "Has v_dot2_f32_f16, v_dot2_i32_i16, v_dot2_u32_u16, v_dot4_u32_u8, v_dot8_u32_u4 instructions"
402 def FeatureDot3Insts : SubtargetFeature<"dot3-insts",
405 "Has v_dot8c_i32_i4 instruction"
408 def FeatureDot4Insts : SubtargetFeature<"dot4-insts",
411 "Has v_dot2c_i32_i16 instruction"
414 def FeatureDot5Insts : SubtargetFeature<"dot5-insts",
417 "Has v_dot2c_f32_f16 instruction"
420 def FeatureDot6Insts : SubtargetFeature<"dot6-insts",
423 "Has v_dot4c_i32_i8 instruction"
426 def FeatureMAIInsts : SubtargetFeature<"mai-insts",
429 "Has mAI instructions"
432 def FeaturePkFmacF16Inst : SubtargetFeature<"pk-fmac-f16-inst",
435 "Has v_pk_fmac_f16 instruction"
438 def FeatureAtomicFaddInsts : SubtargetFeature<"atomic-fadd-insts",
439 "HasAtomicFaddInsts",
441 "Has buffer_atomic_add_f32, buffer_atomic_pk_add_f16, global_atomic_add_f32, "
442 "global_atomic_pk_add_f16 instructions"
445 def FeatureDoesNotSupportSRAMECC : SubtargetFeature<"no-sram-ecc-support",
446 "DoesNotSupportSRAMECC",
448 "Hardware does not support SRAM ECC"
451 def FeatureSRAMECC : SubtargetFeature<"sram-ecc",
457 def FeatureNoSdstCMPX : SubtargetFeature<"no-sdst-cmpx",
460 "V_CMPX does not write VCC/SGPR in addition to EXEC"
463 def FeatureVscnt : SubtargetFeature<"vscnt",
466 "Has separate store vscnt counter"
469 def FeatureRegisterBanking : SubtargetFeature<"register-banking",
470 "HasRegisterBanking",
472 "Has register banking"
475 def FeatureVOP3Literal : SubtargetFeature<"vop3-literal",
478 "Can use one literal in VOP3"
481 def FeatureNoDataDepHazard : SubtargetFeature<"no-data-dep-hazard",
482 "HasNoDataDepHazard",
484 "Does not need SW waitstates"
487 //===------------------------------------------------------------===//
488 // Subtarget Features (options and debugging)
489 //===------------------------------------------------------------===//
491 // Denormal handling for fp64 and fp16 is controlled by the same
492 // config register when fp16 supported.
493 // TODO: Do we need a separate f16 setting when not legal?
494 def FeatureFP64FP16Denormals : SubtargetFeature<"fp64-fp16-denormals",
497 "Enable double and half precision denormal handling",
501 def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
504 "Enable double and half precision denormal handling",
505 [FeatureFP64, FeatureFP64FP16Denormals]
508 def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
511 "Enable half precision denormal handling",
512 [FeatureFP64FP16Denormals]
515 def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
518 "Enable floating point exceptions"
521 class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
522 "max-private-element-size-"#size,
523 "MaxPrivateElementSize",
525 "Maximum private access size may be "#size
528 def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
529 def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
530 def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
532 def FeatureDumpCode : SubtargetFeature <"DumpCode",
535 "Dump MachineInstrs in the CodeEmitter"
538 def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
541 "Dump MachineInstrs in the CodeEmitter"
544 // XXX - This should probably be removed once enabled by default
545 def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
546 "EnableLoadStoreOpt",
548 "Enable SI load/store optimizer pass"
551 // Performance debugging feature. Allow using DS instruction immediate
552 // offsets even if the base pointer can't be proven to be base. On SI,
553 // base pointer values that won't give the same result as a 16-bit add
554 // are not safe to fold, but this will override the conservative test
555 // for the base pointer.
556 def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
557 "unsafe-ds-offset-folding",
558 "EnableUnsafeDSOffsetFolding",
560 "Force using DS instruction immediate offsets on SI"
563 def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
566 "Enable SI Machine Scheduler"
569 def FeatureEnableDS128 : SubtargetFeature<"enable-ds128",
572 "Use ds_{read|write}_b128"
575 // Sparse texture support requires that all result registers are zeroed when
576 // PRTStrictNull is set to true. This feature is turned on for all architectures
577 // but is enabled as a feature in case there are situations where PRTStrictNull
578 // is disabled by the driver.
579 def FeatureEnablePRTStrictNull : SubtargetFeature<"enable-prt-strict-null",
580 "EnablePRTStrictNull",
582 "Enable zeroing of result registers for sparse texture fetches"
585 // Unless +-flat-for-global is specified, turn on FlatForGlobal for
586 // all OS-es on VI and newer hardware to avoid assertion failures due
587 // to missing ADDR64 variants of MUBUF instructions.
588 // FIXME: moveToVALU should be able to handle converting addr64 MUBUF
591 def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
594 "Force to generate flat instruction for global"
597 def FeatureAutoWaitcntBeforeBarrier : SubtargetFeature <
598 "auto-waitcnt-before-barrier",
599 "AutoWaitcntBeforeBarrier",
601 "Hardware automatically inserts waitcnt before barrier"
604 def FeatureCodeObjectV3 : SubtargetFeature <
608 "Generate code object version 3"
611 def FeatureTrigReducedRange : SubtargetFeature<"trig-reduced-range",
612 "HasTrigReducedRange",
614 "Requires use of fract on arguments to trig instructions"
617 // Dummy feature used to disable assembler instructions.
618 def FeatureDisable : SubtargetFeature<"",
619 "FeatureDisable","true",
620 "Dummy feature to disable assembler instructions"
623 class GCNSubtargetFeatureGeneration <string Value,
625 list<SubtargetFeature> Implies> :
626 SubtargetFeatureGeneration <Value, FeatureName, "GCNSubtarget", Implies>;
628 def FeatureSouthernIslands : GCNSubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
630 [FeatureFP64, FeatureLocalMemorySize32768, FeatureMIMG_R128,
631 FeatureWavefrontSize64,
632 FeatureLDSBankCount32, FeatureMovrel, FeatureTrigReducedRange,
633 FeatureDoesNotSupportSRAMECC, FeatureDoesNotSupportXNACK]
636 def FeatureSeaIslands : GCNSubtargetFeatureGeneration<"SEA_ISLANDS",
638 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
639 FeatureWavefrontSize64, FeatureFlatAddressSpace,
640 FeatureCIInsts, FeatureMovrel, FeatureTrigReducedRange,
641 FeatureGFX7GFX8GFX9Insts, FeatureDoesNotSupportSRAMECC]
644 def FeatureVolcanicIslands : GCNSubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
646 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
647 FeatureWavefrontSize64, FeatureFlatAddressSpace,
648 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
649 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
650 FeatureScalarStores, FeatureInv2PiInlineImm,
651 FeatureSDWA, FeatureSDWAOutModsVOPC, FeatureSDWAMac, FeatureDPP,
652 FeatureIntClamp, FeatureTrigReducedRange, FeatureDoesNotSupportSRAMECC,
653 FeatureGFX8Insts, FeatureGFX7GFX8GFX9Insts
657 def FeatureGFX9 : GCNSubtargetFeatureGeneration<"GFX9",
659 [FeatureFP64, FeatureLocalMemorySize65536,
660 FeatureWavefrontSize64, FeatureFlatAddressSpace,
661 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
662 FeatureSMemRealTime, FeatureScalarStores, FeatureInv2PiInlineImm,
663 FeatureApertureRegs, FeatureGFX9Insts, FeatureVOP3P, FeatureVGPRIndexMode,
664 FeatureFastFMAF32, FeatureDPP, FeatureIntClamp,
665 FeatureSDWA, FeatureSDWAOmod, FeatureSDWAScalar, FeatureSDWASdst,
666 FeatureFlatInstOffsets, FeatureFlatGlobalInsts, FeatureFlatScratchInsts,
667 FeatureAddNoCarryInsts, FeatureGFX8Insts, FeatureGFX7GFX8GFX9Insts,
668 FeatureScalarFlatScratchInsts, FeatureScalarAtomics, FeatureR128A16
672 def FeatureGFX10 : GCNSubtargetFeatureGeneration<"GFX10",
674 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
675 FeatureFlatAddressSpace,
676 FeatureCIInsts, Feature16BitInsts,
677 FeatureSMemRealTime, FeatureInv2PiInlineImm,
678 FeatureApertureRegs, FeatureGFX9Insts, FeatureGFX10Insts, FeatureVOP3P,
679 FeatureMovrel, FeatureFastFMAF32, FeatureDPP, FeatureIntClamp,
680 FeatureSDWA, FeatureSDWAOmod, FeatureSDWAScalar, FeatureSDWASdst,
681 FeatureFlatInstOffsets, FeatureFlatGlobalInsts, FeatureFlatScratchInsts,
682 FeatureAddNoCarryInsts, FeatureFmaMixInsts, FeatureGFX8Insts,
683 FeatureNoSdstCMPX, FeatureVscnt, FeatureRegisterBanking,
684 FeatureVOP3Literal, FeatureDPP8,
685 FeatureNoDataDepHazard, FeaturePkFmacF16Inst, FeatureDoesNotSupportSRAMECC
689 class FeatureSet<list<SubtargetFeature> Features_> {
690 list<SubtargetFeature> Features = Features_;
693 def FeatureISAVersion6_0_0 : FeatureSet<[FeatureSouthernIslands,
696 FeatureLDSBankCount32,
697 FeatureDoesNotSupportXNACK,
698 FeatureCodeObjectV3]>;
700 def FeatureISAVersion6_0_1 : FeatureSet<
701 [FeatureSouthernIslands,
702 FeatureLDSBankCount32,
703 FeatureDoesNotSupportXNACK,
704 FeatureCodeObjectV3]>;
706 def FeatureISAVersion7_0_0 : FeatureSet<
708 FeatureLDSBankCount32,
709 FeatureDoesNotSupportXNACK,
710 FeatureCodeObjectV3]>;
712 def FeatureISAVersion7_0_1 : FeatureSet<
715 FeatureLDSBankCount32,
717 FeatureDoesNotSupportXNACK,
718 FeatureCodeObjectV3]>;
720 def FeatureISAVersion7_0_2 : FeatureSet<
722 FeatureLDSBankCount16,
724 FeatureDoesNotSupportXNACK,
725 FeatureCodeObjectV3]>;
727 def FeatureISAVersion7_0_3 : FeatureSet<
729 FeatureLDSBankCount16,
730 FeatureDoesNotSupportXNACK,
731 FeatureCodeObjectV3]>;
733 def FeatureISAVersion7_0_4 : FeatureSet<
735 FeatureLDSBankCount32,
736 FeatureDoesNotSupportXNACK,
737 FeatureCodeObjectV3]>;
739 def FeatureISAVersion8_0_1 : FeatureSet<
740 [FeatureVolcanicIslands,
743 FeatureLDSBankCount32,
745 FeatureUnpackedD16VMem,
746 FeatureCodeObjectV3]>;
748 def FeatureISAVersion8_0_2 : FeatureSet<
749 [FeatureVolcanicIslands,
750 FeatureLDSBankCount32,
752 FeatureUnpackedD16VMem,
753 FeatureDoesNotSupportXNACK,
754 FeatureCodeObjectV3]>;
756 def FeatureISAVersion8_0_3 : FeatureSet<
757 [FeatureVolcanicIslands,
758 FeatureLDSBankCount32,
759 FeatureUnpackedD16VMem,
760 FeatureDoesNotSupportXNACK,
761 FeatureCodeObjectV3]>;
763 def FeatureISAVersion8_1_0 : FeatureSet<
764 [FeatureVolcanicIslands,
765 FeatureLDSBankCount16,
767 FeatureCodeObjectV3]>;
769 def FeatureISAVersion9_0_0 : FeatureSet<
772 FeatureLDSBankCount32,
774 FeatureDoesNotSupportXNACK,
775 FeatureDoesNotSupportSRAMECC]>;
777 def FeatureISAVersion9_0_2 : FeatureSet<
780 FeatureLDSBankCount32,
782 FeatureDoesNotSupportSRAMECC,
783 FeatureCodeObjectV3]>;
785 def FeatureISAVersion9_0_4 : FeatureSet<
787 FeatureLDSBankCount32,
789 FeatureDoesNotSupportXNACK,
790 FeatureDoesNotSupportSRAMECC,
791 FeatureCodeObjectV3]>;
793 def FeatureISAVersion9_0_6 : FeatureSet<
797 FeatureLDSBankCount32,
801 FeatureDoesNotSupportXNACK,
802 FeatureCodeObjectV3]>;
804 def FeatureISAVersion9_0_8 : FeatureSet<
808 FeatureLDSBankCount32,
817 FeaturePkFmacF16Inst,
818 FeatureAtomicFaddInsts,
820 FeatureMFMAInlineLiteralBug,
821 FeatureCodeObjectV3]>;
823 def FeatureISAVersion9_0_9 : FeatureSet<
826 FeatureLDSBankCount32,
828 FeatureCodeObjectV3]>;
830 // TODO: Organize more features into groups.
832 // Bugs present on gfx10.1.
833 list<SubtargetFeature> GFX10_1_Bugs = [
834 FeatureVcmpxPermlaneHazard,
835 FeatureVMEMtoScalarWriteHazard,
836 FeatureSMEMtoVectorWriteHazard,
837 FeatureInstFwdPrefetchBug,
838 FeatureVcmpxExecWARHazard,
839 FeatureLdsBranchVmemWARHazard,
842 FeatureFlatSegmentOffsetBug
846 def FeatureISAVersion10_1_0 : FeatureSet<
847 !listconcat(FeatureGroup.GFX10_1_Bugs,
849 FeatureLDSBankCount32,
852 FeatureWavefrontSize32,
854 FeatureScalarAtomics,
855 FeatureScalarFlatScratchInsts,
856 FeatureLdsMisalignedBug,
857 FeatureDoesNotSupportXNACK,
858 FeatureCodeObjectV3])>;
860 def FeatureISAVersion10_1_1 : FeatureSet<
861 !listconcat(FeatureGroup.GFX10_1_Bugs,
863 FeatureLDSBankCount32,
870 FeatureWavefrontSize32,
872 FeatureScalarAtomics,
873 FeatureScalarFlatScratchInsts,
874 FeatureDoesNotSupportXNACK,
875 FeatureCodeObjectV3])>;
877 def FeatureISAVersion10_1_2 : FeatureSet<
878 !listconcat(FeatureGroup.GFX10_1_Bugs,
880 FeatureLDSBankCount32,
887 FeatureWavefrontSize32,
889 FeatureScalarAtomics,
890 FeatureScalarFlatScratchInsts,
891 FeatureLdsMisalignedBug,
892 FeatureDoesNotSupportXNACK,
893 FeatureCodeObjectV3])>;
895 //===----------------------------------------------------------------------===//
897 def AMDGPUInstrInfo : InstrInfo {
898 let guessInstructionProperties = 1;
899 let noNamedPositionallyEncodedOperands = 1;
902 def AMDGPUAsmParser : AsmParser {
903 // Some of the R600 registers have the same name, so this crashes.
904 // For example T0_XYZW and T0_XY both have the asm name T0.
905 let ShouldEmitMatchRegisterName = 0;
908 def AMDGPUAsmWriter : AsmWriter {
909 int PassSubtarget = 1;
912 def AMDGPUAsmVariants {
913 string Default = "Default";
915 string VOP3 = "VOP3";
917 string SDWA = "SDWA";
919 string SDWA9 = "SDWA9";
923 string Disable = "Disable";
927 def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
928 let Variant = AMDGPUAsmVariants.Default_ID;
929 let Name = AMDGPUAsmVariants.Default;
932 def VOP3AsmParserVariant : AsmParserVariant {
933 let Variant = AMDGPUAsmVariants.VOP3_ID;
934 let Name = AMDGPUAsmVariants.VOP3;
937 def SDWAAsmParserVariant : AsmParserVariant {
938 let Variant = AMDGPUAsmVariants.SDWA_ID;
939 let Name = AMDGPUAsmVariants.SDWA;
942 def SDWA9AsmParserVariant : AsmParserVariant {
943 let Variant = AMDGPUAsmVariants.SDWA9_ID;
944 let Name = AMDGPUAsmVariants.SDWA9;
948 def DPPAsmParserVariant : AsmParserVariant {
949 let Variant = AMDGPUAsmVariants.DPP_ID;
950 let Name = AMDGPUAsmVariants.DPP;
953 def AMDGPU : Target {
954 // Pull in Instruction Info:
955 let InstructionSet = AMDGPUInstrInfo;
956 let AssemblyParsers = [AMDGPUAsmParser];
957 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
958 VOP3AsmParserVariant,
959 SDWAAsmParserVariant,
960 SDWA9AsmParserVariant,
961 DPPAsmParserVariant];
962 let AssemblyWriters = [AMDGPUAsmWriter];
963 let AllowRegisterRenaming = 1;
966 // Dummy Instruction itineraries for pseudo instructions
967 def ALU_NULL : FuncUnit;
968 def NullALU : InstrItinClass;
970 //===----------------------------------------------------------------------===//
971 // Predicate helper class
972 //===----------------------------------------------------------------------===//
975 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS">,
976 AssemblerPredicate<"FeatureSouthernIslands">;
979 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
980 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS">,
981 AssemblerPredicate<"!FeatureGCN3Encoding,!FeatureGFX10Insts">;
983 def isGFX6GFX7GFX10 :
984 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
985 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
986 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX10">,
987 AssemblerPredicate<"!FeatureGCN3Encoding">;
990 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS">,
991 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureCIInsts,!FeatureGFX10Insts">;
994 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
995 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX10">,
996 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureCIInsts">;
999 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
1000 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
1001 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1002 AssemblerPredicate<"FeatureGFX7GFX8GFX9Insts">;
1004 def isGFX6GFX7GFX8GFX9 :
1005 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
1006 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
1007 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
1008 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1009 AssemblerPredicate<"!FeatureGFX10Insts">;
1012 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::SEA_ISLANDS">,
1013 AssemblerPredicate<"FeatureCIInsts">;
1016 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
1017 AssemblerPredicate<"FeatureGFX8Insts">;
1019 def isGFX8Only : Predicate<"Subtarget->getGeneration() =="
1020 "AMDGPUSubtarget::VOLCANIC_ISLANDS">,
1021 AssemblerPredicate <"FeatureVolcanicIslands">;
1024 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
1025 AssemblerPredicate<"FeatureGFX9Insts">;
1027 def isGFX9Only : Predicate <
1028 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1029 AssemblerPredicate<"FeatureGCN3Encoding,FeatureGFX9Insts">;
1032 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
1033 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1034 AssemblerPredicate<"FeatureGFX8Insts,FeatureGCN3Encoding">;
1037 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX10">,
1038 AssemblerPredicate<"FeatureGFX10Insts">;
1040 def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">,
1041 AssemblerPredicate<"FeatureFlatAddressSpace">;
1043 def HasFlatGlobalInsts : Predicate<"Subtarget->hasFlatGlobalInsts()">,
1044 AssemblerPredicate<"FeatureFlatGlobalInsts">;
1045 def HasFlatScratchInsts : Predicate<"Subtarget->hasFlatScratchInsts()">,
1046 AssemblerPredicate<"FeatureFlatScratchInsts">;
1047 def HasScalarFlatScratchInsts : Predicate<"Subtarget->hasScalarFlatScratchInsts()">,
1048 AssemblerPredicate<"FeatureScalarFlatScratchInsts">;
1049 def HasD16LoadStore : Predicate<"Subtarget->hasD16LoadStore()">,
1050 AssemblerPredicate<"FeatureGFX9Insts">;
1052 def HasUnpackedD16VMem : Predicate<"Subtarget->hasUnpackedD16VMem()">,
1053 AssemblerPredicate<"FeatureUnpackedD16VMem">;
1054 def HasPackedD16VMem : Predicate<"!Subtarget->hasUnpackedD16VMem()">,
1055 AssemblerPredicate<"!FeatureUnpackedD16VMem">;
1057 def D16PreservesUnusedBits :
1058 Predicate<"Subtarget->d16PreservesUnusedBits()">,
1059 AssemblerPredicate<"FeatureGFX9Insts,!FeatureSRAMECC">;
1061 def LDSRequiresM0Init : Predicate<"Subtarget->ldsRequiresM0Init()">;
1062 def NotLDSRequiresM0Init : Predicate<"!Subtarget->ldsRequiresM0Init()">;
1064 def HasDSAddTid : Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
1065 AssemblerPredicate<"FeatureGFX9Insts">;
1067 def HasAddNoCarryInsts : Predicate<"Subtarget->hasAddNoCarry()">,
1068 AssemblerPredicate<"FeatureAddNoCarryInsts">;
1070 def NotHasAddNoCarryInsts : Predicate<"!Subtarget->hasAddNoCarry()">;
1072 def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">,
1073 AssemblerPredicate<"Feature16BitInsts">;
1074 def HasVOP3PInsts : Predicate<"Subtarget->hasVOP3PInsts()">,
1075 AssemblerPredicate<"FeatureVOP3P">;
1077 def HasSDWA : Predicate<"Subtarget->hasSDWA()">,
1078 AssemblerPredicate<"FeatureSDWA,FeatureVolcanicIslands">;
1081 Predicate<"Subtarget->hasSDWA()">,
1082 AssemblerPredicate<"FeatureGCN3Encoding,FeatureGFX9Insts,FeatureSDWA">;
1085 Predicate<"Subtarget->hasSDWA()">,
1086 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureSDWA">;
1088 def HasDPP : Predicate<"Subtarget->hasDPP()">,
1089 AssemblerPredicate<"FeatureGCN3Encoding,FeatureDPP">;
1091 def HasDPP8 : Predicate<"Subtarget->hasDPP8()">,
1092 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureDPP8">;
1094 def HasR128A16 : Predicate<"Subtarget->hasR128A16()">,
1095 AssemblerPredicate<"FeatureR128A16">;
1097 def HasDPP16 : Predicate<"Subtarget->hasDPP()">,
1098 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureDPP">;
1100 def HasIntClamp : Predicate<"Subtarget->hasIntClamp()">,
1101 AssemblerPredicate<"FeatureIntClamp">;
1103 def HasMadMixInsts : Predicate<"Subtarget->hasMadMixInsts()">,
1104 AssemblerPredicate<"FeatureMadMixInsts">;
1106 def HasScalarStores : Predicate<"Subtarget->hasScalarStores()">,
1107 AssemblerPredicate<"FeatureScalarStores">;
1109 def HasScalarAtomics : Predicate<"Subtarget->hasScalarAtomics()">,
1110 AssemblerPredicate<"FeatureScalarAtomics">;
1112 def HasNoSdstCMPX : Predicate<"Subtarget->hasNoSdstCMPX()">,
1113 AssemblerPredicate<"FeatureNoSdstCMPX">;
1115 def HasSdstCMPX : Predicate<"!Subtarget->hasNoSdstCMPX()">,
1116 AssemblerPredicate<"!FeatureNoSdstCMPX">;
1118 def has16BankLDS : Predicate<"Subtarget->getLDSBankCount() == 16">;
1119 def has32BankLDS : Predicate<"Subtarget->getLDSBankCount() == 32">;
1120 def HasVGPRIndexMode : Predicate<"Subtarget->hasVGPRIndexMode()">,
1121 AssemblerPredicate<"FeatureVGPRIndexMode">;
1122 def HasMovrel : Predicate<"Subtarget->hasMovrel()">,
1123 AssemblerPredicate<"FeatureMovrel">;
1125 def HasFmaMixInsts : Predicate<"Subtarget->hasFmaMixInsts()">,
1126 AssemblerPredicate<"FeatureFmaMixInsts">;
1128 def HasDLInsts : Predicate<"Subtarget->hasDLInsts()">,
1129 AssemblerPredicate<"FeatureDLInsts">;
1131 def HasDot1Insts : Predicate<"Subtarget->hasDot1Insts()">,
1132 AssemblerPredicate<"FeatureDot1Insts">;
1134 def HasDot2Insts : Predicate<"Subtarget->hasDot2Insts()">,
1135 AssemblerPredicate<"FeatureDot2Insts">;
1137 def HasDot3Insts : Predicate<"Subtarget->hasDot3Insts()">,
1138 AssemblerPredicate<"FeatureDot3Insts">;
1140 def HasDot4Insts : Predicate<"Subtarget->hasDot4Insts()">,
1141 AssemblerPredicate<"FeatureDot4Insts">;
1143 def HasDot5Insts : Predicate<"Subtarget->hasDot5Insts()">,
1144 AssemblerPredicate<"FeatureDot5Insts">;
1146 def HasDot6Insts : Predicate<"Subtarget->hasDot6Insts()">,
1147 AssemblerPredicate<"FeatureDot6Insts">;
1149 def HasMAIInsts : Predicate<"Subtarget->hasMAIInsts()">,
1150 AssemblerPredicate<"FeatureMAIInsts">;
1152 def HasPkFmacF16Inst : Predicate<"Subtarget->hasPkFmacF16Inst()">,
1153 AssemblerPredicate<"FeaturePkFmacF16Inst">;
1155 def HasAtomicFaddInsts : Predicate<"Subtarget->hasAtomicFaddInsts()">,
1156 AssemblerPredicate<"FeatureAtomicFaddInsts">;
1158 def HasOffset3fBug : Predicate<"!Subtarget->hasOffset3fBug()">,
1159 AssemblerPredicate<"FeatureOffset3fBug">;
1161 def EnableLateCFGStructurize : Predicate<
1162 "EnableLateStructurizeCFG">;
1164 // Include AMDGPU TD files
1165 include "SISchedule.td"
1166 include "GCNProcessors.td"
1167 include "AMDGPUInstrInfo.td"
1168 include "AMDGPURegisterInfo.td"
1169 include "AMDGPURegisterBanks.td"
1170 include "AMDGPUInstructions.td"
1171 include "SIInstrInfo.td"
1172 include "AMDGPUCallingConv.td"
1173 include "AMDGPUSearchableTables.td"