Skip to content

cmd/compile: fold single-bit TST; CSET NE into UBFX on arm64#80391

Open
gaul wants to merge 1 commit into
golang:masterfrom
gaul:arm64/tst-cset
Open

cmd/compile: fold single-bit TST; CSET NE into UBFX on arm64#80391
gaul wants to merge 1 commit into
golang:masterfrom
gaul:arm64/tst-cset

Conversation

@gaul

@gaul gaul commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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.

@gopherbot

Copy link
Copy Markdown
Contributor

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:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Jorropo:

Patch Set 1: Commit-Queue+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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 gomote repro 8676364503023035121.

Additional links for debugging:


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

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.
@gaul
gaul force-pushed the arm64/tst-cset branch from cba8fe8 to 0d4f45d Compare July 13, 2026 22:00
@gopherbot

Copy link
Copy Markdown
Contributor

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:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Andrew Gaul:

Patch Set 1:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Keith Randall:

Patch Set 2: Commit-Queue+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Keith Randall:

Patch Set 2: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/800241.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

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.
After addressing review feedback, remember to publish your drafts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants