]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rewrite condselects into doublings and halvings
authorJorropo <jorropo.pgm@gmail.com>
Thu, 3 Jul 2025 00:57:25 +0000 (02:57 +0200)
committerJorropo <jorropo.pgm@gmail.com>
Thu, 24 Jul 2025 21:42:15 +0000 (14:42 -0700)
commitce05ad448fe6ea3b9b33c0eab1143dcb40e3bbc3
tree70236648e475e034764fd106f6717b913587cc8d
parentfcd28070fe4fe86b04c760dd7ce5fff2aa63bad5
cmd/compile: rewrite condselects into doublings and halvings

For performance see CL 685676.

This allows something like:
  if y { x *= 2 }

To be compiled to:
  SHLXQ BX, AX, AX

Instead of:
  MOVQ    AX, CX
  SHLQ    $1, CX
  MOVBLZX BL, DX
  TESTQ   DX, DX
  CMOVQNE CX, AX

While ./make.bash uniqued per LOC, there is 2 doublings and 4 halvings.

Change-Id: Ic0727cbf429528a2dbf17cbfc3b0121db8387444
Reviewed-on: https://go-review.googlesource.com/c/go/+/685695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/_gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
test/codegen/condmove.go