2018-03-02 18:24:16 -05:00
|
|
|
using ChocolArm64.Decoder;
|
|
|
|
using ChocolArm64.State;
|
2018-02-17 16:06:11 -05:00
|
|
|
using ChocolArm64.Translation;
|
2018-06-25 17:40:55 -04:00
|
|
|
using System;
|
2018-02-17 16:06:11 -05:00
|
|
|
using System.Reflection.Emit;
|
2018-05-11 19:10:27 -04:00
|
|
|
using System.Runtime.Intrinsics.X86;
|
2018-02-17 16:06:11 -05:00
|
|
|
|
|
|
|
using static ChocolArm64.Instruction.AInstEmitSimdHelper;
|
|
|
|
|
|
|
|
namespace ChocolArm64.Instruction
|
|
|
|
{
|
|
|
|
static partial class AInstEmit
|
|
|
|
{
|
|
|
|
public static void And_V(AILEmitterCtx Context)
|
|
|
|
{
|
2018-05-11 19:10:27 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitSse2Op(Context, nameof(Sse2.And));
|
2018-05-11 19:10:27 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitVectorBinaryOpZx(Context, () => Context.Emit(OpCodes.And));
|
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Bic_V(AILEmitterCtx Context)
|
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
2018-02-17 16:06:11 -05:00
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
|
|
|
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rm, Op.Size);
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rn, Op.Size);
|
|
|
|
|
|
|
|
Type[] Types = new Type[]
|
|
|
|
{
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size],
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size]
|
|
|
|
};
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.AndNot), Types));
|
|
|
|
|
|
|
|
EmitStvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
|
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
|
|
|
{
|
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitVectorBinaryOpZx(Context, () =>
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Not);
|
|
|
|
Context.Emit(OpCodes.And);
|
|
|
|
});
|
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Bic_Vi(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitVectorImmBinaryOp(Context, () =>
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Not);
|
|
|
|
Context.Emit(OpCodes.And);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-03-15 23:42:44 -04:00
|
|
|
public static void Bif_V(AILEmitterCtx Context)
|
2018-03-30 15:46:00 -04:00
|
|
|
{
|
|
|
|
EmitBitBif(Context, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Bit_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitBitBif(Context, false);
|
|
|
|
}
|
|
|
|
|
2018-06-02 10:44:52 -04:00
|
|
|
private static void EmitBitBif(AILEmitterCtx Context, bool NotRm)
|
2018-03-15 23:42:44 -04:00
|
|
|
{
|
|
|
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
2018-03-15 23:42:44 -04:00
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Type[] Types = new Type[]
|
|
|
|
{
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size],
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size]
|
|
|
|
};
|
|
|
|
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rm, Op.Size);
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rn, Op.Size);
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.Xor), Types));
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
string Name = NotRm ? nameof(Sse2.AndNot) : nameof(Sse2.And);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(Name, Types));
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.Xor), Types));
|
|
|
|
|
|
|
|
EmitStvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
|
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
2018-03-30 15:46:00 -04:00
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
2018-03-30 15:46:00 -04:00
|
|
|
}
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int Bytes = Op.GetBitsCount() >> 3;
|
|
|
|
int Elems = Bytes >> Op.Size;
|
2018-03-30 15:46:00 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
for (int Index = 0; Index < Elems; Index++)
|
|
|
|
{
|
|
|
|
EmitVectorExtractZx(Context, Op.Rd, Index, Op.Size);
|
|
|
|
EmitVectorExtractZx(Context, Op.Rn, Index, Op.Size);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Context.Emit(OpCodes.Xor);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitVectorExtractZx(Context, Op.Rm, Index, Op.Size);
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
if (NotRm)
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Not);
|
|
|
|
}
|
2018-03-15 23:42:44 -04:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Context.Emit(OpCodes.And);
|
|
|
|
|
|
|
|
EmitVectorExtractZx(Context, Op.Rd, Index, Op.Size);
|
|
|
|
|
|
|
|
Context.Emit(OpCodes.Xor);
|
|
|
|
|
|
|
|
EmitVectorInsert(Context, Op.Rd, Index, Op.Size);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
|
|
|
{
|
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
|
|
|
}
|
2018-03-15 23:42:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-17 16:06:11 -05:00
|
|
|
public static void Bsl_V(AILEmitterCtx Context)
|
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
2018-02-17 16:06:11 -05:00
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
AOpCodeSimdReg Op = (AOpCodeSimdReg)Context.CurrOp;
|
2018-02-17 16:06:11 -05:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Type[] Types = new Type[]
|
|
|
|
{
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size],
|
|
|
|
VectorUIntTypesPerSizeLog2[Op.Size]
|
|
|
|
};
|
2018-02-17 16:06:11 -05:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rn, Op.Size);
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rm, Op.Size);
|
2018-02-17 16:06:11 -05:00
|
|
|
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.Xor), Types));
|
|
|
|
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.And), Types));
|
|
|
|
|
|
|
|
EmitLdvecWithUnsignedCast(Context, Op.Rm, Op.Size);
|
|
|
|
|
|
|
|
Context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.Xor), Types));
|
|
|
|
|
|
|
|
EmitStvecWithUnsignedCast(Context, Op.Rd, Op.Size);
|
|
|
|
|
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
|
|
|
{
|
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitVectorTernaryOpZx(Context, () =>
|
|
|
|
{
|
|
|
|
Context.EmitSttmp();
|
|
|
|
Context.EmitLdtmp();
|
|
|
|
|
|
|
|
Context.Emit(OpCodes.Xor);
|
|
|
|
Context.Emit(OpCodes.And);
|
|
|
|
|
|
|
|
Context.EmitLdtmp();
|
|
|
|
|
|
|
|
Context.Emit(OpCodes.Xor);
|
|
|
|
});
|
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Eor_V(AILEmitterCtx Context)
|
|
|
|
{
|
2018-05-11 19:10:27 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitSse2Op(Context, nameof(Sse2.Xor));
|
2018-05-11 19:10:27 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitVectorBinaryOpZx(Context, () => Context.Emit(OpCodes.Xor));
|
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Not_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitVectorUnaryOpZx(Context, () => Context.Emit(OpCodes.Not));
|
|
|
|
}
|
|
|
|
|
Add Cls_V, Clz_V, Orn_V instructions. Add 18 Tests: And_V, Bic_V, Bif_V, Bit_V, Bsl_V, Cls_V, Clz_V, Orn_V, Orr_V. (#104)
* Update AOpCodeTable.cs
* Update AInstEmitSimdLogical.cs
* Update AInstEmitSimdArithmetic.cs
* Update ASoftFallback.cs
* Update AInstEmitAlu.cs
* Update Pseudocode.cs
* Update Instructions.cs
* Update CpuTestSimdReg.cs
* Update CpuTestSimd.cs
2018-04-25 22:20:22 -04:00
|
|
|
public static void Orn_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitVectorBinaryOpZx(Context, () =>
|
|
|
|
{
|
|
|
|
Context.Emit(OpCodes.Not);
|
|
|
|
Context.Emit(OpCodes.Or);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-17 16:06:11 -05:00
|
|
|
public static void Orr_V(AILEmitterCtx Context)
|
|
|
|
{
|
2018-05-11 19:10:27 -04:00
|
|
|
if (AOptimizations.UseSse2)
|
|
|
|
{
|
Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics (#405)
* Optimize BIC, BSL, BIT, BIF, XTN, ZIP, DUP (Gp), FMADD (Scalar) and FCVT (Scalar) using SSE intrinsics, some CQ improvements
* Remove useless space
* Address PR feedback
* Revert EmitVectorZero32_128 changes
2018-09-26 22:30:21 -04:00
|
|
|
EmitSse2Op(Context, nameof(Sse2.Or));
|
2018-05-11 19:10:27 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EmitVectorBinaryOpZx(Context, () => Context.Emit(OpCodes.Or));
|
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Orr_Vi(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitVectorImmBinaryOp(Context, () => Context.Emit(OpCodes.Or));
|
|
|
|
}
|
2018-03-02 18:03:28 -05:00
|
|
|
|
2018-07-03 02:31:16 -04:00
|
|
|
public static void Rbit_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
|
|
|
|
|
|
|
int Elems = Op.RegisterSize == ARegisterSize.SIMD128 ? 16 : 8;
|
|
|
|
|
|
|
|
for (int Index = 0; Index < Elems; Index++)
|
|
|
|
{
|
|
|
|
EmitVectorExtractZx(Context, Op.Rn, Index, 0);
|
|
|
|
|
|
|
|
Context.Emit(OpCodes.Conv_U4);
|
|
|
|
|
|
|
|
ASoftFallback.EmitCall(Context, nameof(ASoftFallback.ReverseBits8));
|
|
|
|
|
|
|
|
Context.Emit(OpCodes.Conv_U8);
|
|
|
|
|
|
|
|
EmitVectorInsert(Context, Op.Rd, Index, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
|
|
|
{
|
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-25 17:40:55 -04:00
|
|
|
public static void Rev16_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitRev_V(Context, ContainerSize: 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Rev32_V(AILEmitterCtx Context)
|
|
|
|
{
|
|
|
|
EmitRev_V(Context, ContainerSize: 2);
|
|
|
|
}
|
|
|
|
|
2018-03-02 18:03:28 -05:00
|
|
|
public static void Rev64_V(AILEmitterCtx Context)
|
2018-06-25 17:40:55 -04:00
|
|
|
{
|
|
|
|
EmitRev_V(Context, ContainerSize: 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void EmitRev_V(AILEmitterCtx Context, int ContainerSize)
|
2018-03-02 18:03:28 -05:00
|
|
|
{
|
2018-03-02 18:24:16 -05:00
|
|
|
AOpCodeSimd Op = (AOpCodeSimd)Context.CurrOp;
|
|
|
|
|
2018-06-25 17:40:55 -04:00
|
|
|
if (Op.Size >= ContainerSize)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
}
|
|
|
|
|
2018-07-14 12:13:02 -04:00
|
|
|
int Bytes = Op.GetBitsCount() >> 3;
|
2018-07-03 02:31:16 -04:00
|
|
|
int Elems = Bytes >> Op.Size;
|
|
|
|
|
2018-06-25 17:40:55 -04:00
|
|
|
int ContainerMask = (1 << (ContainerSize - Op.Size)) - 1;
|
2018-03-02 18:24:16 -05:00
|
|
|
|
2018-07-03 02:31:16 -04:00
|
|
|
for (int Index = 0; Index < Elems; Index++)
|
2018-03-02 18:24:16 -05:00
|
|
|
{
|
2018-06-25 17:40:55 -04:00
|
|
|
int RevIndex = Index ^ ContainerMask;
|
2018-03-02 18:24:16 -05:00
|
|
|
|
2018-06-25 17:40:55 -04:00
|
|
|
EmitVectorExtractZx(Context, Op.Rn, RevIndex, Op.Size);
|
|
|
|
|
|
|
|
EmitVectorInsertTmp(Context, Index, Op.Size);
|
2018-03-02 18:24:16 -05:00
|
|
|
}
|
|
|
|
|
2018-06-25 17:40:55 -04:00
|
|
|
Context.EmitLdvectmp();
|
|
|
|
Context.EmitStvec(Op.Rd);
|
|
|
|
|
2018-03-02 18:24:16 -05:00
|
|
|
if (Op.RegisterSize == ARegisterSize.SIMD64)
|
2018-03-02 18:03:28 -05:00
|
|
|
{
|
2018-03-02 18:24:16 -05:00
|
|
|
EmitVectorZeroUpper(Context, Op.Rd);
|
|
|
|
}
|
2018-03-02 18:03:28 -05:00
|
|
|
}
|
2018-02-17 16:06:11 -05:00
|
|
|
}
|
Add Cls_V, Clz_V, Orn_V instructions. Add 18 Tests: And_V, Bic_V, Bif_V, Bit_V, Bsl_V, Cls_V, Clz_V, Orn_V, Orr_V. (#104)
* Update AOpCodeTable.cs
* Update AInstEmitSimdLogical.cs
* Update AInstEmitSimdArithmetic.cs
* Update ASoftFallback.cs
* Update AInstEmitAlu.cs
* Update Pseudocode.cs
* Update Instructions.cs
* Update CpuTestSimdReg.cs
* Update CpuTestSimd.cs
2018-04-25 22:20:22 -04:00
|
|
|
}
|