]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.simd] cmd/compile: make regalloc simd aware on copy
authorJunyang Shao <shaojunyang@google.com>
Mon, 7 Jul 2025 03:08:01 +0000 (03:08 +0000)
committerJunyang Shao <shaojunyang@google.com>
Mon, 7 Jul 2025 16:58:31 +0000 (09:58 -0700)
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>

src/cmd/compile/internal/ssa/regalloc.go

index f1e210fe9b8b085150eb92759d9e51b3b48d4dc7..d4ce7a815b8b2cb9f3f81342c41557f711535cfd 100644 (file)
@@ -898,6 +898,14 @@ func (s *regAllocState) compatRegs(t *types.Type) regMask {
        if t.IsTuple() || t.IsFlags() {
                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.Kind() == types.TFLOAT32 && s.f.Config.fp32RegMask != 0 {
                        m = s.f.Config.fp32RegMask