feat(arch): add the imm8 scalar FP16 controls to the amd64 extension layer

Assisted-by: GLM 5.3 Flash
This commit is contained in:
petrbalvin committed 2026-10-07 00:33:30 +02:00
1 parent 0354a1f4c1
commit aa9c7ca030
4 files changed
+288 -8

No files matched your search

+12 -2
View File
@@ -37,6 +37,10 @@ func TestAmd64ExtensionRegistry(t *testing.T) {
{"VSQRTPH", 1},
{"VSCALEFSH", 1},
{"VGETEXPSH", 1},
{"VCMPSH", 1},
{"VGETMANTSH", 1},
{"VREDUCESH", 1},
{"VRNDSCALESH", 1},
} {
cands, ok := LookupExtension(arch.AMD64, tt.mnem)
if !ok {
@@ -50,8 +54,8 @@ func TestAmd64ExtensionRegistry(t *testing.T) {
t.Errorf("the %s lookup is not case-insensitive", tt.mnem)
}
}
if got := arch.Extensions(arch.AMD64); len(got) != 48 {
t.Errorf("the amd64 layer registers %d instructions, want 48", len(got))
if got := arch.Extensions(arch.AMD64); len(got) != 52 {
t.Errorf("the amd64 layer registers %d instructions, want 52", len(got))
}
if _, ok := LookupExtension(arch.AMD64, "NOSUCHINSTR"); ok {
t.Error("a non-extended mnemonic resolved")
@@ -115,6 +119,12 @@ func TestEncodeExtensionAmd64(t *testing.T) {
{"word move into an xmm", "VMOVW",
[]arch.ExtOperand{arch.ExtGpr64(12), arch.ExtXmm(30)},
"62457d086ef4"},
{"scalar compare into a mask", "VCMPSH",
[]arch.ExtOperand{arch.ExtImmediate(0x7b), arch.ExtXmm(29), arch.ExtXmm(28), arch.ExtMask(5)},
"62931600c2ec7b"},
{"mantissa extract with a control byte", "VGETMANTSH",
[]arch.ExtOperand{arch.ExtImmediate(0x0b), arch.ExtXmm(29), arch.ExtXmm(28), arch.ExtXmm(30)},
"6203140027f40b"},
} {
got, err := EncodeExtension(arch.AMD64, tt.mnem, tt.ops...)
if err != nil {