feat(arch): add the scaled index to the amd64 memory operands

Assisted-by: GLM 5.3 Flash
This commit is contained in:
petrbalvin committed 2026-10-07 02:06:11 +02:00
1 parent ccb155437e
commit 11cac26508
4 files changed
+183 -44

No files matched your search

+24
View File
@@ -429,6 +429,21 @@ var amd64GoldenRows = []amd64GoldenRow{
[]ExtOperand{ExtBroadcast(1, 0), ExtYmm(6)},
"62f57c385131", "62 f5 7c 38 51 31 vsqrtph (%ecx){1to16},%ymm6"},
// The scaled index: the SIB byte over the same displacement semantics,
// where EVEX.X carries the index's bit three. The compare row quotes
// the listing's indexed row outright; the arithmetic rows pin the bytes
// of {k7}-masked GNU rows, their mask bits riding the bits the layer
// leaves clear.
{"vcomish memory source over a scaled index", "VCOMISH",
[]ExtOperand{ExtScaledMemory(5, 14, 8, 0x10000000), ExtXmm(30)},
"62257c082fb4f500000010", "62 25 7c 08 2f b4 f5 00 00 00 10 vcomish 0x10000000(%rbp,%r14,8),%xmm30"},
{"vaddph memory source over a scaled index", "VADDPH",
[]ExtOperand{ExtZmm(29), ExtScaledMemory(5, 14, 8, 0x10000000), ExtZmm(30)},
"6225144058b4f500000010", "62 25 14 47 58 b4 f5 00 00 00 10 vaddph 0x10000000(%rbp,%r14,8),%zmm29,%zmm30{%k7} (the GNU row adds {k7})"},
{"vsqrtph memory source over a scaled index", "VSQRTPH",
[]ExtOperand{ExtScaledMemory(5, 14, 8, 0x10000000), ExtZmm(30)},
"62257c4851b4f500000010", "62 25 7c 4f 51 b4 f5 00 00 00 10 vsqrtph 0x10000000(%rbp,%r14,8),%zmm30{%k7} (the GNU row adds {k7})"},
// The BF16 memory forms: the dot product reads its second source and
// the narrow convert its full-width source from memory.
{"vdpbf16ps memory source", "VDPBF16PS",
@@ -754,6 +769,15 @@ func TestAmd64ExtRejects(t *testing.T) {
{"broadcast on the narrow convert's full-width source", "VCVTNEPS2BF16",
[]ExtOperand{ExtBroadcast(1, 0), ExtYmm(6)},
"carries a broadcast, the entry's memory operand takes none"},
{"scaled index beyond r15", "VCOMISH",
[]ExtOperand{ExtScaledMemory(5, 16, 8, 0x10000000), ExtXmm(30)},
"index register 16, outside 0-15"},
{"RSP as the scaled index", "VCOMISH",
[]ExtOperand{ExtScaledMemory(5, 4, 8, 0x10000000), ExtXmm(30)},
"cannot encode"},
{"a scale the multipliers do not carry", "VADDPH",
[]ExtOperand{ExtZmm(29), ExtScaledMemory(1, 14, 3, 0), ExtZmm(30)},
"outside the byte multipliers"},
} {
in := amd64ExtInstr(t, tt.mnem, operandClass(t, tt.ops))
_, err := in.Encode(tt.ops)