//===-- EXPInstructions.td - Export Instruction Definitions ---------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // EXP classes //===----------------------------------------------------------------------===// class EXPCommon : InstSI< (outs), (ins exp_tgt:$tgt, ExpSrc0:$src0, ExpSrc1:$src1, ExpSrc2:$src2, ExpSrc3:$src3, exp_vm:$vm, exp_compr:$compr, i32imm:$en), asm> { let EXP = 1; let EXP_CNT = 1; let mayLoad = _done; let mayStore = 1; let maybeAtomic = 0; let UseNamedOperandTable = 1; let Uses = !if(_row, [EXEC, M0], [EXEC]); let SchedRW = [WriteExport]; let DisableWQM = 1; bit row = _row; bit done = _done; } class EXP_Pseudo : EXPCommon, SIMCInstr { let isPseudo = 1; let isCodeGenOnly = 1; } // Real instruction with optional asm operands "compr" and "vm". class EXP_Real_ComprVM : EXPCommon<0, ps.done, "exp$tgt $src0, $src1, $src2, $src3" #!if(ps.done, " done", "")#"$compr$vm">, SIMCInstr { let AsmMatchConverter = "cvtExp"; } // Real instruction with optional asm operand "row_en". class EXP_Real_Row : EXPCommon, SIMCInstr { let AsmMatchConverter = "cvtExp"; } //===----------------------------------------------------------------------===// // EXP Instructions //===----------------------------------------------------------------------===// // DONE variants have mayLoad = 1. // ROW variants have an implicit use of M0. let SubtargetPredicate = HasExportInsts in { def EXP : EXP_Pseudo<0, 0>; def EXP_DONE : EXP_Pseudo<0, 1>; def EXP_ROW : EXP_Pseudo<1, 0>; def EXP_ROW_DONE : EXP_Pseudo<1, 1>; } // let SubtargetPredicate = HasExportInsts //===----------------------------------------------------------------------===// // SI, VI, GFX10. //===----------------------------------------------------------------------===// multiclass EXP_Real_si { defvar ps = !cast(NAME); def _si : EXP_Real_ComprVM, EXPe_ComprVM { let AssemblerPredicate = isGFX6GFX7; let DecoderNamespace = "GFX6GFX7"; let done = ps.done; } } multiclass EXP_Real_vi { defvar ps = !cast(NAME); def _vi : EXP_Real_ComprVM, EXPe_vi { let AssemblerPredicate = isGFX8GFX9; let SubtargetPredicate = isNotGFX90APlus; let DecoderNamespace = "GFX8"; let done = ps.done; } } multiclass EXP_Real_gfx10 { defvar ps = !cast(NAME); def _gfx10 : EXP_Real_ComprVM, EXPe_ComprVM { let AssemblerPredicate = isGFX10Only; let DecoderNamespace = "GFX10"; let done = ps.done; } } defm EXP : EXP_Real_si, EXP_Real_vi, EXP_Real_gfx10; defm EXP_DONE : EXP_Real_si, EXP_Real_vi, EXP_Real_gfx10; //===----------------------------------------------------------------------===// // GFX11, GFX12. //===----------------------------------------------------------------------===// multiclass EXP_Real_gfx11 { defvar ps = !cast(NAME); def _gfx11 : EXP_Real_Row, EXPe_Row { let AssemblerPredicate = isGFX11Only; let DecoderNamespace = "GFX11"; let row = ps.row; let done = ps.done; } } multiclass VEXPORT_Real_gfx12 { defvar ps = !cast(NAME); def _gfx12 : EXP_Real_Row, EXPe_Row { let AssemblerPredicate = isGFX12Only; let DecoderNamespace = "GFX12"; let row = ps.row; let done = ps.done; } def : AMDGPUMnemonicAlias<"exp", "export"> { let AssemblerPredicate = isGFX12Plus; } } defm EXP : EXP_Real_gfx11, VEXPORT_Real_gfx12; defm EXP_DONE : EXP_Real_gfx11, VEXPORT_Real_gfx12; defm EXP_ROW : EXP_Real_gfx11, VEXPORT_Real_gfx12; defm EXP_ROW_DONE : EXP_Real_gfx11, VEXPORT_Real_gfx12; //===----------------------------------------------------------------------===// // EXP Patterns //===----------------------------------------------------------------------===// class ExpPattern : GCNPat< (int_amdgcn_exp timm:$tgt, timm:$en, (vt ExpSrc0:$src0), (vt ExpSrc1:$src1), (vt ExpSrc2:$src2), (vt ExpSrc3:$src3), done_val, timm:$vm), (Inst timm:$tgt, ExpSrc0:$src0, ExpSrc1:$src1, ExpSrc2:$src2, ExpSrc3:$src3, timm:$vm, 0, timm:$en) >; class ExpRowPattern : GCNPat< (int_amdgcn_exp_row timm:$tgt, timm:$en, (vt ExpSrc0:$src0), (vt ExpSrc1:$src1), (vt ExpSrc2:$src2), (vt ExpSrc3:$src3), done_val, M0), (Inst timm:$tgt, ExpSrc0:$src0, ExpSrc1:$src1, ExpSrc2:$src2, ExpSrc3:$src3, 0, 0, timm:$en) >; class ExpComprPattern : GCNPat< (int_amdgcn_exp_compr timm:$tgt, timm:$en, (vt ExpSrc0:$src0), (vt ExpSrc1:$src1), done_val, timm:$vm), (Inst timm:$tgt, ExpSrc0:$src0, ExpSrc1:$src1, (IMPLICIT_DEF), (IMPLICIT_DEF), timm:$vm, 1, timm:$en) >; // FIXME: The generated DAG matcher seems to have strange behavior // with a 1-bit literal to match, so use a -1 for checking a true // 1-bit value. def : ExpPattern; def : ExpPattern; def : ExpPattern; def : ExpPattern; def : ExpRowPattern; def : ExpRowPattern; def : ExpRowPattern; def : ExpRowPattern; def : ExpComprPattern; def : ExpComprPattern; def : ExpComprPattern; def : ExpComprPattern;