Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checks to accommodate register wraparounds in multi-reg ops #101430

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ class CodeGen final : public CodeGenInterface
}
}

#if defined(TARGET_ARM64)
regNumber getNextSIMDRegWithWraparound(regNumber reg)
{
regNumber nextReg = REG_NEXT(reg);

// Wraparound if necessary, REG_V0 comes next after REG_V31.
return (nextReg > REG_V31) ? REG_V0 : nextReg;
}
#endif // defined(TARGET_ARM64)

static GenTreeIndir indirForm(var_types type, GenTree* base);
static GenTreeStoreInd storeIndirForm(var_types type, GenTree* base, GenTree* data);

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/hwintrinsiccodegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)

GenTree* argNode = use.GetNode();
assert(argReg == argNode->GetRegNum());
argReg = REG_NEXT(argReg);
argReg = getNextSIMDRegWithWraparound(argReg);
}
assert((ins == INS_st2 && regCount == 2) || (ins == INS_st3 && regCount == 3) ||
(ins == INS_st4 && regCount == 4));
Expand Down Expand Up @@ -883,7 +883,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)

GenTree* argNode = use.GetNode();
assert(argReg == argNode->GetRegNum());
argReg = REG_NEXT(argReg);
argReg = getNextSIMDRegWithWraparound(argReg);
}
assert((ins == INS_st1_2regs && regCount == 2) || (ins == INS_st2 && regCount == 2) ||
(ins == INS_st1_3regs && regCount == 3) || (ins == INS_st3 && regCount == 3) ||
Expand Down Expand Up @@ -1186,7 +1186,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)

GenTree* argNode = use.GetNode();
assert(argReg == argNode->GetRegNum());
argReg = REG_NEXT(argReg);
argReg = getNextSIMDRegWithWraparound(argReg);
#endif
}
}
Expand Down Expand Up @@ -1241,7 +1241,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
assert(argReg == argNode->GetRegNum());
// and they should not interfere with targetReg
assert(targetReg != argReg);
argReg = REG_NEXT(argReg);
argReg = getNextSIMDRegWithWraparound(argReg);
#endif
}
}
Expand Down