Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SwapnilGaikwad/a83e6458d36f97feb895a3d321148941 to your computer and use it in GitHub Desktop.
Save SwapnilGaikwad/a83e6458d36f97feb895a3d321148941 to your computer and use it in GitHub Desktop.
; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
; Emitting BLENDED_CODE for generic ARM64 CPU - Unix
; Tier-1 compilation
; optimized code
; optimized using profile data
; fp based frame
; fully interruptible
; with PGO: edge weights are invalid, and fgCalledCount is 221096
; 0 inlinees with PGO data; 18 single block inlinees; 1 inlinees without PGO data
; Final local variable assignments
;
; V00 arg0 [V00,T01] ( 8, 2 ) long -> x19 single-def
; V01 arg1 [V01,T02] ( 8, 2 ) long -> x20 single-def
; V02 arg2 [V02,T00] ( 5, 3 ) long -> x2 single-def
; V03 loc0 [V03,T03] ( 29, 1 ) long -> x21
; V04 loc1 [V04,T05] ( 16, 0 ) int -> x24
;* V05 loc2 [V05 ] ( 0, 0 ) int -> zero-ref
; V06 loc3 [V06,T06] ( 8, 0 ) long -> x22
; V07 loc4 [V07,T07] ( 5, 0 ) long -> x23
;* V08 loc5 [V08,T04] ( 0, 0 ) int -> zero-ref
; V09 loc6 [V09,T12] ( 2, 0 ) simd16 -> d16 HFA(simd16) ld-addr-op
; V10 loc7 [V10,T13] ( 2, 0 ) long -> x0
; V11 loc8 [V11,T10] ( 3, 0 ) simd16 -> d17 HFA(simd16)
; V12 loc9 [V12,T11] ( 3, 0 ) simd16 -> d18 HFA(simd16)
;* V13 loc10 [V13 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16)
; V14 loc11 [V14,T14] ( 2, 0 ) long -> x24
;# V15 OutArgs [V15 ] ( 1, 1 ) lclBlk ( 0) [sp+00H] "OutgoingArgSpace"
;* V16 tmp1 [V16 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "struct address for call/obj"
;* V17 tmp2 [V17 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
;* V18 tmp3 [V18 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
;* V19 tmp4 [V19 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "Inlining Arg"
;* V20 tmp5 [V20 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "Inlining Arg"
;* V21 tmp6 [V21 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "Inlining Arg"
;* V22 tmp7 [V22 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
;* V23 tmp8 [V23 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "Inlining Arg"
;* V24 tmp9 [V24 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
;* V25 tmp10 [V25 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
;* V26 tmp11 [V26 ] ( 0, 0 ) simd16 -> zero-ref HFA(simd16) "Inline stloc first use temp"
;* V27 tmp12 [V27 ] ( 0, 0 ) simd8 -> zero-ref HFA(simd8) "Inline stloc first use temp"
;* V28 tmp13 [V28 ] ( 0, 0 ) byref -> zero-ref "Inlining Arg"
;* V29 tmp14 [V29 ] ( 0, 0 ) byref -> zero-ref "Inlining Arg"
;* V30 tmp15 [V30 ] ( 0, 0 ) int -> zero-ref "Inlining Arg"
;* V31 tmp16 [V31 ] ( 0, 0 ) long -> zero-ref "Inlining Arg"
; V32 tmp17 [V32,T08] ( 3, 0 ) byref -> x22 single-def "Inlining Arg"
; V33 tmp18 [V33,T09] ( 3, 0 ) byref -> x19 "Inlining Arg"
;
; Lcl frame size = 0
G_M20911_IG01: ;; offset=0000H
A9BC7BFD stp fp, lr, [sp,#-64]!
A90153F3 stp x19, x20, [sp,#16]
A9025BF5 stp x21, x22, [sp,#32]
A90363F7 stp x23, x24, [sp,#48]
910003FD mov fp, sp
AA0003F3 mov x19, x0
AA0103F4 mov x20, x1
;; size=28 bbWeight=1 PerfScore 5.50
G_M20911_IG02: ;; offset=001CH
AA1F03F5 mov x21, xzr
F100805F cmp x2, #32
54000A22 bhs G_M20911_IG11
;; size=12 bbWeight=1 PerfScore 2.00
G_M20911_IG03: ;; offset=0028H
CB150057 sub x23, x2, x21
F10012FF cmp x23, #4
540002A3 blo G_M20911_IG05
8B1702A0 add x0, x21, x23
D1001018 sub x24, x0, #4
;; size=20 bbWeight=0 PerfScore 0.00
G_M20911_IG04: ;; offset=003CH
8B150660 add x0, x19, x21, LSL #1
F9400016 ldr x22, [x0]
F209A2DF tst x22, #0xff80ff80ff80ff80
540005A1 bne G_M20911_IG09
F209A2DF tst x22, #0xff80ff80ff80ff80
9A9F17E0 cset x0, eq
D29AF301 movz x1, #0xd798 // code for System.Diagnostics.Debug:Assert
F2A28EA1 movk x1, #0x1475 LSL #16
F2DFFFE1 movk x1, #0xffff LSL #32
F9400021 ldr x1, [x1]
D63F0020 blr x1
4E081ED0 ins v16.d[0], x22
2E212A10 sqxtun v16.8b, v16.8h
0E043E00 umov w0, v16.s[0]
B8356A80 str w0, [x20, x21]
910012B5 add x21, x21, #4
EB1802BF cmp x21, x24
54FFFDE9 bls G_M20911_IG04
;; size=72 bbWeight=0 PerfScore 0.00
G_M20911_IG05: ;; offset=0084H
36080237 tbz w23, #1, G_M20911_IG06
8B150660 add x0, x19, x21, LSL #1
B9400018 ldr w24, [x0]
7209A31F tst w24, #0xff80ff80
54000561 bne G_M20911_IG10
8B150296 add x22, x20, x21
7209A31F tst w24, #0xff80ff80
9A9F17E0 cset x0, eq
D29AF301 movz x1, #0xd798 // code for System.Diagnostics.Debug:Assert
F2A28EA1 movk x1, #0x1475 LSL #16
F2DFFFE1 movk x1, #0xffff LSL #32
F9400021 ldr x1, [x1]
D63F0020 blr x1
390002D8 strb w24, [x22]
53107F00 lsr w0, w24, #16
390006C0 strb w0, [x22,#1]
91000AB5 add x21, x21, #2
;; size=68 bbWeight=0 PerfScore 0.00
G_M20911_IG06: ;; offset=00C8H
360000F7 tbz w23, #0, G_M20911_IG07
8B150660 add x0, x19, x21, LSL #1
79400018 ldrh w24, [x0]
7101FF1F cmp w24, #127
54000068 bhi G_M20911_IG07
38357A98 strb w24, [x20, x21]
910006B5 add x21, x21, #1
;; size=28 bbWeight=0 PerfScore 0.00
G_M20911_IG07: ;; offset=00E4H
AA1503E0 mov x0, x21
;; size=4 bbWeight=0 PerfScore 0.00
G_M20911_IG08: ;; offset=00E8H
A94363F7 ldp x23, x24, [sp,#48]
A9425BF5 ldp x21, x22, [sp,#32]
A94153F3 ldp x19, x20, [sp,#16]
A8C47BFD ldp fp, lr, [sp],#64
D65F03C0 ret lr
;; size=20 bbWeight=0 PerfScore 0.00
G_M20911_IG09: ;; offset=00FCH
2A1603F8 mov w24, w22
7209A31F tst w24, #0xff80ff80
540001E1 bne G_M20911_IG10
8B150293 add x19, x20, x21
7209A31F tst w24, #0xff80ff80
9A9F17E0 cset x0, eq
D29AF301 movz x1, #0xd798 // code for System.Diagnostics.Debug:Assert
F2A28EA1 movk x1, #0x1475 LSL #16
F2DFFFE1 movk x1, #0xffff LSL #32
F9400021 ldr x1, [x1]
D63F0020 blr x1
39000278 strb w24, [x19]
53107F00 lsr w0, w24, #16
39000660 strb w0, [x19,#1]
D360FEC0 lsr x0, x22, #32
2A0003F8 mov w24, w0
91000AB5 add x21, x21, #2
;; size=68 bbWeight=0 PerfScore 0.00
G_M20911_IG10: ;; offset=0140H
2A1803E0 mov w0, w24
D296FF01 movz x1, #0xb7f8 // code for System.Text.ASCIIUtility:FirstCharInUInt32IsAscii
F2A29301 movk x1, #0x1498 LSL #16
F2DFFFE1 movk x1, #0xffff LSL #32
F9400021 ldr x1, [x1]
D63F0020 blr x1
34FFFC60 cbz w0, G_M20911_IG07
38357A98 strb w24, [x20, x21]
910006B5 add x21, x21, #1
17FFFFE0 b G_M20911_IG07
;; size=40 bbWeight=0 PerfScore 0.00
G_M20911_IG11: ;; offset=0168H
F9400276 ldr x22, [x19]
F209A2DF tst x22, #0xff80ff80ff80ff80
54FFFC61 bne G_M20911_IG09
32009BE0 mov w0, #0x7f007f
4E040C10 dup v16.4s, w0
D1008040 sub x0, x2, #32
;; size=24 bbWeight=0 PerfScore 0.00
G_M20911_IG12: ;; offset=0180H
8B150661 add x1, x19, x21, LSL #1
3DC00031 ldr q17, [x1]
8B150661 add x1, x19, x21, LSL #1
3DC00432 ldr q18, [x1,#16]
4EB21E33 orr v19.8h, v17.8h, v18.8h
6E703673 cmhi v19.8h, v19.8h, v16.8h
6EB0AA73 umaxv s19, v19.4s
0E043E61 umov w1, v19.s[0]
7100003F cmp w1, #0
54FFF421 bne G_M20911_IG03
0E212A31 xtn v17.8b, v17.8h
4E212A51 xtn2 v17.16b, v18.8h
3CB56A91 str q17, [x20, x21]
910042B5 add x21, x21, #16
EB0002BF cmp x21, x0
54FFFE29 bls G_M20911_IG12
17FFFF9A b G_M20911_IG03
;; size=68 bbWeight=0 PerfScore 0.00
; Total bytes of code 452, prolog size 28, PerfScore 52.70, instruction count 113, allocated bytes for code 452 (MethodHash=e3b6ae50) for method System.Text.ASCIIUtility:NarrowUtf16ToAscii(long,long,long):long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment