Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: "Scaled" addressing mode on ARM #60808

Merged
merged 6 commits into from
Oct 29, 2021
Merged

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Oct 24, 2021

Addressing modes on ARM are tricky, it only supports:

[reg]
[reg  + icon]
[reg1 + reg2]
[reg1 + reg2 * natural-scale]

while on x64 we can do things like [reg1 + 8 * reg2 + icon]

Codegen improvement example:

void GetSet(int* data, int i, int j) 
    => data[i] = data[j];

diff:

; Method Prog:GetSet(long,int,int):this
G_M13801_IG01:
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
G_M13801_IG02:
            sxtw    x0, w3
-           lsl     x0, x0, #2
-           ldr     w0, [x1, x0]
+           ldr     w0, [x1, x0, LSL #2]
            sxtw    x2, w2
-           lsl     x2, x2, #2
-           str     w0, [x1, x2]
+           str     w0, [x1, x2, LSL #2]
G_M13801_IG03:
            ldp     fp, lr, [sp],#16
            ret     lr
; Total bytes of code: 40

Also, I removed SCALED_ADDR_MODES - it's always defined for all targets and I don't think it simplifies porting to new platforms as before this PR this flag was set but scaled addr modes were disabled anyway.

coreclr_tests.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 109454980 (overridden on cmd)
Total bytes of diff: 109451052 (overridden on cmd)
Total bytes of delta: -3928 (-0.00 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
           4 : 2482.dasm (0.71% of base)
           4 : 240122.dasm (1.85% of base)
           4 : 240128.dasm (1.18% of base)

Top file improvements (bytes):
        -324 : 105.dasm (-4.11% of base)
         -52 : 248472.dasm (-6.88% of base)
         -52 : 246408.dasm (-2.92% of base)
         -44 : 240496.dasm (-2.23% of base)
         -32 : 242403.dasm (-0.20% of base)
         -32 : 232908.dasm (-0.20% of base)
         -28 : 237005.dasm (-1.89% of base)
         -28 : 124.dasm (-1.31% of base)
         -24 : 216037.dasm (-5.22% of base)
         -20 : 2477.dasm (-1.79% of base)
         -20 : 103.dasm (-1.09% of base)
         -20 : 237004.dasm (-1.59% of base)
         -16 : 176880.dasm (-1.15% of base)
         -16 : 180145.dasm (-1.15% of base)
         -16 : 247725.dasm (-0.92% of base)
         -16 : 229727.dasm (-1.32% of base)
         -16 : 168580.dasm (-1.15% of base)
         -16 : 179906.dasm (-1.19% of base)
         -16 : 155761.dasm (-1.15% of base)
         -16 : 197830.dasm (-1.15% of base)

703 total files with Code Size differences (700 improved, 3 regressed), 5 unchanged.

Top method regressions (bytes):
           4 ( 1.18% of base) : 240128.dasm - <>c__DisplayClass4_0:<DoBench>b__0(int):this
           4 ( 1.85% of base) : 240122.dasm - BenchmarksGame.MandelBrot_7:GetByte(long,double,int,int):ubyte
           4 ( 0.71% of base) : 2482.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)

Top method improvements (bytes):
        -324 (-4.11% of base) : 105.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
         -52 (-6.88% of base) : 248472.dasm - GitHub_23159:BytesOrdinalEqualsStringAndAscii(System.String,System.Span`1[Byte]):bool
         -52 (-2.92% of base) : 246408.dasm - ImplicitByrefTailCalls:Main():int
         -44 (-2.23% of base) : 240496.dasm - ImplicitByrefTailCalls:Main():int
         -32 (-0.20% of base) : 242403.dasm - StrAccess2:Main():int
         -32 (-0.20% of base) : 232908.dasm - StrAccess2:Main():int
         -28 (-1.89% of base) : 237005.dasm - Runtime_31615:Check(V4,float,float,float,float,int)
         -28 (-1.31% of base) : 124.dasm - System.Text.RegularExpressions.RegexReplacement:.ctor(System.String,System.Text.RegularExpressions.RegexNode,System.Collections.Hashtable):this
         -24 (-5.22% of base) : 216037.dasm - Span.SpanBench:TestQuickSortSpan(System.Span`1[Int32])
         -20 (-1.59% of base) : 237004.dasm - Runtime_31615:Check(V3,float,float,float,int)
         -20 (-1.79% of base) : 2477.dasm - System.Diagnostics.Process:GetNextArgument(System.String,byref):System.String
         -20 (-1.09% of base) : 103.dasm - System.Text.RegularExpressions.RegexWriter:RegexCodeFromRegexTree(System.Text.RegularExpressions.RegexTree):System.Text.RegularExpressions.RegexCode:this
         -16 (-0.92% of base) : 247725.dasm - GitHub_21915:Main():int
         -16 (-1.32% of base) : 229727.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
         -16 (-1.15% of base) : 176880.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 180145.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 168580.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.19% of base) : 179906.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 155761.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 197830.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)

Top method regressions (percentages):
           4 ( 1.85% of base) : 240122.dasm - BenchmarksGame.MandelBrot_7:GetByte(long,double,int,int):ubyte
           4 ( 1.18% of base) : 240128.dasm - <>c__DisplayClass4_0:<DoBench>b__0(int):this
           4 ( 0.71% of base) : 2482.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)

Top method improvements (percentages):
          -4 (-16.67% of base) : 224135.dasm - TestApp:test_116(long,long):long
          -4 (-16.67% of base) : 232140.dasm - TestApp:test_134(long,long):long
          -4 (-16.67% of base) : 231052.dasm - TestApp:test_155(long,long):long
          -4 (-16.67% of base) : 240284.dasm - TestApp:test_173(long,long):long
          -4 (-16.67% of base) : 240286.dasm - TestApp:test_194(long,long):long
          -4 (-16.67% of base) : 243157.dasm - TestApp:test_290(long,long):long
          -4 (-16.67% of base) : 229406.dasm - TestApp:test_311(long,long):long
          -4 (-16.67% of base) : 229422.dasm - TestApp:test_38(long,long):long
          -4 (-16.67% of base) : 232610.dasm - TestApp:test_56(long,long):long
          -4 (-16.67% of base) : 241744.dasm - TestApp:test_95(long,long):long
          -4 (-14.29% of base) : 229435.dasm - TestApp:test_136(long,long):long
          -4 (-14.29% of base) : 232624.dasm - TestApp:test_175(long,long):long
          -4 (-14.29% of base) : 240254.dasm - TestApp:test_292(long,long):long
          -4 (-14.29% of base) : 226381.dasm - TestApp:test_58(long,long):long
          -4 (-14.29% of base) : 237885.dasm - TestApp:test_97(long,long):long
          -4 (-14.29% of base) : 252747.dasm - X:E(byref,int):float
          -4 (-12.50% of base) : 250762.dasm - float4:get_Item(int):float:this
          -4 (-11.11% of base) : 250763.dasm - float4:set_Item(int,float):this
          -4 (-8.33% of base) : 243180.dasm - TestApp:test_212(long,long):long
          -4 (-8.33% of base) : 226348.dasm - TestApp:test_233(long,long):long

703 total methods with Code Size differences (700 improved, 3 regressed), 5 unchanged.


libraries.crossgen2.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 48207596 (overridden on cmd)
Total bytes of diff: 48200580 (overridden on cmd)
Total bytes of delta: -7016 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
          56 : 124427.dasm (5.19% of base)
          28 : 145076.dasm (3.30% of base)
          24 : 145080.dasm (5.26% of base)
          24 : 124430.dasm (4.48% of base)
           8 : 144854.dasm (3.77% of base)
           8 : 124452.dasm (3.23% of base)
           4 : 132109.dasm (0.61% of base)
           4 : 138771.dasm (0.42% of base)
           4 : 131757.dasm (0.60% of base)
           4 : 134952.dasm (0.46% of base)
           4 : 175517.dasm (0.17% of base)
           4 : 125496.dasm (2.04% of base)

