{"record":{"id":"b881eadc7ae2ee3d","repo":"golang/go","slug":"loong64-extension-invalid-lsx-arrangement-type","errorCode":null,"errorMessage":"Loong64 extension: invalid LSX arrangement type: {ext}","messagePattern":"Loong64 extension: invalid LSX arrangement type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/asm/internal/arch/loong64.go","lineNumber":109,"sourceCode":"\t}\n\n\tif isIndex {\n\t\tarngType, ok = loong64ElemExtMap[ext]\n\t\tif !ok {\n\t\t\treturn errors.New(\"Loong64 extension: invalid LSX/LASX arrangement type: \" + ext)\n\t\t}\n\n\t\ta.Reg = loong64.REG_ELEM\n\t\ta.Reg += ((simdReg & loong64.EXT_REG_MASK) << loong64.EXT_REG_SHIFT)\n\t\ta.Reg += ((arngType & loong64.EXT_TYPE_MASK) << loong64.EXT_TYPE_SHIFT)\n\t\ta.Reg += ((simdType & loong64.EXT_SIMDTYPE_MASK) << loong64.EXT_SIMDTYPE_SHIFT)\n\t\ta.Index = num\n\t} else {\n\t\tswitch simdType {\n\t\tcase loong64.LSX:\n\t\t\tarngType, ok = loong64LsxArngExtMap[ext]\n\t\t\tif !ok {\n\t\t\t\treturn errors.New(\"Loong64 extension: invalid LSX arrangement type: \" + ext)\n\t\t\t}\n\n\t\tcase loong64.LASX:\n\t\t\tarngType, ok = loong64LasxArngExtMap[ext]\n\t\t\tif !ok {\n\t\t\t\treturn errors.New(\"Loong64 extension: invalid LASX arrangement type: \" + ext)\n\t\t\t}\n\t\t}\n\n\t\ta.Reg = loong64.REG_ARNG\n\t\ta.Reg += ((simdReg & loong64.EXT_REG_MASK) << loong64.EXT_REG_SHIFT)\n\t\ta.Reg += ((arngType & loong64.EXT_TYPE_MASK) << loong64.EXT_TYPE_SHIFT)\n\t\ta.Reg += ((simdType & loong64.EXT_SIMDTYPE_MASK) << loong64.EXT_SIMDTYPE_SHIFT)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/asm/internal/arch/loong64.go#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before (LASX suffix on LSX register)\nVADD V0.B32, V1, V2\n// after (correct LSX arrangement)\nVADD V0.B16, V1, V2","handlingStrategy":"validation","validationCode":"var validLsxArng = map[string]bool{\"B16\":true,\"H8\":true,\"W4\":true,\"V2\":true}\nfunc isValidLsxArrangement(ext string) bool { return validLsxArng[ext] }","typeGuard":"func isLsxArrangement(ext string) bool {\n    switch ext { case \"B16\",\"H8\",\"W4\",\"V2\": return true }\n    return false\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["loong64","assembly","simd","lsx","assembler"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}