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

[X64] [EgorBo] Small clean up in gtMarkAddrMode #474

Open
MihuBot opened this issue Jul 3, 2024 · 3 comments
Open

[X64] [EgorBo] Small clean up in gtMarkAddrMode #474

MihuBot opened this issue Jul 3, 2024 · 3 comments

Comments

@MihuBot
Copy link
Owner

MihuBot commented Jul 3, 2024

Job completed in 14 minutes.
dotnet/runtime#104387

Diffs

Found 272 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 41536725
Total bytes of diff: 41536758
Total bytes of delta: 33 (0.00 % of base)
Total relative delta: 0.09
    diff is a regression.
    relative diff is a regression.


Top file regressions (bytes):
          12 : System.Collections.Immutable.dasm (0.00 % of base)
          10 : System.Data.Odbc.dasm (0.00 % of base)
           6 : System.Net.Security.dasm (0.00 % of base)
           6 : System.Data.Common.dasm (0.00 % of base)
           4 : System.Runtime.Numerics.dasm (0.00 % of base)

Top file improvements (bytes):
          -5 : System.Private.CoreLib.dasm (-0.00 % of base)

6 total files with Code Size differences (1 improved, 5 regressed), 253 unchanged.

Top method regressions (bytes):
           8 (0.93 % of base) : System.Collections.Immutable.dasm - System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int (FullOpts)
           8 (0.25 % of base) : System.Data.Odbc.dasm - System.Data.Common.MultipartIdentifier:ParseMultipartIdentifier(System.String,System.String,System.String,ushort,int,ubyte,System.String,ubyte):System.String[] (FullOpts)
           6 (3.39 % of base) : System.Net.Security.dasm - System.Net.Security.SslConnectionInfo:MapCipherSuite(ushort):this (FullOpts)
           4 (4.82 % of base) : System.Collections.Immutable.dasm - System.Collections.Frozen.FrozenHashTable:<CalcNumBuckets>g__IsBucketFirstVisit|10_0(int,byref):ubyte (FullOpts)
           4 (2.90 % of base) : System.Data.Common.dasm - System.Data.SqlTypes.SqlDecimal:VerifyPrecision(ubyte):ubyte:this (FullOpts)
           4 (0.38 % of base) : System.Runtime.Numerics.dasm - System.Numerics.BigIntegerCalculator:Square(System.ReadOnlySpan`1[uint],System.Span`1[uint]) (FullOpts)
           3 (0.29 % of base) : System.Private.CoreLib.dasm - System.Globalization.IdnMapping:ValidateStd3AndAscii(System.String,ubyte,ubyte):ubyte (FullOpts)
           2 (0.61 % of base) : System.Data.Odbc.dasm - System.Data.Common.DBConnectionString:RemoveDuplicates(System.String[]):System.String[] (FullOpts)
           2 (0.42 % of base) : System.Data.Common.dasm - System.Data.SqlTypes.SqlDecimal:Round(System.Data.SqlTypes.SqlDecimal,int,ubyte):System.Data.SqlTypes.SqlDecimal (FullOpts)

Top method improvements (bytes):
          -7 (-4.24 % of base) : System.Private.CoreLib.dasm - System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp (FullOpts)
          -1 (-0.26 % of base) : System.Private.CoreLib.dasm - System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem (FullOpts)

Top method regressions (percentages):
           4 (4.82 % of base) : System.Collections.Immutable.dasm - System.Collections.Frozen.FrozenHashTable:<CalcNumBuckets>g__IsBucketFirstVisit|10_0(int,byref):ubyte (FullOpts)
           6 (3.39 % of base) : System.Net.Security.dasm - System.Net.Security.SslConnectionInfo:MapCipherSuite(ushort):this (FullOpts)
           4 (2.90 % of base) : System.Data.Common.dasm - System.Data.SqlTypes.SqlDecimal:VerifyPrecision(ubyte):ubyte:this (FullOpts)
           8 (0.93 % of base) : System.Collections.Immutable.dasm - System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int (FullOpts)
           2 (0.61 % of base) : System.Data.Odbc.dasm - System.Data.Common.DBConnectionString:RemoveDuplicates(System.String[]):System.String[] (FullOpts)
           2 (0.42 % of base) : System.Data.Common.dasm - System.Data.SqlTypes.SqlDecimal:Round(System.Data.SqlTypes.SqlDecimal,int,ubyte):System.Data.SqlTypes.SqlDecimal (FullOpts)
           4 (0.38 % of base) : System.Runtime.Numerics.dasm - System.Numerics.BigIntegerCalculator:Square(System.ReadOnlySpan`1[uint],System.Span`1[uint]) (FullOpts)
           3 (0.29 % of base) : System.Private.CoreLib.dasm - System.Globalization.IdnMapping:ValidateStd3AndAscii(System.String,ubyte,ubyte):ubyte (FullOpts)
           8 (0.25 % of base) : System.Data.Odbc.dasm - System.Data.Common.MultipartIdentifier:ParseMultipartIdentifier(System.String,System.String,System.String,ushort,int,ubyte,System.String,ubyte):System.String[] (FullOpts)

Top method improvements (percentages):
          -7 (-4.24 % of base) : System.Private.CoreLib.dasm - System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp (FullOpts)
          -1 (-0.26 % of base) : System.Private.CoreLib.dasm - System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem (FullOpts)

11 total methods with Code Size differences (2 improved, 9 regressed), 252393 unchanged.

--------------------------------------------------------------------------------

Artifacts:

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 3, 2024

Top method regressions

8 (0.93 % of base) - System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int
 ; Assembly listing for method System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 11 single block inlinees; 5 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;* V00 arg0         [V00    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op single-def <System.ReadOnlySpan`1[int]>
 ;  V01 arg1         [V01,T35] (  3,  3   )   ubyte  ->  rdx         single-def
 ;* V02 loc0         [V02    ] (  0,  0   )  struct (24) zero-ref    ld-addr-op <System.Collections.Frozen.FrozenHashTable+<>c__DisplayClass10_0>
 ;  V03 loc1         [V03,T28] (  7, 12.50)     ref  ->  r14         class-hnd <System.Collections.Generic.HashSet`1[int]>
 ;  V04 loc2         [V04,T29] (  9,  8.50)     int  ->  r13        
 ;  V05 loc3         [V05,T36] (  2,  5   )     int  ->  rdi        
 ;* V06 loc4         [V06    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[int]>
 ;  V07 loc5         [V07,T37] (  4,  3   )     int  ->  [rbp-0x2C]  spill-single-def
 ;  V08 loc6         [V08,T33] (  6,  6.50)     int  ->  [rbp-0x30] 
 ;  V09 loc7         [V09,T32] (  8,  7.50)     int  ->  [rbp-0x34] 
 ;  V10 loc8         [V10,T40] (  3,  3   )     int  ->  [rbp-0x38] 
 ;* V11 loc9         [V11    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[int]>
 ;  V12 loc10        [V12,T00] ( 10,656.50)     int  ->  registers  
 ;  V13 loc11        [V13,T31] (  2,  8   )     int  ->  rsi        
 ;  V14 loc12        [V14,T45] (  2,  1   )     int  ->  rdi        
 ;  V15 loc13        [V15    ] (  6, 40   )  struct (24) [rbp-0x50]  do-not-enreg[XS] must-init addr-exposed ld-addr-op <System.Collections.Generic.HashSet`1+Enumerator[int]>
 ;# V16 OutArgs      [V16    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V17 tmp1         [V17    ] (  0,  0   )     int  ->  zero-ref   
 ;* V18 tmp2         [V18    ] (  0,  0   )     int  ->  zero-ref   
 ;  V19 tmp3         [V19,T46] (  2,  1   )     int  ->  rcx        
 ;* V20 tmp4         [V20    ] (  0,  0   )     ref  ->  zero-ref    class-hnd "impAppendStmt" <int[]>
 ;  V21 tmp5         [V21,T39] (  3,  3   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.Collections.Generic.HashSet`1[int]>
 ;* V22 tmp6         [V22    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
 ;  V23 tmp7         [V23    ] (  1,  4   )     int  ->  [rbp-0x58]  do-not-enreg[X] addr-exposed ld-addr-op "Inline ldloca(s) first use temp"
 ;* V24 tmp8         [V24    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[int]>
 ;  V25 tmp9         [V25,T30] (  3,  8   )     int  ->  rdx         "Inline return value spill temp"
 ;* V26 tmp10        [V26    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
 ;  V27 tmp11        [V27,T24] (  3, 20   )     int  ->  rdx         "Inlining Arg"
 ;* V28 tmp12        [V28    ] (  0,  0   )  struct (24) zero-ref    ld-addr-op "NewObj constructor temp" <System.Collections.Generic.HashSet`1+Enumerator[int]>
 ;* V29 tmp13        [V29,T22] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
 ;  V30 tmp14        [V30,T16] (  2, 64   )     int  ->  rcx         "Inlining Arg"
 ;  V31 tmp15        [V31,T18] (  3, 48   )     int  ->  rdx         "Inline stloc first use temp"
 ;  V32 tmp16        [V32,T17] (  3, 48   )   byref  ->  rax         "dup spill"
 ;* V33 tmp17        [V33    ] (  0,  0   )     int  ->  zero-ref    "Inline stloc first use temp"
 ;* V34 tmp18        [V34,T10] (  0,  0   )   ubyte  ->  zero-ref    "Inline return value spill temp"
 ;* V35 tmp19        [V35    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
 ;  V36 tmp20        [V36,T02] (  3,384   )     int  ->  rdx         "Inline stloc first use temp"
 ;  V37 tmp21        [V37,T09] (  3,192   )   byref  ->  rdx         "dup spill"
 ;* V38 tmp22        [V38    ] (  0,  0   )     int  ->  zero-ref    "Inline stloc first use temp"
 ;  V39 tmp23        [V39,T07] (  3,133   )   byref  ->  r15         single-def "field V00._reference (fldOffset=0x0)" P-INDEP
 ;  V40 tmp24        [V40,T01] (  9,265.50)     int  ->  rbx         single-def "field V00._length (fldOffset=0x8)" P-INDEP
 ;  V41 tmp25        [V41,T08] (  8,193   )     ref  ->  [rbp-0x78]  spill-single-def "field V02.seenBuckets (fldOffset=0x0)" P-INDEP
 ;  V42 tmp26        [V42,T11] (  6,156   )     int  ->  [rbp-0x5C]  spill-single-def "field V02.numBuckets (fldOffset=0x8)" P-INDEP
 ;  V43 tmp27        [V43,T04] ( 10,312   )     int  ->  [rbp-0x60]  "field V02.numCollisions (fldOffset=0xc)" P-INDEP
 ;  V44 tmp28        [V44,T13] (  5,146.50)     int  ->  [rbp-0x64]  "field V02.bestNumCollisions (fldOffset=0x10)" P-INDEP
 ;  V45 tmp29        [V45,T26] (  5, 13.50)   byref  ->  r12         single-def "field V06._reference (fldOffset=0x0)" P-INDEP
 ;* V46 tmp30        [V46,T47] (  0,  0   )     int  ->  zero-ref    "field V06._length (fldOffset=0x8)" P-INDEP
 ;* V47 tmp31        [V47,T14] (  0,  0   )   byref  ->  zero-ref    "field V11._reference (fldOffset=0x0)" P-INDEP
 ;* V48 tmp32        [V48,T15] (  0,  0   )     int  ->  zero-ref    "field V11._length (fldOffset=0x8)" P-INDEP
 ;  V49 tmp33        [V49    ] (  2, 18   )     ref  ->  [rbp-0x50]  do-not-enreg[X] addr-exposed "field V15._hashSet (fldOffset=0x0)" P-DEP
 ;  V50 tmp34        [V50    ] (  2, 18   )     int  ->  [rbp-0x48]  do-not-enreg[X] addr-exposed "field V15._version (fldOffset=0x8)" P-DEP
 ;  V51 tmp35        [V51    ] (  2, 18   )     int  ->  [rbp-0x44]  do-not-enreg[X] addr-exposed "field V15._index (fldOffset=0xc)" P-DEP
 ;  V52 tmp36        [V52    ] (  3, 34   )     int  ->  [rbp-0x40]  do-not-enreg[X] addr-exposed "field V15._current (fldOffset=0x10)" P-DEP
 ;  V53 tmp37        [V53,T41] (  2,  2   )   byref  ->  r12         single-def "field V24._reference (fldOffset=0x0)" P-INDEP
 ;* V54 tmp38        [V54,T48] (  0,  0   )     int  ->  zero-ref    "field V24._length (fldOffset=0x8)" P-INDEP
 ;  V55 tmp39        [V55,T34] (  3,  6   )     ref  ->  rdi         "field V28._hashSet (fldOffset=0x0)" P-INDEP
 ;  V56 tmp40        [V56,T38] (  2,  4   )     int  ->  rcx         "field V28._version (fldOffset=0x8)" P-INDEP
 ;* V57 tmp41        [V57,T42] (  0,  0   )     int  ->  zero-ref    "field V28._index (fldOffset=0xc)" P-INDEP
 ;* V58 tmp42        [V58,T43] (  0,  0   )     int  ->  zero-ref    "field V28._current (fldOffset=0x10)" P-INDEP
-;  V59 cse0         [V59,T05] (  3,288   )    long  ->   r9         "CSE #09: aggressive"
-;  V60 cse1         [V60,T20] (  3, 40   )    long  ->  rax         "CSE #04: moderate"
-;  V61 cse2         [V61,T03] (  3,384   )     int  ->  rdi         "CSE #08: aggressive"
+;  V59 cse0         [V59,T05] (  3,288   )    long  ->   r9         "CSE #11: aggressive"
+;  V60 cse1         [V60,T20] (  3, 40   )    long  ->  rax         "CSE #05: moderate"
+;  V61 cse2         [V61,T03] (  3,384   )     int  ->  rdi         "CSE #09: aggressive"
 ;  V62 cse3         [V62,T19] (  3, 48   )     int  ->  rax         "CSE #03: moderate"
-;  V63 cse4         [V63,T06] (  3,288   )     int  ->  r10         "CSE #12: aggressive"
-;  V64 cse5         [V64,T21] (  3, 40   )     int  ->  rdx         "CSE #07: moderate"
-;  V65 cse6         [V65,T44] (  3,  1.50)     ref  ->  [rbp-0x80]  spill-single-def "CSE #13: conservative"
+;  V63 cse4         [V63,T06] (  3,288   )     int  ->  r10         "CSE #14: aggressive"
+;  V64 cse5         [V64,T21] (  3, 40   )     int  ->  rdx         "CSE #08: moderate"
+;  V65 cse6         [V65,T44] (  3,  1.50)     ref  ->  [rbp-0x80]  spill-single-def "CSE #15: conservative"
 ;  V66 cse7         [V66,T12] (  4,152   )     int  ->  [rbp-0x68]  spill-single-def "CSE #02: moderate"
 ;  V67 rat0         [V67,T25] (  6, 18   )    long  ->  rax         "Widened IV V07"
 ;  V68 rat1         [V68,T27] (  6, 13   )    long  ->  rdx         "Widened IV V09"
 ;  V69 rat2         [V69,T23] (  7, 21   )    long  ->  [rbp-0x70]  "Widened IV V14"
 ;
 ; Lcl frame size = 88
 
 G_M18874_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     r12
        push     rbx
        sub      rsp, 88
        lea      rbp, [rsp+0x80]
        vxorps   xmm8, xmm8, xmm8
        vmovdqa  xmmword ptr [rbp-0x50], xmm8
        xor      eax, eax
        mov      qword ptr [rbp-0x40], rax
        mov      r15, rdi
        mov      ebx, esi
 						;; size=43 bbWeight=1 PerfScore 10.83
 G_M18874_IG02:
        xor      r14, r14
        mov      r13d, ebx
        test     dl, dl
        jne      SHORT G_M18874_IG07
 						;; size=10 bbWeight=1 PerfScore 1.75
 G_M18874_IG03:
        mov      rdi, 0xD1FFAB1E      ; System.Collections.Generic.HashSet`1[int]
        call     CORINFO_HELP_NEWSFAST
        mov      r14, rax
        test     ebx, ebx
        jle      SHORT G_M18874_IG04
        mov      rdi, r14
        mov      esi, ebx
        mov      rax, 0xD1FFAB1E      ; code for System.Collections.Generic.HashSet`1[int]:Initialize(int):int:this
        call     [rax]System.Collections.Generic.HashSet`1[int]:Initialize(int):int:this
 						;; size=39 bbWeight=0.50 PerfScore 3.25
 G_M18874_IG04:
        xor      r12d, r12d
        test     ebx, ebx
        jle      SHORT G_M18874_IG06
 						;; size=7 bbWeight=0.50 PerfScore 0.75
 G_M18874_IG05:
        mov      edx, r12d
        mov      esi, dword ptr [r15+4*rdx]
        lea      rdx, [rbp-0x58]
        mov      rdi, r14
        mov      rax, 0xD1FFAB1E      ; code for System.Collections.Generic.HashSet`1[int]:AddIfNotPresent(int,byref):ubyte:this
        call     [rax]System.Collections.Generic.HashSet`1[int]:AddIfNotPresent(int,byref):ubyte:this
        inc      r12d
        cmp      r12d, ebx
        jl       SHORT G_M18874_IG05
 						;; size=34 bbWeight=4 PerfScore 31.00
 G_M18874_IG06:
        mov      r13d, dword ptr [r14+0x28]
        sub      r13d, dword ptr [r14+0x30]
 						;; size=8 bbWeight=0.50 PerfScore 2.50
 G_M18874_IG07:
        lea      edi, [r13+r13]
        mov      r12, 0xD1FFAB1E      ; static handle
        xor      eax, eax
        jmp      SHORT G_M18874_IG09
 						;; size=19 bbWeight=1 PerfScore 4.50
 G_M18874_IG08:
        inc      eax
 						;; size=2 bbWeight=2 PerfScore 0.50
 G_M18874_IG09:
        cmp      eax, 72
        jae      SHORT G_M18874_IG11
 						;; size=5 bbWeight=8 PerfScore 10.00
 G_M18874_IG10:
        cmp      dword ptr [r12+4*rax], edi
        jl       SHORT G_M18874_IG08
 						;; size=6 bbWeight=4 PerfScore 16.00
 G_M18874_IG11:
        mov      dword ptr [rbp-0x2C], eax
        cmp      eax, 72
        jl       SHORT G_M18874_IG14
 						;; size=8 bbWeight=1 PerfScore 2.25
 G_M18874_IG12:
        mov      edi, r13d
        mov      rax, 0xD1FFAB1E      ; code for System.Collections.HashHelpers:GetPrime(int):int
        call     [rax]System.Collections.HashHelpers:GetPrime(int):int
        nop      
 						;; size=16 bbWeight=0.50 PerfScore 1.88
 G_M18874_IG13:
        add      rsp, 88
        pop      rbx
        pop      r12
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
 						;; size=15 bbWeight=0.50 PerfScore 2.12
 G_M18874_IG14:
        mov      ecx, 3
        mov      esi, 16
        cmp      r13d, 0x3E8
        cmovl    ecx, esi
        imul     ecx, r13d
        mov      edx, eax
        jmp      SHORT G_M18874_IG16
 						;; size=28 bbWeight=0.50 PerfScore 2.62
 G_M18874_IG15:
        inc      edx
 						;; size=2 bbWeight=2 PerfScore 0.50
 G_M18874_IG16:
        cmp      edx, 72
        jae      SHORT G_M18874_IG17
        cmp      dword ptr [r12+4*rdx], ecx
        jl       SHORT G_M18874_IG15
 						;; size=11 bbWeight=4 PerfScore 21.00
 G_M18874_IG17:
        cmp      edx, 72
        jge      G_M18874_IG22
        lea      ecx, [rdx-0x01]
        cmp      ecx, 72
        jae      G_M18874_IG46
        mov      dword ptr [rbp-0x34], edx
        lea      esi, [rdx-0x01]
        mov      ecx, dword ptr [r12+4*rsi]
 						;; size=31 bbWeight=0.50 PerfScore 3.25
 G_M18874_IG18:
        mov      esi, ecx
        sar      esi, 31
        and      esi, 31
        mov      dword ptr [rbp-0x30], ecx
        add      esi, ecx
        sar      esi, 5
        inc      esi
        mov      rdi, 0xD1FFAB1E      ; const ptr
        mov      r8, gword ptr [rdi]
        mov      gword ptr [rbp-0x80], r8
        mov      rdi, r8
        mov      r9, 0xD1FFAB1E      ; code for System.Buffers.SharedArrayPool`1[int]:Rent(int):int[]:this
        call     [r9]System.Buffers.SharedArrayPool`1[int]:Rent(int):int[]:this
        mov      gword ptr [rbp-0x78], rax
        mov      ecx, dword ptr [rbp-0x30]
        mov      dword ptr [rbp-0x38], ecx
        mov      dword ptr [rbp-0x64], r13d
        mov      edi, dword ptr [rbp-0x2C]
        mov      r9d, edi
        mov      r10d, dword ptr [rbp-0x34]
        cmp      r9d, r10d
        jge      SHORT G_M18874_IG21
 						;; size=80 bbWeight=0.50 PerfScore 8.62
 G_M18874_IG19:
        cmp      r9d, 72
        jae      G_M18874_IG46
        mov      qword ptr [rbp-0x70], r9
        mov      r11d, dword ptr [r12+4*r9]
        mov      dword ptr [rbp-0x5C], r11d
        mov      esi, dword ptr [rax+0x08]
        mov      dword ptr [rbp-0x68], esi
        mov      edx, esi
        cmp      r11d, edx
        jle      SHORT G_M18874_IG23
 						;; size=35 bbWeight=4 PerfScore 39.00
 G_M18874_IG20:
        jmp      SHORT G_M18874_IG24
 						;; size=2 bbWeight=2 PerfScore 4.00
 G_M18874_IG21:
        mov      r11, rax
        jmp      G_M18874_IG36
        align    [0 bytes for IG30]
 						;; size=8 bbWeight=0.25 PerfScore 0.56
 G_M18874_IG22:
        mov      dword ptr [rbp-0x34], edx
        jmp      G_M18874_IG18
 						;; size=8 bbWeight=0.25 PerfScore 0.75
 G_M18874_IG23:
        mov      edx, r11d
 						;; size=3 bbWeight=2 PerfScore 0.50
 G_M18874_IG24:
        mov      rdi, rax
        xor      esi, esi
        mov      rcx, 0xD1FFAB1E      ; code for System.Array:Clear(System.Array,int,int)
        call     [rcx]System.Array:Clear(System.Array,int,int)
        xor      eax, eax
        mov      dword ptr [rbp-0x60], eax
        test     r14, r14
        je       SHORT G_M18874_IG29
 						;; size=27 bbWeight=4 PerfScore 25.00
 G_M18874_IG25:
        cmp      r13d, ebx
        je       SHORT G_M18874_IG29
        mov      rdi, r14
        mov      ecx, dword ptr [rdi+0x34]
        mov      gword ptr [rbp-0x50], rdi
        mov      dword ptr [rbp-0x48], ecx
        xor      edi, edi
        mov      dword ptr [rbp-0x44], edi
 						;; size=23 bbWeight=2 PerfScore 13.50
 G_M18874_IG26:
        mov      dword ptr [rbp-0x40], edi
 						;; size=3 bbWeight=2 PerfScore 2.00
 G_M18874_IG27:
        lea      rdi, [rbp-0x50]
        mov      rcx, 0xD1FFAB1E      ; code for System.Collections.Generic.HashSet`1+Enumerator[int]:MoveNext():ubyte:this
        call     [rcx]System.Collections.Generic.HashSet`1+Enumerator[int]:MoveNext():ubyte:this
        test     eax, eax
        jne      G_M18874_IG43
 						;; size=24 bbWeight=16 PerfScore 80.00
 G_M18874_IG28:
        mov      r11, gword ptr [rbp-0x78]
        jmp      SHORT G_M18874_IG33
 						;; size=6 bbWeight=8 PerfScore 24.00
 G_M18874_IG29:
        xor      edx, edx
        xor      ecx, ecx
        test     ebx, ebx
        jle      G_M18874_IG39
 						;; size=12 bbWeight=128 PerfScore 224.00
 G_M18874_IG30:
        mov      edx, ecx
        mov      eax, dword ptr [r15+4*rdx]
        mov      r8d, dword ptr [rbp-0x5C]
        xor      edx, edx
        div      edx:eax, r8d
        mov      edi, edx
        shr      edi, 5
        mov      eax, dword ptr [rbp-0x68]
        cmp      edi, eax
        jae      G_M18874_IG46
        mov      r9d, edi
+       shl      r9, 2
        mov      edi, 1
        shlx     r10d, edi, edx
        mov      r11, gword ptr [rbp-0x78]
-       test     dword ptr [r11+4*r9+0x10], r10d
+       test     dword ptr [r11+r9+0x10], r10d
        je       G_M18874_IG40
-						;; size=59 bbWeight=128 PerfScore 4800.00
+						;; size=63 bbWeight=128 PerfScore 4864.00
 G_M18874_IG31:
        mov      edi, dword ptr [rbp-0x60]
        inc      edi
        mov      edx, dword ptr [rbp-0x64]
        cmp      edi, edx
        jl       G_M18874_IG41
 						;; size=16 bbWeight=64 PerfScore 224.00
 G_M18874_IG32:
        mov      dword ptr [rbp-0x60], edi
        mov      dword ptr [rbp-0x64], edx
 						;; size=6 bbWeight=32 PerfScore 64.00
 G_M18874_IG33:
        mov      eax, dword ptr [rbp-0x60]
        mov      edx, dword ptr [rbp-0x64]
        cmp      eax, edx
        jge      SHORT G_M18874_IG35
 						;; size=10 bbWeight=64 PerfScore 208.00
 G_M18874_IG34:
        mov      r8d, dword ptr [rbp-0x5C]
        mov      dword ptr [rbp-0x38], r8d
        vxorps   xmm0, xmm0, xmm0
        vcvtsi2sd xmm0, xmm0, eax
        vxorps   xmm1, xmm1, xmm1
        vcvtsi2sd xmm1, xmm1, r13d
        vdivsd   xmm0, xmm0, xmm1
        vmovsd   xmm1, qword ptr [reloc @RWD00]
        vucomisd xmm1, xmm0
        jae      SHORT G_M18874_IG36
        mov      edx, eax
 						;; size=45 bbWeight=2 PerfScore 65.83
 G_M18874_IG35:
        mov      rdi, qword ptr [rbp-0x70]
        inc      edi
        mov      eax, dword ptr [rbp-0x34]
        cmp      edi, eax
        mov      dword ptr [rbp-0x64], edx
        mov      dword ptr [rbp-0x34], eax
        mov      r9, rdi
        jl       SHORT G_M18874_IG38
 						;; size=22 bbWeight=4 PerfScore 23.00
 G_M18874_IG36:
        mov      rdi, gword ptr [rbp-0x80]
        mov      rsi, r11
        xor      edx, edx
        mov      rax, 0xD1FFAB1E      ; code for System.Buffers.SharedArrayPool`1[int]:Return(int[],ubyte):this
        call     [rax]System.Buffers.SharedArrayPool`1[int]:Return(int[],ubyte):this
        mov      eax, dword ptr [rbp-0x38]
 						;; size=24 bbWeight=0.50 PerfScore 2.88
 G_M18874_IG37:
        add      rsp, 88
        pop      rbx
        pop      r12
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
 						;; size=15 bbWeight=0.50 PerfScore 2.12
 G_M18874_IG38:
        mov      rax, r11
        jmp      G_M18874_IG19
 						;; size=8 bbWeight=2 PerfScore 4.50
 G_M18874_IG39:
        mov      r11, gword ptr [rbp-0x78]
        jmp      G_M18874_IG33
 						;; size=9 bbWeight=64 PerfScore 192.00
 G_M18874_IG40:
-       lea      rdx, bword ptr [r11+4*r9+0x10]
+       lea      rdx, bword ptr [r11+r9+0x10]
        or       dword ptr [rdx], r10d
        mov      edx, dword ptr [rbp-0x64]
        mov      edi, dword ptr [rbp-0x60]
 						;; size=14 bbWeight=32 PerfScore 192.00
 G_M18874_IG41:
        inc      ecx
        cmp      ecx, ebx
        mov      dword ptr [rbp-0x60], edi
        mov      dword ptr [rbp-0x64], edx
        jge      G_M18874_IG33
 						;; size=16 bbWeight=128 PerfScore 448.00
 G_M18874_IG42:
        jmp      G_M18874_IG30
 						;; size=5 bbWeight=64 PerfScore 128.00
 G_M18874_IG43:
        mov      ecx, dword ptr [rbp-0x40]
        mov      r8d, dword ptr [rbp-0x5C]
        mov      eax, ecx
        xor      edx, edx
        div      edx:eax, r8d
        mov      eax, edx
        shr      eax, 5
        mov      ecx, dword ptr [rbp-0x68]
        cmp      eax, ecx
        jae      SHORT G_M18874_IG46
+       shl      rax, 2
        mov      edi, 1
        shlx     edx, edi, edx
        mov      r11, gword ptr [rbp-0x78]
-       test     dword ptr [r11+4*rax+0x10], edx
+       test     dword ptr [r11+rax+0x10], edx
        je       SHORT G_M18874_IG45
        mov      edi, dword ptr [rbp-0x60]
        inc      edi
        mov      esi, dword ptr [rbp-0x64]
        cmp      edi, esi
        mov      dword ptr [rbp-0x60], edi
        mov      dword ptr [rbp-0x64], esi
        jge      G_M18874_IG33
-						;; size=69 bbWeight=16 PerfScore 668.00
+						;; size=73 bbWeight=16 PerfScore 676.00
 G_M18874_IG44:
        jmp      G_M18874_IG27
 						;; size=5 bbWeight=8 PerfScore 16.00
 G_M18874_IG45:
-       lea      rax, bword ptr [r11+4*rax+0x10]
+       lea      rax, bword ptr [r11+rax+0x10]
        or       dword ptr [rax], edx
        jmp      G_M18874_IG27
 						;; size=12 bbWeight=8 PerfScore 48.00
 G_M18874_IG46:
        call     CORINFO_HELP_RNGCHKFAIL
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 RWD00  	dq	3FA999999999999Ah	;         0.05
 
 
-; Total bytes of code 856, prolog size 43, PerfScore 7622.98, instruction count 254, allocated bytes for code 856 (MethodHash=a5deb645) for method System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int (FullOpts)
+; Total bytes of code 864, prolog size 43, PerfScore 7694.98, instruction count 256, allocated bytes for code 864 (MethodHash=a5deb645) for method System.Collections.Frozen.FrozenHashTable:CalcNumBuckets(System.ReadOnlySpan`1[int],ubyte):int (FullOpts)

Larger list of diffs: https://gist.github.com/MihuBot/169adbca348f12695d62216234968695

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 3, 2024

Top method improvements

-7 (-4.24 % of base) - System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp
 ; Assembly listing for method System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rsp based frame
 ; partially interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 4 single block inlinees; 0 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;  V00 arg0         [V00,T02] (  3,  3   )     int  ->  rdi         single-def
 ;* V01 arg1         [V01    ] (  0,  0   )     int  ->  zero-ref    single-def
 ;  V02 arg2         [V02,T01] (  3,  3   )   byref  ->  rdx         single-def
 ;* V03 loc0         [V03    ] (  0,  0   )  double  ->  zero-ref   
-;  V04 loc1         [V04,T06] (  3,  3   )     int  ->  rax        
+;  V04 loc1         [V04,T05] (  3,  3   )     int  ->  rax        
 ;* V05 loc2         [V05    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[short]>
 ;* V06 loc3         [V06    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[ulong]>
 ;# V07 OutArgs      [V07    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
-;  V08 tmp1         [V08,T04] (  2,  4   )    long  ->  rdx         "impAppendStmt"
+;  V08 tmp1         [V08,T03] (  2,  4   )    long  ->  rax         "impAppendStmt"
 ;* V09 tmp2         [V09    ] (  0,  0   )  struct (16) zero-ref    multireg-ret ld-addr-op "NewObj constructor temp" <System.Number+DiyFp>
 ;* V10 tmp3         [V10    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[short]>
 ;* V11 tmp4         [V11    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[ulong]>
 ;* V12 tmp5         [V12    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[short]>
-;  V13 tmp6         [V13,T05] (  2,  4   )     int  ->  rax         "Inlining Arg"
+;  V13 tmp6         [V13,T04] (  2,  4   )     int  ->  rdx         "Inlining Arg"
 ;* V14 tmp7         [V14    ] (  0,  0   )   byref  ->  zero-ref    "field V05._reference (fldOffset=0x0)" P-INDEP
 ;* V15 tmp8         [V15    ] (  0,  0   )     int  ->  zero-ref    "field V05._length (fldOffset=0x8)" P-INDEP
 ;* V16 tmp9         [V16    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V06._reference (fldOffset=0x0)" P-INDEP
 ;* V17 tmp10        [V17    ] (  0,  0   )     int  ->  zero-ref    "field V06._length (fldOffset=0x8)" P-INDEP
-;  V18 tmp11        [V18,T07] (  2,  2   )    long  ->  registers   "field V09.f (fldOffset=0x0)" P-INDEP
-;  V19 tmp12        [V19,T08] (  2,  2   )     int  ->  [rsp+0x04]  spill-single-def "field V09.e (fldOffset=0x8)" P-INDEP
+;  V18 tmp11        [V18,T08] (  2,  2   )    long  ->  rax         "field V09.f (fldOffset=0x0)" P-INDEP
+;  V19 tmp12        [V19,T09] (  2,  2   )     int  ->  rdx         "field V09.e (fldOffset=0x8)" P-INDEP
 ;* V20 tmp13        [V20    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V10._reference (fldOffset=0x0)" P-INDEP
 ;* V21 tmp14        [V21    ] (  0,  0   )     int  ->  zero-ref    "field V10._length (fldOffset=0x8)" P-INDEP
 ;* V22 tmp15        [V22    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V11._reference (fldOffset=0x0)" P-INDEP
 ;* V23 tmp16        [V23    ] (  0,  0   )     int  ->  zero-ref    "field V11._length (fldOffset=0x8)" P-INDEP
 ;* V24 tmp17        [V24    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V12._reference (fldOffset=0x0)" P-INDEP
 ;* V25 tmp18        [V25    ] (  0,  0   )     int  ->  zero-ref    "field V12._length (fldOffset=0x8)" P-INDEP
-;  V26 cse0         [V26,T03] (  4,  4   )    long  ->  rax         "CSE #01: aggressive"
-;  V27 rat0         [V27,T09] (  3,  6   )  double  ->  mm0         "ReplaceWithLclVar is creating a new local variable"
-;  V28 rat1         [V28,T10] (  3,  6   )  simd16  ->  mm0         "ReplaceWithLclVar is creating a new local variable"
-;  V29 rat2         [V29,T00] (  3,  6   )     int  ->  rax         "ReplaceWithLclVar is creating a new local variable"
+;  V26 cse0         [V26,T06] (  3,  3   )    long  ->  rcx         "CSE #02: aggressive"
+;  V27 cse1         [V27,T07] (  3,  3   )    long  ->  rax         "CSE #01: aggressive"
+;  V28 rat0         [V28,T10] (  3,  6   )  double  ->  mm0         "ReplaceWithLclVar is creating a new local variable"
+;  V29 rat1         [V29,T11] (  3,  6   )  simd16  ->  mm0         "ReplaceWithLclVar is creating a new local variable"
+;  V30 rat2         [V30,T00] (  3,  6   )     int  ->  rax         "ReplaceWithLclVar is creating a new local variable"
 ;
 ; Lcl frame size = 8
 
 G_M18819_IG01:
        push     rax
 						;; size=1 bbWeight=1 PerfScore 1.00
 G_M18819_IG02:
        add      edi, 63
        vxorps   xmm0, xmm0, xmm0
        vcvtsi2sd xmm0, xmm0, edi
        vmulsd   xmm0, xmm0, qword ptr [reloc @RWD00]
        vroundsd xmm0, xmm0, xmm0, 10
        vfixupimmsd xmm0, xmm0, xmmword ptr [reloc @RWD16], 0
        vcmppd   k1, xmm0, xmmword ptr [reloc @RWD32], 13
        vcvttsd2si eax, xmm0
        vpbroadcastd xmm0, eax
        vpblendmd xmm0 {k1}, xmm0, xmmword ptr [reloc @RWD48]
        vmovd    eax, xmm0
        add      eax, 347
        mov      ecx, eax
        sar      ecx, 31
        and      ecx, 7
        add      eax, ecx
        sar      eax, 3
        inc      eax
        cmp      eax, 87
        jae      SHORT G_M18819_IG04
-       mov      rcx, 0xD1FFAB1E      ; static handle
-       movsx    rcx, word  ptr [rcx+2*rax]
-       mov      dword ptr [rdx], ecx
+       lea      rcx, [rax+rax]
+       mov      rdi, 0xD1FFAB1E      ; static handle
+       movsx    rdi, word  ptr [rcx+rdi]
+       mov      dword ptr [rdx], edi
        mov      rdx, 0xD1FFAB1E      ; static handle
-       mov      rdx, qword ptr [rdx+8*rax]
-       mov      rcx, 0xD1FFAB1E      ; static handle
-       movsx    rax, word  ptr [rcx+2*rax]
-       mov      dword ptr [rsp+0x04], eax
-       mov      rax, rdx
-       mov      edx, dword ptr [rsp+0x04]
-						;; size=153 bbWeight=1 PerfScore 55.08
+       mov      rax, qword ptr [rdx+8*rax]
+       mov      rdx, 0xD1FFAB1E      ; static handle
+       movsx    rdx, word  ptr [rcx+rdx]
+						;; size=146 bbWeight=1 PerfScore 53.33
 G_M18819_IG03:
        add      rsp, 8
        ret      
 						;; size=5 bbWeight=1 PerfScore 1.25
 G_M18819_IG04:
        call     CORINFO_HELP_RNGCHKFAIL
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 RWD00  	dq	3FD34413509F79FFh	;  0.301029996
 RWD08  	dd	00000000h, 00000000h
 RWD16  	dq	0000000000000088h, 0000000000000000h
 RWD32  	dq	41DFFFFFFFC00000h, 41DFFFFFFFC00000h
 RWD48  	dq	7FFFFFFF7FFFFFFFh, 7FFFFFFF7FFFFFFFh
 
 
-; Total bytes of code 165, prolog size 1, PerfScore 57.33, instruction count 35, allocated bytes for code 166 (MethodHash=763bb67c) for method System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp (FullOpts)
+; Total bytes of code 158, prolog size 1, PerfScore 55.58, instruction count 33, allocated bytes for code 159 (MethodHash=763bb67c) for method System.Number+Grisu3:GetCachedPowerForBinaryExponentRange(int,int,byref):System.Number+DiyFp (FullOpts)
-1 (-0.26 % of base) - System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem
 ; Assembly listing for method System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX512 - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; partially interruptible
 ; No PGO data
 ; 0 inlinees with PGO data; 7 single block inlinees; 2 inlinees without PGO data
 ; Final local variable assignments
 ;
-;  V00 arg0         [V00,T03] (  3,  3   )     int  ->  r15         single-def
-;  V01 arg1         [V01,T01] (  8,  8   )     int  ->  rbx         single-def
+;  V00 arg0         [V00,T03] (  3,  3   )     int  ->  rbx         single-def
+;  V01 arg1         [V01,T02] (  6,  6   )     int  ->  rsi         single-def
 ;* V02 loc0         [V02    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def <System.String>
 ;* V03 loc1         [V03    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def <System.String>
 ;* V04 loc2         [V04    ] (  0,  0   )     ref  ->  zero-ref    class-hnd exact single-def <System.String>
-;  V05 loc3         [V05,T10] (  2,  2   )     ref  ->  r15         class-hnd exact single-def <System.String>
-;  V06 loc4         [V06,T11] (  2,  2   )     int  ->  rbx        
+;  V05 loc3         [V05,T11] (  2,  2   )     ref  ->  rbx         class-hnd exact single-def <System.String>
+;  V06 loc4         [V06,T12] (  2,  2   )     int  ->  r15        
 ;* V07 loc5         [V07    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[int]>
-;  V08 loc6         [V08,T07] (  5,  3.50)     int  ->  r13        
+;  V08 loc6         [V08,T08] (  5,  3.50)     int  ->  r13        
 ;* V09 loc7         [V09    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op <System.ReadOnlySpan`1[uint]>
 ;# V10 OutArgs      [V10    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
-;  V11 tmp1         [V11,T06] (  2,  4   )     int  ->  r14         "impAppendStmt"
+;  V11 tmp1         [V11,T07] (  2,  4   )     int  ->  r14         "impAppendStmt"
 ;  V12 tmp2         [V12,T00] (  8, 16   )     ref  ->  r12         class-hnd exact single-def "NewObj constructor temp" <System.Text.CodePageDataItem>
 ;* V13 tmp3         [V13    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[int]>
 ;* V14 tmp4         [V14    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[int]>
 ;* V15 tmp5         [V15    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[int]>
 ;  V16 tmp6         [V16,T04] (  6,  4.50)     ref  ->  r13         class-hnd "Inline return value spill temp" <System.String>
-;  V17 tmp7         [V17,T02] (  7,  9   )     int  ->  r12         "Inlining Arg"
-;  V18 tmp8         [V18,T12] (  2,  1   )    long  ->  [rbp-0x30]  spill-single-def "Inline stloc first use temp"
+;  V17 tmp7         [V17,T01] (  7,  9   )     int  ->  r12         "Inlining Arg"
+;  V18 tmp8         [V18,T13] (  2,  1   )    long  ->  [rbp-0x30]  spill-single-def "Inline stloc first use temp"
 ;  V19 tmp9         [V19,T05] (  4,  4   )     ref  ->  r12         class-hnd exact single-def "dup spill" <System.String>
 ;* V20 tmp10        [V20    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
 ;* V21 tmp11        [V21    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
 ;* V22 tmp12        [V22    ] (  0,  0   )  struct (16) zero-ref    "ReadOnlySpan<T> for CreateSpan<T>" <System.ReadOnlySpan`1[uint]>
 ;* V23 tmp13        [V23    ] (  0,  0   )   byref  ->  zero-ref    "field V07._reference (fldOffset=0x0)" P-INDEP
 ;* V24 tmp14        [V24    ] (  0,  0   )     int  ->  zero-ref    "field V07._length (fldOffset=0x8)" P-INDEP
 ;* V25 tmp15        [V25    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V09._reference (fldOffset=0x0)" P-INDEP
 ;* V26 tmp16        [V26    ] (  0,  0   )     int  ->  zero-ref    "field V09._length (fldOffset=0x8)" P-INDEP
 ;* V27 tmp17        [V27    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V13._reference (fldOffset=0x0)" P-INDEP
 ;* V28 tmp18        [V28    ] (  0,  0   )     int  ->  zero-ref    "field V13._length (fldOffset=0x8)" P-INDEP
 ;* V29 tmp19        [V29    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V14._reference (fldOffset=0x0)" P-INDEP
 ;* V30 tmp20        [V30    ] (  0,  0   )     int  ->  zero-ref    "field V14._length (fldOffset=0x8)" P-INDEP
 ;* V31 tmp21        [V31    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V15._reference (fldOffset=0x0)" P-INDEP
 ;* V32 tmp22        [V32    ] (  0,  0   )     int  ->  zero-ref    "field V15._length (fldOffset=0x8)" P-INDEP
 ;* V33 tmp23        [V33    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V22._reference (fldOffset=0x0)" P-INDEP
 ;* V34 tmp24        [V34    ] (  0,  0   )     int  ->  zero-ref    "field V22._length (fldOffset=0x8)" P-INDEP
-;  V35 tmp25        [V35,T13] (  2,  0   )     ref  ->  rdi         single-def "argument with side effect"
-;  V36 cse0         [V36,T08] (  3,  3   )     int  ->  rdi         "CSE #02: moderate"
-;  V37 cse1         [V37,T09] (  3,  3   )    long  ->  rax         "CSE #03: moderate"
+;  V35 tmp25        [V35,T14] (  2,  0   )     ref  ->  rdi         single-def "argument with side effect"
+;  V36 cse0         [V36,T06] (  4,  4   )    long  ->  r15         "CSE #02: moderate"
+;  V37 cse1         [V37,T09] (  3,  3   )     int  ->  rsi         "CSE #03: moderate"
+;  V38 cse2         [V38,T10] (  3,  3   )    long  ->  rdi         "CSE #04: moderate"
 ;
 ; Lcl frame size = 8
 
 G_M21659_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     r12
        push     rbx
        push     rax
        lea      rbp, [rsp+0x30]
-       mov      r15d, edi
-       mov      ebx, esi
-						;; size=21 bbWeight=1 PerfScore 8.00
+       mov      ebx, edi
+						;; size=18 bbWeight=1 PerfScore 7.75
 G_M21659_IG02:
-       cmp      ebx, 8
+       cmp      esi, 8
        jae      G_M21659_IG09
-       mov      edi, ebx
-       mov      rax, 0xD1FFAB1E      ; static handle
-       mov      r14d, dword ptr [rax+4*rdi]
-       cmp      ebx, 9
+       mov      r15d, esi
+       shl      r15, 2
+       mov      rdi, 0xD1FFAB1E      ; static handle
+       mov      r14d, dword ptr [r15+rdi]
+       cmp      esi, 9
        jae      G_M21659_IG09
-       mov      edi, ebx
-       mov      rax, 0xD1FFAB1E      ; static handle
-       mov      r13d, dword ptr [rax+4*rdi]
-       lea      edi, [rbx+0x01]
-       cmp      edi, 9
+       mov      rdi, 0xD1FFAB1E      ; static handle
+       mov      r13d, dword ptr [r15+rdi]
+       inc      esi
+       cmp      esi, 9
        jae      G_M21659_IG09
-       mov      r12d, dword ptr [rax+4*rdi]
+       mov      eax, esi
+       mov      r12d, dword ptr [rdi+4*rax]
        sub      r12d, r13d
        mov      edi, r13d
        mov      eax, r12d
        add      rdi, rax
        cmp      rdi, 56
        ja       G_M21659_IG08
        test     r12d, r12d
        jne      SHORT G_M21659_IG04
-						;; size=93 bbWeight=1 PerfScore 14.75
+						;; size=97 bbWeight=1 PerfScore 15.00
 G_M21659_IG03:
        mov      r13, 0xD1FFAB1E      ; ''
        jmp      SHORT G_M21659_IG06
 						;; size=12 bbWeight=0.50 PerfScore 1.12
 G_M21659_IG04:
        cmp      r12d, 56
        jne      SHORT G_M21659_IG05
        mov      r13, 0xD1FFAB1E      ; 'utf-16utf-16BEutf-32utf-32BEus-asciiiso-8859-1utf-7utf-8'
        jmp      SHORT G_M21659_IG06
 						;; size=18 bbWeight=0.50 PerfScore 1.75
 G_M21659_IG05:
        mov      eax, r12d
        mov      qword ptr [rbp-0x30], rax
        mov      edi, r12d
        call     System.String:FastAllocateString(int):System.String
        mov      r12, rax
        mov      rsi, 0xD1FFAB1E
        mov      edi, r13d
        lea      rsi, bword ptr [rsi+2*rdi]
        cmp      byte  ptr [r12], r12b
        lea      rdi, bword ptr [r12+0x0C]
        mov      r13, qword ptr [rbp-0x30]
        lea      rdx, [r13+r13]
        mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
        call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
        mov      r13, r12
 						;; size=68 bbWeight=0.50 PerfScore 6.88
 G_M21659_IG06:
-       mov      edi, r15d
+       mov      edi, ebx
        mov      rax, 0xD1FFAB1E      ; code for System.Text.EncodingTable:GetDisplayName(int):System.String
        call     [rax]System.Text.EncodingTable:GetDisplayName(int):System.String
-       mov      r15, rax
-       mov      edi, ebx
-       mov      rax, 0xD1FFAB1E      ; static handle
-       mov      ebx, dword ptr [rax+4*rdi]
+       mov      rbx, rax
+       mov      rdi, 0xD1FFAB1E      ; static handle
+       mov      r15d, dword ptr [r15+rdi]
        mov      rdi, 0xD1FFAB1E      ; System.Text.CodePageDataItem
        call     CORINFO_HELP_NEWSFAST
        mov      r12, rax
        mov      dword ptr [r12+0x28], r14d
        lea      rdi, bword ptr [r12+0x08]
        mov      rsi, r13
        call     CORINFO_HELP_ASSIGN_REF
        lea      rdi, bword ptr [r12+0x10]
        mov      rsi, r13
        call     CORINFO_HELP_ASSIGN_REF
        lea      rdi, bword ptr [r12+0x18]
        mov      rsi, r13
        call     CORINFO_HELP_ASSIGN_REF
        lea      rdi, bword ptr [r12+0x20]
-       mov      rsi, r15
+       mov      rsi, rbx
        call     CORINFO_HELP_ASSIGN_REF
-       mov      dword ptr [r12+0x2C], ebx
+       mov      dword ptr [r12+0x2C], r15d
        mov      rax, r12
-						;; size=116 bbWeight=1 PerfScore 17.00
+						;; size=114 bbWeight=1 PerfScore 16.75
 G_M21659_IG07:
        add      rsp, 8
        pop      rbx
        pop      r12
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
 						;; size=15 bbWeight=1 PerfScore 4.25
 G_M21659_IG08:
        mov      edi, 0x18B8D
        mov      rsi, 0xD1FFAB1E
        call     CORINFO_HELP_STRCNS
        mov      rdi, rax
        mov      esi, r13d
        mov      edx, r12d
        mov      rax, 0xD1FFAB1E      ; code for System.String:ThrowSubstringArgumentOutOfRange(int,int):this
        call     [rax]System.String:ThrowSubstringArgumentOutOfRange(int,int):this
        int3     
 						;; size=42 bbWeight=0 PerfScore 0.00
 G_M21659_IG09:
        call     CORINFO_HELP_RNGCHKFAIL
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 391, prolog size 16, PerfScore 53.75, instruction count 97, allocated bytes for code 391 (MethodHash=8edfab64) for method System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem (FullOpts)
+; Total bytes of code 390, prolog size 16, PerfScore 53.50, instruction count 96, allocated bytes for code 390 (MethodHash=8edfab64) for method System.Text.EncodingTable:InternalGetCodePageDataItem(int,int):System.Text.CodePageDataItem (FullOpts)

@MihuBot
Copy link
Owner Author

MihuBot commented Jul 3, 2024

@EgorBo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant