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 <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>
This commit is contained in:
Jorropo 2025-10-26 15:50:13 +01:00 committed by Gopher Robot
parent 2c91c33e88
commit 2d33a456c6
2 changed files with 7 additions and 4 deletions

View file

@ -21,10 +21,7 @@ import "cmd/internal/src"
// rewrite Phis in the postdominator as CondSelects. // rewrite Phis in the postdominator as CondSelects.
func branchelim(f *Func) { func branchelim(f *Func) {
// FIXME: add support for lowering CondSelects on more architectures // FIXME: add support for lowering CondSelects on more architectures
switch f.Config.arch { if !f.Config.haveCondSelect {
case "arm64", "ppc64le", "ppc64", "amd64", "wasm", "loong64":
// implemented
default:
return return
} }

View file

@ -50,6 +50,7 @@ type Config struct {
haveBswap64 bool // architecture implements Bswap64 haveBswap64 bool // architecture implements Bswap64
haveBswap32 bool // architecture implements Bswap32 haveBswap32 bool // architecture implements Bswap32
haveBswap16 bool // architecture implements Bswap16 haveBswap16 bool // architecture implements Bswap16
haveCondSelect bool // architecture implements CondSelect
// mulRecipes[x] = function to build v * x from v. // mulRecipes[x] = function to build v * x from v.
mulRecipes map[int64]mulRecipe mulRecipes map[int64]mulRecipe
@ -191,6 +192,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.haveBswap64 = true c.haveBswap64 = true
c.haveBswap32 = true c.haveBswap32 = true
c.haveBswap16 = true c.haveBswap16 = true
c.haveCondSelect = true
case "386": case "386":
c.PtrSize = 4 c.PtrSize = 4
c.RegSize = 4 c.RegSize = 4
@ -236,6 +238,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.haveBswap64 = true c.haveBswap64 = true
c.haveBswap32 = true c.haveBswap32 = true
c.haveBswap16 = true c.haveBswap16 = true
c.haveCondSelect = true
case "ppc64": case "ppc64":
c.BigEndian = true c.BigEndian = true
fallthrough fallthrough
@ -263,6 +266,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.haveBswap64 = true c.haveBswap64 = true
c.haveBswap32 = true c.haveBswap32 = true
c.haveBswap16 = true c.haveBswap16 = true
c.haveCondSelect = true
case "mips64": case "mips64":
c.BigEndian = true c.BigEndian = true
fallthrough fallthrough
@ -296,6 +300,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.LinkReg = linkRegLOONG64 c.LinkReg = linkRegLOONG64
c.hasGReg = true c.hasGReg = true
c.unalignedOK = true c.unalignedOK = true
c.haveCondSelect = true
case "s390x": case "s390x":
c.PtrSize = 8 c.PtrSize = 8
c.RegSize = 8 c.RegSize = 8
@ -357,6 +362,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat boo
c.useAvg = false c.useAvg = false
c.useHmul = false c.useHmul = false
c.unalignedOK = true c.unalignedOK = true
c.haveCondSelect = true
default: default:
ctxt.Diag("arch %s not implemented", arch) ctxt.Diag("arch %s not implemented", arch)
} }