Merge d7263d0574
into e5917f8968
This commit is contained in:
commit
fe7404f30b
3 changed files with 89 additions and 28 deletions
|
@ -276,10 +276,12 @@ namespace ChocolArm64
|
||||||
SetA64("000111110x0xxxxx0xxxxxxxxxxxxxxx", AInstEmit.Fmadd_S, typeof(AOpCodeSimdReg));
|
SetA64("000111110x0xxxxx0xxxxxxxxxxxxxxx", AInstEmit.Fmadd_S, typeof(AOpCodeSimdReg));
|
||||||
SetA64("000111100x1xxxxx010010xxxxxxxxxx", AInstEmit.Fmax_S, typeof(AOpCodeSimdReg));
|
SetA64("000111100x1xxxxx010010xxxxxxxxxx", AInstEmit.Fmax_S, typeof(AOpCodeSimdReg));
|
||||||
SetA64("0>0011100<1xxxxx111101xxxxxxxxxx", AInstEmit.Fmax_V, typeof(AOpCodeSimdReg));
|
SetA64("0>0011100<1xxxxx111101xxxxxxxxxx", AInstEmit.Fmax_V, typeof(AOpCodeSimdReg));
|
||||||
|
SetA64("0x1011100x1xxxxx111101xxxxxxxxxx", AInstEmit.Fmaxp_V, typeof(AOpCodeSimdReg));
|
||||||
SetA64("000111100x1xxxxx011010xxxxxxxxxx", AInstEmit.Fmaxnm_S, typeof(AOpCodeSimdReg));
|
SetA64("000111100x1xxxxx011010xxxxxxxxxx", AInstEmit.Fmaxnm_S, typeof(AOpCodeSimdReg));
|
||||||
SetA64("0>0011100<1xxxxx110001xxxxxxxxxx", AInstEmit.Fmaxnm_V, typeof(AOpCodeSimdReg));
|
SetA64("0>0011100<1xxxxx110001xxxxxxxxxx", AInstEmit.Fmaxnm_V, typeof(AOpCodeSimdReg));
|
||||||
SetA64("000111100x1xxxxx010110xxxxxxxxxx", AInstEmit.Fmin_S, typeof(AOpCodeSimdReg));
|
SetA64("000111100x1xxxxx010110xxxxxxxxxx", AInstEmit.Fmin_S, typeof(AOpCodeSimdReg));
|
||||||
SetA64("0>0011101<1xxxxx111101xxxxxxxxxx", AInstEmit.Fmin_V, typeof(AOpCodeSimdReg));
|
SetA64("0>0011101<1xxxxx111101xxxxxxxxxx", AInstEmit.Fmin_V, typeof(AOpCodeSimdReg));
|
||||||
|
SetA64("0x1011101x1xxxxx111101xxxxxxxxxx", AInstEmit.Fminp_V, typeof(AOpCodeSimdReg));
|
||||||
SetA64("000111100x1xxxxx011110xxxxxxxxxx", AInstEmit.Fminnm_S, typeof(AOpCodeSimdReg));
|
SetA64("000111100x1xxxxx011110xxxxxxxxxx", AInstEmit.Fminnm_S, typeof(AOpCodeSimdReg));
|
||||||
SetA64("0>0011101<1xxxxx110001xxxxxxxxxx", AInstEmit.Fminnm_V, typeof(AOpCodeSimdReg));
|
SetA64("0>0011101<1xxxxx110001xxxxxxxxxx", AInstEmit.Fminnm_V, typeof(AOpCodeSimdReg));
|
||||||
SetA64("010111111<<xxxxx0001x0xxxxxxxxxx", AInstEmit.Fmla_Se, typeof(AOpCodeSimdRegElemF));
|
SetA64("010111111<<xxxxx0001x0xxxxxxxxxx", AInstEmit.Fmla_Se, typeof(AOpCodeSimdRegElemF));
|
||||||
|
|
|
@ -341,34 +341,7 @@ namespace ChocolArm64.Instruction
|
||||||
|
|
||||||
public static void Faddp_V(AILEmitterCtx Context)
|
public static void Faddp_V(AILEmitterCtx Context)
|
||||||
{
|
{
|
||||||
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
EmitVectorPairwiseFloat(Context, OpCodes.Add);
|
||||||
|
|
||||||
int SizeF = Op.Size & 1;
|
|
||||||
|
|
||||||
int Bytes = Op.GetBitsCount() >> 3;
|
|
||||||
|
|
||||||
int Elems = Bytes >> SizeF + 2;
|
|
||||||
int Half = Elems >> 1;
|
|
||||||
|
|
||||||
for (int Index = 0; Index < Elems; Index++)
|
|
||||||
{
|
|
||||||
int Elem = (Index & (Half - 1)) << 1;
|
|
||||||
|
|
||||||
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 0, SizeF);
|
|
||||||
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 1, SizeF);
|
|
||||||
|
|
||||||
Context.Emit(OpCodes.Add);
|
|
||||||
|
|
||||||
EmitVectorInsertTmpF(Context, Index, SizeF);
|
|
||||||
}
|
|
||||||
|
|
||||||
Context.EmitLdvectmp();
|
|
||||||
Context.EmitStvec(Op.Rd);
|
|
||||||
|
|
||||||
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
|
||||||
{
|
|
||||||
EmitVectorZeroUpper(Context, Op.Rd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Fdiv_S(AILEmitterCtx Context)
|
public static void Fdiv_S(AILEmitterCtx Context)
|
||||||
|
@ -436,6 +409,11 @@ namespace ChocolArm64.Instruction
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Fmaxp_V(AILEmitterCtx Context)
|
||||||
|
{
|
||||||
|
EmitVectorPairwiseFloat(Context, nameof(ASoftFloat.Max), nameof(ASoftFloat.Max));
|
||||||
|
}
|
||||||
|
|
||||||
public static void Fmin_S(AILEmitterCtx Context)
|
public static void Fmin_S(AILEmitterCtx Context)
|
||||||
{
|
{
|
||||||
EmitScalarBinaryOpF(Context, () =>
|
EmitScalarBinaryOpF(Context, () =>
|
||||||
|
@ -452,6 +430,12 @@ namespace ChocolArm64.Instruction
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Fminp_V(AILEmitterCtx Context)
|
||||||
|
{
|
||||||
|
EmitVectorPairwiseFloat(Context, nameof(ASoftFloat.Min), nameof(ASoftFloat.Min));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Fminnm_S(AILEmitterCtx Context)
|
public static void Fminnm_S(AILEmitterCtx Context)
|
||||||
{
|
{
|
||||||
EmitScalarBinaryOpF(Context, () =>
|
EmitScalarBinaryOpF(Context, () =>
|
||||||
|
|
|
@ -1371,6 +1371,81 @@ namespace ChocolArm64.Instruction
|
||||||
Context.EmitStvectmp();
|
Context.EmitStvectmp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void EmitVectorPairwiseFloat(AILEmitterCtx Context, OpCode EmitMethod)
|
||||||
|
{
|
||||||
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
||||||
|
|
||||||
|
int SizeF = Op.Size & 1;
|
||||||
|
|
||||||
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
|
||||||
|
int Elems = Bytes >> SizeF + 2;
|
||||||
|
int Half = Elems >> 1;
|
||||||
|
|
||||||
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
|
{
|
||||||
|
int Elem = (Index & (Half - 1)) << 1;
|
||||||
|
|
||||||
|
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 0, SizeF);
|
||||||
|
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 1, SizeF);
|
||||||
|
|
||||||
|
Context.Emit(EmitMethod);
|
||||||
|
|
||||||
|
EmitVectorInsertTmpF(Context, Index, SizeF);
|
||||||
|
}
|
||||||
|
|
||||||
|
Context.EmitLdvectmp();
|
||||||
|
Context.EmitStvec(Op.Rd);
|
||||||
|
|
||||||
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
||||||
|
{
|
||||||
|
EmitVectorZeroUpper(Context, Op.Rd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EmitVectorPairwiseFloat(AILEmitterCtx Context, string EmitMethodF, string EmitMethod)
|
||||||
|
{
|
||||||
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
||||||
|
|
||||||
|
int SizeF = Op.Size & 1;
|
||||||
|
|
||||||
|
int Bytes = Context.CurrOp.GetBitsCount() >> 3;
|
||||||
|
|
||||||
|
int Elems = Bytes >> SizeF + 2;
|
||||||
|
int Half = Elems >> 1;
|
||||||
|
|
||||||
|
for (int Index = 0; Index < Elems; Index++)
|
||||||
|
{
|
||||||
|
int Elem = (Index & (Half - 1)) << 1;
|
||||||
|
|
||||||
|
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 0, SizeF);
|
||||||
|
EmitVectorExtractF(Context, Index < Half ? Op.Rn : Op.Rm, Elem + 1, SizeF);
|
||||||
|
|
||||||
|
if (SizeF == 0)
|
||||||
|
{
|
||||||
|
AVectorHelper.EmitCall(Context, EmitMethodF);
|
||||||
|
}
|
||||||
|
else if (SizeF == 1)
|
||||||
|
{
|
||||||
|
AVectorHelper.EmitCall(Context, EmitMethod);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
EmitVectorInsertTmpF(Context, Index, SizeF);
|
||||||
|
}
|
||||||
|
|
||||||
|
Context.EmitLdvectmp();
|
||||||
|
Context.EmitStvec(Op.Rd);
|
||||||
|
|
||||||
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
||||||
|
{
|
||||||
|
EmitVectorZeroUpper(Context, Op.Rd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void ThrowIfInvalid(int Index, int Size)
|
private static void ThrowIfInvalid(int Index, int Size)
|
||||||
{
|
{
|
||||||
if ((uint)Size > 3)
|
if ((uint)Size > 3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue