golang/go · error
Loong64 extension: invalid LASX arrangement type: {ext}
Error message
Loong64 extension: invalid LASX arrangement type: {ext} What it means
Thrown by Loong64RegisterExtension in the non-index (arrangement) branch when simdType is LASX (register is X0-X31) and `ext` is not a key in loong64LasxArngExtMap. LASX arrangement suffixes are restricted to B32, H16, W8, V4, and Q2, describing a 256-bit LASX vector's lane layout.
Source
Thrown at src/cmd/asm/internal/arch/loong64.go:115
}
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
}
func loong64RegisterNumber(name string, n int16) (int16, bool) {
switch name {
case "F":
if 0 <= n && n <= 31 {
return loong64.REG_F0 + n, true
}View on GitHub (pinned to b6b368adc5)
Solutions
- Use one of the LASX arrangements: B32, H16, W8, V4, or Q2.
- If you intended a 128-bit arrangement, switch the register to an LSX V-register (V0-V31).
- Confirm the lane width/count against the 256-bit LASX register size (32 bytes total).
Example fix
// before (LSX suffix on LASX register) XVADD X0.B16, X1, X2 // after (correct LASX arrangement) XVADD X0.B32, X1, X2
Defensive patterns
Strategy: validation
Validate before calling
var validLasxArng = map[string]bool{"B32":true,"H16":true,"W8":true,"V4":true,"Q2":true}
func isValidLasxArrangement(ext string) bool { return validLasxArng[ext] } Type guard
func isLasxArrangement(ext string) bool {
switch ext { case "B32","H16","W8","V4","Q2": return true }
return false
} Prevention
- Remember LASX is 256-bit: B32/H16/W8/V4/Q2 are the only valid full-vector arrangements.
- Do not reuse LSX (128-bit) suffixes on X-registers.
- Cross-check assembly mnemonics with the LoongArch ISA manual when porting.
When it happens
Trigger: Calling Loong64RegisterExtension with isIndex==false, an X-register (LASX), and an arrangement suffix not equal to B32/H16/W8/V4/Q2. In assembly this is an operand like `X0.B16` or `X0.H8` where the suffix does not match a 256-bit LASX arrangement.
Common situations: Using an LSX (128-bit) arrangement suffix (B16, H8, W4, V2) on an LASX X-register; reusing a V-register suffix verbatim; typos in lane count.
Related errors
- Loong64 extension: invalid LSX/LASX arrangement type: {ext}
- Loong64 extension: invalid LSX 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/e0ba603ca86d94d5.
Report an issue: GitHub.