feat(arch): add the amd64 fp16 packed conversion family

Assisted-by: GLM 5.3
This commit is contained in:
petrbalvin committed 2026-10-07 13:51:48 +02:00
1 parent fb6d01a7d0
commit 8de1b371da
4 files changed
+659 -34

No files matched your search

+31 -2
View File
@@ -41,6 +41,20 @@ func TestAmd64ExtensionRegistry(t *testing.T) {
{"VGETMANTSH", 1},
{"VREDUCESH", 1},
{"VRNDSCALESH", 1},
{"VCVTPH2W", 3},
{"VCVTPH2UW", 3},
{"VCVTW2PH", 3},
{"VCVTUW2PH", 3},
{"VCVTPH2DQ", 3},
{"VCVTPH2UDQ", 3},
{"VCVTDQ2PH", 3},
{"VCVTUDQ2PH", 3},
{"VCVTPH2QQ", 3},
{"VCVTPH2UQQ", 3},
{"VCVTQQ2PH", 3},
{"VCVTUQQ2PH", 3},
{"VCVTPH2PD", 3},
{"VCVTPD2PH", 3},
} {
cands, ok := LookupExtension(arch.AMD64, tt.mnem)
if !ok {
@@ -54,8 +68,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) != 70 {
t.Errorf("the amd64 layer registers %d instructions, want 70", len(got))
if got := arch.Extensions(arch.AMD64); len(got) != 112 {
t.Errorf("the amd64 layer registers %d instructions, want 112", len(got))
}
if _, ok := LookupExtension(arch.AMD64, "NOSUCHINSTR"); ok {
t.Error("a non-extended mnemonic resolved")
@@ -131,6 +145,21 @@ func TestEncodeExtensionAmd64(t *testing.T) {
{"scalar fp16 minimum with exceptions suppressed", "VMINSH",
[]arch.ExtOperand{arch.ExtXmm(5), arch.ExtXmm(4), arch.ExtRounded(arch.ExtXmm(6), arch.ExtRoundSAE)},
"62f556185df4"},
{"fp16 to signed words", "VCVTPH2W",
[]arch.ExtOperand{arch.ExtZmm(5), arch.ExtZmm(6)},
"62f57d487df5"},
{"dwords to fp16 over a broadcast source", "VCVTDQ2PH",
[]arch.ExtOperand{arch.ExtBroadcast(9, 0), arch.ExtYmm(30)},
"62457c585b31"},
{"fp16 to signed qwords, rounded", "VCVTPH2QQ",
[]arch.ExtOperand{arch.ExtXmm(5), arch.ExtRounded(arch.ExtZmm(6), arch.ExtRoundTruncate)},
"62f57d787bf5"},
{"fp16 scalar out of memory into an integer", "VCVTSH2SI",
[]arch.ExtOperand{arch.ExtMemory(9, 0), arch.ExtGpr64(12)},
"6255fe082d21"},
{"fp16 to double-precision, widened", "VCVTPH2PD",
[]arch.ExtOperand{arch.ExtXmm(5), arch.ExtZmm(6)},
"62f57c485af5"},
} {
got, err := EncodeExtension(arch.AMD64, tt.mnem, tt.ops...)
if err != nil {