Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7586 from a7ehuo/fix-xmm-register-type
Browse files Browse the repository at this point in the history
x86: Use TR_VRF type for XMM temp registers in arraycopy
  • Loading branch information
0xdaryl authored Dec 9, 2024
2 parents 937b947 + b55409a commit b766d37
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions compiler/x/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,7 @@ static bool enablePrimitiveArrayCopyInlineSmallSizeWithoutREPMOVS(uint8_t elemen
* The code generator
*
*/
static void generateArrayElementStore(TR::Node* node, TR::Register* addressReg, int32_t index, TR::Register* valueReg, uint8_t size, TR::CodeGenerator* cg)
static void generateArrayElementStore(TR::Node* node, TR::Register* addressReg, int32_t index, TR::Register* valueReg, uint8_t size, TR::CodeGenerator* cg)
{
TR::InstOpCode::Mnemonic storeOpcode;
if (valueReg->getKind() == TR_VRF)
Expand Down Expand Up @@ -2853,9 +2853,6 @@ static void generateArrayElementStore(TR::Node* node, TR::Register* addressReg,
case 8:
storeOpcode = TR::InstOpCode::MOVQMemReg;
break;
case 16:
storeOpcode = TR::InstOpCode::MOVDQUMemReg;
break;
default:
TR_ASSERT_FATAL(0, "%s: Unsupported size: %u for TR_FPR registers\n", __FUNCTION__, size);
break;
Expand Down Expand Up @@ -2942,9 +2939,6 @@ static void generateArrayElementLoad(TR::Node* node, TR::Register* valueReg, uin
case 8:
loadOpCode = TR::InstOpCode::MOVQRegMem;
break;
case 16:
loadOpCode = TR::InstOpCode::MOVDQURegMem;
break;
default:
TR_ASSERT_FATAL(0, "%s: Unsupported size %u for TR_FPR registers\n", __FUNCTION__, size);
break;
Expand Down Expand Up @@ -3199,7 +3193,7 @@ static void arraycopyForShortConstArrayWithDirection(TR::Node* node, TR::Registe
{
if (xmmReg == NULL && regSize[i] == 16)
{
xmmReg = cg->allocateRegister(TR_FPR);
xmmReg = cg->allocateRegister(TR_VRF);
}
else if (gprReg == NULL && regSize[i] < 16)
{
Expand Down Expand Up @@ -3256,7 +3250,7 @@ static void arraycopyForShortConstArrayWithoutDirection(TR::Node* node, TR::Regi
// First load as many bytes as possible into XMM
for (uint32_t i=0; i<moves[0]; i++)
{
TR::Register* xmmReg = cg->allocateRegister(TR_FPR);
TR::Register* xmmReg = cg->allocateRegister(TR_VRF);
generateArrayElementLoad(node, xmmReg, 16, srcReg, i*16, cg);
xmmUsed[i] = xmmReg;
}
Expand All @@ -3283,7 +3277,7 @@ static void arraycopyForShortConstArrayWithoutDirection(TR::Node* node, TR::Regi
}
else if (totalSize > 16 && residue > 0) // shift 1 xmm
{
reg1 = cg->allocateRegister(TR_FPR);
reg1 = cg->allocateRegister(TR_VRF);
generateArrayElementLoad(node, reg1, 16, srcReg, totalSize - 16, cg);
residueCase = 2;
}
Expand All @@ -3297,7 +3291,7 @@ static void arraycopyForShortConstArrayWithoutDirection(TR::Node* node, TR::Regi
}
else if (residue != 0) // 1 gpr + 1 xmm
{
reg1 = cg->allocateRegister(TR_FPR);
reg1 = cg->allocateRegister(TR_VRF);
reg2 = srcReg;
firstLoadSizeForCase4 = residue>8? 8:4;
secondLoadSizeForCase4 = (residue - firstLoadSizeForCase4);
Expand Down Expand Up @@ -3632,7 +3626,7 @@ static void arraySetToZeroForShortConstantArrays(TR::Node* node, TR::Register* a
}
else
{
tempReg = cg->allocateRegister(TR_FPR);
tempReg = cg->allocateRegister(TR_VRF);
generateRegRegInstruction(TR::InstOpCode::XORPDRegReg, node, tempReg, tempReg, cg);
int32_t moves = static_cast<int32_t>(size/16);
for (int32_t i=0; i<moves; i++)
Expand Down Expand Up @@ -3731,7 +3725,7 @@ static void arraySetForShortConstantArrays(TR::Node* node, uint8_t elementSize,
}
else
{
TR::Register* XMM = cg->allocateRegister(TR_FPR);
TR::Register* XMM = cg->allocateRegister(TR_VRF);
packXMMWithMultipleValues(node, XMM, valueReg, elementSize, cg);

for (int32_t i=0; i<moves[0]; i++)
Expand Down

0 comments on commit b766d37

Please sign in to comment.