Uh oh!
There was an error while loading. Please reload this page.
Port SequenceEqual to crossplat Vectors, optimize vector compare on x64 - #67202
Merged
Conversation
ghost
commented
Mar 27, 2022
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsThis PR does:
boolTest(Vector128<int>v1,Vector128<int>v2)=>v1==v2;boolTest(Vector256<int>v1,Vector256<int>v2)=>v1==v2;codegen diff: ; Method Proga:Test
G_M56888_IG01:
vzeroupper G_M56888_IG02:
vmovupd xmm0, xmmword ptr [rdx]
- vpcmpeqd xmm0, xmm0, xmmword ptr [r8]- vpmovmskb eax, xmm0- cmp eax, 0xFFFF+ vpxor xmm0, xmm0, xmmword ptr [r8]+ vptest xmm0, xmm0
sete al
movzx rax, al
G_M56888_IG03:
ret -; Total bytes of code: 28+; Total bytes of code: 24
; Method Proga:Test
G_M5176_IG01:
vzeroupper G_M5176_IG02:
vmovupd ymm0, ymmword ptr[rdx]
- vpcmpeqd ymm0, ymm0, ymmword ptr[r8]- vpmovmskb eax, ymm0- cmp eax, -1+ vpxor ymm0, ymm0, ymmword ptr[r8]+ vptest ymm0, ymm0
sete al
movzx rax, al
G_M5176_IG03:
vzeroupper ret -; Total bytes of code: 29+; Total bytes of code: 27However, it seems like in some cases/on some CPUs movmsk is faster 🤔
|
radekdoulik pushed a commit
to radekdoulik/runtime
that referenced
this pull request
Mar 30, 2022
This was referenced Apr 5, 2022
EgorBo added a commit
to EgorBo/runtime-1
that referenced
this pull request
Apr 12, 2022
This was referenced Apr 12, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does:
SequenceEqualto use cross-plat vectorsvec1 == vec2with xor+vptest if available:codegen diff:
However, it seems like in some cases/on some CPUs movmsk is faster 🤔
cc @tannergooding
PS: seems like the main loop in
SequenceEqualis not properly aligned and hits JCC erratum each iteration