[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:
TSRBerry 2023-06-26 07:25:06 +02:00 committed by GitHub
parent 2de78a2d55
commit ff53dcf560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
300 changed files with 3515 additions and 3120 deletions

View file

@ -5,7 +5,7 @@ namespace ARMeilleure.Instructions
{
static class SoftFallback
{
#region "ShrImm64"
#region "ShrImm64"
public static long SignedShrImm64(long value, long roundConst, int shift)
{
if (roundConst == 0L)
@ -89,12 +89,15 @@ namespace ARMeilleure.Instructions
}
}
}
#endregion
#endregion
#region "Saturation"
#region "Saturation"
public static int SatF32ToS32(float value)
{
if (float.IsNaN(value)) return 0;
if (float.IsNaN(value))
{
return 0;
}
return value >= int.MaxValue ? int.MaxValue :
value <= int.MinValue ? int.MinValue : (int)value;
@ -102,7 +105,10 @@ namespace ARMeilleure.Instructions
public static long SatF32ToS64(float value)
{
if (float.IsNaN(value)) return 0;
if (float.IsNaN(value))
{
return 0;
}
return value >= long.MaxValue ? long.MaxValue :
value <= long.MinValue ? long.MinValue : (long)value;
@ -110,7 +116,10 @@ namespace ARMeilleure.Instructions
public static uint SatF32ToU32(float value)
{
if (float.IsNaN(value)) return 0;
if (float.IsNaN(value))
{
return 0;
}
return value >= uint.MaxValue ? uint.MaxValue :
value <= uint.MinValue ? uint.MinValue : (uint)value;
@ -118,7 +127,10 @@ namespace ARMeilleure.Instructions
public static ulong SatF32ToU64(float value)
{
if (float.IsNaN(value)) return 0;
if (float.IsNaN(value))
{
return 0;
}
return value >= ulong.MaxValue ? ulong.MaxValue :
value <= ulong.MinValue ? ulong.MinValue : (ulong)value;
@ -126,7 +138,10 @@ namespace ARMeilleure.Instructions
public static int SatF64ToS32(double value)
{
if (double.IsNaN(value)) return 0;
if (double.IsNaN(value))
{
return 0;
}
return value >= int.MaxValue ? int.MaxValue :
value <= int.MinValue ? int.MinValue : (int)value;
@ -134,7 +149,10 @@ namespace ARMeilleure.Instructions
public static long SatF64ToS64(double value)
{
if (double.IsNaN(value)) return 0;
if (double.IsNaN(value))
{
return 0;
}
return value >= long.MaxValue ? long.MaxValue :
value <= long.MinValue ? long.MinValue : (long)value;
@ -142,7 +160,10 @@ namespace ARMeilleure.Instructions
public static uint SatF64ToU32(double value)
{
if (double.IsNaN(value)) return 0;
if (double.IsNaN(value))
{
return 0;
}
return value >= uint.MaxValue ? uint.MaxValue :
value <= uint.MinValue ? uint.MinValue : (uint)value;
@ -150,14 +171,17 @@ namespace ARMeilleure.Instructions
public static ulong SatF64ToU64(double value)
{
if (double.IsNaN(value)) return 0;
if (double.IsNaN(value))
{
return 0;
}
return value >= ulong.MaxValue ? ulong.MaxValue :
value <= ulong.MinValue ? ulong.MinValue : (ulong)value;
}
#endregion
#endregion
#region "Count"
#region "Count"
public static ulong CountLeadingSigns(ulong value, int size) // size is 8, 16, 32 or 64 (SIMD&FP or Base Inst.).
{
value ^= value >> 1;
@ -197,9 +221,9 @@ namespace ARMeilleure.Instructions
return (ulong)count;
}
#endregion
#endregion
#region "Table"
#region "Table"
public static V128 Tbl1(V128 vector, int bytes, V128 tb0)
{
return TblOrTbx(default, vector, bytes, tb0);
@ -270,21 +294,21 @@ namespace ARMeilleure.Instructions
return new V128(res);
}
#endregion
#endregion
#region "Crc32"
private const uint Crc32RevPoly = 0xedb88320;
#region "Crc32"
private const uint Crc32RevPoly = 0xedb88320;
private const uint Crc32cRevPoly = 0x82f63b78;
public static uint Crc32b(uint crc, byte value) => Crc32 (crc, Crc32RevPoly, value);
public static uint Crc32b(uint crc, byte value) => Crc32(crc, Crc32RevPoly, value);
public static uint Crc32h(uint crc, ushort value) => Crc32h(crc, Crc32RevPoly, value);
public static uint Crc32w(uint crc, uint value) => Crc32w(crc, Crc32RevPoly, value);
public static uint Crc32x(uint crc, ulong value) => Crc32x(crc, Crc32RevPoly, value);
public static uint Crc32w(uint crc, uint value) => Crc32w(crc, Crc32RevPoly, value);
public static uint Crc32x(uint crc, ulong value) => Crc32x(crc, Crc32RevPoly, value);
public static uint Crc32cb(uint crc, byte value) => Crc32 (crc, Crc32cRevPoly, value);
public static uint Crc32cb(uint crc, byte value) => Crc32(crc, Crc32cRevPoly, value);
public static uint Crc32ch(uint crc, ushort value) => Crc32h(crc, Crc32cRevPoly, value);
public static uint Crc32cw(uint crc, uint value) => Crc32w(crc, Crc32cRevPoly, value);
public static uint Crc32cx(uint crc, ulong value) => Crc32x(crc, Crc32cRevPoly, value);
public static uint Crc32cw(uint crc, uint value) => Crc32w(crc, Crc32cRevPoly, value);
public static uint Crc32cx(uint crc, ulong value) => Crc32x(crc, Crc32cRevPoly, value);
private static uint Crc32h(uint crc, uint poly, ushort val)
{
@ -331,9 +355,9 @@ namespace ARMeilleure.Instructions
return crc;
}
#endregion
#endregion
#region "Aes"
#region "Aes"
public static V128 Decrypt(V128 value, V128 roundKey)
{
return CryptoHelper.AesInvSubBytes(CryptoHelper.AesInvShiftRows(value ^ roundKey));
@ -353,9 +377,9 @@ namespace ARMeilleure.Instructions
{
return CryptoHelper.AesMixColumns(value);
}
#endregion
#endregion
#region "Sha1"
#region "Sha1"
public static V128 HashChoose(V128 hash_abcd, uint hash_e, V128 wk)
{
for (int e = 0; e <= 3; e++)
@ -426,7 +450,7 @@ namespace ARMeilleure.Instructions
ulong t2 = w4_7.Extract<ulong>(0);
ulong t1 = w0_3.Extract<ulong>(1);
V128 result = new V128(t1, t2);
V128 result = new(t1, t2);
return result ^ (w0_3 ^ w8_11);
}
@ -472,9 +496,9 @@ namespace ARMeilleure.Instructions
{
return (value << count) | (value >> (32 - count));
}
#endregion
#endregion
#region "Sha256"
#region "Sha256"
public static V128 HashLower(V128 hash_abcd, V128 hash_efgh, V128 wk)
{
return Sha256Hash(hash_abcd, hash_efgh, wk, part1: true);
@ -487,7 +511,7 @@ namespace ARMeilleure.Instructions
public static V128 Sha256SchedulePart1(V128 w0_3, V128 w4_7)
{
V128 result = new V128();
V128 result = new();
for (int e = 0; e <= 3; e++)
{
@ -505,7 +529,7 @@ namespace ARMeilleure.Instructions
public static V128 Sha256SchedulePart2(V128 w0_3, V128 w8_11, V128 w12_15)
{
V128 result = new V128();
V128 result = new();
ulong t1 = w12_15.Extract<ulong>(1);
@ -602,13 +626,13 @@ namespace ARMeilleure.Instructions
? (uint)(value & 0xFFFFFFFFUL)
: (uint)(value >> 32);
}
#endregion
#endregion
public static V128 PolynomialMult64_128(ulong op1, ulong op2)
{
V128 result = V128.Zero;
V128 op2_128 = new V128(op2, 0);
V128 op2_128 = new(op2, 0);
for (int i = 0; i < 64; i++)
{