Arm64: Minor optimization to bfxil and bfi

When the destination doesn't alias the source, we can remove a final mov
from both of these operations.

Does some minor code improvement.
This commit is contained in:
Ryan Houdek 2023-10-26 20:25:44 -07:00
parent 4045bfd187
commit 61f22911c7

View File

@ -1227,6 +1227,11 @@ DEF_OP(Bfi) {
// If Dst and SrcDst match then this turns in to a simple BFI instruction.
bfi(EmitSize, Dst, Src, Op->lsb, Op->Width);
}
else if (Dst != Src) {
// If the destination isn't the source then we can move the DstSrc and insert directly.
mov(EmitSize, Dst, SrcDst);
bfi(EmitSize, Dst, Src, Op->lsb, Op->Width);
}
else {
// Destination didn't match the dst source register.
// TODO: Inefficient until FEX can have RA constraints here.
@ -1256,6 +1261,11 @@ DEF_OP(Bfxil) {
// If Dst and SrcDst match then this turns in to a single instruction.
bfxil(EmitSize, Dst, Src, Op->lsb, Op->Width);
}
else if (Dst != Src) {
// If the destination isn't the source then we can move the DstSrc and insert directly.
mov(EmitSize, Dst, SrcDst);
bfxil(EmitSize, Dst, Src, Op->lsb, Op->Width);
}
else {
// Destination didn't match the dst source register.
// TODO: Inefficient until FEX can have RA constraints here.