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

[JitDiff X64] [xtqqczze] Use Unsafe.BitCast for generic span casting #748

Open
MihuBot opened this issue Oct 23, 2024 · 3 comments
Open

Comments

@MihuBot
Copy link
Owner

MihuBot commented Oct 23, 2024

Job completed in 18 minutes 56 seconds.
dotnet/runtime#109136

Diffs

Found 260 files with textual diffs.

Summary of Code Size diffs:
(Lower is better)

Total bytes of base: 39524821
Total bytes of diff: 39524815
Total bytes of delta: -6 (-0.00 % of base)
Total relative delta: -0.03
    diff is an improvement.
    relative diff is an improvement.


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

1 total files with Code Size differences (1 improved, 0 regressed), 258 unchanged.

Top method regressions (bytes):
           3 (0.05 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:FormatCustomized[ubyte](System.DateTime,System.ReadOnlySpan`1[ushort],System.Globalization.DateTimeFormatInfo,System.TimeSpan,byref) (FullOpts)

Top method improvements (bytes):
          -7 (-2.78 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:AppendChar[ubyte](byref,ushort) (FullOpts)
          -2 (-0.31 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int (FullOpts)

Top method regressions (percentages):
           3 (0.05 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:FormatCustomized[ubyte](System.DateTime,System.ReadOnlySpan`1[ushort],System.Globalization.DateTimeFormatInfo,System.TimeSpan,byref) (FullOpts)

Top method improvements (percentages):
          -7 (-2.78 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:AppendChar[ubyte](byref,ushort) (FullOpts)
          -2 (-0.31 % of base) : System.Private.CoreLib.dasm - System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int (FullOpts)

3 total methods with Code Size differences (2 improved, 1 regressed), 232551 unchanged.

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

Artifacts:

xtqqczze referenced this issue in xtqqczze/dotnet-runtime Oct 23, 2024
@MihuBot
Copy link
Owner Author

MihuBot commented Oct 23, 2024

Top method regressions

Note: some changes were skipped as they were too large to fit into a comment.

Larger list of diffs: https://gist.github.com/MihuBot/8e4617ba2fb008ae339e6f031ee21f26

@MihuBot
Copy link
Owner Author

MihuBot commented Oct 23, 2024

Top method improvements

-7 (-2.78 % of base) - System.DateTimeFormat:AppendChar[ubyte](byref,ushort)
 ; Assembly listing for method System.DateTimeFormat:AppendChar[ubyte](byref,ushort) (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; partially interruptible
 ; No PGO data
-; 0 inlinees with PGO data; 9 single block inlinees; 6 inlinees without PGO data
+; 0 inlinees with PGO data; 7 single block inlinees; 5 inlinees without PGO data
 ; Final local variable assignments
 ;
 ;  V00 arg0         [V00,T00] ( 12,  7   )   byref  ->  rbx         single-def
-;  V01 arg1         [V01,T01] (  5,  4   )  ushort  ->  rsi         single-def
+;  V01 arg1         [V01,T01] (  4,  3.50)  ushort  ->  rsi         single-def
 ;* V02 loc0         [V02    ] (  0,  0   )  struct ( 8) zero-ref    ld-addr-op <System.Text.Rune>
 ;# V03 OutArgs      [V03    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
 ;* V04 tmp1         [V04    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[ubyte]>
-;* V05 tmp2         [V05    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[ubyte]>
-;  V06 tmp3         [V06,T04] (  4,  2   )     int  ->  r15         "Inline stloc first use temp"
-;* V07 tmp4         [V07    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
-;  V08 tmp5         [V08,T03] (  3,  3   )   ubyte  ->  rsi         "Inlining Arg"
-;  V09 tmp6         [V09,T06] (  3,  1.50)     int  ->  r15         "Inline stloc first use temp"
-;* V10 tmp7         [V10    ] (  0,  0   )  struct (16) zero-ref    multireg-ret "Inline return value spill temp" <System.Span`1[ubyte]>
-;  V11 tmp8         [V11,T07] (  3,  1.50)     int  ->  r14         "Inline stloc first use temp"
-;* V12 tmp9         [V12    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
-;  V13 tmp10        [V13,T02] (  5,  5   )     int  ->  rax         "Inlining Arg"
-;* V14 tmp11        [V14    ] (  0,  0   )  struct (16) zero-ref    do-not-enreg[SBR] multireg-ret "Return value temp for multireg return" <System.Span`1[ubyte]>
-;* V15 tmp12        [V15    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
-;* V16 tmp13        [V16    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;* V17 tmp14        [V17    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[ubyte]>
-;* V18 tmp15        [V18    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
-;* V19 tmp16        [V19    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[ubyte]>
-;* V20 tmp17        [V20    ] (  0,  0   )   byref  ->  zero-ref    single-def "Inlining Arg"
-;* V21 tmp18        [V21    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
-;  V22 tmp19        [V22    ] (  1,  0.50)     int  ->  [rbp-0x30]  do-not-enreg[X] addr-exposed ld-addr-op "Inline ldloca(s) first use temp"
-;  V23 tmp20        [V23,T08] (  3,  1.50)     int  ->  r15         "field V02._value (fldOffset=0x0)" P-INDEP
-;* V24 tmp21        [V24    ] (  0,  0   )   byref  ->  zero-ref    "field V04._reference (fldOffset=0x0)" P-INDEP
-;* V25 tmp22        [V25    ] (  0,  0   )     int  ->  zero-ref    "field V04._length (fldOffset=0x8)" P-INDEP
-;* V26 tmp23        [V26    ] (  0,  0   )   byref  ->  zero-ref    "field V05._reference (fldOffset=0x0)" P-INDEP
-;* V27 tmp24        [V27    ] (  0,  0   )     int  ->  zero-ref    "field V05._length (fldOffset=0x8)" P-INDEP
-;  V28 tmp25        [V28,T11] (  2,  1   )   byref  ->  r14         single-def "field V07._reference (fldOffset=0x0)" P-INDEP
-;  V29 tmp26        [V29,T15] (  2,  1   )     int  ->  rdi         "field V07._length (fldOffset=0x8)" P-INDEP
-;  V30 tmp27        [V30,T05] (  3,  1.50)   byref  ->  rsi         single-def "field V10._reference (fldOffset=0x0)" P-INDEP
-;  V31 tmp28        [V31,T09] (  3,  1.50)     int  ->  rdx         "field V10._length (fldOffset=0x8)" P-INDEP
-;  V32 tmp29        [V32,T12] (  2,  1   )   byref  ->  r13         single-def "field V12._reference (fldOffset=0x0)" P-INDEP
-;  V33 tmp30        [V33,T16] (  2,  1   )     int  ->  rdi         "field V12._length (fldOffset=0x8)" P-INDEP
-;* V34 tmp31        [V34    ] (  0,  0   )   byref  ->  zero-ref    "field V14._reference (fldOffset=0x0)" P-DEP
-;* V35 tmp32        [V35    ] (  0,  0   )     int  ->  zero-ref    "field V14._length (fldOffset=0x8)" P-DEP
-;  V36 tmp33        [V36,T13] (  2,  1   )   byref  ->  rsi         single-def "field V15._reference (fldOffset=0x0)" P-INDEP
-;  V37 tmp34        [V37,T17] (  2,  1   )     int  ->  rdx         "field V15._length (fldOffset=0x8)" P-INDEP
-;* V38 tmp35        [V38    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V17._reference (fldOffset=0x0)" P-INDEP
-;* V39 tmp36        [V39    ] (  0,  0   )     int  ->  zero-ref    "field V17._length (fldOffset=0x8)" P-INDEP
-;  V40 tmp37        [V40,T14] (  2,  1   )   byref  ->  rsi         single-def "field V18._reference (fldOffset=0x0)" P-INDEP
-;  V41 tmp38        [V41,T18] (  2,  1   )     int  ->  rdx         "field V18._length (fldOffset=0x8)" P-INDEP
-;* V42 tmp39        [V42    ] (  0,  0   )   byref  ->  zero-ref    single-def "field V19._reference (fldOffset=0x0)" P-INDEP
-;* V43 tmp40        [V43    ] (  0,  0   )     int  ->  zero-ref    "field V19._length (fldOffset=0x8)" P-INDEP
-;  V44 cse0         [V44,T10] (  3,  1.50)    long  ->  r12         "CSE #02: moderate"
+;  V05 tmp2         [V05,T05] (  4,  2   )     int  ->  r15         "Inline stloc first use temp"
+;* V06 tmp3         [V06    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
+;  V07 tmp4         [V07,T03] (  3,  3   )   ubyte  ->  rsi         "Inlining Arg"
+;  V08 tmp5         [V08,T07] (  3,  1.50)     int  ->  r15         "Inline stloc first use temp"
+;* V09 tmp6         [V09    ] (  0,  0   )  struct (16) zero-ref    multireg-arg multireg-ret "Inline return value spill temp" <System.Span`1[ubyte]>
+;  V10 tmp7         [V10,T08] (  3,  1.50)     int  ->  r14         "Inline stloc first use temp"
+;* V11 tmp8         [V11    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
+;  V12 tmp9         [V12,T02] (  5,  5   )     int  ->  rax         "Inlining Arg"
+;* V13 tmp10        [V13    ] (  0,  0   )  struct (16) zero-ref    do-not-enreg[SBR] multireg-ret "Return value temp for multireg return" <System.Span`1[ubyte]>
+;* V14 tmp11        [V14    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
+;* V15 tmp12        [V15    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
+;  V16 tmp13        [V16    ] (  1,  0.50)     int  ->  [rbp-0x28]  do-not-enreg[X] addr-exposed ld-addr-op "Inline ldloca(s) first use temp"
+;  V17 tmp14        [V17,T09] (  3,  1.50)     int  ->  r15         "field V02._value (fldOffset=0x0)" P-INDEP
+;* V18 tmp15        [V18    ] (  0,  0   )   byref  ->  zero-ref    "field V04._reference (fldOffset=0x0)" P-INDEP
+;* V19 tmp16        [V19    ] (  0,  0   )     int  ->  zero-ref    "field V04._length (fldOffset=0x8)" P-INDEP
+;  V20 tmp17        [V20,T12] (  2,  1   )   byref  ->  r14         single-def "field V06._reference (fldOffset=0x0)" P-INDEP
+;  V21 tmp18        [V21,T15] (  2,  1   )     int  ->  rdi         "field V06._length (fldOffset=0x8)" P-INDEP
+;  V22 tmp19        [V22,T06] (  3,  1.50)   byref  ->  rax         single-def "field V09._reference (fldOffset=0x0)" P-INDEP
+;  V23 tmp20        [V23,T10] (  3,  1.50)     int  ->  rdx         "field V09._length (fldOffset=0x8)" P-INDEP
+;  V24 tmp21        [V24,T13] (  2,  1   )   byref  ->  rsi         single-def "field V11._reference (fldOffset=0x0)" P-INDEP
+;  V25 tmp22        [V25,T16] (  2,  1   )     int  ->  rdi         "field V11._length (fldOffset=0x8)" P-INDEP
+;* V26 tmp23        [V26    ] (  0,  0   )   byref  ->  zero-ref    "field V13._reference (fldOffset=0x0)" P-DEP
+;* V27 tmp24        [V27    ] (  0,  0   )     int  ->  zero-ref    "field V13._length (fldOffset=0x8)" P-DEP
+;  V28 tmp25        [V28,T14] (  2,  1   )   byref  ->  rsi         single-def "field V14._reference (fldOffset=0x0)" P-INDEP
+;  V29 tmp26        [V29,T17] (  2,  1   )     int  ->  rdx         "field V14._length (fldOffset=0x8)" P-INDEP
+;  V30 cse0         [V30,T11] (  3,  1.50)    long  ->  r13         "CSE #02: moderate"
+;  V31 cse1         [V31,T04] (  3,  2.50)     int  ->  r15         "CSE #01: aggressive"
 ;
-; Lcl frame size = 8
+; Lcl frame size = 16
 
 G_M43494_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
-       push     r12
        push     rbx
-       push     rax
+       sub      rsp, 16
        lea      rbp, [rsp+0x30]
        mov      rbx, rdi
-						;; size=19 bbWeight=1 PerfScore 7.75
+						;; size=20 bbWeight=1 PerfScore 6.00
 G_M43494_IG02:
-       movzx    rdi, si
-       cmp      edi, 127
-       jle      G_M43494_IG06
-						;; size=12 bbWeight=1 PerfScore 1.50
-G_M43494_IG03:
        movzx    r15, si
+       cmp      r15d, 127
+       jle      SHORT G_M43494_IG06
+						;; size=10 bbWeight=1 PerfScore 1.50
+G_M43494_IG03:
        lea      edi, [r15-0xD800]
        cmp      edi, 0x7FF
        jbe      G_M43494_IG10
        mov      edi, r15d
        mov      rax, 0xD1FFAB1E      ; code for System.Text.UnicodeUtility:GetUtf8SequenceLength(uint):int
        call     [rax]System.Text.UnicodeUtility:GetUtf8SequenceLength(uint):int
        mov      r14d, dword ptr [rbx+0x08]
-       mov      r13, bword ptr [rbx+0x10]
+       mov      rsi, bword ptr [rbx+0x10]
        mov      edi, dword ptr [rbx+0x18]
-       mov      r12d, r14d
-       mov      esi, eax
-       add      rsi, r12
-       cmp      rsi, rdi
+       mov      r13d, r14d
+       mov      ecx, eax
+       add      rcx, r13
+       cmp      rcx, rdi
        jbe      SHORT G_M43494_IG04
        mov      rdi, rbx
        mov      esi, eax
        mov      rax, 0xD1FFAB1E      ; code for System.Collections.Generic.ValueListBuilder`1[ubyte]:AppendSpanWithGrow(int):System.Span`1[ubyte]:this
        call     [rax]System.Collections.Generic.ValueListBuilder`1[ubyte]:AppendSpanWithGrow(int):System.Span`1[ubyte]:this
-       mov      rsi, rax
        jmp      SHORT G_M43494_IG05
-						;; size=84 bbWeight=0.50 PerfScore 9.75
+						;; size=77 bbWeight=0.50 PerfScore 9.50
 G_M43494_IG04:
        add      r14d, eax
        mov      dword ptr [rbx+0x08], r14d
-       add      r13, r12
-       mov      rsi, r13
+       add      rsi, r13
        mov      edx, eax
+       mov      rax, rsi
 						;; size=15 bbWeight=0.50 PerfScore 1.00
 G_M43494_IG05:
-       lea      rcx, [rbp-0x30]
+       mov      rsi, rax
+       lea      rcx, [rbp-0x28]
        mov      edi, r15d
        mov      rax, 0xD1FFAB1E      ; code for System.Text.Rune:TryEncodeToUtf8(System.Text.Rune,System.Span`1[ubyte],byref):ubyte
        call     [rax]System.Text.Rune:TryEncodeToUtf8(System.Text.Rune,System.Span`1[ubyte],byref):ubyte
        test     eax, eax
        jne      SHORT G_M43494_IG08
        jmp      SHORT G_M43494_IG09
-						;; size=25 bbWeight=0.50 PerfScore 3.62
+						;; size=28 bbWeight=0.50 PerfScore 3.75
 G_M43494_IG06:
        movzx    rsi, sil
        mov      r15d, dword ptr [rbx+0x08]
        mov      r14, bword ptr [rbx+0x10]
        mov      edi, dword ptr [rbx+0x18]
        cmp      r15d, edi
        jb       SHORT G_M43494_IG07
        mov      rdi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        call     [rax]System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        jmp      SHORT G_M43494_IG08
 						;; size=37 bbWeight=0.50 PerfScore 6.50
 G_M43494_IG07:
        mov      eax, r15d
        mov      byte  ptr [r14+rax], sil
        inc      r15d
        mov      dword ptr [rbx+0x08], r15d
 						;; size=14 bbWeight=0.50 PerfScore 1.25
 G_M43494_IG08:
-       add      rsp, 8
+       add      rsp, 16
        pop      rbx
-       pop      r12
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
-						;; size=15 bbWeight=1 PerfScore 4.25
+						;; size=13 bbWeight=1 PerfScore 3.75
 G_M43494_IG09:
        mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentException_DestinationTooShort()
        call     [rax]System.ThrowHelper:ThrowArgumentException_DestinationTooShort()
        int3     
 						;; size=13 bbWeight=0 PerfScore 0.00
 G_M43494_IG10:
        mov      edi, 13
        mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentOutOfRangeException(int)
        call     [rax]System.ThrowHelper:ThrowArgumentOutOfRangeException(int)
        int3     
 						;; size=18 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 252, prolog size 16, PerfScore 35.62, instruction count 74, allocated bytes for code 252 (MethodHash=6deb5619) for method System.DateTimeFormat:AppendChar[ubyte](byref,ushort) (FullOpts)
+; Total bytes of code 245, prolog size 17, PerfScore 33.25, instruction count 71, allocated bytes for code 245 (MethodHash=6deb5619) for method System.DateTimeFormat:AppendChar[ubyte](byref,ushort) (FullOpts)
 ; ============================================================
-2 (-0.31 % of base) - System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int
 ; Assembly listing for method System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int (FullOpts)
 ; Emitting BLENDED_CODE for X64 with AVX - Unix
 ; FullOpts code
 ; optimized code
 ; rbp based frame
 ; fully interruptible
 ; No PGO data
-; 0 inlinees with PGO data; 11 single block inlinees; 8 inlinees without PGO data
+; 0 inlinees with PGO data; 9 single block inlinees; 7 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[ushort]>
 ;  V01 arg1         [V01,T02] ( 12, 24   )     int  ->  [rbp-0x2C] 
 ;  V02 arg2         [V02,T00] ( 17, 32   )   byref  ->  rbx         single-def
 ;  V03 loc0         [V03,T10] (  4,  8   )     int  ->  r12        
 ;  V04 loc1         [V04,T18] (  5,  5   )     int  ->  r15        
 ;  V05 loc2         [V05,T19] (  3,  5   )  ushort  ->  [rbp-0x30]  spill-single-def
-;* V06 loc3         [V06,T31] (  0,  0   )   ubyte  ->  zero-ref   
+;* V06 loc3         [V06,T29] (  0,  0   )   ubyte  ->  zero-ref   
 ;  V07 loc4         [V07,T04] (  6, 18   )  ushort  ->  rdx        
 ;# V08 OutArgs      [V08    ] (  1,  1   )  struct ( 0) [rsp+0x00]  do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
-;  V09 tmp1         [V09,T25] (  2,  4   )     int  ->  rdi         "impSpillLclRefs"
+;  V09 tmp1         [V09,T24] (  2,  4   )     int  ->  rdi         "impSpillLclRefs"
 ;  V10 tmp2         [V10,T01] (  4, 32   )     int  ->  rdi         "impSpillLclRefs"
-;  V11 tmp3         [V11,T32] (  3,  0   )     ref  ->  rbx         class-hnd exact "NewObj constructor temp" <System.FormatException>
+;  V11 tmp3         [V11,T30] (  3,  0   )     ref  ->  rbx         class-hnd exact "NewObj constructor temp" <System.FormatException>
 ;  V12 tmp4         [V12,T05] (  4, 16   )     int  ->  rdi         "impSpillLclRefs"
-;  V13 tmp5         [V13,T33] (  3,  0   )     ref  ->  r15         class-hnd exact single-def "Single-def Box Helper" <System.Char>
-;  V14 tmp6         [V14,T35] (  2,  0   )     ref  ->  rbx         class-hnd exact single-def "impImportAndPushBox" <System.String>
-;  V15 tmp7         [V15,T34] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.FormatException>
+;  V13 tmp5         [V13,T31] (  3,  0   )     ref  ->  r15         class-hnd exact single-def "Single-def Box Helper" <System.Char>
+;  V14 tmp6         [V14,T33] (  2,  0   )     ref  ->  rbx         class-hnd exact single-def "impImportAndPushBox" <System.String>
+;  V15 tmp7         [V15,T32] (  3,  0   )     ref  ->  r14         class-hnd exact single-def "NewObj constructor temp" <System.FormatException>
 ;* V16 tmp8         [V16    ] (  0,  0   )  ushort  ->  zero-ref    "Inlining Arg"
 ;  V17 tmp9         [V17,T11] (  4,  8   )     int  ->  rdx         "Inline stloc first use temp"
 ;* V18 tmp10        [V18    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
 ;  V19 tmp11        [V19,T06] (  3, 12   )   ubyte  ->  rsi         "Inlining Arg"
 ;* V20 tmp12        [V20    ] (  0,  0   )  struct ( 8) zero-ref    ld-addr-op "Inline ldloca(s) first use temp" <System.Text.Rune>
 ;* V21 tmp13        [V21    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[ubyte]>
-;* V22 tmp14        [V22    ] (  0,  0   )  struct (16) zero-ref    "spilled call-like call argument" <System.Span`1[ubyte]>
-;  V23 tmp15        [V23,T12] (  4,  8   )     int  ->  rdx         "Inline stloc first use temp"
-;* V24 tmp16        [V24    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
-;  V25 tmp17        [V25,T07] (  3, 12   )   ubyte  ->  rsi         "Inlining Arg"
-;  V26 tmp18        [V26,T16] (  3,  6   )     int  ->  rdx         "Inline stloc first use temp"
-;* V27 tmp19        [V27    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
-;* V28 tmp20        [V28    ] (  0,  0   )     int  ->  zero-ref    "Inline stloc first use temp"
-;* V29 tmp21        [V29    ] (  0,  0   )  struct (16) zero-ref    multireg-ret "Inline return value spill temp" <System.Span`1[ubyte]>
-;  V30 tmp22        [V30,T13] (  4,  8   )     int  ->   r8         "Inline stloc first use temp"
-;* V31 tmp23        [V31    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
-;  V32 tmp24        [V32,T03] (  5, 20   )     int  ->  rsi         "Inlining Arg"
-;* V33 tmp25        [V33    ] (  0,  0   )  struct (16) zero-ref    do-not-enreg[SBR] multireg-ret "Return value temp for multireg return" <System.Span`1[ubyte]>
-;* V34 tmp26        [V34    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
-;* V35 tmp27        [V35    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;* V36 tmp28        [V36    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[ubyte]>
-;* V37 tmp29        [V37    ] (  0,  0   )  struct (16) zero-ref    multireg-arg ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
-;* V38 tmp30        [V38    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inlining Arg" <System.Span`1[ubyte]>
-;* V39 tmp31        [V39    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
-;* V40 tmp32        [V40    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
-;  V41 tmp33        [V41    ] (  1,  2   )     int  ->  [rbp-0x38]  do-not-enreg[X] addr-exposed ld-addr-op "Inline ldloca(s) first use temp"
-;  V42 tmp34        [V42,T09] (  4,  8   )   byref  ->  r13         single-def "field V00._reference (fldOffset=0x0)" P-INDEP
-;  V43 tmp35        [V43,T08] (  5,  9   )     int  ->  r14         single-def "field V00._length (fldOffset=0x8)" P-INDEP
-;  V44 tmp36        [V44,T20] (  2,  4   )   byref  ->   r8         "field V18._reference (fldOffset=0x0)" P-INDEP
-;  V45 tmp37        [V45,T26] (  2,  4   )     int  ->  rdi         "field V18._length (fldOffset=0x8)" P-INDEP
-;  V46 tmp38        [V46,T14] (  4,  8   )     int  ->  [rbp-0x3C]  spill-single-def "field V20._value (fldOffset=0x0)" P-INDEP
-;* V47 tmp39        [V47    ] (  0,  0   )   byref  ->  zero-ref    "field V21._reference (fldOffset=0x0)" P-INDEP
-;* V48 tmp40        [V48    ] (  0,  0   )     int  ->  zero-ref    "field V21._length (fldOffset=0x8)" P-INDEP
-;* V49 tmp41        [V49    ] (  0,  0   )   byref  ->  zero-ref    "field V22._reference (fldOffset=0x0)" P-INDEP
-;* V50 tmp42        [V50    ] (  0,  0   )     int  ->  zero-ref    "field V22._length (fldOffset=0x8)" P-INDEP
-;  V51 tmp43        [V51,T21] (  2,  4   )   byref  ->   r8         "field V24._reference (fldOffset=0x0)" P-INDEP
-;  V52 tmp44        [V52,T27] (  2,  4   )     int  ->  rdi         "field V24._length (fldOffset=0x8)" P-INDEP
-;  V53 tmp45        [V53,T15] (  3,  6   )   byref  ->  registers   "field V29._reference (fldOffset=0x0)" P-INDEP
-;  V54 tmp46        [V54,T17] (  3,  6   )     int  ->  registers   "field V29._length (fldOffset=0x8)" P-INDEP
-;  V55 tmp47        [V55,T22] (  2,  4   )   byref  ->   r9         "field V31._reference (fldOffset=0x0)" P-INDEP
-;  V56 tmp48        [V56,T28] (  2,  4   )     int  ->  rdi         "field V31._length (fldOffset=0x8)" P-INDEP
-;* V57 tmp49        [V57    ] (  0,  0   )   byref  ->  zero-ref    "field V33._reference (fldOffset=0x0)" P-DEP
-;* V58 tmp50        [V58    ] (  0,  0   )     int  ->  zero-ref    "field V33._length (fldOffset=0x8)" P-DEP
-;  V59 tmp51        [V59,T23] (  2,  4   )   byref  ->  rdi         "field V34._reference (fldOffset=0x0)" P-INDEP
-;  V60 tmp52        [V60,T29] (  2,  4   )     int  ->  rsi         "field V34._length (fldOffset=0x8)" P-INDEP
-;* V61 tmp53        [V61    ] (  0,  0   )   byref  ->  zero-ref    "field V36._reference (fldOffset=0x0)" P-INDEP
-;* V62 tmp54        [V62    ] (  0,  0   )     int  ->  zero-ref    "field V36._length (fldOffset=0x8)" P-INDEP
-;  V63 tmp55        [V63,T24] (  2,  4   )   byref  ->  rdi         "field V37._reference (fldOffset=0x0)" P-INDEP
-;  V64 tmp56        [V64,T30] (  2,  4   )     int  ->   r8         "field V37._length (fldOffset=0x8)" P-INDEP
-;* V65 tmp57        [V65    ] (  0,  0   )   byref  ->  zero-ref    "field V38._reference (fldOffset=0x0)" P-INDEP
-;* V66 tmp58        [V66    ] (  0,  0   )     int  ->  zero-ref    "field V38._length (fldOffset=0x8)" P-INDEP
-;  V67 tmp59        [V67,T36] (  2,  0   )     ref  ->  rsi         "argument with side effect"
-;  V68 tmp60        [V68,T37] (  2,  0   )     ref  ->  rsi         single-def "argument with side effect"
+;  V22 tmp14        [V22,T12] (  4,  8   )     int  ->  rdx         "Inline stloc first use temp"
+;* V23 tmp15        [V23    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
+;  V24 tmp16        [V24,T07] (  3, 12   )   ubyte  ->  rsi         "Inlining Arg"
+;  V25 tmp17        [V25,T16] (  3,  6   )     int  ->  rdx         "Inline stloc first use temp"
+;* V26 tmp18        [V26    ] (  0,  0   )     int  ->  zero-ref    "Inlining Arg"
+;* V27 tmp19        [V27    ] (  0,  0   )     int  ->  zero-ref    "Inline stloc first use temp"
+;* V28 tmp20        [V28    ] (  0,  0   )  struct (16) zero-ref    multireg-arg multireg-ret "Inline return value spill temp" <System.Span`1[ubyte]>
+;  V29 tmp21        [V29,T13] (  4,  8   )     int  ->   r8         "Inline stloc first use temp"
+;* V30 tmp22        [V30    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "Inline stloc first use temp" <System.Span`1[ubyte]>
+;  V31 tmp23        [V31,T03] (  5, 20   )     int  ->  rsi         "Inlining Arg"
+;* V32 tmp24        [V32    ] (  0,  0   )  struct (16) zero-ref    do-not-enreg[SBR] multireg-ret "Return value temp for multireg return" <System.Span`1[ubyte]>
+;* V33 tmp25        [V33    ] (  0,  0   )  struct (16) zero-ref    ld-addr-op "NewObj constructor temp" <System.Span`1[ubyte]>
+;* V34 tmp26        [V34    ] (  0,  0   )   byref  ->  zero-ref    "Inlining Arg"
+;  V35 tmp27        [V35    ] (  1,  2   )     int  ->  [rbp-0x38]  do-not-enreg[X] addr-exposed ld-addr-op "Inline ldloca(s) first use temp"
+;  V36 tmp28        [V36,T09] (  4,  8   )   byref  ->  r13         single-def "field V00._reference (fldOffset=0x0)" P-INDEP
+;  V37 tmp29        [V37,T08] (  5,  9   )     int  ->  r14         single-def "field V00._length (fldOffset=0x8)" P-INDEP
+;  V38 tmp30        [V38,T20] (  2,  4   )   byref  ->   r8         "field V18._reference (fldOffset=0x0)" P-INDEP
+;  V39 tmp31        [V39,T25] (  2,  4   )     int  ->  rdi         "field V18._length (fldOffset=0x8)" P-INDEP
+;  V40 tmp32        [V40,T14] (  4,  8   )     int  ->  [rbp-0x3C]  spill-single-def "field V20._value (fldOffset=0x0)" P-INDEP
+;* V41 tmp33        [V41    ] (  0,  0   )   byref  ->  zero-ref    "field V21._reference (fldOffset=0x0)" P-INDEP
+;* V42 tmp34        [V42    ] (  0,  0   )     int  ->  zero-ref    "field V21._length (fldOffset=0x8)" P-INDEP
+;  V43 tmp35        [V43,T21] (  2,  4   )   byref  ->   r8         "field V23._reference (fldOffset=0x0)" P-INDEP
+;  V44 tmp36        [V44,T26] (  2,  4   )     int  ->  rdi         "field V23._length (fldOffset=0x8)" P-INDEP
+;  V45 tmp37        [V45,T15] (  3,  6   )   byref  ->  registers   "field V28._reference (fldOffset=0x0)" P-INDEP
+;  V46 tmp38        [V46,T17] (  3,  6   )     int  ->  registers   "field V28._length (fldOffset=0x8)" P-INDEP
+;  V47 tmp39        [V47,T22] (  2,  4   )   byref  ->   r9         "field V30._reference (fldOffset=0x0)" P-INDEP
+;  V48 tmp40        [V48,T27] (  2,  4   )     int  ->  rdi         "field V30._length (fldOffset=0x8)" P-INDEP
+;* V49 tmp41        [V49    ] (  0,  0   )   byref  ->  zero-ref    "field V32._reference (fldOffset=0x0)" P-DEP
+;* V50 tmp42        [V50    ] (  0,  0   )     int  ->  zero-ref    "field V32._length (fldOffset=0x8)" P-DEP
+;  V51 tmp43        [V51,T23] (  2,  4   )   byref  ->  rdi         "field V33._reference (fldOffset=0x0)" P-INDEP
+;  V52 tmp44        [V52,T28] (  2,  4   )     int  ->  rsi         "field V33._length (fldOffset=0x8)" P-INDEP
+;  V53 tmp45        [V53,T34] (  2,  0   )     ref  ->  rsi         "argument with side effect"
+;  V54 tmp46        [V54,T35] (  2,  0   )     ref  ->  rsi         single-def "argument with side effect"
 ;
 ; Lcl frame size = 24
 
 G_M36138_IG01:
        push     rbp
        push     r15
        push     r14
        push     r13
        push     r12
        push     rbx
        sub      rsp, 24
        lea      rbp, [rsp+0x40]
        mov      r13, rdi
        mov      r14d, esi
        mov      r15d, edx
        mov      rbx, rcx
 						;; size=31 bbWeight=1 PerfScore 7.75
 G_M36138_IG02:
        mov      r12d, r14d
        mov      edi, r15d
        inc      edi
        mov      eax, edi
        cmp      r15d, r12d
        jae      G_M36138_IG20
        mov      edi, r15d
        movzx    rcx, word  ptr [r13+2*rdi]
        mov      dword ptr [rbp-0x30], ecx
        cmp      eax, r14d
        jl       SHORT G_M36138_IG05
 						;; size=36 bbWeight=1 PerfScore 6.75
 G_M36138_IG03:
        jmp      G_M36138_IG18
 						;; size=5 bbWeight=0.50 PerfScore 1.00
 G_M36138_IG04:
        mov      ecx, dword ptr [rbp-0x30]
 						;; size=3 bbWeight=2 PerfScore 2.00
 G_M36138_IG05:
        mov      edi, eax
        lea      eax, [rdi+0x01]
        mov      dword ptr [rbp-0x2C], eax
        cmp      edi, r12d
        jae      G_M36138_IG20
        movzx    rdx, word  ptr [r13+2*rdi]
        cmp      edx, ecx
        je       G_M36138_IG14
        cmp      edx, 92
        je       G_M36138_IG11
 						;; size=40 bbWeight=4 PerfScore 30.00
 G_M36138_IG06:
        cmp      edx, 127
        jle      G_M36138_IG09
        lea      edi, [rdx-0xD800]
        cmp      edi, 0x7FF
        jbe      G_M36138_IG17
        mov      dword ptr [rbp-0x3C], edx
        mov      edi, edx
        xor      edi, 0xF800
        add      edi, 0xD1FFAB1E
        shr      edi, 24
        lea      esi, [rdx-0x0800]
        sar      esi, 31
        lea      esi, [rdi+2*rsi]
        mov      r8d, dword ptr [rbx+0x08]
        mov      r9, bword ptr [rbx+0x10]
        mov      edi, dword ptr [rbx+0x18]
        mov      r10d, r8d
        mov      r11d, esi
        add      r10, r11
        cmp      r10, rdi
        jbe      SHORT G_M36138_IG07
        mov      rdi, rbx
        mov      r8, 0xD1FFAB1E      ; code for System.Collections.Generic.ValueListBuilder`1[ubyte]:AppendSpanWithGrow(int):System.Span`1[ubyte]:this
        call     [r8]System.Collections.Generic.ValueListBuilder`1[ubyte]:AppendSpanWithGrow(int):System.Span`1[ubyte]:this
-       mov      rsi, rax
-       mov      rdi, rsi
-       mov      esi, edx
+       mov      rdi, rax
+       mov      r8d, edx
        jmp      SHORT G_M36138_IG08
-						;; size=110 bbWeight=2 PerfScore 42.00
+						;; size=108 bbWeight=2 PerfScore 41.50
 G_M36138_IG07:
        lea      edi, [r8+rsi]
        mov      dword ptr [rbx+0x08], edi
        mov      edi, r8d
        add      rdi, r9
-						;; size=13 bbWeight=2 PerfScore 4.00
-G_M36138_IG08:
        mov      r8d, esi
+						;; size=16 bbWeight=2 PerfScore 4.50
+G_M36138_IG08:
        mov      rsi, rdi
        mov      edx, r8d
        lea      rcx, [rbp-0x38]
        mov      edi, dword ptr [rbp-0x3C]
        mov      r8, 0xD1FFAB1E      ; code for System.Text.Rune:TryEncodeToUtf8(System.Text.Rune,System.Span`1[ubyte],byref):ubyte
        call     [r8]System.Text.Rune:TryEncodeToUtf8(System.Text.Rune,System.Span`1[ubyte],byref):ubyte
        test     eax, eax
        jne      G_M36138_IG13
        jmp      G_M36138_IG16
-						;; size=42 bbWeight=2 PerfScore 17.50
+						;; size=39 bbWeight=2 PerfScore 17.00
 G_M36138_IG09:
        movzx    rsi, dl
        mov      edx, dword ptr [rbx+0x08]
        mov      r8, bword ptr [rbx+0x10]
        mov      edi, dword ptr [rbx+0x18]
        cmp      edx, edi
        jb       SHORT G_M36138_IG10
        mov      rdi, rbx
        mov      rdx, 0xD1FFAB1E      ; code for System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        call     [rdx]System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        jmp      SHORT G_M36138_IG13
 						;; size=35 bbWeight=2 PerfScore 26.00
 G_M36138_IG10:
        mov      edi, edx
        mov      byte  ptr [r8+rdi], sil
        inc      edx
        mov      dword ptr [rbx+0x08], edx
        jmp      SHORT G_M36138_IG13
 						;; size=13 bbWeight=2 PerfScore 9.00
 G_M36138_IG11:
        mov      eax, dword ptr [rbp-0x2C]
        cmp      eax, r14d
        jge      G_M36138_IG19
        mov      edi, eax
        lea      eax, [rdi+0x01]
        mov      dword ptr [rbp-0x2C], eax
        cmp      edi, r12d
        jae      G_M36138_IG20
        movzx    rsi, byte  ptr [r13+2*rdi]
        mov      edx, dword ptr [rbx+0x08]
        mov      r8, bword ptr [rbx+0x10]
        mov      edi, dword ptr [rbx+0x18]
        cmp      edx, edi
        jb       SHORT G_M36138_IG12
        mov      rdi, rbx
        mov      rdx, 0xD1FFAB1E      ; code for System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        call     [rdx]System.Collections.Generic.ValueListBuilder`1[ubyte]:AddWithResize(ubyte):this
        jmp      SHORT G_M36138_IG13
 						;; size=66 bbWeight=2 PerfScore 40.00
 G_M36138_IG12:
        mov      edi, edx
        mov      byte  ptr [r8+rdi], sil
        inc      edx
        mov      dword ptr [rbx+0x08], edx
 						;; size=11 bbWeight=2 PerfScore 5.00
 G_M36138_IG13:
        mov      eax, dword ptr [rbp-0x2C]
        cmp      eax, r14d
        jl       G_M36138_IG04
        jmp      SHORT G_M36138_IG18
 						;; size=14 bbWeight=4 PerfScore 17.00
 G_M36138_IG14:
        mov      eax, dword ptr [rbp-0x2C]
        sub      eax, r15d
 						;; size=6 bbWeight=1 PerfScore 1.25
 G_M36138_IG15:
        add      rsp, 24
        pop      rbx
        pop      r12
        pop      r13
        pop      r14
        pop      r15
        pop      rbp
        ret      
 						;; size=15 bbWeight=1 PerfScore 4.25
 G_M36138_IG16:
        mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentException_DestinationTooShort()
        call     [rax]System.ThrowHelper:ThrowArgumentException_DestinationTooShort()
        int3     
 						;; size=13 bbWeight=0 PerfScore 0.00
 G_M36138_IG17:
        mov      edi, 13
        mov      rax, 0xD1FFAB1E      ; code for System.ThrowHelper:ThrowArgumentOutOfRangeException(int)
        call     [rax]System.ThrowHelper:ThrowArgumentOutOfRangeException(int)
        int3     
 						;; size=18 bbWeight=0 PerfScore 0.00
 G_M36138_IG18:
        mov      rdi, 0xD1FFAB1E      ; System.Char
        call     CORINFO_HELP_NEWSFAST
        mov      r15, rax
        mov      rax, 0xD1FFAB1E      ; code for System.SR:get_Format_BadQuote():System.String
        call     [rax]System.SR:get_Format_BadQuote():System.String
        mov      rbx, rax
        mov      r14d, dword ptr [rbp-0x30]
        mov      word  ptr [r15+0x08], r14w
        mov      rdi, 0xD1FFAB1E      ; System.FormatException
        call     CORINFO_HELP_NEWSFAST
        mov      r14, rax
        mov      rsi, r15
        mov      rdi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.SR:Format(System.String,System.Object):System.String
        call     [rax]System.SR:Format(System.String,System.Object):System.String
        mov      rsi, rax
        mov      rdi, r14
        mov      rax, 0xD1FFAB1E      ; code for System.FormatException:.ctor(System.String):this
        call     [rax]System.FormatException:.ctor(System.String):this
        mov      rdi, r14
        call     CORINFO_HELP_THROW
        int3     
 						;; size=105 bbWeight=0 PerfScore 0.00
 G_M36138_IG19:
        mov      rdi, 0xD1FFAB1E      ; System.FormatException
        call     CORINFO_HELP_NEWSFAST
        mov      rbx, rax
        mov      rax, 0xD1FFAB1E      ; code for System.SR:get_Format_InvalidString():System.String
        call     [rax]System.SR:get_Format_InvalidString():System.String
        mov      rsi, rax
        mov      rdi, rbx
        mov      rax, 0xD1FFAB1E      ; code for System.FormatException:.ctor(System.String):this
        call     [rax]System.FormatException:.ctor(System.String):this
        mov      rdi, rbx
        call     CORINFO_HELP_THROW
        int3     
 						;; size=57 bbWeight=0 PerfScore 0.00
 G_M36138_IG20:
        call     CORINFO_HELP_RNGCHKFAIL
        int3     
 						;; size=6 bbWeight=0 PerfScore 0.00
 
-; Total bytes of code 639, prolog size 31, PerfScore 213.50, instruction count 171, allocated bytes for code 639 (MethodHash=22c872d5) for method System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int (FullOpts)
+; Total bytes of code 637, prolog size 31, PerfScore 213.00, instruction count 170, allocated bytes for code 637 (MethodHash=22c872d5) for method System.DateTimeFormat:ParseQuoteString[ubyte](System.ReadOnlySpan`1[ushort],int,byref):int (FullOpts)
 ; ============================================================

@MihuBot
Copy link
Owner Author

MihuBot commented Oct 23, 2024

@xtqqczze

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