]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: move branchelim supported arches to Config
authorJorropo <jorropo.pgm@gmail.com>
Sun, 26 Oct 2025 14:50:13 +0000 (15:50 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 28 Oct 2025 14:51:47 +0000 (07:51 -0700)
Change-Id: I8d10399ba71e5fa97ead06a717fc972c806c0856
Reviewed-on: https://go-review.googlesource.com/c/go/+/715042
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/ssa/branchelim.go
src/cmd/compile/internal/ssa/config.go

index a7d339cad064ac35f363bf467122fc46096d93d2..7b0a7ae8ec16b1586766609f6e390bb885fc5565 100644 (file)
@@ -21,10 +21,7 @@ import "cmd/internal/src"
 // rewrite Phis in the postdominator as CondSelects.
 func branchelim(f *Func) {
        // FIXME: add support for lowering CondSelects on more architectures
-       switch f.Config.arch {
-       case "arm64", "ppc64le", "ppc64", "amd64", "wasm", "loong64":
-               // implemented
-       default:
+       if !f.Config.haveCondSelect {
                return
        }
 
index 7cc16ce26d5cf011c9751f13ddd84b3418555152..819d77e420a783615f79fb5a3ab8cd8d93a15590 100644 (file)
@@ -50,6 +50,7 @@ type Config struct {
        haveBswap64    bool      // architecture implements Bswap64
        haveBswap32    bool      // architecture implements Bswap32
        haveBswap16    bool      // architecture implements Bswap16
+       haveCondSelect bool      // architecture implements CondSelect
 
        // mulRecipes[x] = function to build v * x from v.
        mulRecipes map[int64]mulRecipe
@@ -191,6 +192,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
                c.haveBswap64 = true
                c.haveBswap32 = true
                c.haveBswap16 = true
+               c.haveCondSelect = true
        case "386":
                c.PtrSize = 4
                c.RegSize = 4
@@ -236,6 +238,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
                c.haveBswap64 = true
                c.haveBswap32 = true
                c.haveBswap16 = true
+               c.haveCondSelect = true
        case "ppc64":
                c.BigEndian = true
                fallthrough
@@ -263,6 +266,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
                c.haveBswap64 = true
                c.haveBswap32 = true
                c.haveBswap16 = true
+               c.haveCondSelect = true
        case "mips64":
                c.BigEndian = true
                fallthrough
@@ -296,6 +300,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
                c.LinkReg = linkRegLOONG64
                c.hasGReg = true
                c.unalignedOK = true
+               c.haveCondSelect = true
        case "s390x":
                c.PtrSize = 8
                c.RegSize = 8
@@ -357,6 +362,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
                c.useAvg = false
                c.useHmul = false
                c.unalignedOK = true
+               c.haveCondSelect = true
        default:
                ctxt.Diag("arch %s not implemented", arch)
        }