Top file improvements (bytes):
        -292 : 206055.dasm (-3.54% of base)
        -144 : 136346.dasm (-8.13% of base)
        -140 : 193023.dasm (-2.72% of base)
        -136 : 139438.dasm (-2.53% of base)
        -128 : 82762.dasm (-8.04% of base)
         -68 : 126142.dasm (-2.67% of base)
         -64 : 137257.dasm (-2.82% of base)
         -64 : 125617.dasm (-1.54% of base)
         -64 : 141093.dasm (-6.81% of base)
         -52 : 109057.dasm (-6.10% of base)
         -52 : 129283.dasm (-1.55% of base)
         -52 : 175057.dasm (-3.59% of base)
         -52 : 175522.dasm (-3.59% of base)
         -52 : 139355.dasm (-3.64% of base)
         -48 : 139401.dasm (-3.69% of base)
         -48 : 139402.dasm (-3.77% of base)
         -48 : 175376.dasm (-2.45% of base)
         -48 : 139392.dasm (-3.69% of base)
         -48 : 139396.dasm (-3.75% of base)
         -48 : 175058.dasm (-4.88% of base)

664 total files with Code Size differences (652 improved, 12 regressed), 14 unchanged.

Top method regressions (bytes):
          56 ( 5.19% of base) : 124427.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon]):int
          28 ( 3.30% of base) : 145076.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double]):int
          24 ( 4.48% of base) : 124430.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon],int,int)
          24 ( 5.26% of base) : 145080.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double],int,int)
           8 ( 3.23% of base) : 124452.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.__Canon],System.Comparison`1[System.__Canon],int,int)
           8 ( 3.77% of base) : 144854.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.Int32],System.Comparison`1[System.Int32],int,int)
           4 ( 2.04% of base) : 125496.dasm - System.Diagnostics.Tracing.EventSource:WriteCleanup(long,int)
           4 ( 0.46% of base) : 134952.dasm - System.Globalization.OrdinalCasing:ToUpperOrdinal(System.ReadOnlySpan`1[System.Char],System.Span`1[System.Char])
           4 ( 0.17% of base) : 175517.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String
           4 ( 0.42% of base) : 138771.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
           4 ( 0.61% of base) : 132109.dasm - System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
           4 ( 0.60% of base) : 131757.dasm - System.Text.Latin1Utility:NarrowUtf16ToLatin1(long,long,long):long

Top method improvements (bytes):
        -292 (-3.54% of base) : 206055.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -144 (-8.13% of base) : 136346.dasm - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
        -140 (-2.72% of base) : 193023.dasm - Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[System.Char],System.Globalization.NumberFormatInfo)
        -136 (-2.53% of base) : 139438.dasm - System.Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[System.Char],System.Globalization.NumberFormatInfo)
        -128 (-8.04% of base) : 82762.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -68 (-2.67% of base) : 126142.dasm - System.IO.Enumeration.FileSystemName:MatchPattern(System.ReadOnlySpan`1[System.Char],System.ReadOnlySpan`1[System.Char],bool,bool):bool
         -64 (-2.82% of base) : 137257.dasm - StringSerializer:GetSerializedString(System.TimeZoneInfo):System.String
         -64 (-6.81% of base) : 141093.dasm - System.Convert:ConvertToBase64Array(long,long,int,int,bool):int
         -64 (-1.54% of base) : 125617.dasm - System.Diagnostics.Tracing.EventProvider:WriteEvent(byref,long,long,long,System.Object[]):bool:this
         -52 (-3.64% of base) : 139355.dasm - BigInteger:DivRem(byref,byref,byref,byref)
         -52 (-3.59% of base) : 175057.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[System.Char],System.Span`1[System.UInt16],int,byref)
         -52 (-3.59% of base) : 175522.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[System.Char],System.Span`1[System.UInt16],int,byref)
         -52 (-1.55% of base) : 129283.dasm - System.Reflection.CustomAttributeTypedArgument:ToString(bool):System.String:this
         -52 (-6.10% of base) : 109057.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[System.Char],byref)
         -48 (-10.71% of base) : 139354.dasm - BigInteger:HeuristicDivide(byref,byref):int
         -48 (-7.10% of base) : 139334.dasm - BigInteger:ShiftLeft(int):this
         -48 (-4.88% of base) : 175058.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -48 (-3.77% of base) : 139402.dasm - System.Number:TryParseInt32IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int
         -48 (-3.69% of base) : 139401.dasm - System.Number:TryParseInt64IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int
         -48 (-3.75% of base) : 139396.dasm - System.Number:TryParseUInt32IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int

