11
11
//===----------------------------------------------------------------------===//
12
12
13
13
class VINTERPe <VOPProfile P> : Enc64 {
14
- bits<8 > vdst;
14
+ bits<11 > vdst;
15
15
bits<4> src0_modifiers;
16
- bits<9 > src0;
16
+ bits<11 > src0;
17
17
bits<3> src1_modifiers;
18
- bits<9 > src1;
18
+ bits<11 > src1;
19
19
bits<3> src2_modifiers;
20
- bits<9 > src2;
20
+ bits<11 > src2;
21
21
bits<1> clamp;
22
22
bits<3> waitexp;
23
23
24
24
let Inst{31-26} = 0x33; // VOP3P encoding
25
25
let Inst{25-24} = 0x1; // VINTERP sub-encoding
26
26
27
- let Inst{7-0} = vdst;
27
+ let Inst{7-0} = vdst{7-0} ;
28
28
let Inst{10-8} = waitexp;
29
- let Inst{11} = !if(P.HasOpSel, src0_modifiers{2}, 0); // op_sel(0)
30
- let Inst{12} = !if(P.HasOpSel, src1_modifiers{2}, 0); // op_sel(1)
31
- let Inst{13} = !if(P.HasOpSel, src2_modifiers{2}, 0); // op_sel(2)
32
- let Inst{14} = !if(P.HasOpSel, src0_modifiers{3}, 0); // op_sel(3)
29
+ // Fields for hi/lo 16-bits of register selection
30
+ let Inst{11} = !if(P.HasSrc0, src0_modifiers{2}, 0);
31
+ let Inst{12} = !if(P.HasSrc1, src1_modifiers{2}, 0);
32
+ let Inst{13} = !if(P.HasSrc2, src2_modifiers{2}, 0);
33
+ let Inst{14} = !if(P.HasDst, src0_modifiers{3}, 0);
33
34
let Inst{15} = clamp;
34
- let Inst{40-32} = src0;
35
- let Inst{49-41} = src1;
36
- let Inst{58-50} = src2;
35
+ let Inst{40-32} = src0{8-0} ;
36
+ let Inst{49-41} = src1{8-0} ;
37
+ let Inst{58-50} = src2{8-0} ;
37
38
let Inst{61} = src0_modifiers{0}; // neg(0)
38
39
let Inst{62} = src1_modifiers{0}; // neg(1)
39
40
let Inst{63} = src2_modifiers{0}; // neg(2)
@@ -60,9 +61,10 @@ class VINTERP_Pseudo <string OpName, VOPProfile P, list<dag> pattern = []> :
60
61
let VINTERP = 1;
61
62
}
62
63
63
- class VINTERP_Real <VOP_Pseudo ps, int EncodingFamily> :
64
- VOP3_Real <ps, EncodingFamily> {
64
+ class VINTERP_Real <VOP_Pseudo ps, int EncodingFamily, string asmName > :
65
+ VOP3_Real <ps, EncodingFamily, asmName > {
65
66
let VINTERP = 1;
67
+ let IsSingle = 1;
66
68
}
67
69
68
70
def VOP3_VINTERP_F32 : VOPProfile<[f32, f32, f32, f32]> {
@@ -83,22 +85,35 @@ def VOP3_VINTERP_F32 : VOPProfile<[f32, f32, f32, f32]> {
83
85
let Asm64 = " $vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$waitexp";
84
86
}
85
87
86
- class VOP3_VINTERP_F16 <list<ValueType> ArgVT> : VOPProfile<ArgVT> {
87
- let HasOpSel = 1;
88
- let HasModifiers = 1;
88
+ class VOP3_VINTERP_F16_t16 <list<ValueType> ArgVT> : VOPProfile_True16<VOPProfile<ArgVT>> {
89
+ let Src0Mod = FPT16VRegInputMods</*Fake16*/0>;
90
+ let Src1Mod = FPVRegInputMods;
91
+ let Src2Mod = !if(!eq(ArgVT[3].Size, 16), FPT16VRegInputMods</*Fake16*/0>,
92
+ FPVRegInputMods);
93
+ let Ins64 = (ins Src0Mod:$src0_modifiers, VRegSrc_16:$src0,
94
+ Src1Mod:$src1_modifiers, VRegSrc_32:$src1,
95
+ Src2Mod:$src2_modifiers,
96
+ !if(!eq(ArgVT[3].Size, 16), VRegSrc_16, VRegSrc_32):$src2,
97
+ Clamp:$clamp, op_sel0:$op_sel,
98
+ WaitEXP:$waitexp);
89
99
90
- let Src0Mod = FPVRegInputMods;
100
+ let Asm64 = "$vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$op_sel$waitexp";
101
+ }
102
+
103
+ class VOP3_VINTERP_F16_fake16 <list<ValueType> ArgVT> : VOPProfile_Fake16<VOPProfile<ArgVT>> {
104
+ let Src0Mod = FPT16VRegInputMods</*Fake16*/1>;
91
105
let Src1Mod = FPVRegInputMods;
92
- let Src2Mod = FPVRegInputMods;
106
+ let Src2Mod = !if(!eq(ArgVT[3].Size, 16), FPT16VRegInputMods</*Fake16*/1>,
107
+ FPVRegInputMods);
93
108
94
- let Outs64 = (outs VGPR_32:$vdst);
95
- let Ins64 = (ins Src0Mod:$src0_modifiers, VRegSrc_32:$src0,
109
+ let Ins64 = (ins Src0Mod:$src0_modifiers, VRegSrc_fake16:$src0,
96
110
Src1Mod:$src1_modifiers, VRegSrc_32:$src1,
97
- Src2Mod:$src2_modifiers, VRegSrc_32:$src2,
111
+ Src2Mod:$src2_modifiers,
112
+ !if(!eq(ArgVT[3].Size, 16), VRegSrc_fake16, VRegSrc_32):$src2,
98
113
Clamp:$clamp, op_sel0:$op_sel,
99
114
WaitEXP:$waitexp);
100
115
101
- let Asm64 = " $vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$op_sel$waitexp";
116
+ let Asm64 = "$vdst, $src0_modifiers, $src1_modifiers, $src2_modifiers$clamp$op_sel$waitexp";
102
117
}
103
118
104
119
//===----------------------------------------------------------------------===//
@@ -107,20 +122,26 @@ class VOP3_VINTERP_F16 <list<ValueType> ArgVT> : VOPProfile<ArgVT> {
107
122
108
123
let SubtargetPredicate = HasVINTERPEncoding in {
109
124
125
+ multiclass VINTERP_t16<string OpName, list<ValueType> ArgVT> {
126
+ let True16Predicate = UseRealTrue16Insts in {
127
+ def _t16 : VINTERP_Pseudo<OpName#"_t16", VOP3_VINTERP_F16_t16<ArgVT>> ;
128
+ }
129
+ let True16Predicate = UseFakeTrue16Insts in {
130
+ def _fake16 : VINTERP_Pseudo<OpName#"_fake16", VOP3_VINTERP_F16_fake16<ArgVT>> ;
131
+ }
132
+ }
133
+
110
134
let Uses = [M0, EXEC, MODE] in {
111
135
def V_INTERP_P10_F32_inreg : VINTERP_Pseudo <"v_interp_p10_f32", VOP3_VINTERP_F32>;
112
136
def V_INTERP_P2_F32_inreg : VINTERP_Pseudo <"v_interp_p2_f32", VOP3_VINTERP_F32>;
113
- def V_INTERP_P10_F16_F32_inreg :
114
- VINTERP_Pseudo <"v_interp_p10_f16_f32", VOP3_VINTERP_F16<[f32, f32, f32, f32]>>;
115
- def V_INTERP_P2_F16_F32_inreg :
116
- VINTERP_Pseudo <"v_interp_p2_f16_f32", VOP3_VINTERP_F16<[f16, f32, f32, f32]>>;
137
+
138
+ defm V_INTERP_P10_F16_F32_inreg : VINTERP_t16<"v_interp_p10_f16_f32", [f32, f16, f32, f16]>;
139
+ defm V_INTERP_P2_F16_F32_inreg : VINTERP_t16<"v_interp_p2_f16_f32", [f16, f16, f32, f32]>;
117
140
} // Uses = [M0, EXEC, MODE]
118
141
119
142
let Uses = [M0, EXEC] in {
120
- def V_INTERP_P10_RTZ_F16_F32_inreg :
121
- VINTERP_Pseudo <"v_interp_p10_rtz_f16_f32", VOP3_VINTERP_F16<[f32, f32, f32, f32]>>;
122
- def V_INTERP_P2_RTZ_F16_F32_inreg :
123
- VINTERP_Pseudo <"v_interp_p2_rtz_f16_f32", VOP3_VINTERP_F16<[f16, f32, f32, f32]>>;
143
+ defm V_INTERP_P10_RTZ_F16_F32_inreg : VINTERP_t16<"v_interp_p10_rtz_f16_f32", [f32, f16, f32, f16]>;
144
+ defm V_INTERP_P2_RTZ_F16_F32_inreg : VINTERP_t16 <"v_interp_p2_rtz_f16_f32", [f16, f16, f32, f32]>;
124
145
} // Uses = [M0, EXEC]
125
146
126
147
} // SubtargetPredicate = HasVINTERPEncoding.
@@ -137,11 +158,6 @@ class VInterpF32Pat <SDPatternOperator op, Instruction inst> : GCNPat <
137
158
7) /* wait_exp */
138
159
>;
139
160
140
- def VINTERP_OPSEL {
141
- int LOW = 0;
142
- int HIGH = 0xa;
143
- }
144
-
145
161
class VInterpF16Pat <SDPatternOperator op, Instruction inst,
146
162
ValueType dst_type, bit high,
147
163
list<ComplexPattern> pat> : GCNPat <
@@ -167,45 +183,58 @@ multiclass VInterpF16Pat <SDPatternOperator op, Instruction inst,
167
183
168
184
def : VInterpF32Pat<int_amdgcn_interp_inreg_p10, V_INTERP_P10_F32_inreg>;
169
185
def : VInterpF32Pat<int_amdgcn_interp_inreg_p2, V_INTERP_P2_F32_inreg>;
186
+
187
+ let True16Predicate = UseFakeTrue16Insts in {
170
188
defm : VInterpF16Pat<int_amdgcn_interp_inreg_p10_f16,
171
- V_INTERP_P10_F16_F32_inreg , f32,
189
+ V_INTERP_P10_F16_F32_inreg_fake16 , f32,
172
190
[VINTERPModsHi, VINTERPMods, VINTERPModsHi]>;
173
191
defm : VInterpF16Pat<int_amdgcn_interp_inreg_p2_f16,
174
- V_INTERP_P2_F16_F32_inreg , f16,
192
+ V_INTERP_P2_F16_F32_inreg_fake16 , f16,
175
193
[VINTERPModsHi, VINTERPMods, VINTERPMods]>;
176
194
defm : VInterpF16Pat<int_amdgcn_interp_p10_rtz_f16,
177
- V_INTERP_P10_RTZ_F16_F32_inreg , f32,
195
+ V_INTERP_P10_RTZ_F16_F32_inreg_fake16 , f32,
178
196
[VINTERPModsHi, VINTERPMods, VINTERPModsHi]>;
179
197
defm : VInterpF16Pat<int_amdgcn_interp_p2_rtz_f16,
180
- V_INTERP_P2_RTZ_F16_F32_inreg , f16,
198
+ V_INTERP_P2_RTZ_F16_F32_inreg_fake16 , f16,
181
199
[VINTERPModsHi, VINTERPMods, VINTERPMods]>;
200
+ }
182
201
183
202
//===----------------------------------------------------------------------===//
184
203
// VINTERP Real Instructions
185
204
//===----------------------------------------------------------------------===//
186
205
187
- multiclass VINTERP_Real_gfx11 <bits<7> op> {
188
- let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in {
206
+ multiclass VINTERP_Real_gfx11 <bits<7> op, string asmName> {
207
+ defvar ps = !cast<VOP3_Pseudo>(NAME);
208
+ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" #
209
+ !if(ps.Pfl.IsRealTrue16, "", "_FAKE16") in {
189
210
def _gfx11 :
190
- VINTERP_Real<!cast<VOP3_Pseudo>(NAME) , SIEncodingFamily.GFX11>,
191
- VINTERPe_gfx11<op, !cast<VOP3_Pseudo>(NAME) .Pfl>;
211
+ VINTERP_Real<ps , SIEncodingFamily.GFX11, asmName >,
212
+ VINTERPe_gfx11<op, ps .Pfl>;
192
213
}
193
214
}
194
215
195
- multiclass VINTERP_Real_gfx12 <bits<7> op> {
196
- let AssemblerPredicate = isGFX12Only, DecoderNamespace = "GFX12" in {
216
+ multiclass VINTERP_Real_gfx12 <bits<7> op, string asmName> {
217
+ defvar ps = !cast<VOP3_Pseudo>(NAME);
218
+ let AssemblerPredicate = isGFX12Only, DecoderNamespace = "GFX12" #
219
+ !if(ps.Pfl.IsRealTrue16, "", "_FAKE16") in {
197
220
def _gfx12 :
198
- VINTERP_Real<!cast<VOP3_Pseudo>(NAME) , SIEncodingFamily.GFX12>,
199
- VINTERPe_gfx12<op, !cast<VOP3_Pseudo>(NAME) .Pfl>;
221
+ VINTERP_Real<ps , SIEncodingFamily.GFX12, asmName >,
222
+ VINTERPe_gfx12<op, ps .Pfl>;
200
223
}
201
224
}
202
225
203
- multiclass VINTERP_Real_gfx11_gfx12 <bits<7> op> :
204
- VINTERP_Real_gfx11<op>, VINTERP_Real_gfx12<op>;
226
+ multiclass VINTERP_Real_gfx11_gfx12 <bits<7> op, string asmName = !cast<VOP3_Pseudo>(NAME).Mnemonic, string opName = NAME> :
227
+ VINTERP_Real_gfx11<op, asmName>, VINTERP_Real_gfx12<op, asmName>;
228
+
229
+ multiclass VINTERP_Real_t16_and_fake16_gfx11_gfx12 <bits<7> op, string asmName = !cast<VOP3_Pseudo>(NAME).Mnemonic, string opName = NAME> {
230
+ defm _t16: VINTERP_Real_gfx11_gfx12<op, asmName, opName#"_t16">;
231
+ defm _fake16: VINTERP_Real_gfx11_gfx12<op, asmName, opName#"_fake16">;
232
+ }
233
+
205
234
206
235
defm V_INTERP_P10_F32_inreg : VINTERP_Real_gfx11_gfx12<0x000>;
207
236
defm V_INTERP_P2_F32_inreg : VINTERP_Real_gfx11_gfx12<0x001>;
208
- defm V_INTERP_P10_F16_F32_inreg : VINTERP_Real_gfx11_gfx12 <0x002>;
209
- defm V_INTERP_P2_F16_F32_inreg : VINTERP_Real_gfx11_gfx12 <0x003>;
210
- defm V_INTERP_P10_RTZ_F16_F32_inreg : VINTERP_Real_gfx11_gfx12 <0x004>;
211
- defm V_INTERP_P2_RTZ_F16_F32_inreg : VINTERP_Real_gfx11_gfx12 <0x005>;
237
+ defm V_INTERP_P10_F16_F32_inreg : VINTERP_Real_t16_and_fake16_gfx11_gfx12 <0x002, "v_interp_p10_f16_f32" >;
238
+ defm V_INTERP_P2_F16_F32_inreg : VINTERP_Real_t16_and_fake16_gfx11_gfx12 <0x003, "v_interp_p2_f16_f32" >;
239
+ defm V_INTERP_P10_RTZ_F16_F32_inreg : VINTERP_Real_t16_and_fake16_gfx11_gfx12 <0x004, "v_interp_p10_rtz_f16_f32" >;
240
+ defm V_INTERP_P2_RTZ_F16_F32_inreg : VINTERP_Real_t16_and_fake16_gfx11_gfx12 <0x005, "v_interp_p2_rtz_f16_f32" >;
0 commit comments