From: Jorropo Date: Sun, 26 Oct 2025 14:50:13 +0000 (+0100) Subject: cmd/compile: move branchelim supported arches to Config X-Git-Tag: go1.26rc1~446 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2d33a456c678c388dc3ce7e2a5389aeeeb6ef184;p=gostls13.git cmd/compile: move branchelim supported arches to Config Change-Id: I8d10399ba71e5fa97ead06a717fc972c806c0856 Reviewed-on: https://go-review.googlesource.com/c/go/+/715042 LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Auto-Submit: Jorropo Reviewed-by: Keith Randall Reviewed-by: Michael Pratt --- diff --git a/src/cmd/compile/internal/ssa/branchelim.go b/src/cmd/compile/internal/ssa/branchelim.go index a7d339cad0..7b0a7ae8ec 100644 --- a/src/cmd/compile/internal/ssa/branchelim.go +++ b/src/cmd/compile/internal/ssa/branchelim.go @@ -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 } diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 7cc16ce26d..819d77e420 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -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) }