Top method regressions (percentages):
          24 ( 5.26% of base) : 145080.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double],int,int)
          56 ( 5.19% of base) : 124427.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon]):int
          24 ( 4.48% of base) : 124430.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon],int,int)
           8 ( 3.77% of base) : 144854.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.Int32],System.Comparison`1[System.Int32],int,int)
          28 ( 3.30% of base) : 145076.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double]):int
           8 ( 3.23% of base) : 124452.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.__Canon],System.Comparison`1[System.__Canon],int,int)
           4 ( 2.04% of base) : 125496.dasm - System.Diagnostics.Tracing.EventSource:WriteCleanup(long,int)
           4 ( 0.61% of base) : 132109.dasm - System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
           4 ( 0.60% of base) : 131757.dasm - System.Text.Latin1Utility:NarrowUtf16ToLatin1(long,long,long):long
           4 ( 0.46% of base) : 134952.dasm - System.Globalization.OrdinalCasing:ToUpperOrdinal(System.ReadOnlySpan`1[System.Char],System.Span`1[System.Char])
           4 ( 0.42% of base) : 138771.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
           4 ( 0.17% of base) : 175517.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
          -4 (-12.50% of base) : 140368.dasm - System.DateTimeRawInfo:GetNumber(int):int:this
         -48 (-10.71% of base) : 139354.dasm - BigInteger:HeuristicDivide(byref,byref):int
          -8 (-9.52% of base) : 82765.dasm - System.Xml.UniqueId:UnsafeDecode(long,ushort,ushort):int:this
          -4 (-9.09% of base) : 140369.dasm - System.DateTimeRawInfo:AddNumber(int):this
          -8 (-8.33% of base) : 180389.dasm - Microsoft.Diagnostics.Tracing.Extensions.ETWKernelControl:CopyStringToPtr(long,System.String)
          -8 (-8.33% of base) : 18366.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:CopyStringToPtr(long,System.String)
        -144 (-8.13% of base) : 136346.dasm - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
        -128 (-8.04% of base) : 82762.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -20 (-7.81% of base) : 193025.dasm - Number:RoundNumber(byref,int)
          -4 (-7.69% of base) : 8079.dasm - Microsoft.Diagnostics.Tracing.Parsers.JSDumpHeap.DoubleTableTraceData:Doubles(int):double:this
         -40 (-7.25% of base) : 145032.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
          -4 (-7.14% of base) : 142118.dasm - System.String:IsCharBitSet(long,ubyte):bool
          -4 (-7.14% of base) : 145235.dasm - System.Text.EUCJPEncoding:CleanUpEndBytes(long):this
         -48 (-7.10% of base) : 139334.dasm - BigInteger:ShiftLeft(int):this
         -64 (-6.81% of base) : 141093.dasm - System.Convert:ConvertToBase64Array(long,long,int,int,bool):int
         -20 (-6.76% of base) : 193019.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[System.UInt32],System.ReadOnlySpan`1[System.UInt32],System.Span`1[System.UInt32])
          -8 (-6.67% of base) : 140333.dasm - System.Guid:IsHexPrefix(System.ReadOnlySpan`1[System.Char],int):bool
         -36 (-6.57% of base) : 192997.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[System.UInt32],System.ReadOnlySpan`1[System.UInt32],byref,byref)
         -12 (-6.38% of base) : 192804.dasm - System.Numerics.NumericsHelpers:DangerousMakeTwosComplement(System.Span`1[System.UInt32])
         -28 (-6.31% of base) : 139360.dasm - BigInteger:Add(byref,byref,byref)

664 total methods with Code Size differences (652 improved, 12 regressed), 14 unchanged.


libraries.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 47236676 (overridden on cmd)
Total bytes of diff: 47230656 (overridden on cmd)
Total bytes of delta: -6020 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
         156 : 79614.dasm (4.29% of base)
          24 : 6482.dasm (5.50% of base)
          12 : 6486.dasm (1.35% of base)
           4 : 11389.dasm (0.71% of base)
           4 : 187812.dasm (0.22% of base)

Top file improvements (bytes):
        -324 : 102.dasm (-4.11% of base)
        -152 : 199490.dasm (-3.30% of base)
        -128 : 56317.dasm (-8.25% of base)
         -60 : 187807.dasm (-5.21% of base)
         -60 : 186375.dasm (-5.21% of base)
         -52 : 76195.dasm (-6.95% of base)
         -48 : 187964.dasm (-1.73% of base)
         -48 : 221831.dasm (-1.69% of base)
         -44 : 187865.dasm (-3.00% of base)
         -44 : 186374.dasm (-4.49% of base)
         -44 : 203593.dasm (-6.71% of base)
         -40 : 187873.dasm (-0.98% of base)
         -40 : 1300.dasm (-7.69% of base)
         -40 : 53340.dasm (-2.09% of base)
         -36 : 187877.dasm (-4.41% of base)
         -36 : 199528.dasm (-4.04% of base)
         -36 : 187801.dasm (-2.48% of base)
         -36 : 199539.dasm (-8.33% of base)
         -32 : 210531.dasm (-3.43% of base)
         -32 : 48764.dasm (-1.38% of base)

707 total files with Code Size differences (702 improved, 5 regressed), 12 unchanged.

Top method regressions (bytes):
         156 ( 4.29% of base) : 79614.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:SetStackTraceIds(int,long,int):int
          24 ( 5.50% of base) : 6482.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:SwapIfGreaterWithValues(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon],int,int)
          12 ( 1.35% of base) : 6486.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:PickPivotAndPartition(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon]):int
           4 ( 0.71% of base) : 11389.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 187812.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (bytes):
        -324 (-4.11% of base) : 102.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -152 (-3.30% of base) : 199490.dasm - Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[Char],System.Globalization.NumberFormatInfo)
        -128 (-8.25% of base) : 56317.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -60 (-5.21% of base) : 187807.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -60 (-5.21% of base) : 186375.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -52 (-6.95% of base) : 76195.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[Char],byref)
         -48 (-1.73% of base) : 187964.dasm - System.UriBuilder:ToString():System.String:this
         -48 (-1.69% of base) : 221831.dasm - TlsFrameInfo:ToString():System.String:this
         -44 (-4.49% of base) : 186374.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -44 (-6.71% of base) : 203593.dasm - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -44 (-3.00% of base) : 187865.dasm - System.Uri:PrivateParseMinimal():int:this
         -40 (-2.09% of base) : 53340.dasm - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -40 (-7.69% of base) : 1300.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
         -40 (-0.98% of base) : 187873.dasm - System.Uri:ReCreateParts(int,ushort,int):System.String:this
         -36 (-2.48% of base) : 187801.dasm - System.IPv6AddressHelper:ParseCanonicalName(System.String,int,byref,byref):System.String
         -36 (-4.04% of base) : 199528.dasm - System.Numerics.BigIntegerCalculator:Divide(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
         -36 (-8.33% of base) : 199539.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],byref,byref)
         -36 (-4.41% of base) : 187877.dasm - System.Uri:ParseSchemeCheckImplicitFile(long,int,byref,byref,byref):int
         -32 (-1.35% of base) : 53370.dasm - System.Data.SqlTypes.SqlDecimal:op_Multiply(System.Data.SqlTypes.SqlDecimal,System.Data.SqlTypes.SqlDecimal):System.Data.SqlTypes.SqlDecimal
         -32 (-1.38% of base) : 48764.dasm - System.Drawing.Printing.PageSettings:ToString():System.String:this

Top method regressions (percentages):
          24 ( 5.50% of base) : 6482.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:SwapIfGreaterWithValues(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon],int,int)
         156 ( 4.29% of base) : 79614.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:SetStackTraceIds(int,long,int):int
          12 ( 1.35% of base) : 6486.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:PickPivotAndPartition(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon]):int
           4 ( 0.71% of base) : 11389.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 187812.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
         -20 (-11.36% of base) : 199517.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
          -4 (-11.11% of base) : 89862.dasm - Microsoft.Diagnostics.Tracing.Parsers.JSDumpHeap.DoubleTableTraceData:Doubles(int):double:this
         -16 (-9.76% of base) : 199520.dasm - System.Numerics.BigIntegerCalculator:Subtract(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
          -8 (-9.52% of base) : 56314.dasm - System.Xml.UniqueId:UnsafeDecode(long,ushort,ushort):int:this
          -8 (-8.33% of base) : 158210.dasm - Microsoft.Diagnostics.Tracing.Extensions.ETWKernelControl:CopyStringToPtr(long,System.String)
          -8 (-8.33% of base) : 79588.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:CopyStringToPtr(long,System.String)
         -36 (-8.33% of base) : 199539.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],byref,byref)
        -128 (-8.25% of base) : 56317.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -20 (-8.20% of base) : 199512.dasm - System.Numerics.BigIntegerCalculator:SubtractCore(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
         -20 (-7.81% of base) : 199488.dasm - Number:RoundNumber(byref,int)
         -12 (-7.69% of base) : 199518.dasm - System.Numerics.BigIntegerCalculator:AddSelf(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32])
         -12 (-7.69% of base) : 199521.dasm - System.Numerics.BigIntegerCalculator:SubtractSelf(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32])
         -40 (-7.69% of base) : 1300.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
         -12 (-7.50% of base) : 199709.dasm - System.Numerics.NumericsHelpers:DangerousMakeTwosComplement(System.Span`1[UInt32])
          -8 (-7.41% of base) : 199516.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32])
          -8 (-7.41% of base) : 209179.dasm - System.Numerics.Tensors.ArrayUtilities:IsAscending(System.ReadOnlySpan`1[Int32]):bool
          -8 (-7.41% of base) : 209180.dasm - System.Numerics.Tensors.ArrayUtilities:IsDescending(System.ReadOnlySpan`1[Int32]):bool
          -4 (-7.14% of base) : 98004.dasm - System.Text.EUCJPEncoding:CleanUpEndBytes(long):this
         -52 (-6.95% of base) : 76195.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[Char],byref)
          -8 (-6.90% of base) : 199510.dasm - System.Numerics.BigIntegerCalculator:Multiply(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32])

707 total methods with Code Size differences (702 improved, 5 regressed), 12 unchanged.


libraries_tests.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 111312920 (overridden on cmd)
Total bytes of diff: 111302620 (overridden on cmd)
Total bytes of delta: -10300 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
          12 : 147459.dasm (0.79% of base)
           4 : 281269.dasm (0.22% of base)
           4 : 188.dasm (0.71% of base)
           4 : 251629.dasm (2.33% of base)

Top file improvements (bytes):
        -324 : 284989.dasm (-4.11% of base)
        -324 : 62.dasm (-4.11% of base)
         -96 : 296609.dasm (-2.85% of base)
         -60 : 249671.dasm (-5.21% of base)
         -48 : 19892.dasm (-0.90% of base)
         -48 : 19894.dasm (-0.82% of base)
         -48 : 315936.dasm (-0.78% of base)
         -48 : 206136.dasm (-1.75% of base)
         -48 : 257924.dasm (-1.69% of base)
         -44 : 249670.dasm (-4.47% of base)
         -32 : 325249.dasm (-3.43% of base)
         -32 : 331380.dasm (-1.12% of base)
         -32 : 288994.dasm (-3.43% of base)
         -32 : 325686.dasm (-4.08% of base)
         -28 : 249667.dasm (-3.40% of base)
         -28 : 176581.dasm (-2.80% of base)
         -28 : 81.dasm (-1.31% of base)
         -28 : 196354.dasm (-1.45% of base)
         -24 : 71858.dasm (-1.69% of base)
         -24 : 19893.dasm (-0.98% of base)

1400 total files with Code Size differences (1396 improved, 4 regressed), 3 unchanged.

Top method regressions (bytes):
          12 ( 0.79% of base) : 147459.dasm - System.Runtime.InteropServices.Tests.CollectionsMarshalTests:ListAsSpanLinkBreaksOnResize():this
           4 ( 2.33% of base) : 251629.dasm - IdentityEncoding:GetBytes(System.Char[],int,int,System.Byte[],int):int:this
           4 ( 0.71% of base) : 188.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 281269.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (bytes):
        -324 (-4.11% of base) : 284989.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -324 (-4.11% of base) : 62.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
         -96 (-2.85% of base) : 296609.dasm - System.Xml.Tests.XmlBaseCharConvertTests2:XmlEncodeName5():int:this
         -60 (-5.21% of base) : 249671.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -48 (-0.78% of base) : 315936.dasm - System.Net.Primitives.Functional.Tests.IPEndPointParsing:Parse_InvalidPort_Throws(System.String,bool):this
         -48 (-0.82% of base) : 19894.dasm - System.Runtime.Tests.JitInfoTests:JitInfoCurrentThreadIsPopulated():this
         -48 (-0.90% of base) : 19892.dasm - System.Runtime.Tests.JitInfoTests:JitInfoIsPopulated():this
         -48 (-1.75% of base) : 206136.dasm - TlsFrameInfo:ToString():System.String:this
         -48 (-1.69% of base) : 257924.dasm - TlsFrameInfo:ToString():System.String:this
         -44 (-4.47% of base) : 249670.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -32 (-1.12% of base) : 331380.dasm - <PacketSizeIsRespected>d__2:MoveNext():this
         -32 (-4.08% of base) : 325686.dasm - System.IO.PathInternal:RemoveRelativeSegments(System.ReadOnlySpan`1[Char],int,byref):bool
         -32 (-3.43% of base) : 325249.dasm - System.PasteArguments:AppendArgument(byref,System.String)
         -32 (-3.43% of base) : 288994.dasm - System.PasteArguments:AppendArgument(byref,System.String)
         -28 (-2.80% of base) : 176581.dasm - LargeStruct:get_Value():long:this
         -28 (-3.40% of base) : 249667.dasm - System.IPv4AddressHelper:ParseNonCanonical(long,int,byref,bool):long
         -28 (-1.45% of base) : 196354.dasm - System.Memory.Tests.SequenceReader.IsNext:IsNext_Value():this
         -28 (-1.31% of base) : 81.dasm - System.Text.RegularExpressions.RegexReplacement:.ctor(System.String,System.Text.RegularExpressions.RegexNode,System.Collections.Hashtable):this
         -24 (-2.67% of base) : 269129.dasm - __M2Struct:ToString():System.String:this
         -24 (-2.67% of base) : 332293.dasm - __M2Struct:ToString():System.String:this

Top method regressions (percentages):
           4 ( 2.33% of base) : 251629.dasm - IdentityEncoding:GetBytes(System.Char[],int,int,System.Byte[],int):int:this
          12 ( 0.79% of base) : 147459.dasm - System.Runtime.InteropServices.Tests.CollectionsMarshalTests:ListAsSpanLinkBreaksOnResize():this
           4 ( 0.71% of base) : 188.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 281269.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
          -4 (-6.67% of base) : 198216.dasm - <>c__DisplayClass1_0`1[__Canon][System.__Canon]:<ValidateReferenceType>b__0(System.Span`1[__Canon]):this
          -4 (-6.67% of base) : 198217.dasm - <>c__DisplayClass7_0`1[__Canon][System.__Canon]:<ValidateReferenceType>b__0(System.ReadOnlySpan`1[__Canon]):this
          -4 (-6.25% of base) : 80129.dasm - AsciiPreescapedData:TryGetPreescapedData(int,byref):bool:this
          -4 (-6.25% of base) : 284983.dasm - System.Text.RegularExpressions.RegexWriter:PatchJump(int,int):this
          -8 (-5.88% of base) : 79820.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 284614.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 307347.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 258548.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 281272.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 160565.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 252153.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 257437.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 249673.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
         -12 (-5.66% of base) : 249770.dasm - System.Net.IPAddressParser:IPv4AddressToStringHelper(int,long):int
         -12 (-5.66% of base) : 258788.dasm - System.Net.IPAddressParser:IPv4AddressToStringHelper(int,long):int
          -4 (-5.56% of base) : 284711.dasm - System.Collections.Generic.ValueListBuilder`1[__Canon][System.__Canon]:Pop():System.__Canon:this
          -4 (-5.56% of base) : 284726.dasm - System.Collections.Generic.ValueListBuilder`1[Double][System.Double]:Pop():double:this
          -4 (-5.56% of base) : 284722.dasm - System.Collections.Generic.ValueListBuilder`1[Int16][System.Int16]:Pop():short:this
          -4 (-5.56% of base) : 284724.dasm - System.Collections.Generic.ValueListBuilder`1[Int32][System.Int32]:Pop():int:this
          -4 (-5.56% of base) : 284730.dasm - System.Collections.Generic.ValueListBuilder`1[Int64][System.Int64]:Pop():long:this

1400 total methods with Code Size differences (1396 improved, 4 regressed), 3 unchanged.


I have a more complicated improvement with bigger diffs but it's not ready yet (see #60813 (comment))

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 24, 2021
@ghost
Copy link

ghost commented Oct 24, 2021

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

Addressing modes on ARM are tricky, it only supports:

[reg]
[reg  + icon]
[reg1 + reg2]
[reg1 + reg2 * natural-scale]

while on x64 we can do things like [reg1 + 8 * reg2 + icon]

Codegen improvement example:

void GetSet(int* data, int i, int j) 
    => data[i] = data[j];

diff:

; Method Prog:GetSet(long,int,int):this
G_M13801_IG01:
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
G_M13801_IG02:
            sxtw    x0, w3
-           lsl     x0, x0, #2
-           ldr     w0, [x1, x0]
+           ldr     w0, [x1, x0, LSL #2]
            sxtw    x2, w2
-           lsl     x2, x2, #2
-           str     w0, [x1, x2]
+           str     w0, [x1, x2, LSL #2]
G_M13801_IG03:
            ldp     fp, lr, [sp],#16
            ret     lr
; Total bytes of code: 40

Also, I removed SCALED_ADDR_MODES - it's always defined for all targets and I don't think it simplifies porting to new platforms as before this PR this flag was set but scaled addr modes were disabled anyway.

coreclr_tests.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 109454980 (overridden on cmd)
Total bytes of diff: 109451052 (overridden on cmd)
Total bytes of delta: -3928 (-0.00 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
           4 : 2482.dasm (0.71% of base)
           4 : 240122.dasm (1.85% of base)
           4 : 240128.dasm (1.18% of base)

Top file improvements (bytes):
        -324 : 105.dasm (-4.11% of base)
         -52 : 248472.dasm (-6.88% of base)
         -52 : 246408.dasm (-2.92% of base)
         -44 : 240496.dasm (-2.23% of base)
         -32 : 242403.dasm (-0.20% of base)
         -32 : 232908.dasm (-0.20% of base)
         -28 : 237005.dasm (-1.89% of base)
         -28 : 124.dasm (-1.31% of base)
         -24 : 216037.dasm (-5.22% of base)
         -20 : 2477.dasm (-1.79% of base)
         -20 : 103.dasm (-1.09% of base)
         -20 : 237004.dasm (-1.59% of base)
         -16 : 176880.dasm (-1.15% of base)
         -16 : 180145.dasm (-1.15% of base)
         -16 : 247725.dasm (-0.92% of base)
         -16 : 229727.dasm (-1.32% of base)
         -16 : 168580.dasm (-1.15% of base)
         -16 : 179906.dasm (-1.19% of base)
         -16 : 155761.dasm (-1.15% of base)
         -16 : 197830.dasm (-1.15% of base)

703 total files with Code Size differences (700 improved, 3 regressed), 5 unchanged.

Top method regressions (bytes):
           4 ( 1.18% of base) : 240128.dasm - <>c__DisplayClass4_0:<DoBench>b__0(int):this
           4 ( 1.85% of base) : 240122.dasm - BenchmarksGame.MandelBrot_7:GetByte(long,double,int,int):ubyte
           4 ( 0.71% of base) : 2482.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)

Top method improvements (bytes):
        -324 (-4.11% of base) : 105.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
         -52 (-6.88% of base) : 248472.dasm - GitHub_23159:BytesOrdinalEqualsStringAndAscii(System.String,System.Span`1[Byte]):bool
         -52 (-2.92% of base) : 246408.dasm - ImplicitByrefTailCalls:Main():int
         -44 (-2.23% of base) : 240496.dasm - ImplicitByrefTailCalls:Main():int
         -32 (-0.20% of base) : 242403.dasm - StrAccess2:Main():int
         -32 (-0.20% of base) : 232908.dasm - StrAccess2:Main():int
         -28 (-1.89% of base) : 237005.dasm - Runtime_31615:Check(V4,float,float,float,float,int)
         -28 (-1.31% of base) : 124.dasm - System.Text.RegularExpressions.RegexReplacement:.ctor(System.String,System.Text.RegularExpressions.RegexNode,System.Collections.Hashtable):this
         -24 (-5.22% of base) : 216037.dasm - Span.SpanBench:TestQuickSortSpan(System.Span`1[Int32])
         -20 (-1.59% of base) : 237004.dasm - Runtime_31615:Check(V3,float,float,float,int)
         -20 (-1.79% of base) : 2477.dasm - System.Diagnostics.Process:GetNextArgument(System.String,byref):System.String
         -20 (-1.09% of base) : 103.dasm - System.Text.RegularExpressions.RegexWriter:RegexCodeFromRegexTree(System.Text.RegularExpressions.RegexTree):System.Text.RegularExpressions.RegexCode:this
         -16 (-0.92% of base) : 247725.dasm - GitHub_21915:Main():int
         -16 (-1.32% of base) : 229727.dasm - IntelHardwareIntrinsicTest.Program:Main(System.String[]):int
         -16 (-1.15% of base) : 176880.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 180145.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 168580.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.19% of base) : 179906.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 155761.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)
         -16 (-1.15% of base) : 197830.dasm - IntelHardwareIntrinsicTest.Program:PrintErrorHeaderTuv(System.String,System.String)

Top method regressions (percentages):
           4 ( 1.85% of base) : 240122.dasm - BenchmarksGame.MandelBrot_7:GetByte(long,double,int,int):ubyte
           4 ( 1.18% of base) : 240128.dasm - <>c__DisplayClass4_0:<DoBench>b__0(int):this
           4 ( 0.71% of base) : 2482.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)

Top method improvements (percentages):
          -4 (-16.67% of base) : 224135.dasm - TestApp:test_116(long,long):long
          -4 (-16.67% of base) : 232140.dasm - TestApp:test_134(long,long):long
          -4 (-16.67% of base) : 231052.dasm - TestApp:test_155(long,long):long
          -4 (-16.67% of base) : 240284.dasm - TestApp:test_173(long,long):long
          -4 (-16.67% of base) : 240286.dasm - TestApp:test_194(long,long):long
          -4 (-16.67% of base) : 243157.dasm - TestApp:test_290(long,long):long
          -4 (-16.67% of base) : 229406.dasm - TestApp:test_311(long,long):long
          -4 (-16.67% of base) : 229422.dasm - TestApp:test_38(long,long):long
          -4 (-16.67% of base) : 232610.dasm - TestApp:test_56(long,long):long
          -4 (-16.67% of base) : 241744.dasm - TestApp:test_95(long,long):long
          -4 (-14.29% of base) : 229435.dasm - TestApp:test_136(long,long):long
          -4 (-14.29% of base) : 232624.dasm - TestApp:test_175(long,long):long
          -4 (-14.29% of base) : 240254.dasm - TestApp:test_292(long,long):long
          -4 (-14.29% of base) : 226381.dasm - TestApp:test_58(long,long):long
          -4 (-14.29% of base) : 237885.dasm - TestApp:test_97(long,long):long
          -4 (-14.29% of base) : 252747.dasm - X:E(byref,int):float
          -4 (-12.50% of base) : 250762.dasm - float4:get_Item(int):float:this
          -4 (-11.11% of base) : 250763.dasm - float4:set_Item(int,float):this
          -4 (-8.33% of base) : 243180.dasm - TestApp:test_212(long,long):long
          -4 (-8.33% of base) : 226348.dasm - TestApp:test_233(long,long):long

703 total methods with Code Size differences (700 improved, 3 regressed), 5 unchanged.


libraries.crossgen2.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 48207596 (overridden on cmd)
Total bytes of diff: 48200580 (overridden on cmd)
Total bytes of delta: -7016 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
          56 : 124427.dasm (5.19% of base)
          28 : 145076.dasm (3.30% of base)
          24 : 145080.dasm (5.26% of base)
          24 : 124430.dasm (4.48% of base)
           8 : 144854.dasm (3.77% of base)
           8 : 124452.dasm (3.23% of base)
           4 : 132109.dasm (0.61% of base)
           4 : 138771.dasm (0.42% of base)
           4 : 131757.dasm (0.60% of base)
           4 : 134952.dasm (0.46% of base)
           4 : 175517.dasm (0.17% of base)
           4 : 125496.dasm (2.04% of base)

Top file improvements (bytes):
        -292 : 206055.dasm (-3.54% of base)
        -144 : 136346.dasm (-8.13% of base)
        -140 : 193023.dasm (-2.72% of base)
        -136 : 139438.dasm (-2.53% of base)
        -128 : 82762.dasm (-8.04% of base)
         -68 : 126142.dasm (-2.67% of base)
         -64 : 137257.dasm (-2.82% of base)
         -64 : 125617.dasm (-1.54% of base)
         -64 : 141093.dasm (-6.81% of base)
         -52 : 109057.dasm (-6.10% of base)
         -52 : 129283.dasm (-1.55% of base)
         -52 : 175057.dasm (-3.59% of base)
         -52 : 175522.dasm (-3.59% of base)
         -52 : 139355.dasm (-3.64% of base)
         -48 : 139401.dasm (-3.69% of base)
         -48 : 139402.dasm (-3.77% of base)
         -48 : 175376.dasm (-2.45% of base)
         -48 : 139392.dasm (-3.69% of base)
         -48 : 139396.dasm (-3.75% of base)
         -48 : 175058.dasm (-4.88% of base)

664 total files with Code Size differences (652 improved, 12 regressed), 14 unchanged.

Top method regressions (bytes):
          56 ( 5.19% of base) : 124427.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon]):int
          28 ( 3.30% of base) : 145076.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double]):int
          24 ( 4.48% of base) : 124430.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon],int,int)
          24 ( 5.26% of base) : 145080.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double],int,int)
           8 ( 3.23% of base) : 124452.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.__Canon],System.Comparison`1[System.__Canon],int,int)
           8 ( 3.77% of base) : 144854.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.Int32],System.Comparison`1[System.Int32],int,int)
           4 ( 2.04% of base) : 125496.dasm - System.Diagnostics.Tracing.EventSource:WriteCleanup(long,int)
           4 ( 0.46% of base) : 134952.dasm - System.Globalization.OrdinalCasing:ToUpperOrdinal(System.ReadOnlySpan`1[System.Char],System.Span`1[System.Char])
           4 ( 0.17% of base) : 175517.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String
           4 ( 0.42% of base) : 138771.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
           4 ( 0.61% of base) : 132109.dasm - System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
           4 ( 0.60% of base) : 131757.dasm - System.Text.Latin1Utility:NarrowUtf16ToLatin1(long,long,long):long

