-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: No BCE for len(x)&y in slice expression #52563
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
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
Comments
#38717 is also similar, but for IsInBounds instead of IsSliceInBounds. |
I just noticed that the examples from #38476, ChaCha20 and Poly1305, would reduce to this if the compiler also knew that
|
Jorropo
added a commit
to Jorropo/go
that referenced
this issue
May 3, 2022
This allows to rewrite: AND BX, AX SUB AX, BX Into (with GOAMD64=v3): ANDN AX, BX, AX Which is twice as fast, and smaller. Into (without GOAMD64=v3): NOT BX AND AX, BX Which if AX's depency isn't resolved yet but BX is in most cases twice as fast because now the NOT BX and AX's depency can execute in parallel. In other cases, it has negligeable positive impact. Other instructions set will also benefits from the pipelining adventage. And also benefit from the smaller ANDN instruction if they have something similar. Help reduce ChaCha20 and Poly1305 to golang#52563
Change https://go.dev/cl/403654 mentions this issue: |
Jorropo
added a commit
to Jorropo/go
that referenced
this issue
May 3, 2022
This allows to rewrite: AND BX, AX SUB AX, BX Into (with GOAMD64=v3): ANDN AX, BX, AX Which is twice as fast, and smaller. Into (without GOAMD64=v3): NOT BX AND AX, BX Which if AX's depency isn't resolved yet but BX is in most cases twice as fast because now the NOT BX and AX's depency can execute in parallel. In other cases, it has negligeable positive impact. Other instructions set will also benefits from the pipelining adventage. And also benefit from the smaller ANDN instruction if they have something similar. Help reduce ChaCha20 and Poly1305 to golang#52563
Change https://go.dev/cl/404315 mentions this issue: |
greatroar
pushed a commit
to greatroar/go-mph
that referenced
this issue
May 8, 2022
This is about as fast on a 54763 corpus, but means the data structure is no longer up to 2× too large. Go 1.18, amd64: name old time/op new time/op delta MPH-8 1.33ms ± 1% 1.31ms ± 1% -1.57% (p=0.000 n=10+8) Map-8 1.97ms ± 5% 1.92ms ± 1% -2.66% (p=0.001 n=9+10) A fix for golang/go#52563 might undo this speed benefit, because with the old code, a bounds check is inserted for xorshiftMult64(uint64(seed)+hash) & (size - 1) that might get eliminated. reducerange causes a bounds check either way, unless the compiler were amended to know about it as well.
greatroar
added a commit
to greatroar/go-mph
that referenced
this issue
May 10, 2022
This is about as fast on a 54763 corpus, but means the data structure is no longer up to 2× too large. Go 1.18, amd64: name old time/op new time/op delta MPH-8 1.33ms ± 1% 1.31ms ± 1% -1.57% (p=0.000 n=10+8) Map-8 1.97ms ± 5% 1.92ms ± 1% -2.66% (p=0.001 n=9+10) A fix for golang/go#52563 might undo this speed benefit, because with the old code, a bounds check is inserted for xorshiftMult64(uint64(seed)+hash) & (size - 1) that might get eliminated. reducerange causes a bounds check either way, unless the compiler were amended to know about it as well.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
What version of Go are you using (
go version
)?What did you do?
What did you expect to see?
I expected the bounds checks on the final two lines to be eliminated, since len(p)&x <= cap(p) always.
What did you see instead?
Bounds checks. This is similar to #38476, but presumably easier to tackle. GOSSAFUNC output shows one of these checks as
The text was updated successfully, but these errors were encountered: