@@ -90,31 +90,7 @@ bool emitter::IsApxOnlyInstruction(instruction ins)
9090 return (ins >= INS_FIRST_APX_INSTRUCTION) && (ins <= INS_LAST_APX_INSTRUCTION);
9191}
9292
93- bool emitter::IsFMAInstruction(instruction ins)
94- {
95- return (ins >= INS_FIRST_FMA_INSTRUCTION) && (ins <= INS_LAST_FMA_INSTRUCTION);
96- }
97-
98- bool emitter::IsAVXVNNIInstruction(instruction ins)
99- {
100- return (ins >= INS_FIRST_AVXVNNI_INSTRUCTION) && (ins <= INS_LAST_AVXVNNI_INSTRUCTION);
101- }
102-
103- bool emitter::IsBMIInstruction(instruction ins)
104- {
105- return (ins >= INS_FIRST_BMI_INSTRUCTION) && (ins <= INS_LAST_BMI_INSTRUCTION);
106- }
107-
108- //------------------------------------------------------------------------
109- // IsPermuteVar2xInstruction: Is this an Avx512 permutex2var instruction?
110- //
111- // Arguments:
112- // ins - The instruction to check.
113- //
114- // Returns:
115- // `true` if it is a permutex2var instruction.
116- //
117- bool emitter::IsPermuteVar2xInstruction(instruction ins)
93+ bool emitter::Is3OpRmwInstruction(instruction ins)
11894{
11995 switch (ins)
12096 {
@@ -136,11 +112,18 @@ bool emitter::IsPermuteVar2xInstruction(instruction ins)
136112
137113 default:
138114 {
139- return false;
115+ return ((ins >= INS_FIRST_FMA_INSTRUCTION) && (ins <= INS_LAST_FMA_INSTRUCTION)) ||
116+ ((ins >= INS_FIRST_AVXVNNI_INSTRUCTION) && (ins <= INS_LAST_AVXVNNI_INSTRUCTION)) ||
117+ ((ins >= INS_FIRST_AVXIFMA_INSTRUCTION) && (ins <= INS_LAST_AVXIFMA_INSTRUCTION));
140118 }
141119 }
142120}
143121
122+ bool emitter::IsBMIInstruction(instruction ins)
123+ {
124+ return (ins >= INS_FIRST_BMI_INSTRUCTION) && (ins <= INS_LAST_BMI_INSTRUCTION);
125+ }
126+
144127//------------------------------------------------------------------------
145128// IsKMOVInstruction: Is this an Avx512 KMOV instruction?
146129//
@@ -255,18 +238,6 @@ regNumber emitter::getSseShiftRegNumber(instruction ins)
255238 }
256239}
257240
258- bool emitter::HasVexEncoding(instruction ins)
259- {
260- insFlags flags = CodeGenInterface::instInfo[ins];
261- return (flags & Encoding_VEX) != 0;
262- }
263-
264- bool emitter::HasEvexEncoding(instruction ins)
265- {
266- insFlags flags = CodeGenInterface::instInfo[ins];
267- return (flags & Encoding_EVEX) != 0;
268- }
269-
270241bool emitter::HasRex2Encoding(instruction ins)
271242{
272243 insFlags flags = CodeGenInterface::instInfo[ins];
@@ -291,7 +262,29 @@ bool emitter::IsVexEncodableInstruction(instruction ins) const
291262 {
292263 return false;
293264 }
294- return HasVexEncoding(ins);
265+
266+ switch (ins)
267+ {
268+ case INS_vpdpbusd:
269+ case INS_vpdpwssd:
270+ case INS_vpdpbusds:
271+ case INS_vpdpwssds:
272+ {
273+ return emitComp->compOpportunisticallyDependsOn(InstructionSet_AVXVNNI);
274+ }
275+
276+ case INS_vpmadd52huq:
277+ case INS_vpmadd52luq:
278+ {
279+ return emitComp->compOpportunisticallyDependsOn(InstructionSet_AVXIFMA);
280+ }
281+
282+ default:
283+ {
284+ insFlags flags = CodeGenInterface::instInfo[ins];
285+ return (flags & Encoding_VEX) != 0;
286+ }
287+ }
295288}
296289
297290//------------------------------------------------------------------------
@@ -312,14 +305,37 @@ bool emitter::IsEvexEncodableInstruction(instruction ins) const
312305
313306 switch (ins)
314307 {
308+ case INS_aesdec:
309+ case INS_aesdeclast:
310+ case INS_aesenc:
311+ case INS_aesenclast:
312+ {
313+ return emitComp->compOpportunisticallyDependsOn(InstructionSet_AES_V256);
314+ }
315+
315316 case INS_pclmulqdq:
316317 {
317318 return emitComp->compOpportunisticallyDependsOn(InstructionSet_PCLMULQDQ_V256);
318319 }
319320
321+ case INS_vpdpbusd:
322+ case INS_vpdpwssd:
323+ case INS_vpdpbusds:
324+ case INS_vpdpwssds:
325+ {
326+ return emitComp->compOpportunisticallyDependsOn(InstructionSet_AVX512VNNI);
327+ }
328+
329+ case INS_vpmadd52huq:
330+ case INS_vpmadd52luq:
331+ {
332+ return emitComp->compOpportunisticallyDependsOn(InstructionSet_AVX512IFMA);
333+ }
334+
320335 default:
321336 {
322- return HasEvexEncoding(ins);
337+ insFlags flags = CodeGenInterface::instInfo[ins];
338+ return (flags & Encoding_EVEX) != 0;
323339 }
324340 }
325341}
@@ -2053,7 +2069,7 @@ emitter::code_t emitter::AddEvexPrefix(const instrDesc* id, code_t code, emitAtt
20532069
20542070 if (IsApxExtendedEvexInstruction(ins))
20552071 {
2056- if (!HasEvexEncoding (ins))
2072+ if (!IsEvexEncodableInstruction (ins))
20572073 {
20582074 // Legacy-promoted insutrcions are not labeled with Encoding_EVEX.
20592075 code |= MAP4_IN_BYTE_EVEX_PREFIX;
@@ -10008,7 +10024,7 @@ void emitter::emitIns_SIMD_R_R_R_A(instruction ins,
1000810024 GenTreeIndir* indir,
1000910025 insOpts instOptions)
1001010026{
10011- assert(IsFMAInstruction(ins) || IsPermuteVar2xInstruction(ins) || IsAVXVNNIInstruction (ins));
10027+ assert(Is3OpRmwInstruction (ins));
1001210028 assert(UseSimdEncoding());
1001310029
1001410030 // Ensure we aren't overwriting op2
@@ -10041,7 +10057,7 @@ void emitter::emitIns_SIMD_R_R_R_C(instruction ins,
1004110057 int offs,
1004210058 insOpts instOptions)
1004310059{
10044- assert(IsFMAInstruction(ins) || IsPermuteVar2xInstruction(ins) || IsAVXVNNIInstruction (ins));
10060+ assert(Is3OpRmwInstruction (ins));
1004510061 assert(UseSimdEncoding());
1004610062
1004710063 // Ensure we aren't overwriting op2
@@ -10072,7 +10088,7 @@ void emitter::emitIns_SIMD_R_R_R_R(instruction ins,
1007210088 regNumber op3Reg,
1007310089 insOpts instOptions)
1007410090{
10075- if (IsFMAInstruction(ins) || IsPermuteVar2xInstruction(ins) || IsAVXVNNIInstruction (ins))
10091+ if (Is3OpRmwInstruction (ins))
1007610092 {
1007710093 assert(UseSimdEncoding());
1007810094
@@ -10159,7 +10175,7 @@ void emitter::emitIns_SIMD_R_R_R_S(instruction ins,
1015910175 int offs,
1016010176 insOpts instOptions)
1016110177{
10162- assert(IsFMAInstruction(ins) || IsPermuteVar2xInstruction(ins) || IsAVXVNNIInstruction (ins));
10178+ assert(Is3OpRmwInstruction (ins));
1016310179 assert(UseSimdEncoding());
1016410180
1016510181 // Ensure we aren't overwriting op2
@@ -20883,8 +20899,8 @@ emitter::insExecutionCharacteristics emitter::getInsExecutionCharacteristics(ins
2088320899 case INS_vmovdqu8:
2088420900 case INS_vmovdqu16:
2088520901 case INS_vmovdqu64:
20886- case INS_vmovd :
20887- case INS_vmovw :
20902+ case INS_vmovd_simd :
20903+ case INS_vmovw_simd :
2088820904 case INS_movaps:
2088920905 case INS_movups:
2089020906 case INS_movapd:
0 commit comments