Top method improvements (bytes):
        -292 (-3.54% of base) : 206055.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -144 (-8.13% of base) : 136346.dasm - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
        -140 (-2.72% of base) : 193023.dasm - Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[System.Char],System.Globalization.NumberFormatInfo)
        -136 (-2.53% of base) : 139438.dasm - System.Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[System.Char],System.Globalization.NumberFormatInfo)
        -128 (-8.04% of base) : 82762.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -68 (-2.67% of base) : 126142.dasm - System.IO.Enumeration.FileSystemName:MatchPattern(System.ReadOnlySpan`1[System.Char],System.ReadOnlySpan`1[System.Char],bool,bool):bool
         -64 (-2.82% of base) : 137257.dasm - StringSerializer:GetSerializedString(System.TimeZoneInfo):System.String
         -64 (-6.81% of base) : 141093.dasm - System.Convert:ConvertToBase64Array(long,long,int,int,bool):int
         -64 (-1.54% of base) : 125617.dasm - System.Diagnostics.Tracing.EventProvider:WriteEvent(byref,long,long,long,System.Object[]):bool:this
         -52 (-3.64% of base) : 139355.dasm - BigInteger:DivRem(byref,byref,byref,byref)
         -52 (-3.59% of base) : 175057.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[System.Char],System.Span`1[System.UInt16],int,byref)
         -52 (-3.59% of base) : 175522.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[System.Char],System.Span`1[System.UInt16],int,byref)
         -52 (-1.55% of base) : 129283.dasm - System.Reflection.CustomAttributeTypedArgument:ToString(bool):System.String:this
         -52 (-6.10% of base) : 109057.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[System.Char],byref)
         -48 (-10.71% of base) : 139354.dasm - BigInteger:HeuristicDivide(byref,byref):int
         -48 (-7.10% of base) : 139334.dasm - BigInteger:ShiftLeft(int):this
         -48 (-4.88% of base) : 175058.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -48 (-3.77% of base) : 139402.dasm - System.Number:TryParseInt32IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int
         -48 (-3.69% of base) : 139401.dasm - System.Number:TryParseInt64IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int
         -48 (-3.75% of base) : 139396.dasm - System.Number:TryParseUInt32IntegerStyle(System.ReadOnlySpan`1[System.Char],int,System.Globalization.NumberFormatInfo,byref):int

Top method regressions (percentages):
          24 ( 5.26% of base) : 145080.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double],int,int)
          56 ( 5.19% of base) : 124427.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon]):int
          24 ( 4.48% of base) : 124430.dasm - System.Collections.Generic.ArraySortHelper`2:SwapIfGreaterWithValues(System.Span`1[System.__Canon],System.Span`1[System.__Canon],System.Collections.Generic.IComparer`1[System.__Canon],int,int)
           8 ( 3.77% of base) : 144854.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.Int32],System.Comparison`1[System.Int32],int,int)
          28 ( 3.30% of base) : 145076.dasm - System.Collections.Generic.ArraySortHelper`2:PickPivotAndPartition(System.Span`1[System.Double],System.Span`1[System.Double],System.Collections.Generic.IComparer`1[System.Double]):int
           8 ( 3.23% of base) : 124452.dasm - System.Collections.Generic.ArraySortHelper`1:SwapIfGreater(System.Span`1[System.__Canon],System.Comparison`1[System.__Canon],int,int)
           4 ( 2.04% of base) : 125496.dasm - System.Diagnostics.Tracing.EventSource:WriteCleanup(long,int)
           4 ( 0.61% of base) : 132109.dasm - System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
           4 ( 0.60% of base) : 131757.dasm - System.Text.Latin1Utility:NarrowUtf16ToLatin1(long,long,long):long
           4 ( 0.46% of base) : 134952.dasm - System.Globalization.OrdinalCasing:ToUpperOrdinal(System.ReadOnlySpan`1[System.Char],System.Span`1[System.Char])
           4 ( 0.42% of base) : 138771.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
           4 ( 0.17% of base) : 175517.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
          -4 (-12.50% of base) : 140368.dasm - System.DateTimeRawInfo:GetNumber(int):int:this
         -48 (-10.71% of base) : 139354.dasm - BigInteger:HeuristicDivide(byref,byref):int
          -8 (-9.52% of base) : 82765.dasm - System.Xml.UniqueId:UnsafeDecode(long,ushort,ushort):int:this
          -4 (-9.09% of base) : 140369.dasm - System.DateTimeRawInfo:AddNumber(int):this
          -8 (-8.33% of base) : 180389.dasm - Microsoft.Diagnostics.Tracing.Extensions.ETWKernelControl:CopyStringToPtr(long,System.String)
          -8 (-8.33% of base) : 18366.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:CopyStringToPtr(long,System.String)
        -144 (-8.13% of base) : 136346.dasm - System.Numerics.Matrix4x4:Decompose(System.Numerics.Matrix4x4,byref,byref,byref):bool
        -128 (-8.04% of base) : 82762.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -20 (-7.81% of base) : 193025.dasm - Number:RoundNumber(byref,int)
          -4 (-7.69% of base) : 8079.dasm - Microsoft.Diagnostics.Tracing.Parsers.JSDumpHeap.DoubleTableTraceData:Doubles(int):double:this
         -40 (-7.25% of base) : 145032.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
          -4 (-7.14% of base) : 142118.dasm - System.String:IsCharBitSet(long,ubyte):bool
          -4 (-7.14% of base) : 145235.dasm - System.Text.EUCJPEncoding:CleanUpEndBytes(long):this
         -48 (-7.10% of base) : 139334.dasm - BigInteger:ShiftLeft(int):this
         -64 (-6.81% of base) : 141093.dasm - System.Convert:ConvertToBase64Array(long,long,int,int,bool):int
         -20 (-6.76% of base) : 193019.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[System.UInt32],System.ReadOnlySpan`1[System.UInt32],System.Span`1[System.UInt32])
          -8 (-6.67% of base) : 140333.dasm - System.Guid:IsHexPrefix(System.ReadOnlySpan`1[System.Char],int):bool
         -36 (-6.57% of base) : 192997.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[System.UInt32],System.ReadOnlySpan`1[System.UInt32],byref,byref)
         -12 (-6.38% of base) : 192804.dasm - System.Numerics.NumericsHelpers:DangerousMakeTwosComplement(System.Span`1[System.UInt32])
         -28 (-6.31% of base) : 139360.dasm - BigInteger:Add(byref,byref,byref)

