[ARMeilleure] Address dotnet-format issues (#5357)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address or silence dotnet format CA2208 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Silence CA1806 and CA1834 issues * Address dotnet format CA1401 warnings * Fix new dotnet-format issues after rebase * Address review comments * Address dotnet format CA2208 warnings properly * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for OpCodeTable.cs * Enable formatting for a few cases again * Format if-blocks correctly * Enable formatting for a few more cases again * Fix inline comment alignment * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Adjust namespaces * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Remove unnecessary formatting exclusion * Add unsafe dotnet format changes * Change visibility of JitSupportDarwin to internal
This commit is contained in:
@ -8,7 +8,7 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
static SoftFloat()
|
||||
{
|
||||
RecipEstimateTable = BuildRecipEstimateTable();
|
||||
RecipEstimateTable = BuildRecipEstimateTable();
|
||||
RecipSqrtEstimateTable = BuildRecipSqrtEstimateTable();
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
while (src * (aux + 1u) * (aux + 1u) < (1u << 28))
|
||||
{
|
||||
aux = aux + 1u;
|
||||
aux++;
|
||||
}
|
||||
|
||||
uint dst = (aux + 1u) >> 1;
|
||||
@ -133,8 +133,8 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
sign = (~(uint)valueBits & 0x8000u) == 0u;
|
||||
|
||||
uint exp16 = ((uint)valueBits & 0x7C00u) >> 10;
|
||||
uint frac16 = (uint)valueBits & 0x03FFu;
|
||||
uint exp16 = ((uint)valueBits & 0x7C00u) >> 10;
|
||||
uint frac16 = (uint)valueBits & 0x03FFu;
|
||||
|
||||
double real;
|
||||
|
||||
@ -180,17 +180,17 @@ namespace ARMeilleure.Instructions
|
||||
const int e = 5;
|
||||
const int f = 10;
|
||||
|
||||
bool sign;
|
||||
bool sign;
|
||||
double mantissa;
|
||||
|
||||
if (real < 0d)
|
||||
{
|
||||
sign = true;
|
||||
sign = true;
|
||||
mantissa = -real;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = false;
|
||||
sign = false;
|
||||
mantissa = real;
|
||||
}
|
||||
|
||||
@ -229,22 +229,22 @@ namespace ARMeilleure.Instructions
|
||||
switch (context.Fpcr.GetRoundingMode())
|
||||
{
|
||||
case FPRoundingMode.ToNearest:
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
overflowToInf = true;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsPlusInfinity:
|
||||
roundUp = (error != 0d && !sign);
|
||||
roundUp = (error != 0d && !sign);
|
||||
overflowToInf = !sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsMinusInfinity:
|
||||
roundUp = (error != 0d && sign);
|
||||
roundUp = (error != 0d && sign);
|
||||
overflowToInf = sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsZero:
|
||||
roundUp = false;
|
||||
roundUp = false;
|
||||
overflowToInf = false;
|
||||
break;
|
||||
|
||||
@ -359,17 +359,17 @@ namespace ARMeilleure.Instructions
|
||||
const int e = 8;
|
||||
const int f = 23;
|
||||
|
||||
bool sign;
|
||||
bool sign;
|
||||
double mantissa;
|
||||
|
||||
if (real < 0d)
|
||||
{
|
||||
sign = true;
|
||||
sign = true;
|
||||
mantissa = -real;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = false;
|
||||
sign = false;
|
||||
mantissa = real;
|
||||
}
|
||||
|
||||
@ -415,22 +415,22 @@ namespace ARMeilleure.Instructions
|
||||
switch (context.Fpcr.GetRoundingMode())
|
||||
{
|
||||
case FPRoundingMode.ToNearest:
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
overflowToInf = true;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsPlusInfinity:
|
||||
roundUp = (error != 0d && !sign);
|
||||
roundUp = (error != 0d && !sign);
|
||||
overflowToInf = !sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsMinusInfinity:
|
||||
roundUp = (error != 0d && sign);
|
||||
roundUp = (error != 0d && sign);
|
||||
overflowToInf = sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsZero:
|
||||
roundUp = false;
|
||||
roundUp = false;
|
||||
overflowToInf = false;
|
||||
break;
|
||||
|
||||
@ -534,17 +534,17 @@ namespace ARMeilleure.Instructions
|
||||
const int e = 11;
|
||||
const int f = 52;
|
||||
|
||||
bool sign;
|
||||
bool sign;
|
||||
double mantissa;
|
||||
|
||||
if (real < 0d)
|
||||
{
|
||||
sign = true;
|
||||
sign = true;
|
||||
mantissa = -real;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = false;
|
||||
sign = false;
|
||||
mantissa = real;
|
||||
}
|
||||
|
||||
@ -590,22 +590,22 @@ namespace ARMeilleure.Instructions
|
||||
switch (context.Fpcr.GetRoundingMode())
|
||||
{
|
||||
case FPRoundingMode.ToNearest:
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
roundUp = (error > 0.5d || (error == 0.5d && (intMant & 1u) == 1u));
|
||||
overflowToInf = true;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsPlusInfinity:
|
||||
roundUp = (error != 0d && !sign);
|
||||
roundUp = (error != 0d && !sign);
|
||||
overflowToInf = !sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsMinusInfinity:
|
||||
roundUp = (error != 0d && sign);
|
||||
roundUp = (error != 0d && sign);
|
||||
overflowToInf = sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsZero:
|
||||
roundUp = false;
|
||||
roundUp = false;
|
||||
overflowToInf = false;
|
||||
break;
|
||||
|
||||
@ -728,8 +728,8 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
sign = (~valueBits & 0x80000000u) == 0u;
|
||||
|
||||
uint exp32 = (valueBits & 0x7F800000u) >> 23;
|
||||
uint frac32 = valueBits & 0x007FFFFFu;
|
||||
uint exp32 = (valueBits & 0x7F800000u) >> 23;
|
||||
uint frac32 = valueBits & 0x007FFFFFu;
|
||||
|
||||
double real;
|
||||
|
||||
@ -798,8 +798,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == !sign2)
|
||||
{
|
||||
@ -840,8 +842,8 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.Fpcr;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out _, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out _, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out _, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out _, context, fpcr);
|
||||
|
||||
int result;
|
||||
|
||||
@ -995,8 +997,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && inf2) || (zero1 && zero2))
|
||||
{
|
||||
@ -1232,8 +1236,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -1276,11 +1282,13 @@ namespace ARMeilleure.Instructions
|
||||
FPCR fpcr = standardFpscr ? context.StandardFpcrValue : context.Fpcr;
|
||||
|
||||
valueA = valueA.FPUnpack(out FPType typeA, out bool signA, out uint addend, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out uint op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out uint op2, context, fpcr);
|
||||
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
float result = FPProcessNaNs3(typeA, type1, type2, addend, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
@ -1293,10 +1301,11 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool infA = typeA == FPType.Infinity; bool zeroA = typeA == FPType.Zero;
|
||||
bool infA = typeA == FPType.Infinity;
|
||||
bool zeroA = typeA == FPType.Zero;
|
||||
|
||||
bool signP = sign1 ^ sign2;
|
||||
bool infP = inf1 || inf2;
|
||||
bool signP = sign1 ^ sign2;
|
||||
bool infP = inf1 || inf2;
|
||||
bool zeroP = zero1 || zero2;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2) || (infA && infP && signA != signP))
|
||||
@ -1359,8 +1368,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -1435,34 +1446,17 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
else if (MathF.Abs(value) < MathF.Pow(2f, -128))
|
||||
{
|
||||
bool overflowToInf;
|
||||
|
||||
switch (fpcr.GetRoundingMode())
|
||||
var overflowToInf = fpcr.GetRoundingMode() switch
|
||||
{
|
||||
case FPRoundingMode.ToNearest:
|
||||
overflowToInf = true;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsPlusInfinity:
|
||||
overflowToInf = !sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsMinusInfinity:
|
||||
overflowToInf = sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsZero:
|
||||
overflowToInf = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\".");
|
||||
}
|
||||
|
||||
FPRoundingMode.TowardsPlusInfinity => !sign,
|
||||
FPRoundingMode.TowardsMinusInfinity => sign,
|
||||
FPRoundingMode.TowardsZero => false,
|
||||
_ => throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\"."),
|
||||
};
|
||||
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
||||
|
||||
SoftFloat.FPProcessException(FPException.Overflow, context, fpcr);
|
||||
SoftFloat.FPProcessException(FPException.Inexact, context, fpcr);
|
||||
SoftFloat.FPProcessException(FPException.Inexact, context, fpcr);
|
||||
}
|
||||
else if ((fpcr & FPCR.Fz) != 0 && (MathF.Abs(value) >= MathF.Pow(2f, 126)))
|
||||
{
|
||||
@ -1518,15 +1512,17 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.StandardFpcrValue;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out uint op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out uint op2, context, fpcr);
|
||||
|
||||
float result = FPProcessNaNs(type1, type2, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
float product;
|
||||
|
||||
@ -1559,8 +1555,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -1691,8 +1689,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == sign2)
|
||||
{
|
||||
@ -1733,15 +1733,17 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.StandardFpcrValue;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out uint op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out uint op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out uint op2, context, fpcr);
|
||||
|
||||
float result = FPProcessNaNs(type1, type2, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
float product;
|
||||
|
||||
@ -1774,8 +1776,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -1860,8 +1864,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == sign2)
|
||||
{
|
||||
@ -1958,7 +1964,7 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
if ((valueBits & 0x007FFFFFu) == 0u || (fpcr & FPCR.Fz) != 0)
|
||||
{
|
||||
type = FPType.Zero;
|
||||
type = FPType.Zero;
|
||||
value = FPZero(sign);
|
||||
|
||||
if ((valueBits & 0x007FFFFFu) != 0u)
|
||||
@ -1979,7 +1985,7 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
else
|
||||
{
|
||||
type = (~valueBits & 0x00400000u) == 0u ? FPType.QNaN : FPType.SNaN;
|
||||
type = (~valueBits & 0x00400000u) == 0u ? FPType.QNaN : FPType.SNaN;
|
||||
value = FPZero(sign);
|
||||
}
|
||||
}
|
||||
@ -2153,8 +2159,8 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
sign = (~valueBits & 0x8000000000000000ul) == 0u;
|
||||
|
||||
ulong exp64 = (valueBits & 0x7FF0000000000000ul) >> 52;
|
||||
ulong frac64 = valueBits & 0x000FFFFFFFFFFFFFul;
|
||||
ulong exp64 = (valueBits & 0x7FF0000000000000ul) >> 52;
|
||||
ulong frac64 = valueBits & 0x000FFFFFFFFFFFFFul;
|
||||
|
||||
double real;
|
||||
|
||||
@ -2223,8 +2229,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == !sign2)
|
||||
{
|
||||
@ -2265,8 +2273,8 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.Fpcr;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out _, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out _, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out _, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out _, context, fpcr);
|
||||
|
||||
int result;
|
||||
|
||||
@ -2420,8 +2428,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && inf2) || (zero1 && zero2))
|
||||
{
|
||||
@ -2657,8 +2667,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -2701,11 +2713,13 @@ namespace ARMeilleure.Instructions
|
||||
FPCR fpcr = standardFpscr ? context.StandardFpcrValue : context.Fpcr;
|
||||
|
||||
valueA = valueA.FPUnpack(out FPType typeA, out bool signA, out ulong addend, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out ulong op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out ulong op2, context, fpcr);
|
||||
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
double result = FPProcessNaNs3(typeA, type1, type2, addend, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
@ -2718,10 +2732,11 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool infA = typeA == FPType.Infinity; bool zeroA = typeA == FPType.Zero;
|
||||
bool infA = typeA == FPType.Infinity;
|
||||
bool zeroA = typeA == FPType.Zero;
|
||||
|
||||
bool signP = sign1 ^ sign2;
|
||||
bool infP = inf1 || inf2;
|
||||
bool signP = sign1 ^ sign2;
|
||||
bool infP = inf1 || inf2;
|
||||
bool zeroP = zero1 || zero2;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2) || (infA && infP && signA != signP))
|
||||
@ -2784,8 +2799,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -2860,34 +2877,17 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
else if (Math.Abs(value) < Math.Pow(2d, -1024))
|
||||
{
|
||||
bool overflowToInf;
|
||||
|
||||
switch (fpcr.GetRoundingMode())
|
||||
var overflowToInf = fpcr.GetRoundingMode() switch
|
||||
{
|
||||
case FPRoundingMode.ToNearest:
|
||||
overflowToInf = true;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsPlusInfinity:
|
||||
overflowToInf = !sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsMinusInfinity:
|
||||
overflowToInf = sign;
|
||||
break;
|
||||
|
||||
case FPRoundingMode.TowardsZero:
|
||||
overflowToInf = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\".");
|
||||
}
|
||||
|
||||
FPRoundingMode.TowardsPlusInfinity => !sign,
|
||||
FPRoundingMode.TowardsMinusInfinity => sign,
|
||||
FPRoundingMode.TowardsZero => false,
|
||||
_ => throw new ArgumentException($"Invalid rounding mode \"{fpcr.GetRoundingMode()}\"."),
|
||||
};
|
||||
result = overflowToInf ? FPInfinity(sign) : FPMaxNormal(sign);
|
||||
|
||||
SoftFloat.FPProcessException(FPException.Overflow, context, fpcr);
|
||||
SoftFloat.FPProcessException(FPException.Inexact, context, fpcr);
|
||||
SoftFloat.FPProcessException(FPException.Inexact, context, fpcr);
|
||||
}
|
||||
else if ((fpcr & FPCR.Fz) != 0 && (Math.Abs(value) >= Math.Pow(2d, 1022)))
|
||||
{
|
||||
@ -2943,15 +2943,17 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.StandardFpcrValue;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out ulong op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out ulong op2, context, fpcr);
|
||||
|
||||
double result = FPProcessNaNs(type1, type2, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
double product;
|
||||
|
||||
@ -2984,8 +2986,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -3116,8 +3120,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == sign2)
|
||||
{
|
||||
@ -3158,15 +3164,17 @@ namespace ARMeilleure.Instructions
|
||||
ExecutionContext context = NativeInterface.GetContext();
|
||||
FPCR fpcr = context.StandardFpcrValue;
|
||||
|
||||
value1 = value1.FPUnpack(out FPType type1, out bool sign1, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out bool sign2, out ulong op2, context, fpcr);
|
||||
value1 = value1.FPUnpack(out FPType type1, out _, out ulong op1, context, fpcr);
|
||||
value2 = value2.FPUnpack(out FPType type2, out _, out ulong op2, context, fpcr);
|
||||
|
||||
double result = FPProcessNaNs(type1, type2, op1, op2, out bool done, context, fpcr);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
double product;
|
||||
|
||||
@ -3199,8 +3207,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if ((inf1 && zero2) || (zero1 && inf2))
|
||||
{
|
||||
@ -3285,8 +3295,10 @@ namespace ARMeilleure.Instructions
|
||||
|
||||
if (!done)
|
||||
{
|
||||
bool inf1 = type1 == FPType.Infinity; bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity; bool zero2 = type2 == FPType.Zero;
|
||||
bool inf1 = type1 == FPType.Infinity;
|
||||
bool zero1 = type1 == FPType.Zero;
|
||||
bool inf2 = type2 == FPType.Infinity;
|
||||
bool zero2 = type2 == FPType.Zero;
|
||||
|
||||
if (inf1 && inf2 && sign1 == sign2)
|
||||
{
|
||||
@ -3383,7 +3395,7 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
if ((valueBits & 0x000FFFFFFFFFFFFFul) == 0ul || (fpcr & FPCR.Fz) != 0)
|
||||
{
|
||||
type = FPType.Zero;
|
||||
type = FPType.Zero;
|
||||
value = FPZero(sign);
|
||||
|
||||
if ((valueBits & 0x000FFFFFFFFFFFFFul) != 0ul)
|
||||
@ -3404,7 +3416,7 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
else
|
||||
{
|
||||
type = (~valueBits & 0x0008000000000000ul) == 0ul ? FPType.QNaN : FPType.SNaN;
|
||||
type = (~valueBits & 0x0008000000000000ul) == 0ul ? FPType.QNaN : FPType.SNaN;
|
||||
value = FPZero(sign);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user