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 class BoolToList<bit Value> {
14 list<int> ret = !if(Value, [1]<int>, []<int>);
17 //===------------------------------------------------------------===//
18 // Subtarget Features (device properties)
19 //===------------------------------------------------------------===//
21 def FeatureFastFMAF32 : SubtargetFeature<"fast-fmaf",
24 "Assuming f32 fma is at least as fast as mul + add"
27 def FeatureMIMG_R128 : SubtargetFeature<"mimg-r128",
30 "Support 128-bit texture resources"
33 def HalfRate64Ops : SubtargetFeature<"half-rate-64-ops",
36 "Most fp64 instructions are half rate instead of quarter"
39 def FeatureFlatAddressSpace : SubtargetFeature<"flat-address-space",
42 "Support flat address space"
45 def FeatureFlatInstOffsets : SubtargetFeature<"flat-inst-offsets",
48 "Flat instructions have immediate offset addressing mode"
51 def FeatureFlatGlobalInsts : SubtargetFeature<"flat-global-insts",
54 "Have global_* flat memory instructions"
57 def FeatureFlatScratchInsts : SubtargetFeature<"flat-scratch-insts",
60 "Have scratch_* flat memory instructions"
63 def FeatureScalarFlatScratchInsts : SubtargetFeature<"scalar-flat-scratch-insts",
64 "ScalarFlatScratchInsts",
66 "Have s_scratch_* flat memory instructions"
69 def FeatureAddNoCarryInsts : SubtargetFeature<"add-no-carry-insts",
72 "Have VALU add/sub instructions without carry out"
75 def FeatureUnalignedBufferAccess : SubtargetFeature<"unaligned-buffer-access",
76 "UnalignedBufferAccess",
78 "Support unaligned global loads and stores"
81 def FeatureTrapHandler: SubtargetFeature<"trap-handler",
84 "Trap handler support"
87 def FeatureUnalignedScratchAccess : SubtargetFeature<"unaligned-scratch-access",
88 "UnalignedScratchAccess",
90 "Support unaligned scratch loads and stores"
93 def FeatureApertureRegs : SubtargetFeature<"aperture-regs",
96 "Has Memory Aperture Base and Size Registers"
99 def FeatureMadMixInsts : SubtargetFeature<"mad-mix-insts",
102 "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions"
105 def FeatureFmaMixInsts : SubtargetFeature<"fma-mix-insts",
108 "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions"
111 def FeatureDoesNotSupportXNACK : SubtargetFeature<"no-xnack-support",
112 "DoesNotSupportXNACK",
114 "Hardware does not support XNACK"
117 // XNACK is disabled if SH_MEM_CONFIG.ADDRESS_MODE = GPUVM on chips that support
118 // XNACK. The current default kernel driver setting is:
119 // - graphics ring: XNACK disabled
120 // - compute ring: XNACK enabled
122 // If XNACK is enabled, the VMEM latency can be worse.
123 // If XNACK is disabled, the 2 SGPRs can be used for general purposes.
124 def FeatureXNACK : SubtargetFeature<"xnack",
127 "Enable XNACK support"
130 def FeatureCuMode : SubtargetFeature<"cumode",
133 "Enable CU wavefront execution mode"
136 def FeatureSGPRInitBug : SubtargetFeature<"sgpr-init-bug",
139 "VI SGPR initialization bug requiring a fixed SGPR allocation size"
142 def FeatureLdsMisalignedBug : SubtargetFeature<"lds-misaligned-bug",
145 "Some GFX10 bug with misaligned multi-dword LDS access in WGP mode"
148 def FeatureVcmpxPermlaneHazard : SubtargetFeature<"vcmpx-permlane-hazard",
149 "HasVcmpxPermlaneHazard",
154 def FeatureVMEMtoScalarWriteHazard : SubtargetFeature<"vmem-to-scalar-write-hazard",
155 "HasVMEMtoScalarWriteHazard",
157 "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution."
160 def FeatureSMEMtoVectorWriteHazard : SubtargetFeature<"smem-to-vector-write-hazard",
161 "HasSMEMtoVectorWriteHazard",
163 "s_load_dword followed by v_cmp page faults"
166 def FeatureInstFwdPrefetchBug : SubtargetFeature<"inst-fwd-prefetch-bug",
167 "HasInstFwdPrefetchBug",
169 "S_INST_PREFETCH instruction causes shader to hang"
172 def FeatureVcmpxExecWARHazard : SubtargetFeature<"vcmpx-exec-war-hazard",
173 "HasVcmpxExecWARHazard",
175 "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)"
178 def FeatureLdsBranchVmemWARHazard : SubtargetFeature<"lds-branch-vmem-war-hazard",
179 "HasLdsBranchVmemWARHazard",
181 "Switching between LDS and VMEM-tex not waiting VM_VSRC=0"
184 def FeatureNSAtoVMEMBug : SubtargetFeature<"nsa-to-vmem-bug",
187 "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero"
190 def FeatureFlatSegmentOffsetBug : SubtargetFeature<"flat-segment-offset-bug",
191 "HasFlatSegmentOffsetBug",
193 "GFX10 bug, inst_offset ignored in flat segment"
196 def FeatureOffset3fBug : SubtargetFeature<"offset-3f-bug",
199 "Branch offset of 3f hardware bug"
202 class SubtargetFeatureLDSBankCount <int Value> : SubtargetFeature <
203 "ldsbankcount"#Value,
205 !cast<string>(Value),
206 "The number of LDS banks per compute unit."
209 def FeatureLDSBankCount16 : SubtargetFeatureLDSBankCount<16>;
210 def FeatureLDSBankCount32 : SubtargetFeatureLDSBankCount<32>;
212 def FeatureGCN3Encoding : SubtargetFeature<"gcn3-encoding",
215 "Encoding format for VI"
218 def FeatureCIInsts : SubtargetFeature<"ci-insts",
221 "Additional instructions for CI+"
224 def FeatureGFX8Insts : SubtargetFeature<"gfx8-insts",
227 "Additional instructions for GFX8+"
230 def FeatureGFX9Insts : SubtargetFeature<"gfx9-insts",
233 "Additional instructions for GFX9+"
236 def FeatureGFX10Insts : SubtargetFeature<"gfx10-insts",
239 "Additional instructions for GFX10+"
242 def FeatureGFX7GFX8GFX9Insts : SubtargetFeature<"gfx7-gfx8-gfx9-insts",
245 "Instructions shared in GFX7, GFX8, GFX9"
248 def FeatureSMemRealTime : SubtargetFeature<"s-memrealtime",
251 "Has s_memrealtime instruction"
254 def FeatureInv2PiInlineImm : SubtargetFeature<"inv-2pi-inline-imm",
255 "HasInv2PiInlineImm",
257 "Has 1 / (2 * pi) as inline immediate"
260 def Feature16BitInsts : SubtargetFeature<"16-bit-insts",
263 "Has i16/f16 instructions"
266 def FeatureVOP3P : SubtargetFeature<"vop3p",
269 "Has VOP3P packed instructions"
272 def FeatureMovrel : SubtargetFeature<"movrel",
275 "Has v_movrel*_b32 instructions"
278 def FeatureVGPRIndexMode : SubtargetFeature<"vgpr-index-mode",
281 "Has VGPR mode register indexing"
284 def FeatureScalarStores : SubtargetFeature<"scalar-stores",
287 "Has store scalar memory instructions"
290 def FeatureScalarAtomics : SubtargetFeature<"scalar-atomics",
293 "Has atomic scalar memory instructions"
296 def FeatureSDWA : SubtargetFeature<"sdwa",
299 "Support SDWA (Sub-DWORD Addressing) extension"
302 def FeatureSDWAOmod : SubtargetFeature<"sdwa-omod",
305 "Support OMod with SDWA (Sub-DWORD Addressing) extension"
308 def FeatureSDWAScalar : SubtargetFeature<"sdwa-scalar",
311 "Support scalar register with SDWA (Sub-DWORD Addressing) extension"
314 def FeatureSDWASdst : SubtargetFeature<"sdwa-sdst",
317 "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension"
320 def FeatureSDWAMac : SubtargetFeature<"sdwa-mav",
323 "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension"
326 def FeatureSDWAOutModsVOPC : SubtargetFeature<"sdwa-out-mods-vopc",
327 "HasSDWAOutModsVOPC",
329 "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension"
332 def FeatureDPP : SubtargetFeature<"dpp",
335 "Support DPP (Data Parallel Primitives) extension"
338 // DPP8 allows arbitrary cross-lane swizzling withing groups of 8 lanes.
339 def FeatureDPP8 : SubtargetFeature<"dpp8",
342 "Support DPP8 (Data Parallel Primitives) extension"
345 def FeatureR128A16 : SubtargetFeature<"r128-a16",
348 "Support 16 bit coordindates/gradients/lod/clamp/mip types on gfx9"
351 def FeatureNSAEncoding : SubtargetFeature<"nsa-encoding",
354 "Support NSA encoding for image instructions"
357 def FeatureIntClamp : SubtargetFeature<"int-clamp-insts",
360 "Support clamp for integer destination"
363 def FeatureUnpackedD16VMem : SubtargetFeature<"unpacked-d16-vmem",
364 "HasUnpackedD16VMem",
366 "Has unpacked d16 vmem instructions"
369 def FeatureDLInsts : SubtargetFeature<"dl-insts",
372 "Has v_fmac_f32 and v_xnor_b32 instructions"
375 def FeatureDot1Insts : SubtargetFeature<"dot1-insts",
378 "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions"
381 def FeatureDot2Insts : SubtargetFeature<"dot2-insts",
384 "Has v_dot2_f32_f16, v_dot2_i32_i16, v_dot2_u32_u16, v_dot4_u32_u8, v_dot8_u32_u4 instructions"
387 def FeatureDot3Insts : SubtargetFeature<"dot3-insts",
390 "Has v_dot8c_i32_i4 instruction"
393 def FeatureDot4Insts : SubtargetFeature<"dot4-insts",
396 "Has v_dot2c_i32_i16 instruction"
399 def FeatureDot5Insts : SubtargetFeature<"dot5-insts",
402 "Has v_dot2c_f32_f16 instruction"
405 def FeatureDot6Insts : SubtargetFeature<"dot6-insts",
408 "Has v_dot4c_i32_i8 instruction"
411 def FeatureMAIInsts : SubtargetFeature<"mai-insts",
414 "Has mAI instructions"
417 def FeaturePkFmacF16Inst : SubtargetFeature<"pk-fmac-f16-inst",
420 "Has v_pk_fmac_f16 instruction"
423 def FeatureAtomicFaddInsts : SubtargetFeature<"atomic-fadd-insts",
424 "HasAtomicFaddInsts",
426 "Has buffer_atomic_add_f32, buffer_atomic_pk_add_f16, global_atomic_add_f32, "
427 "global_atomic_pk_add_f16 instructions"
430 def FeatureDoesNotSupportSRAMECC : SubtargetFeature<"no-sram-ecc-support",
431 "DoesNotSupportSRAMECC",
433 "Hardware does not support SRAM ECC"
436 def FeatureSRAMECC : SubtargetFeature<"sram-ecc",
442 def FeatureNoSdstCMPX : SubtargetFeature<"no-sdst-cmpx",
445 "V_CMPX does not write VCC/SGPR in addition to EXEC"
448 def FeatureVscnt : SubtargetFeature<"vscnt",
451 "Has separate store vscnt counter"
454 def FeatureRegisterBanking : SubtargetFeature<"register-banking",
455 "HasRegisterBanking",
457 "Has register banking"
460 def FeatureVOP3Literal : SubtargetFeature<"vop3-literal",
463 "Can use one literal in VOP3"
466 def FeatureNoDataDepHazard : SubtargetFeature<"no-data-dep-hazard",
467 "HasNoDataDepHazard",
469 "Does not need SW waitstates"
472 //===------------------------------------------------------------===//
473 // Subtarget Features (options and debugging)
474 //===------------------------------------------------------------===//
476 // Denormal handling for fp64 and fp16 is controlled by the same
477 // config register when fp16 supported.
478 // TODO: Do we need a separate f16 setting when not legal?
479 def FeatureFP64FP16Denormals : SubtargetFeature<"fp64-fp16-denormals",
482 "Enable double and half precision denormal handling",
486 def FeatureFP64Denormals : SubtargetFeature<"fp64-denormals",
489 "Enable double and half precision denormal handling",
490 [FeatureFP64, FeatureFP64FP16Denormals]
493 def FeatureFP16Denormals : SubtargetFeature<"fp16-denormals",
496 "Enable half precision denormal handling",
497 [FeatureFP64FP16Denormals]
500 def FeatureFPExceptions : SubtargetFeature<"fp-exceptions",
503 "Enable floating point exceptions"
506 class FeatureMaxPrivateElementSize<int size> : SubtargetFeature<
507 "max-private-element-size-"#size,
508 "MaxPrivateElementSize",
510 "Maximum private access size may be "#size
513 def FeatureMaxPrivateElementSize4 : FeatureMaxPrivateElementSize<4>;
514 def FeatureMaxPrivateElementSize8 : FeatureMaxPrivateElementSize<8>;
515 def FeatureMaxPrivateElementSize16 : FeatureMaxPrivateElementSize<16>;
517 def FeatureDumpCode : SubtargetFeature <"DumpCode",
520 "Dump MachineInstrs in the CodeEmitter"
523 def FeatureDumpCodeLower : SubtargetFeature <"dumpcode",
526 "Dump MachineInstrs in the CodeEmitter"
529 // XXX - This should probably be removed once enabled by default
530 def FeatureEnableLoadStoreOpt : SubtargetFeature <"load-store-opt",
531 "EnableLoadStoreOpt",
533 "Enable SI load/store optimizer pass"
536 // Performance debugging feature. Allow using DS instruction immediate
537 // offsets even if the base pointer can't be proven to be base. On SI,
538 // base pointer values that won't give the same result as a 16-bit add
539 // are not safe to fold, but this will override the conservative test
540 // for the base pointer.
541 def FeatureEnableUnsafeDSOffsetFolding : SubtargetFeature <
542 "unsafe-ds-offset-folding",
543 "EnableUnsafeDSOffsetFolding",
545 "Force using DS instruction immediate offsets on SI"
548 def FeatureEnableSIScheduler : SubtargetFeature<"si-scheduler",
551 "Enable SI Machine Scheduler"
554 def FeatureEnableDS128 : SubtargetFeature<"enable-ds128",
557 "Use ds_{read|write}_b128"
560 // Sparse texture support requires that all result registers are zeroed when
561 // PRTStrictNull is set to true. This feature is turned on for all architectures
562 // but is enabled as a feature in case there are situations where PRTStrictNull
563 // is disabled by the driver.
564 def FeatureEnablePRTStrictNull : SubtargetFeature<"enable-prt-strict-null",
565 "EnablePRTStrictNull",
567 "Enable zeroing of result registers for sparse texture fetches"
570 // Unless +-flat-for-global is specified, turn on FlatForGlobal for
571 // all OS-es on VI and newer hardware to avoid assertion failures due
572 // to missing ADDR64 variants of MUBUF instructions.
573 // FIXME: moveToVALU should be able to handle converting addr64 MUBUF
576 def FeatureFlatForGlobal : SubtargetFeature<"flat-for-global",
579 "Force to generate flat instruction for global"
582 def FeatureAutoWaitcntBeforeBarrier : SubtargetFeature <
583 "auto-waitcnt-before-barrier",
584 "AutoWaitcntBeforeBarrier",
586 "Hardware automatically inserts waitcnt before barrier"
589 def FeatureCodeObjectV3 : SubtargetFeature <
593 "Generate code object version 3"
596 def FeatureTrigReducedRange : SubtargetFeature<"trig-reduced-range",
597 "HasTrigReducedRange",
599 "Requires use of fract on arguments to trig instructions"
602 // Dummy feature used to disable assembler instructions.
603 def FeatureDisable : SubtargetFeature<"",
604 "FeatureDisable","true",
605 "Dummy feature to disable assembler instructions"
608 class GCNSubtargetFeatureGeneration <string Value,
610 list<SubtargetFeature> Implies> :
611 SubtargetFeatureGeneration <Value, FeatureName, "GCNSubtarget", Implies>;
613 def FeatureSouthernIslands : GCNSubtargetFeatureGeneration<"SOUTHERN_ISLANDS",
615 [FeatureFP64, FeatureLocalMemorySize32768, FeatureMIMG_R128,
616 FeatureWavefrontSize64,
617 FeatureLDSBankCount32, FeatureMovrel, FeatureTrigReducedRange,
618 FeatureDoesNotSupportSRAMECC, FeatureDoesNotSupportXNACK]
621 def FeatureSeaIslands : GCNSubtargetFeatureGeneration<"SEA_ISLANDS",
623 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
624 FeatureWavefrontSize64, FeatureFlatAddressSpace,
625 FeatureCIInsts, FeatureMovrel, FeatureTrigReducedRange,
626 FeatureGFX7GFX8GFX9Insts, FeatureDoesNotSupportSRAMECC]
629 def FeatureVolcanicIslands : GCNSubtargetFeatureGeneration<"VOLCANIC_ISLANDS",
631 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
632 FeatureWavefrontSize64, FeatureFlatAddressSpace,
633 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
634 FeatureSMemRealTime, FeatureVGPRIndexMode, FeatureMovrel,
635 FeatureScalarStores, FeatureInv2PiInlineImm,
636 FeatureSDWA, FeatureSDWAOutModsVOPC, FeatureSDWAMac, FeatureDPP,
637 FeatureIntClamp, FeatureTrigReducedRange, FeatureDoesNotSupportSRAMECC,
638 FeatureGFX8Insts, FeatureGFX7GFX8GFX9Insts
642 def FeatureGFX9 : GCNSubtargetFeatureGeneration<"GFX9",
644 [FeatureFP64, FeatureLocalMemorySize65536,
645 FeatureWavefrontSize64, FeatureFlatAddressSpace,
646 FeatureGCN3Encoding, FeatureCIInsts, Feature16BitInsts,
647 FeatureSMemRealTime, FeatureScalarStores, FeatureInv2PiInlineImm,
648 FeatureApertureRegs, FeatureGFX9Insts, FeatureVOP3P, FeatureVGPRIndexMode,
649 FeatureFastFMAF32, FeatureDPP, FeatureIntClamp,
650 FeatureSDWA, FeatureSDWAOmod, FeatureSDWAScalar, FeatureSDWASdst,
651 FeatureFlatInstOffsets, FeatureFlatGlobalInsts, FeatureFlatScratchInsts,
652 FeatureAddNoCarryInsts, FeatureGFX8Insts, FeatureGFX7GFX8GFX9Insts,
653 FeatureScalarFlatScratchInsts, FeatureScalarAtomics, FeatureR128A16
657 def FeatureGFX10 : GCNSubtargetFeatureGeneration<"GFX10",
659 [FeatureFP64, FeatureLocalMemorySize65536, FeatureMIMG_R128,
660 FeatureFlatAddressSpace,
661 FeatureCIInsts, Feature16BitInsts,
662 FeatureSMemRealTime, FeatureInv2PiInlineImm,
663 FeatureApertureRegs, FeatureGFX9Insts, FeatureGFX10Insts, FeatureVOP3P,
664 FeatureMovrel, FeatureFastFMAF32, FeatureDPP, FeatureIntClamp,
665 FeatureSDWA, FeatureSDWAOmod, FeatureSDWAScalar, FeatureSDWASdst,
666 FeatureFlatInstOffsets, FeatureFlatGlobalInsts, FeatureFlatScratchInsts,
667 FeatureAddNoCarryInsts, FeatureFmaMixInsts, FeatureGFX8Insts,
668 FeatureNoSdstCMPX, FeatureVscnt, FeatureRegisterBanking,
669 FeatureVOP3Literal, FeatureDPP8,
670 FeatureNoDataDepHazard, FeaturePkFmacF16Inst, FeatureDoesNotSupportSRAMECC
674 class FeatureSet<list<SubtargetFeature> Features_> {
675 list<SubtargetFeature> Features = Features_;
678 def FeatureISAVersion6_0_0 : FeatureSet<[FeatureSouthernIslands,
681 FeatureLDSBankCount32,
682 FeatureDoesNotSupportXNACK,
683 FeatureCodeObjectV3]>;
685 def FeatureISAVersion6_0_1 : FeatureSet<
686 [FeatureSouthernIslands,
687 FeatureLDSBankCount32,
688 FeatureDoesNotSupportXNACK,
689 FeatureCodeObjectV3]>;
691 def FeatureISAVersion7_0_0 : FeatureSet<
693 FeatureLDSBankCount32,
694 FeatureDoesNotSupportXNACK,
695 FeatureCodeObjectV3]>;
697 def FeatureISAVersion7_0_1 : FeatureSet<
700 FeatureLDSBankCount32,
702 FeatureDoesNotSupportXNACK,
703 FeatureCodeObjectV3]>;
705 def FeatureISAVersion7_0_2 : FeatureSet<
707 FeatureLDSBankCount16,
709 FeatureDoesNotSupportXNACK,
710 FeatureCodeObjectV3]>;
712 def FeatureISAVersion7_0_3 : FeatureSet<
714 FeatureLDSBankCount16,
715 FeatureDoesNotSupportXNACK,
716 FeatureCodeObjectV3]>;
718 def FeatureISAVersion7_0_4 : FeatureSet<
720 FeatureLDSBankCount32,
721 FeatureDoesNotSupportXNACK,
722 FeatureCodeObjectV3]>;
724 def FeatureISAVersion8_0_1 : FeatureSet<
725 [FeatureVolcanicIslands,
728 FeatureLDSBankCount32,
730 FeatureUnpackedD16VMem,
731 FeatureCodeObjectV3]>;
733 def FeatureISAVersion8_0_2 : FeatureSet<
734 [FeatureVolcanicIslands,
735 FeatureLDSBankCount32,
737 FeatureUnpackedD16VMem,
738 FeatureDoesNotSupportXNACK,
739 FeatureCodeObjectV3]>;
741 def FeatureISAVersion8_0_3 : FeatureSet<
742 [FeatureVolcanicIslands,
743 FeatureLDSBankCount32,
744 FeatureUnpackedD16VMem,
745 FeatureDoesNotSupportXNACK,
746 FeatureCodeObjectV3]>;
748 def FeatureISAVersion8_1_0 : FeatureSet<
749 [FeatureVolcanicIslands,
750 FeatureLDSBankCount16,
752 FeatureCodeObjectV3]>;
754 def FeatureISAVersion9_0_0 : FeatureSet<
757 FeatureLDSBankCount32,
759 FeatureDoesNotSupportXNACK,
760 FeatureDoesNotSupportSRAMECC]>;
762 def FeatureISAVersion9_0_2 : FeatureSet<
765 FeatureLDSBankCount32,
767 FeatureDoesNotSupportSRAMECC,
768 FeatureCodeObjectV3]>;
770 def FeatureISAVersion9_0_4 : FeatureSet<
772 FeatureLDSBankCount32,
774 FeatureDoesNotSupportXNACK,
775 FeatureDoesNotSupportSRAMECC,
776 FeatureCodeObjectV3]>;
778 def FeatureISAVersion9_0_6 : FeatureSet<
782 FeatureLDSBankCount32,
786 FeatureDoesNotSupportXNACK,
787 FeatureCodeObjectV3]>;
789 def FeatureISAVersion9_0_8 : FeatureSet<
793 FeatureLDSBankCount32,
802 FeaturePkFmacF16Inst,
803 FeatureAtomicFaddInsts,
805 FeatureCodeObjectV3]>;
807 def FeatureISAVersion9_0_9 : FeatureSet<
810 FeatureLDSBankCount32,
812 FeatureCodeObjectV3]>;
814 // TODO: Organize more features into groups.
816 // Bugs present on gfx10.1.
817 list<SubtargetFeature> GFX10_1_Bugs = [
818 FeatureVcmpxPermlaneHazard,
819 FeatureVMEMtoScalarWriteHazard,
820 FeatureSMEMtoVectorWriteHazard,
821 FeatureInstFwdPrefetchBug,
822 FeatureVcmpxExecWARHazard,
823 FeatureLdsBranchVmemWARHazard,
826 FeatureFlatSegmentOffsetBug
830 def FeatureISAVersion10_1_0 : FeatureSet<
831 !listconcat(FeatureGroup.GFX10_1_Bugs,
833 FeatureLDSBankCount32,
836 FeatureWavefrontSize32,
838 FeatureScalarAtomics,
839 FeatureScalarFlatScratchInsts,
840 FeatureLdsMisalignedBug,
841 FeatureDoesNotSupportXNACK,
842 FeatureCodeObjectV3])>;
844 def FeatureISAVersion10_1_1 : FeatureSet<
845 !listconcat(FeatureGroup.GFX10_1_Bugs,
847 FeatureLDSBankCount32,
854 FeatureWavefrontSize32,
856 FeatureScalarAtomics,
857 FeatureScalarFlatScratchInsts,
858 FeatureDoesNotSupportXNACK,
859 FeatureCodeObjectV3])>;
861 def FeatureISAVersion10_1_2 : FeatureSet<
862 !listconcat(FeatureGroup.GFX10_1_Bugs,
864 FeatureLDSBankCount32,
871 FeatureWavefrontSize32,
873 FeatureScalarAtomics,
874 FeatureScalarFlatScratchInsts,
875 FeatureLdsMisalignedBug,
876 FeatureDoesNotSupportXNACK,
877 FeatureCodeObjectV3])>;
879 //===----------------------------------------------------------------------===//
881 def AMDGPUInstrInfo : InstrInfo {
882 let guessInstructionProperties = 1;
883 let noNamedPositionallyEncodedOperands = 1;
886 def AMDGPUAsmParser : AsmParser {
887 // Some of the R600 registers have the same name, so this crashes.
888 // For example T0_XYZW and T0_XY both have the asm name T0.
889 let ShouldEmitMatchRegisterName = 0;
892 def AMDGPUAsmWriter : AsmWriter {
893 int PassSubtarget = 1;
896 def AMDGPUAsmVariants {
897 string Default = "Default";
899 string VOP3 = "VOP3";
901 string SDWA = "SDWA";
903 string SDWA9 = "SDWA9";
907 string Disable = "Disable";
911 def DefaultAMDGPUAsmParserVariant : AsmParserVariant {
912 let Variant = AMDGPUAsmVariants.Default_ID;
913 let Name = AMDGPUAsmVariants.Default;
916 def VOP3AsmParserVariant : AsmParserVariant {
917 let Variant = AMDGPUAsmVariants.VOP3_ID;
918 let Name = AMDGPUAsmVariants.VOP3;
921 def SDWAAsmParserVariant : AsmParserVariant {
922 let Variant = AMDGPUAsmVariants.SDWA_ID;
923 let Name = AMDGPUAsmVariants.SDWA;
926 def SDWA9AsmParserVariant : AsmParserVariant {
927 let Variant = AMDGPUAsmVariants.SDWA9_ID;
928 let Name = AMDGPUAsmVariants.SDWA9;
932 def DPPAsmParserVariant : AsmParserVariant {
933 let Variant = AMDGPUAsmVariants.DPP_ID;
934 let Name = AMDGPUAsmVariants.DPP;
937 def AMDGPU : Target {
938 // Pull in Instruction Info:
939 let InstructionSet = AMDGPUInstrInfo;
940 let AssemblyParsers = [AMDGPUAsmParser];
941 let AssemblyParserVariants = [DefaultAMDGPUAsmParserVariant,
942 VOP3AsmParserVariant,
943 SDWAAsmParserVariant,
944 SDWA9AsmParserVariant,
945 DPPAsmParserVariant];
946 let AssemblyWriters = [AMDGPUAsmWriter];
947 let AllowRegisterRenaming = 1;
950 // Dummy Instruction itineraries for pseudo instructions
951 def ALU_NULL : FuncUnit;
952 def NullALU : InstrItinClass;
954 //===----------------------------------------------------------------------===//
955 // Predicate helper class
956 //===----------------------------------------------------------------------===//
959 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS">,
960 AssemblerPredicate<"FeatureSouthernIslands">;
963 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
964 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS">,
965 AssemblerPredicate<"!FeatureGCN3Encoding,!FeatureGFX10Insts">;
967 def isGFX6GFX7GFX10 :
968 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
969 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
970 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX10">,
971 AssemblerPredicate<"!FeatureGCN3Encoding">;
974 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS">,
975 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureCIInsts,!FeatureGFX10Insts">;
978 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
979 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX10">,
980 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureCIInsts">;
983 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
984 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
985 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
986 AssemblerPredicate<"FeatureGFX7GFX8GFX9Insts">;
988 def isGFX6GFX7GFX8GFX9 :
989 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS ||"
990 "Subtarget->getGeneration() == AMDGPUSubtarget::SEA_ISLANDS ||"
991 "Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
992 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
993 AssemblerPredicate<"!FeatureGFX10Insts">;
996 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::SEA_ISLANDS">,
997 AssemblerPredicate<"FeatureCIInsts">;
1000 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS">,
1001 AssemblerPredicate<"FeatureGFX8Insts">;
1003 def isGFX8Only : Predicate<"Subtarget->getGeneration() =="
1004 "AMDGPUSubtarget::VOLCANIC_ISLANDS">,
1005 AssemblerPredicate <"FeatureVolcanicIslands">;
1008 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
1009 AssemblerPredicate<"FeatureGFX9Insts">;
1011 def isGFX9Only : Predicate <
1012 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1013 AssemblerPredicate<"FeatureGCN3Encoding,FeatureGFX9Insts">;
1016 Predicate<"Subtarget->getGeneration() == AMDGPUSubtarget::VOLCANIC_ISLANDS ||"
1017 "Subtarget->getGeneration() == AMDGPUSubtarget::GFX9">,
1018 AssemblerPredicate<"FeatureGFX8Insts,FeatureGCN3Encoding">;
1021 Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX10">,
1022 AssemblerPredicate<"FeatureGFX10Insts">;
1024 def HasFlatAddressSpace : Predicate<"Subtarget->hasFlatAddressSpace()">,
1025 AssemblerPredicate<"FeatureFlatAddressSpace">;
1027 def HasFlatGlobalInsts : Predicate<"Subtarget->hasFlatGlobalInsts()">,
1028 AssemblerPredicate<"FeatureFlatGlobalInsts">;
1029 def HasFlatScratchInsts : Predicate<"Subtarget->hasFlatScratchInsts()">,
1030 AssemblerPredicate<"FeatureFlatScratchInsts">;
1031 def HasScalarFlatScratchInsts : Predicate<"Subtarget->hasScalarFlatScratchInsts()">,
1032 AssemblerPredicate<"FeatureScalarFlatScratchInsts">;
1033 def HasD16LoadStore : Predicate<"Subtarget->hasD16LoadStore()">,
1034 AssemblerPredicate<"FeatureGFX9Insts">;
1036 def HasUnpackedD16VMem : Predicate<"Subtarget->hasUnpackedD16VMem()">,
1037 AssemblerPredicate<"FeatureUnpackedD16VMem">;
1038 def HasPackedD16VMem : Predicate<"!Subtarget->hasUnpackedD16VMem()">,
1039 AssemblerPredicate<"!FeatureUnpackedD16VMem">;
1041 def D16PreservesUnusedBits :
1042 Predicate<"Subtarget->d16PreservesUnusedBits()">,
1043 AssemblerPredicate<"FeatureGFX9Insts,!FeatureSRAMECC">;
1045 def LDSRequiresM0Init : Predicate<"Subtarget->ldsRequiresM0Init()">;
1046 def NotLDSRequiresM0Init : Predicate<"!Subtarget->ldsRequiresM0Init()">;
1048 def HasDSAddTid : Predicate<"Subtarget->getGeneration() >= AMDGPUSubtarget::GFX9">,
1049 AssemblerPredicate<"FeatureGFX9Insts">;
1051 def HasAddNoCarryInsts : Predicate<"Subtarget->hasAddNoCarry()">,
1052 AssemblerPredicate<"FeatureAddNoCarryInsts">;
1054 def NotHasAddNoCarryInsts : Predicate<"!Subtarget->hasAddNoCarry()">;
1056 def Has16BitInsts : Predicate<"Subtarget->has16BitInsts()">,
1057 AssemblerPredicate<"Feature16BitInsts">;
1058 def HasVOP3PInsts : Predicate<"Subtarget->hasVOP3PInsts()">,
1059 AssemblerPredicate<"FeatureVOP3P">;
1061 def HasSDWA : Predicate<"Subtarget->hasSDWA()">,
1062 AssemblerPredicate<"FeatureSDWA,FeatureVolcanicIslands">;
1065 Predicate<"Subtarget->hasSDWA()">,
1066 AssemblerPredicate<"FeatureGCN3Encoding,FeatureGFX9Insts,FeatureSDWA">;
1069 Predicate<"Subtarget->hasSDWA()">,
1070 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureSDWA">;
1072 def HasDPP : Predicate<"Subtarget->hasDPP()">,
1073 AssemblerPredicate<"FeatureGCN3Encoding,FeatureDPP">;
1075 def HasDPP8 : Predicate<"Subtarget->hasDPP8()">,
1076 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureDPP8">;
1078 def HasR128A16 : Predicate<"Subtarget->hasR128A16()">,
1079 AssemblerPredicate<"FeatureR128A16">;
1081 def HasDPP16 : Predicate<"Subtarget->hasDPP()">,
1082 AssemblerPredicate<"!FeatureGCN3Encoding,FeatureGFX10Insts,FeatureDPP">;
1084 def HasIntClamp : Predicate<"Subtarget->hasIntClamp()">,
1085 AssemblerPredicate<"FeatureIntClamp">;
1087 def HasMadMixInsts : Predicate<"Subtarget->hasMadMixInsts()">,
1088 AssemblerPredicate<"FeatureMadMixInsts">;
1090 def HasScalarStores : Predicate<"Subtarget->hasScalarStores()">,
1091 AssemblerPredicate<"FeatureScalarStores">;
1093 def HasScalarAtomics : Predicate<"Subtarget->hasScalarAtomics()">,
1094 AssemblerPredicate<"FeatureScalarAtomics">;
1096 def HasNoSdstCMPX : Predicate<"Subtarget->hasNoSdstCMPX()">,
1097 AssemblerPredicate<"FeatureNoSdstCMPX">;
1099 def HasSdstCMPX : Predicate<"!Subtarget->hasNoSdstCMPX()">,
1100 AssemblerPredicate<"!FeatureNoSdstCMPX">;
1102 def has16BankLDS : Predicate<"Subtarget->getLDSBankCount() == 16">;
1103 def has32BankLDS : Predicate<"Subtarget->getLDSBankCount() == 32">;
1104 def HasVGPRIndexMode : Predicate<"Subtarget->hasVGPRIndexMode()">,
1105 AssemblerPredicate<"FeatureVGPRIndexMode">;
1106 def HasMovrel : Predicate<"Subtarget->hasMovrel()">,
1107 AssemblerPredicate<"FeatureMovrel">;
1109 def HasFmaMixInsts : Predicate<"Subtarget->hasFmaMixInsts()">,
1110 AssemblerPredicate<"FeatureFmaMixInsts">;
1112 def HasDLInsts : Predicate<"Subtarget->hasDLInsts()">,
1113 AssemblerPredicate<"FeatureDLInsts">;
1115 def HasDot1Insts : Predicate<"Subtarget->hasDot1Insts()">,
1116 AssemblerPredicate<"FeatureDot1Insts">;
1118 def HasDot2Insts : Predicate<"Subtarget->hasDot2Insts()">,
1119 AssemblerPredicate<"FeatureDot2Insts">;
1121 def HasDot3Insts : Predicate<"Subtarget->hasDot3Insts()">,
1122 AssemblerPredicate<"FeatureDot3Insts">;
1124 def HasDot4Insts : Predicate<"Subtarget->hasDot4Insts()">,
1125 AssemblerPredicate<"FeatureDot4Insts">;
1127 def HasDot5Insts : Predicate<"Subtarget->hasDot5Insts()">,
1128 AssemblerPredicate<"FeatureDot5Insts">;
1130 def HasDot6Insts : Predicate<"Subtarget->hasDot6Insts()">,
1131 AssemblerPredicate<"FeatureDot6Insts">;
1133 def HasMAIInsts : Predicate<"Subtarget->hasMAIInsts()">,
1134 AssemblerPredicate<"FeatureMAIInsts">;
1136 def HasPkFmacF16Inst : Predicate<"Subtarget->hasPkFmacF16Inst()">,
1137 AssemblerPredicate<"FeaturePkFmacF16Inst">;
1139 def HasAtomicFaddInsts : Predicate<"Subtarget->hasAtomicFaddInsts()">,
1140 AssemblerPredicate<"FeatureAtomicFaddInsts">;
1142 def HasOffset3fBug : Predicate<"!Subtarget->hasOffset3fBug()">,
1143 AssemblerPredicate<"FeatureOffset3fBug">;
1145 def EnableLateCFGStructurize : Predicate<
1146 "EnableLateStructurizeCFG">;
1148 // Include AMDGPU TD files
1149 include "SISchedule.td"
1150 include "GCNProcessors.td"
1151 include "AMDGPUInstrInfo.td"
1152 include "AMDGPURegisterInfo.td"
1153 include "AMDGPURegisterBanks.td"
1154 include "AMDGPUInstructions.td"
1155 include "SIInstrInfo.td"
1156 include "AMDGPUCallingConv.td"
1157 include "AMDGPUSearchableTables.td"