diff --git a/src/coreclr/jit/lsrabuild.cpp b/src/coreclr/jit/lsrabuild.cpp index 882008acc9921b..f5f2ad7f409d9b 100644 --- a/src/coreclr/jit/lsrabuild.cpp +++ b/src/coreclr/jit/lsrabuild.cpp @@ -1876,6 +1876,10 @@ const unsigned lsraRegOrderSize = ArrLen(lsraRegOrder); // TODO-XARCH-AVX512 we might want to move this to be configured with the rbm variables too static const regNumber lsraRegOrderFlt[] = {REG_VAR_ORDER_FLT}; const unsigned lsraRegOrderFltSize = ArrLen(lsraRegOrderFlt); +#if defined(TARGET_AMD64) +static const regNumber lsraRegOrderFltUpper[] = {REG_VAR_ORDER_FLT_UPPER}; +const unsigned lsraRegOrderUpperFltSize = ArrLen(lsraRegOrderFltUpper); +#endif // TARGET_AMD64 //------------------------------------------------------------------------ // buildPhysRegRecords: Make an interval for each physical register @@ -1899,6 +1903,17 @@ void LinearScan::buildPhysRegRecords() RegRecord* curr = &physRegs[reg]; curr->regOrder = (unsigned char)i; } +#if defined(TARGET_AMD64) + if (compiler->canUseEvexEncoding()) + { + for (unsigned int i = 0; i < lsraRegOrderUpperFltSize; i++) + { + regNumber reg = lsraRegOrderFltUpper[i]; + RegRecord* curr = &physRegs[reg]; + curr->regOrder = (unsigned char)(i + lsraRegOrderFltSize); + } + } +#endif // TARGET_AMD64 } //------------------------------------------------------------------------ diff --git a/src/coreclr/jit/targetamd64.h b/src/coreclr/jit/targetamd64.h index 408bbd99c3e5cc..bf5b0d57c8d81f 100644 --- a/src/coreclr/jit/targetamd64.h +++ b/src/coreclr/jit/targetamd64.h @@ -227,9 +227,12 @@ #endif #define REG_VAR_ORDER_FLT REG_XMM0,REG_XMM1,REG_XMM2,REG_XMM3,REG_XMM4,REG_XMM5,REG_XMM6,REG_XMM7, \ - REG_XMM8,REG_XMM9,REG_XMM10,REG_XMM11,REG_XMM12,REG_XMM13,REG_XMM14,REG_XMM15, \ - REG_XMM16,REG_XMM17,REG_XMM18,REG_XMM19,REG_XMM20,REG_XMM21,REG_XMM22,REG_XMM23, \ - REG_XMM24,REG_XMM25,REG_XMM26,REG_XMM27,REG_XMM28,REG_XMM29,REG_XMM30,REG_XMM31 + REG_XMM8,REG_XMM9,REG_XMM10,REG_XMM11,REG_XMM12,REG_XMM13,REG_XMM14,REG_XMM15 +#if defined(TARGET_AMD64) + #define REG_VAR_ORDER_FLT_UPPER REG_XMM16,REG_XMM17,REG_XMM18,REG_XMM19,REG_XMM20,REG_XMM21,REG_XMM22,REG_XMM23, \ + REG_XMM24,REG_XMM25,REG_XMM26,REG_XMM27,REG_XMM28,REG_XMM29,REG_XMM30,REG_XMM31 +#endif // TARGET_AMD64 + #ifdef UNIX_AMD64_ABI #define CNT_CALLEE_SAVED (5 + REG_ETW_FRAMED_EBP_COUNT)