[dev.simd] cmd/compile: make regalloc simd aware on copy

When making a temporary copy, regalloc should be aware of the SIMD-ness
of the type; otherwise it might generate invalid moves.

Change-Id: I722c3a0111d0990af32d84c6aaa151f1ac8c1f00
Reviewed-on: https://go-review.googlesource.com/c/go/+/685895
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Junyang Shao 2025-07-07 03:08:01 +00:00
parent dfd75f82d4
commit d8fa853b37

View file

@ -898,6 +898,14 @@ func (s *regAllocState) compatRegs(t *types.Type) regMask {
if t.IsTuple() || t.IsFlags() { if t.IsTuple() || t.IsFlags() {
return 0 return 0
} }
if t.IsSIMD() {
if t.Size() > 8 {
return s.f.Config.fpRegMask & s.allocatable
} else {
// K mask
return s.f.Config.gpRegMask & s.allocatable
}
}
if t.IsFloat() || t == types.TypeInt128 { if t.IsFloat() || t == types.TypeInt128 {
if t.Kind() == types.TFLOAT32 && s.f.Config.fp32RegMask != 0 { if t.Kind() == types.TFLOAT32 && s.f.Config.fp32RegMask != 0 {
m = s.f.Config.fp32RegMask m = s.f.Config.fp32RegMask