golang/go · error
Loong64 extension: invalid LSX arrangement type: {ext}
Error message
Loong64 extension: invalid LSX arrangement type: {ext} What it means
Thrown by Loong64RegisterExtension in the non-index (arrangement) branch when simdType is LSX (register is V0-V31) and `ext` is not a key in loong64LsxArngExtMap. LSX arrangement suffixes are restricted to B16, H8, W4, and V2, which describe a 128-bit LSX vector's lane layout.
Source
Thrown at src/cmd/asm/internal/arch/loong64.go:109
}
if isIndex {
arngType, ok = loong64ElemExtMap[ext]
if !ok {
return errors.New("Loong64 extension: invalid LSX/LASX arrangement type: " + ext)
}
a.Reg = loong64.REG_ELEM
a.Reg += ((simdReg & loong64.EXT_REG_MASK) << loong64.EXT_REG_SHIFT)
a.Reg += ((arngType & loong64.EXT_TYPE_MASK) << loong64.EXT_TYPE_SHIFT)
a.Reg += ((simdType & loong64.EXT_SIMDTYPE_MASK) << loong64.EXT_SIMDTYPE_SHIFT)
a.Index = num
} else {
switch simdType {
case loong64.LSX:
arngType, ok = loong64LsxArngExtMap[ext]
if !ok {
return errors.New("Loong64 extension: invalid LSX arrangement type: " + ext)
}
case loong64.LASX:
arngType, ok = loong64LasxArngExtMap[ext]
if !ok {
return errors.New("Loong64 extension: invalid LASX arrangement type: " + ext)
}
}
a.Reg = loong64.REG_ARNG
a.Reg += ((simdReg & loong64.EXT_REG_MASK) << loong64.EXT_REG_SHIFT)
a.Reg += ((arngType & loong64.EXT_TYPE_MASK) << loong64.EXT_TYPE_SHIFT)
a.Reg += ((simdType & loong64.EXT_SIMDTYPE_MASK) << loong64.EXT_SIMDTYPE_SHIFT)
}
return nil
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Use one of the LSX arrangements: B16, H8, W4, or V2.
- If you need a wider arrangement, switch the register to an LASX X-register (X0-X31) so the LASX map applies.
- Verify the intended lane width and count against the 128-bit LSX register size (16 bytes total).
Example fix
// before (LASX suffix on LSX register) VADD V0.B32, V1, V2 // after (correct LSX arrangement) VADD V0.B16, V1, V2
Defensive patterns
Strategy: validation
Validate before calling
var validLsxArng = map[string]bool{"B16":true,"H8":true,"W4":true,"V2":true}
func isValidLsxArrangement(ext string) bool { return validLsxArng[ext] } Type guard
func isLsxArrangement(ext string) bool {
switch ext { case "B16","H8","W4","V2": return true }
return false
} Prevention
- Remember LSX is 128-bit: B16/H8/W4/V2 are the only valid full-vector arrangements.
- Do not reuse LASX (256-bit) suffixes on V-registers.
- Validate generated assembly against the arrangement maps in loong64.go before emitting.
When it happens
Trigger: Calling Loong64RegisterExtension with isIndex==false, a V-register (LSX), and an arrangement suffix not equal to B16/H8/W4/V2. In assembly this is an operand like `V0.B8` or `V0.H4` where the suffix does not match a 128-bit LSX arrangement.
Common situations: Copying an LASX (256-bit) arrangement suffix (B32, H16, W8, V4, Q2) onto an LSX V-register; using ARM NEON-style suffixes (8B, 4H) directly; typos in the lane count.
Related errors
- Loong64 extension: invalid LSX/LASX arrangement type: {ext}
- Loong64 extension: invalid LASX arrangement type: {ext}
- Loong64 extension: invalid LSX/LASX register: {reg}
- invalid register for shift operation
- expect V0-V31, Z0-Z31, or P0-P15; found: {name}
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/b881eadc7ae2ee3d.
Report an issue: GitHub.