cmd/compile: fold single-bit TST; CSET NE into UBFX on arm64#80391
Conversation
|
This PR (HEAD: cba8fe8) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/800241. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Jorropo: Patch Set 1: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 1: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-07-13T19:30:27Z","revision":"4ebd208b8d45698e72b122e3d42ce1cb77fba231"} Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 1: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 1: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_5200>) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Jorropo: Patch Set 1: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_55763>) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 1: This CL has failed the run. Reason: Tryjob golang/try/gotip-linux-arm64-boringcrypto has failed with summary (view all results):
To reproduce, try Additional links for debugging: Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 1: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
A boolean materialized from a single-bit test compiles to TST $(1<<k); CSET NE. The bit is a bitfield extract: rewrite the NotEqual of a one-bit TSTconst/TSTWconst to UBFX #k, golang#1, the value form of the existing single-bit TBZ/TBNZ branch rules. The flags producer remains for any other reader, and a shared bool's branch then tests the extracted bit directly, so the TST disappears there too. Measured with armlint on darwin/arm64: cmd/go: 166 TST; CSET pairs eliminated, __text -672 bytes. gofmt: 35 pairs eliminated, __text -192 bytes.
|
This PR (HEAD: 0d4f45d) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/800241. Important tips:
|
|
Message from Andrew Gaul: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 2: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-07-13T22:06:27Z","revision":"b475005e131e77efa5d7dce8bc4bb87a676d612b"} Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 2: Auto-Submit+1 Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 2: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from Keith Randall: Patch Set 2: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_5200>) Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 2: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
|
Message from golang-scoped@luci-project-accounts.iam.gserviceaccount.com: Patch Set 2: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/800241. |
A boolean materialized from a single-bit test compiles to
TST $(1<<k); CSET NE. The bit is a bitfield extract: rewrite the
NotEqual of a one-bit TSTconst/TSTWconst to UBFX #k, #1, the value
form of the existing single-bit TBZ/TBNZ branch rules. The flags
producer remains for any other reader, and a shared bool's branch
then tests the extracted bit directly, so the TST disappears there
too.
Measured with armlint on darwin/arm64:
cmd/go: 166 TST; CSET pairs eliminated, __text -672 bytes.
gofmt: 35 pairs eliminated, __text -192 bytes.