Updated lots of renamed/relocated methods

This commit is contained in:
Andy Adshead 2019-01-21 20:05:43 +00:00
parent 27de20aeee
commit a6fa77bbf8
8 changed files with 115 additions and 115 deletions

View file

@ -188,7 +188,7 @@ namespace ChocolArm64.Instructions
Type[] typesSubAndNot = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -207,7 +207,7 @@ namespace ChocolArm64.Instructions
Type[] typesSubAndNot = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -246,7 +246,7 @@ namespace ChocolArm64.Instructions
Type[] typesSubAndNot = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -268,7 +268,7 @@ namespace ChocolArm64.Instructions
Type[] typesSubAndNot = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -303,7 +303,7 @@ namespace ChocolArm64.Instructions
Type[] typesAndNot = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdvec(op.Rn);
@ -319,7 +319,7 @@ namespace ChocolArm64.Instructions
Type[] typesAndNot = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
EmitLdvecWithCastToDouble(context, op.Rn);
@ -353,7 +353,7 @@ namespace ChocolArm64.Instructions
Type[] typesAndNot = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdvec(op.Rn);
@ -372,7 +372,7 @@ namespace ChocolArm64.Instructions
Type[] typesAndNot = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitLdvecWithCastToDouble(context, op.Rn);
@ -1107,7 +1107,7 @@ namespace ChocolArm64.Instructions
Type[] typesXor = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdvec(op.Rn);
@ -1123,7 +1123,7 @@ namespace ChocolArm64.Instructions
Type[] typesXor = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
EmitLdvecWithCastToDouble(context, op.Rn);
@ -1154,7 +1154,7 @@ namespace ChocolArm64.Instructions
Type[] typesXor = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(-0f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdvec(op.Rn);
@ -1173,7 +1173,7 @@ namespace ChocolArm64.Instructions
Type[] typesXor = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(-0d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitLdvecWithCastToDouble(context, op.Rn);
@ -1290,7 +1290,7 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(2f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -1308,7 +1308,7 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(2d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -1344,7 +1344,7 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(2f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -1365,7 +1365,7 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(2d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -1627,10 +1627,10 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(0.5f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdc_R4(3f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -1649,10 +1649,10 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(0.5d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
context.EmitLdc_R8(3d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetScalarVector128), typesSsv));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.CreateScalarUnsafe), typesSsv));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -1689,10 +1689,10 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<float>), typeof(Vector128<float>) };
context.EmitLdc_R4(0.5f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdc_R4(3f);
context.EmitCall(typeof(Sse).GetMethod(nameof(Sse.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdvec(op.Rn);
context.EmitLdvec(op.Rm);
@ -1714,10 +1714,10 @@ namespace ChocolArm64.Instructions
Type[] typesMulSub = new Type[] { typeof(Vector128<double>), typeof(Vector128<double>) };
context.EmitLdc_R8(0.5d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitLdc_R8(3d);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitLdvecWithCastToDouble(context, op.Rn);
EmitLdvecWithCastToDouble(context, op.Rm);
@ -2079,7 +2079,7 @@ namespace ChocolArm64.Instructions
Type[] typesAvg = new Type[] { VectorUIntTypesPerSizeLog2[op.Size], VectorUIntTypesPerSizeLog2[op.Size] };
context.EmitLdc_I4(op.Size == 0 ? sbyte.MinValue : short.MinValue);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitStvectmp();
@ -2421,7 +2421,7 @@ namespace ChocolArm64.Instructions
Type[] typesAvg = new Type[] { VectorUIntTypesPerSizeLog2[op.Size], VectorUIntTypesPerSizeLog2[op.Size] };
context.EmitLdc_I4(op.Size == 0 ? sbyte.MinValue : short.MinValue);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.Emit(OpCodes.Dup);
context.EmitStvectmp();

View file

@ -202,7 +202,7 @@ namespace ChocolArm64.Instructions
EmitLdvecWithUnsignedCast(context, op.Rn, 0);
context.EmitLdc_I4(byte.MaxValue);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.AndNot), typesAndNot));
@ -232,7 +232,7 @@ namespace ChocolArm64.Instructions
EmitLdvecWithUnsignedCast(context, op.Rm, 0);
context.EmitLdc_I4(byte.MaxValue);
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.AndNot), typesAndNotOr));
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.Or), typesAndNotOr));
@ -310,7 +310,7 @@ namespace ChocolArm64.Instructions
context.EmitLdc_I8(14L << 56 | 15L << 48 | 12L << 40 | 13L << 32 | 10L << 24 | 11L << 16 | 08L << 8 | 09L << 0); // maskE1
context.EmitLdc_I8(06L << 56 | 07L << 48 | 04L << 40 | 05L << 32 | 02L << 24 | 03L << 16 | 00L << 8 | 01L << 0); // maskE0
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetVector128), typesSve));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSve));
context.EmitCall(typeof(Ssse3).GetMethod(nameof(Ssse3.Shuffle), typesSfl));
@ -349,7 +349,7 @@ namespace ChocolArm64.Instructions
context.EmitLdc_I8(05L << 56 | 04L << 48 | 07L << 40 | 06L << 32 | 01L << 24 | 00L << 16 | 03L << 8 | 02L << 0); // maskE0
}
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetVector128), typesSve));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSve));
context.EmitCall(typeof(Ssse3).GetMethod(nameof(Ssse3.Shuffle), typesSfl));
@ -393,7 +393,7 @@ namespace ChocolArm64.Instructions
context.EmitLdc_I8(03L << 56 | 02L << 48 | 01L << 40 | 00L << 32 | 07L << 24 | 06L << 16 | 05L << 8 | 04L << 0); // maskE0
}
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetVector128), typesSve));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSve));
context.EmitCall(typeof(Ssse3).GetMethod(nameof(Ssse3.Shuffle), typesSfl));

View file

@ -57,7 +57,7 @@ namespace ChocolArm64.Instructions
case 2: context.Emit(OpCodes.Conv_U4); break;
}
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitStvecWithUnsignedCast(context, op.Rd, op.Size);
}
@ -106,7 +106,7 @@ namespace ChocolArm64.Instructions
case 2: context.Emit(OpCodes.Conv_U4); break;
}
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetAllVector128), typesSav));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSav));
EmitStvecWithUnsignedCast(context, op.Rd, op.Size);
}
@ -423,7 +423,7 @@ namespace ChocolArm64.Instructions
context.EmitLdc_I8(_masksE0_TrnUzpXtn[op.Size]); // mask
context.Emit(OpCodes.Dup); // mask
context.EmitCall(typeof(Sse2).GetMethod(nameof(Sse2.SetVector128), typesSve));
context.EmitCall(typeof(Vector128).GetMethod(nameof(Vector128.Create), typesSve));
context.EmitCall(typeof(Ssse3).GetMethod(nameof(Ssse3.Shuffle), GetTypesSflUpk(0)));

View file

@ -895,8 +895,8 @@ namespace ChocolArm64.Instructions
Vector128<float> result = new Vector128<float>();
Vector128<float> t = Sse.Xor(tw0_3, Sse.StaticCast<uint, float>(
Sse2.ShiftRightLogical128BitLane(Sse.StaticCast<float, uint>(w12_15), (byte)4)));
Vector128<float> t = Sse.Xor(tw0_3,
Sse2.ShiftRightLogical128BitLane(w12_15.As<uint>(), (byte)4).As<float>());
uint tE0 = (uint)VectorExtractIntZx(t, (byte)0, 2);
uint tE1 = (uint)VectorExtractIntZx(t, (byte)1, 2);
@ -919,7 +919,7 @@ namespace ChocolArm64.Instructions
uint xE3 = (uint)VectorExtractIntZx(x, (byte)3, 2);
x = Sse.StaticCast<uint, float>(Sse2.ShiftLeftLogical128BitLane(Sse.StaticCast<float, uint>(x), (byte)4));
x = Sse2.ShiftLeftLogical128BitLane(x.As<uint>(), (byte)4).As<float>();
x = VectorInsertInt((ulong)y, x, (byte)0, 2);
y = xE3;
@ -1049,8 +1049,8 @@ namespace ChocolArm64.Instructions
uint yE3 = (uint)VectorExtractIntZx(y, (byte)3, 2);
uint xE3 = (uint)VectorExtractIntZx(x, (byte)3, 2);
y = Sse.StaticCast<uint, float>(Sse2.ShiftLeftLogical128BitLane(Sse.StaticCast<float, uint>(y), (byte)4));
x = Sse.StaticCast<uint, float>(Sse2.ShiftLeftLogical128BitLane(Sse.StaticCast<float, uint>(x), (byte)4));
y = Sse2.ShiftLeftLogical128BitLane(y.As<uint>(), (byte)4).As<float>();
x = Sse2.ShiftLeftLogical128BitLane(x.As<uint>(), (byte)4).As<float>();
y = VectorInsertInt((ulong)xE3, y, (byte)0, 2);
x = VectorInsertInt((ulong)yE3, x, (byte)0, 2);

View file

@ -217,7 +217,7 @@ namespace ChocolArm64.Instructions
{
if (Sse41.IsSupported)
{
return BitConverter.Int64BitsToDouble(Sse41.Extract(Sse.StaticCast<float, long>(vector), index));
return BitConverter.Int64BitsToDouble(Sse41.Extract(vector.As<long>(), index));
}
else if (Sse2.IsSupported)
{
@ -234,19 +234,19 @@ namespace ChocolArm64.Instructions
{
if (size == 0)
{
return (sbyte)Sse41.Extract(Sse.StaticCast<float, byte>(vector), index);
return (sbyte)Sse41.Extract(vector.As<byte>(), index);
}
else if (size == 1)
{
return (short)Sse2.Extract(Sse.StaticCast<float, ushort>(vector), index);
return (short)Sse2.Extract(vector.As<ushort>(), index);
}
else if (size == 2)
{
return Sse41.Extract(Sse.StaticCast<float, int>(vector), index);
return Sse41.Extract(vector.As<int>(), index);
}
else if (size == 3)
{
return Sse41.Extract(Sse.StaticCast<float, long>(vector), index);
return Sse41.Extract(vector.As<long>(), index);
}
else
{
@ -287,19 +287,19 @@ namespace ChocolArm64.Instructions
{
if (size == 0)
{
return Sse41.Extract(Sse.StaticCast<float, byte>(vector), index);
return Sse41.Extract(vector.As<byte>(), index);
}
else if (size == 1)
{
return Sse2.Extract(Sse.StaticCast<float, ushort>(vector), index);
return Sse2.Extract(vector.As<ushort>(), index);
}
else if (size == 2)
{
return Sse41.Extract(Sse.StaticCast<float, uint>(vector), index);
return Sse41.Extract(vector.As<uint>(), index);
}
else if (size == 3)
{
return Sse41.Extract(Sse.StaticCast<float, ulong>(vector), index);
return Sse41.Extract(vector.As<ulong>(), index);
}
else
{
@ -312,7 +312,7 @@ namespace ChocolArm64.Instructions
? index >> 1
: index << (size - 1);
ushort value = Sse2.Extract(Sse.StaticCast<float, ushort>(vector), (byte)shortIdx);
ushort value = Sse2.Extract(vector.As<ushort>(), (byte)shortIdx);
if (size == 0)
{
@ -324,15 +324,15 @@ namespace ChocolArm64.Instructions
}
else if (size == 2 || size == 3)
{
ushort value1 = Sse2.Extract(Sse.StaticCast<float, ushort>(vector), (byte)(shortIdx + 1));
ushort value1 = Sse2.Extract(vector.As<ushort>(), (byte)(shortIdx + 1));
if (size == 2)
{
return (uint)(value | (value1 << 16));
}
ushort value2 = Sse2.Extract(Sse.StaticCast<float, ushort>(vector), (byte)(shortIdx + 2));
ushort value3 = Sse2.Extract(Sse.StaticCast<float, ushort>(vector), (byte)(shortIdx + 3));
ushort value2 = Sse2.Extract(vector.As<ushort>(), (byte)(shortIdx + 2));
ushort value3 = Sse2.Extract(vector.As<ushort>(), (byte)(shortIdx + 3));
return ((ulong)value << 0) |
((ulong)value1 << 16) |
@ -357,7 +357,7 @@ namespace ChocolArm64.Instructions
}
else if (Sse2.IsSupported)
{
Vector128<ushort> shortVector = Sse.StaticCast<float, ushort>(vector);
Vector128<ushort> shortVector = vector.As<ushort>();
int low = Sse2.Extract(shortVector, (byte)(index * 2 + 0));
int high = Sse2.Extract(shortVector, (byte)(index * 2 + 1));
@ -381,19 +381,19 @@ namespace ChocolArm64.Instructions
{
if (size == 0)
{
return Sse.StaticCast<byte, float>(Sse41.Insert(Sse.StaticCast<float, byte>(vector), (byte)value, index));
return Sse41.Insert(vector.As<byte>(), (byte)value, index).As<float>();
}
else if (size == 1)
{
return Sse.StaticCast<ushort, float>(Sse2.Insert(Sse.StaticCast<float, ushort>(vector), (ushort)value, index));
return Sse2.Insert(vector.As<ushort>(), (ushort)value, index).As<float>();
}
else if (size == 2)
{
return Sse.StaticCast<uint, float>(Sse41.Insert(Sse.StaticCast<float, uint>(vector), (uint)value, index));
return Sse41.Insert(vector.As<uint>(), (uint)value, index).As<float>();
}
else if (size == 3)
{
return Sse.StaticCast<ulong, float>(Sse41.Insert(Sse.StaticCast<float, ulong>(vector), value, index));
return Sse41.Insert(vector.As<ulong>(), value, index).As<float>();
}
else
{
@ -402,7 +402,7 @@ namespace ChocolArm64.Instructions
}
else if (Sse2.IsSupported)
{
Vector128<ushort> shortVector = Sse.StaticCast<float, ushort>(vector);
Vector128<ushort> shortVector = vector.As<ushort>();
int shortIdx = size == 0
? index >> 1
@ -410,7 +410,7 @@ namespace ChocolArm64.Instructions
if (size == 0)
{
ushort shortVal = Sse2.Extract(Sse.StaticCast<float, ushort>(vector), (byte)shortIdx);
ushort shortVal = Sse2.Extract(vector.As<ushort>(), (byte)shortIdx);
int shift = (index & 1) * 8;
@ -418,11 +418,11 @@ namespace ChocolArm64.Instructions
shortVal |= (ushort)((byte)value << shift);
return Sse.StaticCast<ushort, float>(Sse2.Insert(shortVector, shortVal, (byte)shortIdx));
return Sse2.Insert(shortVector, shortVal, (byte)shortIdx).As<float>();
}
else if (size == 1)
{
return Sse.StaticCast<ushort, float>(Sse2.Insert(Sse.StaticCast<float, ushort>(vector), (ushort)value, index));
return Sse2.Insert(vector.As<ushort>(), (ushort)value, index).As<float>();
}
else if (size == 2 || size == 3)
{
@ -435,7 +435,7 @@ namespace ChocolArm64.Instructions
shortVector = Sse2.Insert(shortVector, (ushort)(value >> 48), (byte)(shortIdx + 3));
}
return Sse.StaticCast<ushort, float>(shortVector);
return shortVector.As<float>();
}
else
{
@ -456,19 +456,19 @@ namespace ChocolArm64.Instructions
//jump table fallback.
if (index == 0)
{
return Sse41.Insert(vector, value, 0x00);
return Sse41.Insert(vector, Vector128.CreateScalarUnsafe(value), 0x00);
}
else if (index == 1)
{
return Sse41.Insert(vector, value, 0x10);
return Sse41.Insert(vector, Vector128.CreateScalarUnsafe(value), 0x10);
}
else if (index == 2)
{
return Sse41.Insert(vector, value, 0x20);
return Sse41.Insert(vector, Vector128.CreateScalarUnsafe(value), 0x20);
}
else if (index == 3)
{
return Sse41.Insert(vector, value, 0x30);
return Sse41.Insert(vector, Vector128.CreateScalarUnsafe(value), 0x30);
}
else
{
@ -482,12 +482,12 @@ namespace ChocolArm64.Instructions
ushort low = (ushort)(intValue >> 0);
ushort high = (ushort)(intValue >> 16);
Vector128<ushort> shortVector = Sse.StaticCast<float, ushort>(vector);
Vector128<ushort> shortVector = vector.As<ushort>();
shortVector = Sse2.Insert(shortVector, low, (byte)(index * 2 + 0));
shortVector = Sse2.Insert(shortVector, high, (byte)(index * 2 + 1));
return Sse.StaticCast<ushort, float>(shortVector);
return shortVector.As<float>();
}
throw new PlatformNotSupportedException();
@ -497,7 +497,7 @@ namespace ChocolArm64.Instructions
public static Vector128<float> Sse41VectorInsertScalarSingle(float value, Vector128<float> vector)
{
//Note: 0b1110 is the mask to zero the upper bits.
return Sse41.Insert(vector, value, 0b1110);
return Sse41.Insert(vector, Vector128.CreateScalarUnsafe(value), 0b1110);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -505,7 +505,7 @@ namespace ChocolArm64.Instructions
{
if (Sse2.IsSupported)
{
return Sse2.SetZeroVector128<sbyte>();
return Vector128<sbyte>.Zero;
}
throw new PlatformNotSupportedException();
@ -516,7 +516,7 @@ namespace ChocolArm64.Instructions
{
if (Sse2.IsSupported)
{
return Sse2.SetZeroVector128<short>();
return Vector128<short>.Zero;
}
throw new PlatformNotSupportedException();
@ -527,7 +527,7 @@ namespace ChocolArm64.Instructions
{
if (Sse2.IsSupported)
{
return Sse2.SetZeroVector128<int>();
return Vector128<int>.Zero;
}
throw new PlatformNotSupportedException();
@ -538,7 +538,7 @@ namespace ChocolArm64.Instructions
{
if (Sse2.IsSupported)
{
return Sse2.SetZeroVector128<long>();
return Vector128<long>.Zero;
}
throw new PlatformNotSupportedException();
@ -549,7 +549,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.SetZeroVector128();
return Vector128<float>.Zero;
}
throw new PlatformNotSupportedException();
@ -560,7 +560,7 @@ namespace ChocolArm64.Instructions
{
if (Sse2.IsSupported)
{
return Sse2.SetZeroVector128<double>();
return Vector128<double>.Zero;
}
throw new PlatformNotSupportedException();
@ -571,7 +571,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, sbyte>(vector);
return vector.As<sbyte>();
}
throw new PlatformNotSupportedException();
@ -582,7 +582,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, short>(vector);
return vector.As<short>();
}
throw new PlatformNotSupportedException();
@ -593,7 +593,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, int>(vector);
return vector.As<int>();
}
throw new PlatformNotSupportedException();
@ -604,7 +604,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, long>(vector);
return vector.As<long>();
}
throw new PlatformNotSupportedException();
@ -615,7 +615,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, byte>(vector);
return vector.As<byte>();
}
throw new PlatformNotSupportedException();
@ -626,7 +626,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, ushort>(vector);
return vector.As<ushort>();
}
throw new PlatformNotSupportedException();
@ -637,7 +637,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, uint>(vector);
return vector.As<uint>();
}
throw new PlatformNotSupportedException();
@ -648,7 +648,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, ulong>(vector);
return vector.As<ulong>();
}
throw new PlatformNotSupportedException();
@ -659,7 +659,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<float, double>(vector);
return vector.As<double>();
}
throw new PlatformNotSupportedException();
@ -670,7 +670,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<sbyte, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -681,7 +681,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<short, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -692,7 +692,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<int, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -703,7 +703,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<long, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -714,7 +714,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<byte, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -725,7 +725,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<ushort, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -736,7 +736,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<uint, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -747,7 +747,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<ulong, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();
@ -758,7 +758,7 @@ namespace ChocolArm64.Instructions
{
if (Sse.IsSupported)
{
return Sse.StaticCast<double, float>(vector);
return vector.As<float>();
}
throw new PlatformNotSupportedException();

View file

@ -243,7 +243,7 @@ namespace ChocolArm64.Memory
{
if (Sse2.IsSupported)
{
return Sse.StaticCast<byte, float>(Sse2.SetVector128(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ReadByte(position)));
return Vector128.Create(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ReadByte(position)).As<float>();
}
else
{
@ -260,7 +260,7 @@ namespace ChocolArm64.Memory
{
if (Sse2.IsSupported && (position & 1) == 0)
{
return Sse.StaticCast<ushort, float>(Sse2.Insert(Sse2.SetZeroVector128<ushort>(), ReadUInt16(position), 0));
return Sse2.Insert(Vector128<ushort>.Zero, ReadUInt16(position), 0).As<float>();
}
else
{
@ -294,7 +294,7 @@ namespace ChocolArm64.Memory
{
if (Sse2.IsSupported && (position & 7) == 0)
{
return Sse.StaticCast<double, float>(Sse2.LoadScalarVector128((double*)Translate(position)));
return Sse2.LoadScalarVector128((double*)Translate(position)).As<float>();
}
else
{
@ -466,11 +466,11 @@ namespace ChocolArm64.Memory
{
if (Sse41.IsSupported)
{
WriteByte(position, Sse41.Extract(Sse.StaticCast<float, byte>(value), 0));
WriteByte(position, Sse41.Extract(value.As<byte>(), 0));
}
else if (Sse2.IsSupported)
{
WriteByte(position, (byte)Sse2.Extract(Sse.StaticCast<float, ushort>(value), 0));
WriteByte(position, (byte)Sse2.Extract(value.As<ushort>(), 0));
}
else
{
@ -483,7 +483,7 @@ namespace ChocolArm64.Memory
{
if (Sse2.IsSupported)
{
WriteUInt16(position, Sse2.Extract(Sse.StaticCast<float, ushort>(value), 0));
WriteUInt16(position, Sse2.Extract(value.As<ushort>(), 0));
}
else
{
@ -509,7 +509,7 @@ namespace ChocolArm64.Memory
{
if (Sse2.IsSupported && (position & 7) == 0)
{
Sse2.StoreScalar((double*)TranslateWrite(position), Sse.StaticCast<float, double>(value));
Sse2.StoreScalar((double*)TranslateWrite(position), value.As<double>());
}
else
{

View file

@ -437,7 +437,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<long, float>(Sse2.SetVector128(0, BitConverter.DoubleToInt64Bits(e0)));
return Vector128.Create(0, BitConverter.DoubleToInt64Bits(e0)).As<float>();
}
protected static Vector128<float> MakeVectorE0E1(double e0, double e1)
@ -447,8 +447,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<long, float>(
Sse2.SetVector128(BitConverter.DoubleToInt64Bits(e1), BitConverter.DoubleToInt64Bits(e0)));
return Vector128.Create(BitConverter.DoubleToInt64Bits(e1), BitConverter.DoubleToInt64Bits(e0)).As<float>();
}
protected static Vector128<float> MakeVectorE1(double e1)
@ -458,7 +457,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<long, float>(Sse2.SetVector128(BitConverter.DoubleToInt64Bits(e1), 0));
return Vector128.Create(BitConverter.DoubleToInt64Bits(e1), 0).As<float>();
}
protected static float VectorExtractSingle(Vector128<float> vector, byte index)
@ -468,7 +467,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
int value = Sse41.Extract(Sse.StaticCast<float, int>(vector), index);
int value = Sse41.Extract(vector.As<int>(), index);
return BitConverter.Int32BitsToSingle(value);
}
@ -480,7 +479,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
long value = Sse41.Extract(Sse.StaticCast<float, long>(vector), index);
long value = Sse41.Extract(vector.As<long>(), index);
return BitConverter.Int64BitsToDouble(value);
}
@ -492,7 +491,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<ulong, float>(Sse2.SetVector128(0, e0));
return Vector128.Create(0, e0).As<float>();
}
protected static Vector128<float> MakeVectorE0E1(ulong e0, ulong e1)
@ -502,7 +501,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<ulong, float>(Sse2.SetVector128(e1, e0));
return Vector128.Create(e1, e0).As<float>();
}
protected static Vector128<float> MakeVectorE1(ulong e1)
@ -512,7 +511,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse.StaticCast<ulong, float>(Sse2.SetVector128(e1, 0));
return Vector128.Create(e1, 0).As<float>();
}
protected static ulong GetVectorE0(Vector128<float> vector)
@ -522,7 +521,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse41.Extract(Sse.StaticCast<float, ulong>(vector), (byte)0);
return Sse41.Extract(vector.As<ulong>(), (byte)0);
}
protected static ulong GetVectorE1(Vector128<float> vector)
@ -532,7 +531,7 @@ namespace Ryujinx.Tests.Cpu
throw new PlatformNotSupportedException();
}
return Sse41.Extract(Sse.StaticCast<float, ulong>(vector), (byte)1);
return Sse41.Extract(vector.As<ulong>(), (byte)1);
}
protected static ushort GenNormalH()

View file

@ -1,3 +1,4 @@
using System.Runtime.Intrinsics;
using ChocolArm64.State;
using NUnit.Framework;
@ -76,8 +77,8 @@ namespace Ryujinx.Tests.Cpu
*/
SetThreadState(
v0: Sse.SetScalarVector128(a),
v1: Sse.SetScalarVector128(b));
v0: Vector128.CreateScalar(a),
v1: Vector128.CreateScalar(b));
Opcode(0x1E2E1002);
Opcode(0x1E201840);
Opcode(0x1E211841);
@ -125,8 +126,8 @@ namespace Ryujinx.Tests.Cpu
*/
SetThreadState(
v0: Sse.StaticCast<double, float>(Sse2.SetScalarVector128(a)),
v1: Sse.StaticCast<double, float>(Sse2.SetScalarVector128(b)));
v0: Vector128.CreateScalar(a).As<float>(),
v1: Vector128.CreateScalar(b).As<float>());
Opcode(0x1E6E1002);
Opcode(0x1E601840);
Opcode(0x1E611841);