Arm64: Simplify TryEncodeBitMask and use for constants (#4328)
* Arm64: Simplify TryEncodeBitMask * CodeGenerator: Use TryEncodeBitMask in GenerateConstantCopy * Ptc: Bump version
This commit is contained in:
parent
32a1cd83fd
commit
4f293f8cbe
5 changed files with 81 additions and 107 deletions
|
@ -1303,7 +1303,15 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
|
||||
private static void GenerateConstantCopy(CodeGenContext context, Operand dest, ulong value)
|
||||
{
|
||||
if (value != 0)
|
||||
if (value == 0)
|
||||
{
|
||||
context.Assembler.Mov(dest, Register(ZrRegister, dest.Type));
|
||||
}
|
||||
else if (CodeGenCommon.TryEncodeBitMask(dest.Type, value, out _, out _, out _))
|
||||
{
|
||||
context.Assembler.Orr(dest, Register(ZrRegister, dest.Type), Const(dest.Type, (long)value));
|
||||
}
|
||||
else
|
||||
{
|
||||
int hw = 0;
|
||||
bool first = true;
|
||||
|
@ -1328,10 +1336,6 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
value >>= 16;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Assembler.Mov(dest, Register(ZrRegister, dest.Type));
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateAtomicCas(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue