golang/go · error

expect V0-V31, Z0-Z31, or P0-P15; found: {name}

Error message

expect V0-V31, Z0-Z31, or P0-P15; found: {name}

What it means

The Go assembler's ARM64RegisterArrangement returns this error when the register name does not begin with 'V', 'Z', or 'P' (arm64.go:216-218). Vector arrangement suffixes (like V0.B16, Z0.S, P0) are only valid on V (NEON/AdvSIMD vector), Z (SVE vector), or P (SVE predicate) registers. A name starting with any other letter is rejected because no arrangement encoding is defined for it.

Source

Thrown at src/cmd/asm/internal/arch/arm64.go:217

		}
	}
	return 0, false
}

// ARM64RegisterShift constructs an ARM64 register with shift operation.
func ARM64RegisterShift(reg, op, count int16) (int64, error) {
	// the base register of shift operations must be general register.
	if reg > arm64.REG_R31 || reg < arm64.REG_R0 {
		return 0, errors.New("invalid register for shift operation")
	}
	return int64(reg&31)<<16 | int64(op)<<22 | int64(uint16(count)), nil
}

// ARM64RegisterArrangement constructs an ARM64 vector register arrangement.
func ARM64RegisterArrangement(reg int16, name, arng string) (int64, error) {
	var curQ, curSize, prefix uint16
	if name[0] != 'V' && name[0] != 'Z' && name[0] != 'P' {
		return 0, errors.New("expect V0-V31, Z0-Z31, or P0-P15; found: " + name)
	}
	switch name[0] {
	case 'V':
		prefix = 0
	case 'Z':
		prefix = 1
	case 'P':
		prefix = 2
	}
	if reg < 0 {
		return 0, errors.New("invalid register number: " + name)
	}
	switch arng {
	case "B8":
		curSize = 0
		curQ = 0
	case "B16":
		curSize = 0

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Use V0-V31, Z0-Z31, or P0-P15 as the register when specifying an arrangement suffix.
  2. Remove the arrangement suffix from R/F registers — scalar instructions do not take one.
  3. Verify the instruction is actually a vector/SVE instruction that requires an arrangement.
  4. Check the register prefix letter for typos (e.g., 'W' instead of 'V').

Example fix

; before — arrangement on a GPR
VADD R0.B16, R1.B16, R2.B16

; after — use vector registers
VADD V0.B16, V1.B16, V2.B16
Defensive patterns

Strategy: validation

Validate before calling

// Validate the register name prefix before constructing an arrangement.
func validArrangementReg(name string) bool {
    if len(name) == 0 { return false }
    switch name[0] {
    case 'V', 'Z', 'P': return true
    }
    return false
}

Prevention

When it happens

Trigger: Triggered when an ARM64 assembly operand has an arrangement suffix attached to a non-V/Z/P register, e.g., `R0.B16` or `F0.H4`. The check `name[0] != 'V' && name[0] != 'Z' && name[0] != 'P'` (arm64.go:216) fires before the arrangement string is even examined.

Common situations: Attaching a vector arrangement suffix (B8, B16, H4, H8, S2, S4, D1, D2, B, H, S, D, Q) to a general-purpose (R) or floating-point (F) register in hand-written `.s` files. Copying disassembly output that the Go assembler's syntax does not accept. Typos in the register prefix.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/511b98ffd024b0cc. Report an issue: GitHub.