Skip to content

Instantly share code, notes, and snippets.

; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii_Intrinsified(long,long,long):long
; Emitting BLENDED_CODE for X64 CPU with AVX - Unix
; Tier-1 compilation
; optimized code
; rbp based frame
; fully interruptible
; No PGO data
; 0 inlinees with PGO data; 17 single block inlinees; 28 inlinees without PGO data
; Final local variable assignments
;
; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii_Sse2(long,long,long):long
; Emitting BLENDED_CODE for X64 CPU with AVX - Unix
; Tier-1 compilation
; optimized code
; optimized using profile data
; rbp based frame
; fully interruptible
; with PGO: edge weights are invalid, and fgCalledCount is 43814
; 0 inlinees with PGO data; 8 single block inlinees; 8 inlinees without PGO data
; Final local variable assignments
; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii_Sse2(long,long,long):long
; Emitting BLENDED_CODE for X64 CPU with AVX - Unix
; Tier-1 compilation
; optimized code
; optimized using profile data
; rbp based frame
; fully interruptible
; with PGO: edge weights are valid, and fgCalledCount is 43814
; Final local variable assignments
;
; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii_Intrinsified(long,long,long):long
; Emitting BLENDED_CODE for X64 CPU with AVX - Unix
; Tier-1 compilation
; optimized code
; rbp based frame
; fully interruptible
; No PGO data
; 0 inlinees with PGO data; 9 single block inlinees; 20 inlinees without PGO data
; Final local variable assignments
;
; Assembly listing for method System.Text.ASCIIUtility:NarrowUtf16ToAscii_Intrinsified(long,long,long):long
; Emitting BLENDED_CODE for generic ARM64 CPU - Unix
; Tier-1 compilation
; optimized code
; fp based frame
; fully interruptible
; No PGO data
; 0 inlinees with PGO data; 0 single block inlinees; 8 inlinees without PGO data
; Final local variable assignments
;
; 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
G_M20155_IG01:
stp fp, lr, [sp,#-16]!
mov fp, sp
;; size=8 bbWeight=1 PerfScore 1.50
G_M20155_IG02:
ld1 {v16.8h}, [x0]
umaxp v17.8h, v16.8h, v16.8h
umov x3, v17.d[0]
tst x3, #0xd1ffab1e
bne G_M20155_IG04
G_M20155_IG01:
stp fp, lr, [sp,#-16]!
mov fp, sp
;; size=8 bbWeight=1 PerfScore 1.50
G_M20155_IG02:
ld1 {v16.8h}, [x0]
umaxp v17.8h, v16.8h, v16.8h
ldr q18, [@RWD00]
and v17.2d, v17.2d, v18.2d
umaxv s17, v17.4s
G_M65217_IG01:
push rbp
push r14
push rbx
vzeroupper
lea rbp, [rsp+10H]
mov rbx, rdi
;; size=15 bbWeight=1 PerfScore 4.75
G_M65217_IG02:
test rsi, rsi
diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/ASCIIUtility.cs b/src/libraries/System.Private.CoreLib/src/System/Text/ASCIIUtility.cs
index 163d62208c6..864bcb58b2e 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Text/ASCIIUtility.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Text/ASCIIUtility.cs
@@ -794,6 +794,8 @@ private static unsafe nuint GetIndexOfFirstNonAsciiChar_Sse2(char* pBuffer, nuin
// This method is written such that control generally flows top-to-bottom, avoiding
// jumps as much as possible in the optimistic case of "all ASCII". If we see non-ASCII
// data, we jump out of the hot paths to targets at the end of the method.
+
+ Vector128<ushort> asciiMaskForTestZ = Vector128.Create((ushort)0xFF80); // used for PTEST on supported hardware