feat(arch): add the amd64 extended-instruction layer with BF16 and VP2INTERSECT

Assisted-by: GLM 5.3 Flash
This commit is contained in:
petrbalvin committed 2026-10-07 00:07:58 +02:00
1 parent 2d803e38d8
commit 28bea95128
6 files changed
+803 -8

No files matched your search

+23 -4
View File
@@ -152,14 +152,15 @@ func TestExtensionEncodable(t *testing.T) {
}
}
// TestExtensionArchIsolation is the architecture-binding negative case: the
// extension layer is registered for arm64 alone, and no other architecture
// answers its queries, not even for a mnemonic the amd64 base table carries.
// TestExtensionArchIsolation is the architecture-binding negative case: no
// architecture answers the arm64 mnemonics but arm64, and the amd64 layer
// answers nothing of the arm64 family either (its own mnemonics live in
// extension_amd64_test.go).
func TestExtensionArchIsolation(t *testing.T) {
ops := []arch.ExtOperand{
arch.ExtVector(0, arch.ExtArrB), arch.ExtVector(0, arch.ExtArrB), arch.ExtVector(0, arch.ExtArrB),
}
for _, a := range []arch.Arch{arch.AMD64, arch.RISCV, arch.LOONG64, arch.Unknown} {
for _, a := range []arch.Arch{arch.RISCV, arch.LOONG64, arch.Unknown} {
if cands, ok := LookupExtension(a, "ADD"); ok || cands != nil {
t.Errorf("LookupExtension(%s, ADD) offered %d candidates", a, len(cands))
}
@@ -181,6 +182,24 @@ func TestExtensionArchIsolation(t *testing.T) {
t.Errorf("arch.Extensions(%s) carries %d instructions", a, len(got))
}
}
// The amd64 layer exists but stays silent about the arm64 family.
if cands, ok := LookupExtension(arch.AMD64, "ADD"); ok || cands != nil {
t.Errorf("LookupExtension(AMD64, ADD) offered %d candidates", len(cands))
}
if got, err := EncodeExtension(arch.AMD64, "ADD", ops...); err == nil {
t.Errorf("EncodeExtension(AMD64, ADD) encoded %x, want a refusal", got)
} else if !strings.Contains(err.Error(), string(arch.AMD64)) {
t.Errorf("EncodeExtension(AMD64) error %q does not name the architecture", err)
}
if ExtensionEncodable(arch.AMD64, "ADD", ops...) {
t.Error("ExtensionEncodable(AMD64, ADD) reported true")
}
if names := ExtensionNames(arch.AMD64); len(names) == 0 {
t.Error("the amd64 layer registers no names")
}
if got := arch.Extensions(arch.AMD64); len(got) == 0 {
t.Error("arch.Extensions(AMD64) is empty")
}
}
// TestExtensionNamesARM64 checks the completion-facing name list: every