1 //===-- EXPInstructions.td - Export Instruction Definitions ---------------===//
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 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 class EXPCommon<bit done, string asm = ""> : InstSI<
16 ExpSrc0:$src0, ExpSrc1:$src1, ExpSrc2:$src2, ExpSrc3:$src3,
17 exp_vm:$vm, exp_compr:$compr, i32imm:$en),
23 let UseNamedOperandTable = 1;
25 let SchedRW = [WriteExport];
29 class EXP_Pseudo<bit done> : EXPCommon<done>,
30 SIMCInstr <NAME, SIEncodingFamily.NONE> {
32 let isCodeGenOnly = 1;
35 class EXP_Real<bit done, string pseudo, int subtarget>
36 : EXPCommon<done, "exp$tgt $src0, $src1, $src2, $src3"#!if(done, " done", "")
38 SIMCInstr <pseudo, subtarget> {
39 let AsmMatchConverter = "cvtExp";
42 //===----------------------------------------------------------------------===//
44 //===----------------------------------------------------------------------===//
46 // Split EXP instruction into EXP and EXP_DONE so we can set
47 // mayLoad for done=1.
48 def EXP : EXP_Pseudo<0>;
49 def EXP_DONE : EXP_Pseudo<1>;
51 //===----------------------------------------------------------------------===//
53 //===----------------------------------------------------------------------===//
55 class EXP_Real_si<bit _done, string pseudo>
56 : EXP_Real<_done, pseudo, SIEncodingFamily.SI>, EXPe {
57 let AssemblerPredicate = isGFX6GFX7;
58 let DecoderNamespace = "GFX6GFX7";
62 def EXP_si : EXP_Real_si<0, "EXP">;
63 def EXP_DONE_si : EXP_Real_si<1, "EXP_DONE">;
65 //===----------------------------------------------------------------------===//
67 //===----------------------------------------------------------------------===//
69 class EXP_Real_vi<bit _done, string pseudo>
70 : EXP_Real<_done, pseudo, SIEncodingFamily.VI>, EXPe_vi {
71 let AssemblerPredicate = isGFX8GFX9;
72 let DecoderNamespace = "GFX8";
76 def EXP_vi : EXP_Real_vi<0, "EXP">;
77 def EXP_DONE_vi : EXP_Real_vi<1, "EXP_DONE">;
79 //===----------------------------------------------------------------------===//
81 //===----------------------------------------------------------------------===//
83 class EXP_Real_gfx10<bit _done, string pseudo>
84 : EXP_Real<_done, pseudo, SIEncodingFamily.GFX10>, EXPe {
85 let AssemblerPredicate = isGFX10Plus;
86 let DecoderNamespace = "GFX10";
90 def EXP_gfx10 : EXP_Real_gfx10<0, "EXP">;
91 def EXP_DONE_gfx10 : EXP_Real_gfx10<1, "EXP_DONE">;
93 //===----------------------------------------------------------------------===//
95 //===----------------------------------------------------------------------===//
97 class ExpPattern<ValueType vt, Instruction Inst, int done_val> : GCNPat<
98 (int_amdgcn_exp timm:$tgt, timm:$en,
99 (vt ExpSrc0:$src0), (vt ExpSrc1:$src1),
100 (vt ExpSrc2:$src2), (vt ExpSrc3:$src3),
102 (Inst timm:$tgt, ExpSrc0:$src0, ExpSrc1:$src1,
103 ExpSrc2:$src2, ExpSrc3:$src3, timm:$vm, 0, timm:$en)
106 class ExpComprPattern<ValueType vt, Instruction Inst, int done_val> : GCNPat<
107 (int_amdgcn_exp_compr timm:$tgt, timm:$en,
108 (vt ExpSrc0:$src0), (vt ExpSrc1:$src1),
110 (Inst timm:$tgt, ExpSrc0:$src0, ExpSrc1:$src1,
111 (IMPLICIT_DEF), (IMPLICIT_DEF), timm:$vm, 1, timm:$en)
114 // FIXME: The generated DAG matcher seems to have strange behavior
115 // with a 1-bit literal to match, so use a -1 for checking a true
117 def : ExpPattern<i32, EXP, 0>;
118 def : ExpPattern<i32, EXP_DONE, -1>;
119 def : ExpPattern<f32, EXP, 0>;
120 def : ExpPattern<f32, EXP_DONE, -1>;
122 def : ExpComprPattern<v2i16, EXP, 0>;
123 def : ExpComprPattern<v2i16, EXP_DONE, -1>;
124 def : ExpComprPattern<v2f16, EXP, 0>;
125 def : ExpComprPattern<v2f16, EXP_DONE, -1>;