664 total methods with Code Size differences (652 improved, 12 regressed), 14 unchanged.


libraries.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 47236676 (overridden on cmd)
Total bytes of diff: 47230656 (overridden on cmd)
Total bytes of delta: -6020 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
         156 : 79614.dasm (4.29% of base)
          24 : 6482.dasm (5.50% of base)
          12 : 6486.dasm (1.35% of base)
           4 : 11389.dasm (0.71% of base)
           4 : 187812.dasm (0.22% of base)

Top file improvements (bytes):
        -324 : 102.dasm (-4.11% of base)
        -152 : 199490.dasm (-3.30% of base)
        -128 : 56317.dasm (-8.25% of base)
         -60 : 187807.dasm (-5.21% of base)
         -60 : 186375.dasm (-5.21% of base)
         -52 : 76195.dasm (-6.95% of base)
         -48 : 187964.dasm (-1.73% of base)
         -48 : 221831.dasm (-1.69% of base)
         -44 : 187865.dasm (-3.00% of base)
         -44 : 186374.dasm (-4.49% of base)
         -44 : 203593.dasm (-6.71% of base)
         -40 : 187873.dasm (-0.98% of base)
         -40 : 1300.dasm (-7.69% of base)
         -40 : 53340.dasm (-2.09% of base)
         -36 : 187877.dasm (-4.41% of base)
         -36 : 199528.dasm (-4.04% of base)
         -36 : 187801.dasm (-2.48% of base)
         -36 : 199539.dasm (-8.33% of base)
         -32 : 210531.dasm (-3.43% of base)
         -32 : 48764.dasm (-1.38% of base)

707 total files with Code Size differences (702 improved, 5 regressed), 12 unchanged.

