Address PR feedback
This commit is contained in:
parent
6e4aeff9e2
commit
5245960880
5 changed files with 33 additions and 29 deletions
|
@ -66,10 +66,11 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
EmitVectorExtractZx(Context, Op.Rn, 0, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, 0, Op.Size);
|
||||||
|
|
||||||
for (int Index = 1; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 1; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
||||||
|
|
||||||
|
@ -98,8 +99,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
||||||
|
|
||||||
|
@ -1202,10 +1204,11 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
EmitVectorExtractZx(Context, Op.Rn, 0, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, 0, Op.Size);
|
||||||
|
|
||||||
for (int Index = 1; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 1; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
||||||
|
|
||||||
|
|
|
@ -509,8 +509,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
if (Opers.HasFlag(OperFlags.Rd))
|
if (Opers.HasFlag(OperFlags.Rd))
|
||||||
{
|
{
|
||||||
|
@ -564,8 +565,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
if (Ternary)
|
if (Ternary)
|
||||||
{
|
{
|
||||||
|
@ -604,8 +606,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimdImm Op = (AOpCodeSimdImm)Context.CurrOp;
|
AOpCodeSimdImm Op = (AOpCodeSimdImm)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
if (Binary)
|
if (Binary)
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,12 +106,13 @@ namespace ChocolArm64.Instruction
|
||||||
}
|
}
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int SElem = 0; SElem < Op.SElems; SElem++)
|
for (int SElem = 0; SElem < Op.SElems; SElem++)
|
||||||
{
|
{
|
||||||
int Rt = (Op.Rt + SElem) & 0x1f;
|
int Rt = (Op.Rt + SElem) & 0x1f;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitMemAddress();
|
EmitMemAddress();
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp;
|
AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
Context.EmitLdintzr(Op.Rn);
|
Context.EmitLdintzr(Op.Rn);
|
||||||
|
|
||||||
|
@ -43,8 +44,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp;
|
AOpCodeSimdIns Op = (AOpCodeSimdIns)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtractZx(Context, Op.Rn, Op.DstIndex, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, Op.DstIndex, Op.Size);
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = Op.Imm - (8 << Op.Size);
|
EmitVectorShImmBinaryZx(Context, () => Context.Emit(OpCodes.Shl), GetImmShl(Op));
|
||||||
|
|
||||||
EmitVectorShImmBinaryZx(Context, () => Context.Emit(OpCodes.Shl), Shift);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Shll_V(AILEmitterCtx Context)
|
public static void Shll_V(AILEmitterCtx Context)
|
||||||
|
@ -45,9 +43,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = (8 << (Op.Size + 1)) - Op.Imm;
|
EmitVectorShImmNarrowBinaryZx(Context, () => Context.Emit(OpCodes.Shr_Un), GetImmShr(Op));
|
||||||
|
|
||||||
EmitVectorShImmNarrowBinaryZx(Context, () => Context.Emit(OpCodes.Shr_Un), Shift);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Sli_V(AILEmitterCtx Context)
|
public static void Sli_V(AILEmitterCtx Context)
|
||||||
|
@ -55,12 +51,13 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
int Shift = Op.Imm - (8 << Op.Size);
|
int Shift = GetImmShl(Op);
|
||||||
|
|
||||||
ulong Mask = Shift != 0 ? ulong.MaxValue >> (64 - Shift) : 0;
|
ulong Mask = Shift != 0 ? ulong.MaxValue >> (64 - Shift) : 0;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
||||||
|
|
||||||
|
@ -88,7 +85,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = (8 << (Op.Size + 1)) - Op.Imm;
|
int Shift = GetImmShr(Op);
|
||||||
|
|
||||||
long RoundConst = 1L << (Shift - 1);
|
long RoundConst = 1L << (Shift - 1);
|
||||||
|
|
||||||
|
@ -110,7 +107,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = (8 << (Op.Size + 1)) - Op.Imm;
|
int Shift = GetImmShr(Op);
|
||||||
|
|
||||||
long RoundConst = 1L << (Shift - 1);
|
long RoundConst = 1L << (Shift - 1);
|
||||||
|
|
||||||
|
@ -126,9 +123,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = Op.Imm - (8 << Op.Size);
|
EmitVectorShImmWidenBinarySx(Context, () => Context.Emit(OpCodes.Shl), GetImmShl(Op));
|
||||||
|
|
||||||
EmitVectorShImmWidenBinarySx(Context, () => Context.Emit(OpCodes.Shl), Shift);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Sshr_S(AILEmitterCtx Context)
|
public static void Sshr_S(AILEmitterCtx Context)
|
||||||
|
@ -148,7 +143,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = (8 << (Op.Size + 1)) - Op.Imm;
|
int Shift = GetImmShr(Op);
|
||||||
|
|
||||||
EmitVectorShImmBinarySx(Context, () => Context.Emit(OpCodes.Shr), Shift);
|
EmitVectorShImmBinarySx(Context, () => Context.Emit(OpCodes.Shr), Shift);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +152,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = (8 << (Op.Size + 1)) - Op.Imm;
|
int Shift = GetImmShr(Op);
|
||||||
|
|
||||||
Action Emit = () =>
|
Action Emit = () =>
|
||||||
{
|
{
|
||||||
|
@ -177,9 +172,7 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
AOpCodeSimdShImm Op = (AOpCodeSimdShImm)Context.CurrOp;
|
||||||
|
|
||||||
int Shift = Op.Imm - (8 << Op.Size);
|
EmitVectorShImmWidenBinaryZx(Context, () => Context.Emit(OpCodes.Shl), GetImmShl(Op));
|
||||||
|
|
||||||
EmitVectorShImmWidenBinaryZx(Context, () => Context.Emit(OpCodes.Shl), Shift);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Ushr_S(AILEmitterCtx Context)
|
public static void Ushr_S(AILEmitterCtx Context)
|
||||||
|
@ -304,8 +297,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
if (Ternary)
|
if (Ternary)
|
||||||
{
|
{
|
||||||
|
@ -337,8 +331,9 @@ namespace ChocolArm64.Instruction
|
||||||
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
||||||
|
|
||||||
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
int Elems = Bytes >> Op.Size;
|
||||||
|
|
||||||
for (int Index = 0; Index < (Bytes >> Op.Size); Index++)
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
{
|
{
|
||||||
EmitVectorExtract(Context, Op.Rn, Index, Op.Size, Signed);
|
EmitVectorExtract(Context, Op.Rn, Index, Op.Size, Signed);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue