From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 19 Jun 2023 21:43:38 +0000 (+0100) Subject: Use pairwise load in `WidenAsciiToUtf16` (#87737) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~1515 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ceb56225f87b7b90f269828c819a61df303bd516;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Use pairwise load in `WidenAsciiToUtf16` (#87737) --- diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs b/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs index 8696fca..69b3cc1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Utility.cs @@ -1670,9 +1670,9 @@ namespace System.Text break; } - (Vector256 low, Vector256 upper) = Vector256.Widen(asciiVector); - low.Store(pCurrentWriteAddress); - upper.Store(pCurrentWriteAddress + Vector256.Count); + (Vector256 utf16LowVector, Vector256 utf16HighVector) = Vector256.Widen(asciiVector); + utf16LowVector.Store(pCurrentWriteAddress); + utf16HighVector.Store(pCurrentWriteAddress + Vector256.Count); currentOffset += (nuint)Vector256.Count; pCurrentWriteAddress += (nuint)Vector256.Count; @@ -1694,11 +1694,9 @@ namespace System.Text break; } - // Vector128.Widen is not used here as it less performant on ARM64 - Vector128 utf16HalfVector = Vector128.WidenLower(asciiVector); - utf16HalfVector.Store(pCurrentWriteAddress); - utf16HalfVector = Vector128.WidenUpper(asciiVector); - utf16HalfVector.Store(pCurrentWriteAddress + Vector128.Count); + (Vector128 utf16LowVector, Vector128 utf16HighVector) = Vector128.Widen(asciiVector); + utf16LowVector.Store(pCurrentWriteAddress); + utf16HighVector.Store(pCurrentWriteAddress + Vector128.Count); currentOffset += (nuint)Vector128.Count; pCurrentWriteAddress += (nuint)Vector128.Count;