Top method regressions (bytes):
         156 ( 4.29% of base) : 79614.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:SetStackTraceIds(int,long,int):int
          24 ( 5.50% of base) : 6482.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:SwapIfGreaterWithValues(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon],int,int)
          12 ( 1.35% of base) : 6486.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:PickPivotAndPartition(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon]):int
           4 ( 0.71% of base) : 11389.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 187812.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (bytes):
        -324 (-4.11% of base) : 102.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -152 (-3.30% of base) : 199490.dasm - Number:NumberToStringFormat(byref,byref,System.ReadOnlySpan`1[Char],System.Globalization.NumberFormatInfo)
        -128 (-8.25% of base) : 56317.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -60 (-5.21% of base) : 187807.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -60 (-5.21% of base) : 186375.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -52 (-6.95% of base) : 76195.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[Char],byref)
         -48 (-1.73% of base) : 187964.dasm - System.UriBuilder:ToString():System.String:this
         -48 (-1.69% of base) : 221831.dasm - TlsFrameInfo:ToString():System.String:this
         -44 (-4.49% of base) : 186374.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -44 (-6.71% of base) : 203593.dasm - System.Text.Encodings.Web.OptimizedInboxTextEncoder:GetIndexOfFirstCharToEncode(System.ReadOnlySpan`1[Char]):int:this
         -44 (-3.00% of base) : 187865.dasm - System.Uri:PrivateParseMinimal():int:this
         -40 (-2.09% of base) : 53340.dasm - System.Data.SqlTypes.SqlDecimal:MpDiv(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32],int,System.Span`1[UInt32],byref,System.Span`1[UInt32],byref)
         -40 (-7.69% of base) : 1300.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
         -40 (-0.98% of base) : 187873.dasm - System.Uri:ReCreateParts(int,ushort,int):System.String:this
         -36 (-2.48% of base) : 187801.dasm - System.IPv6AddressHelper:ParseCanonicalName(System.String,int,byref,byref):System.String
         -36 (-4.04% of base) : 199528.dasm - System.Numerics.BigIntegerCalculator:Divide(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
         -36 (-8.33% of base) : 199539.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],byref,byref)
         -36 (-4.41% of base) : 187877.dasm - System.Uri:ParseSchemeCheckImplicitFile(long,int,byref,byref,byref):int
         -32 (-1.35% of base) : 53370.dasm - System.Data.SqlTypes.SqlDecimal:op_Multiply(System.Data.SqlTypes.SqlDecimal,System.Data.SqlTypes.SqlDecimal):System.Data.SqlTypes.SqlDecimal
         -32 (-1.38% of base) : 48764.dasm - System.Drawing.Printing.PageSettings:ToString():System.String:this

Top method regressions (percentages):
          24 ( 5.50% of base) : 6482.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:SwapIfGreaterWithValues(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon],int,int)
         156 ( 4.29% of base) : 79614.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:SetStackTraceIds(int,long,int):int
          12 ( 1.35% of base) : 6486.dasm - System.Collections.Generic.ArraySortHelper`2[__Canon,Nullable`1][System.__Canon,System.Nullable`1[System.Int32]]:PickPivotAndPartition(System.Span`1[__Canon],System.Span`1[Nullable`1],System.Collections.Generic.IComparer`1[__Canon]):int
           4 ( 0.71% of base) : 11389.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 187812.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
         -20 (-11.36% of base) : 199517.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
          -4 (-11.11% of base) : 89862.dasm - Microsoft.Diagnostics.Tracing.Parsers.JSDumpHeap.DoubleTableTraceData:Doubles(int):double:this
         -16 (-9.76% of base) : 199520.dasm - System.Numerics.BigIntegerCalculator:Subtract(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
          -8 (-9.52% of base) : 56314.dasm - System.Xml.UniqueId:UnsafeDecode(long,ushort,ushort):int:this
          -8 (-8.33% of base) : 158210.dasm - Microsoft.Diagnostics.Tracing.Extensions.ETWKernelControl:CopyStringToPtr(long,System.String)
          -8 (-8.33% of base) : 79588.dasm - Microsoft.Diagnostics.Tracing.Session.TraceEventSession:CopyStringToPtr(long,System.String)
         -36 (-8.33% of base) : 199539.dasm - System.Numerics.BigIntegerCalculator:ExtractDigits(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],byref,byref)
        -128 (-8.25% of base) : 56317.dasm - System.Xml.UniqueId:UnsafeParse(long,int):this
         -20 (-8.20% of base) : 199512.dasm - System.Numerics.BigIntegerCalculator:SubtractCore(System.ReadOnlySpan`1[UInt32],System.ReadOnlySpan`1[UInt32],System.Span`1[UInt32])
         -20 (-7.81% of base) : 199488.dasm - Number:RoundNumber(byref,int)
         -12 (-7.69% of base) : 199518.dasm - System.Numerics.BigIntegerCalculator:AddSelf(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32])
         -12 (-7.69% of base) : 199521.dasm - System.Numerics.BigIntegerCalculator:SubtractSelf(System.Span`1[UInt32],System.ReadOnlySpan`1[UInt32])
         -40 (-7.69% of base) : 1300.dasm - System.SpanHelpers:SequenceEqual(byref,byref,int):bool
         -12 (-7.50% of base) : 199709.dasm - System.Numerics.NumericsHelpers:DangerousMakeTwosComplement(System.Span`1[UInt32])
          -8 (-7.41% of base) : 199516.dasm - System.Numerics.BigIntegerCalculator:Add(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32])
          -8 (-7.41% of base) : 209179.dasm - System.Numerics.Tensors.ArrayUtilities:IsAscending(System.ReadOnlySpan`1[Int32]):bool
          -8 (-7.41% of base) : 209180.dasm - System.Numerics.Tensors.ArrayUtilities:IsDescending(System.ReadOnlySpan`1[Int32]):bool
          -4 (-7.14% of base) : 98004.dasm - System.Text.EUCJPEncoding:CleanUpEndBytes(long):this
         -52 (-6.95% of base) : 76195.dasm - System.Text.Json.JsonWriterHelper:EscapeNextChars(ushort,System.Span`1[Char],byref)
          -8 (-6.90% of base) : 199510.dasm - System.Numerics.BigIntegerCalculator:Multiply(System.ReadOnlySpan`1[UInt32],int,System.Span`1[UInt32])

707 total methods with Code Size differences (702 improved, 5 regressed), 12 unchanged.


libraries_tests.pmi.Linux.arm64.checked.mch:


Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 111312920 (overridden on cmd)
Total bytes of diff: 111302620 (overridden on cmd)
Total bytes of delta: -10300 (-0.01 % of base)
    diff is an improvement.
    relative diff is an improvement.
Detail diffs


Top file regressions (bytes):
          12 : 147459.dasm (0.79% of base)
           4 : 281269.dasm (0.22% of base)
           4 : 188.dasm (0.71% of base)
           4 : 251629.dasm (2.33% of base)

Top file improvements (bytes):
        -324 : 284989.dasm (-4.11% of base)
        -324 : 62.dasm (-4.11% of base)
         -96 : 296609.dasm (-2.85% of base)
         -60 : 249671.dasm (-5.21% of base)
         -48 : 19892.dasm (-0.90% of base)
         -48 : 19894.dasm (-0.82% of base)
         -48 : 315936.dasm (-0.78% of base)
         -48 : 206136.dasm (-1.75% of base)
         -48 : 257924.dasm (-1.69% of base)
         -44 : 249670.dasm (-4.47% of base)
         -32 : 325249.dasm (-3.43% of base)
         -32 : 331380.dasm (-1.12% of base)
         -32 : 288994.dasm (-3.43% of base)
         -32 : 325686.dasm (-4.08% of base)
         -28 : 249667.dasm (-3.40% of base)
         -28 : 176581.dasm (-2.80% of base)
         -28 : 81.dasm (-1.31% of base)
         -28 : 196354.dasm (-1.45% of base)
         -24 : 71858.dasm (-1.69% of base)
         -24 : 19893.dasm (-0.98% of base)

1400 total files with Code Size differences (1396 improved, 4 regressed), 3 unchanged.

