@@ -225,24 +225,25 @@ static bool CompressEVEXImpl(MachineInstr &MI, const X86Subtarget &ST) {
225225 //
226226 // For AVX512 cases, EVEX prefix is needed in order to carry this information
227227 // thus preventing the transformation to VEX encoding.
228- // MOVBE*rr is special because it has semantic of NDD but not set EVEX_B.
229- bool IsMovberr =
230- MI.getOpcode () == X86::MOVBE32rr || MI.getOpcode () == X86::MOVBE64rr;
228+ unsigned Opc = MI.getOpcode ();
231229 bool IsND = X86II::hasNewDataDest (TSFlags);
232- if ((TSFlags & X86II::EVEX_B) || IsMovberr)
233- if ((!IsND && !IsMovberr) || !isRedundantNewDataDest (MI, ST))
234- return false ;
230+ if (TSFlags & X86II::EVEX_B && !IsND)
231+ return false ;
232+ // MOVBE*rr is special because it has semantic of NDD but not set EVEX_B.
233+ bool IsNDLike = IsND || Opc == X86::MOVBE32rr || Opc == X86::MOVBE64rr;
234+ if (IsNDLike && !isRedundantNewDataDest (MI, ST))
235+ return false ;
235236
236237 ArrayRef<X86CompressEVEXTableEntry> Table = ArrayRef (X86CompressEVEXTable);
237238
238- unsigned Opc = MI.getOpcode ();
239+ Opc = MI.getOpcode ();
239240 const auto *I = llvm::lower_bound (Table, Opc);
240241 if (I == Table.end () || I->OldOpc != Opc) {
241- assert (!IsND && " Missing entry for ND instruction" );
242+ assert (!IsNDLike && " Missing entry for ND-like instruction" );
242243 return false ;
243244 }
244245
245- if (!IsND && !IsMovberr ) {
246+ if (!IsNDLike ) {
246247 if (usesExtendedRegister (MI) || !checkPredicate (I->NewOpc , &ST) ||
247248 !performCustomAdjustments (MI, I->NewOpc ))
248249 return false ;
@@ -267,7 +268,7 @@ static bool CompressEVEXImpl(MachineInstr &MI, const X86Subtarget &ST) {
267268 llvm_unreachable (" Unknown EVEX compression" );
268269 }
269270 MI.setAsmPrinterFlag (AsmComment);
270- if (IsND || IsMovberr )
271+ if (IsNDLike )
271272 MI.tieOperands (0 , 1 );
272273
273274 return true ;
0 commit comments