Top method regressions (bytes):
          12 ( 0.79% of base) : 147459.dasm - System.Runtime.InteropServices.Tests.CollectionsMarshalTests:ListAsSpanLinkBreaksOnResize():this
           4 ( 2.33% of base) : 251629.dasm - IdentityEncoding:GetBytes(System.Char[],int,int,System.Byte[],int):int:this
           4 ( 0.71% of base) : 188.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 281269.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (bytes):
        -324 (-4.11% of base) : 284989.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
        -324 (-4.11% of base) : 62.dasm - System.Text.RegularExpressions.RegexWriter:EmitFragment(int,System.Text.RegularExpressions.RegexNode,int):this
         -96 (-2.85% of base) : 296609.dasm - System.Xml.Tests.XmlBaseCharConvertTests2:XmlEncodeName5():int:this
         -60 (-5.21% of base) : 249671.dasm - System.IPv6AddressHelper:Parse(System.ReadOnlySpan`1[Char],System.Span`1[UInt16],int,byref)
         -48 (-0.78% of base) : 315936.dasm - System.Net.Primitives.Functional.Tests.IPEndPointParsing:Parse_InvalidPort_Throws(System.String,bool):this
         -48 (-0.82% of base) : 19894.dasm - System.Runtime.Tests.JitInfoTests:JitInfoCurrentThreadIsPopulated():this
         -48 (-0.90% of base) : 19892.dasm - System.Runtime.Tests.JitInfoTests:JitInfoIsPopulated():this
         -48 (-1.75% of base) : 206136.dasm - TlsFrameInfo:ToString():System.String:this
         -48 (-1.69% of base) : 257924.dasm - TlsFrameInfo:ToString():System.String:this
         -44 (-4.47% of base) : 249670.dasm - System.IPv6AddressHelper:IsValidStrict(long,int,byref):bool
         -32 (-1.12% of base) : 331380.dasm - <PacketSizeIsRespected>d__2:MoveNext():this
         -32 (-4.08% of base) : 325686.dasm - System.IO.PathInternal:RemoveRelativeSegments(System.ReadOnlySpan`1[Char],int,byref):bool
         -32 (-3.43% of base) : 325249.dasm - System.PasteArguments:AppendArgument(byref,System.String)
         -32 (-3.43% of base) : 288994.dasm - System.PasteArguments:AppendArgument(byref,System.String)
         -28 (-2.80% of base) : 176581.dasm - LargeStruct:get_Value():long:this
         -28 (-3.40% of base) : 249667.dasm - System.IPv4AddressHelper:ParseNonCanonical(long,int,byref,bool):long
         -28 (-1.45% of base) : 196354.dasm - System.Memory.Tests.SequenceReader.IsNext:IsNext_Value():this
         -28 (-1.31% of base) : 81.dasm - System.Text.RegularExpressions.RegexReplacement:.ctor(System.String,System.Text.RegularExpressions.RegexNode,System.Collections.Hashtable):this
         -24 (-2.67% of base) : 269129.dasm - __M2Struct:ToString():System.String:this
         -24 (-2.67% of base) : 332293.dasm - __M2Struct:ToString():System.String:this

Top method regressions (percentages):
           4 ( 2.33% of base) : 251629.dasm - IdentityEncoding:GetBytes(System.Char[],int,int,System.Byte[],int):int:this
          12 ( 0.79% of base) : 147459.dasm - System.Runtime.InteropServices.Tests.CollectionsMarshalTests:ListAsSpanLinkBreaksOnResize():this
           4 ( 0.71% of base) : 188.dasm - Sys:AllocNullTerminatedArray(System.String[],byref)
           4 ( 0.22% of base) : 281269.dasm - System.IriHelper:EscapeUnescapeIri(long,int,int,int):System.String

Top method improvements (percentages):
          -4 (-6.67% of base) : 198216.dasm - <>c__DisplayClass1_0`1[__Canon][System.__Canon]:<ValidateReferenceType>b__0(System.Span`1[__Canon]):this
          -4 (-6.67% of base) : 198217.dasm - <>c__DisplayClass7_0`1[__Canon][System.__Canon]:<ValidateReferenceType>b__0(System.ReadOnlySpan`1[__Canon]):this
          -4 (-6.25% of base) : 80129.dasm - AsciiPreescapedData:TryGetPreescapedData(int,byref):bool:this
          -4 (-6.25% of base) : 284983.dasm - System.Text.RegularExpressions.RegexWriter:PatchJump(int,int):this
          -8 (-5.88% of base) : 79820.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 284614.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 307347.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 258548.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 281272.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 160565.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 252153.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 257437.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
          -8 (-5.88% of base) : 249673.dasm - System.HexConverter:ToCharsBuffer(ubyte,System.Span`1[Char],int,int)
         -12 (-5.66% of base) : 249770.dasm - System.Net.IPAddressParser:IPv4AddressToStringHelper(int,long):int
         -12 (-5.66% of base) : 258788.dasm - System.Net.IPAddressParser:IPv4AddressToStringHelper(int,long):int
          -4 (-5.56% of base) : 284711.dasm - System.Collections.Generic.ValueListBuilder`1[__Canon][System.__Canon]:Pop():System.__Canon:this
          -4 (-5.56% of base) : 284726.dasm - System.Collections.Generic.ValueListBuilder`1[Double][System.Double]:Pop():double:this
          -4 (-5.56% of base) : 284722.dasm - System.Collections.Generic.ValueListBuilder`1[Int16][System.Int16]:Pop():short:this
          -4 (-5.56% of base) : 284724.dasm - System.Collections.Generic.ValueListBuilder`1[Int32][System.Int32]:Pop():int:this
          -4 (-5.56% of base) : 284730.dasm - System.Collections.Generic.ValueListBuilder`1[Int64][System.Int64]:Pop():long:this

1400 total methods with Code Size differences (1396 improved, 4 regressed), 3 unchanged.


I have a more complicated improvement with bigger diffs but it's not ready yet.

Author: EgorBo
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member Author

EgorBo commented Oct 24, 2021

It doesn't handle "array access via index" yet, e.g.:

int a = array[i]; // int[] array, int i

currently emits:

mov     w1, w1
lsl     x1, x1, #2
add     x1, x1, #16
ldr     w0, [x0, x1]

while could be:

add     x8, x0, w1, uxtw #2
ldr     w0, [x8, #16]

@EgorBo
Copy link
Member Author

EgorBo commented Oct 24, 2021

/azp run runtime-coreclr jitstressregs, runtime-coreclr outerloop, runtime-coreclr jitstress2-jitstressregs, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@EgorBo
Copy link
Member Author

EgorBo commented Oct 25, 2021

PTAL @dotnet/jit-contrib

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

src/coreclr/jit/emitarm64.cpp Outdated Show resolved Hide resolved
src/coreclr/jit/codegencommon.cpp Outdated Show resolved Hide resolved
src/coreclr/jit/gentree.cpp Show resolved Hide resolved
@@ -3176,12 +3174,12 @@ bool Compiler::gtMarkAddrMode(GenTree* addr, int* pCostEx, int* pCostSz, var_typ
assert(op1 != op1Save);
assert(op2 != nullptr);

#if defined(TARGET_XARCH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here explaining why arm64 doesn't/shouldn't do this walk?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

#ifdef TARGET_ARMARCH
if ((scale > 0) && (genTypeSize(targetType) != scale))
{
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there cases now where we look for and find a scale, but it is not the appropriate number, and so we bail out on creating an addressing mode that we would previously find?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: https://godbolt.org/z/xG4TsYYTG - in case of Test2 we bail out

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but in that case we would also bail out in the baseline as well as with this change, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding genCreateAddrMode is called from two places (gtSetEvalOrder and in Lower) and these checks are needed in both otherwise it leads to asserts.

@EgorBo
Copy link
Member Author

EgorBo commented Oct 28, 2021

@BruceForstall could you please take a look one more time?

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Long-term, I'm worried about one comment you added:

"For now we only handle MUL and LSH because
arm doesn't support both scale and offset at the same. Offset is handled
at the emitter as a peephole optimization."

There's been controversy over the years about what GenTreeAddrMode should represent; it is a fully general x86 addressing mode, as the comments seem to indicate? Or is it "target-specific" as the comments also say? Should it be extended to include the arm64 "sxt/uxt" shifters, for arm? It seems like handling "offset as a peephole optimization" is the wrong place for that; the full address mode should be properly represented in the GenTree.

@BruceForstall
Copy link
Member

Also, can you verify there are no spmi asm diffs on x86/x64?

@EgorBo
Copy link
Member Author

EgorBo commented Oct 29, 2021

Also, can you verify there are no spmi asm diffs on x86/x64?

Just checked, no diffs.

Should it be extended to include the arm64 "sxt/uxt" shifters, for arm?

I agree, I want to try to refactor it as it looks like a proper fix here will have ~200kb diffs on arm64 (for many indirect loads we emit up to 4 instructions where we could do it in 1 or 2), this PR was just a low-hanging fruit.

@EgorBo EgorBo merged commit b98b30b into dotnet:main Oct 29, 2021
@krwq
Copy link
Member

krwq commented Nov 2, 2021

@EgorBo I think this has regressed rolling builds. See i.e.:

essentially every rolling build since then is consistently failing with that assert. If fix is unclear please consider temporarily reverting.

Note: I'm not 100% sure this PR is responsible but looking at the list of commits: https://dev.azure.com/dnceng/public/_traceability/runview/changes?currentRunId=1446655 this looks most probable.

@EgorBo
Copy link
Member Author

EgorBo commented Nov 4, 2021

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants