loadertest: more operand types
This commit is contained in:
@@ -85,17 +85,14 @@ func arg(t string) string {
|
|||||||
"imm16": fmt.Sprintf("$%d", math.MaxInt16), // <xs:enumeration value="imm16" />
|
"imm16": fmt.Sprintf("$%d", math.MaxInt16), // <xs:enumeration value="imm16" />
|
||||||
"imm32": fmt.Sprintf("$%d", math.MaxInt32), // <xs:enumeration value="imm32" />
|
"imm32": fmt.Sprintf("$%d", math.MaxInt32), // <xs:enumeration value="imm32" />
|
||||||
"imm64": fmt.Sprintf("$%d", math.MaxInt64), // <xs:enumeration value="imm64" />
|
"imm64": fmt.Sprintf("$%d", math.MaxInt64), // <xs:enumeration value="imm64" />
|
||||||
"al": "AL", // <xs:enumeration value="al" />
|
|
||||||
"cl": "CL", // <xs:enumeration value="cl" />
|
|
||||||
|
|
||||||
// <xs:enumeration value="r8" />
|
"al": "AL", // <xs:enumeration value="al" />
|
||||||
// <xs:enumeration value="r8l" />
|
"cl": "CL", // <xs:enumeration value="cl" />
|
||||||
// <xs:enumeration value="ax" />
|
"r8": "CH", // <xs:enumeration value="r8" />
|
||||||
// <xs:enumeration value="r16" />
|
"ax": "AX", // <xs:enumeration value="ax" />
|
||||||
// <xs:enumeration value="r16l" />
|
"r16": "SI", // <xs:enumeration value="r16" />
|
||||||
"eax": "AX", // <xs:enumeration value="eax" />
|
"eax": "AX", // <xs:enumeration value="eax" />
|
||||||
// <xs:enumeration value="r32" />
|
"r32": "DX", // <xs:enumeration value="r32" />
|
||||||
// <xs:enumeration value="r32l" />
|
|
||||||
"rax": "AX", // <xs:enumeration value="rax" />
|
"rax": "AX", // <xs:enumeration value="rax" />
|
||||||
"r64": "R15", // <xs:enumeration value="r64" />
|
"r64": "R15", // <xs:enumeration value="r64" />
|
||||||
// <xs:enumeration value="mm" />
|
// <xs:enumeration value="mm" />
|
||||||
@@ -103,7 +100,7 @@ func arg(t string) string {
|
|||||||
"xmm": "X7", // <xs:enumeration value="xmm" />
|
"xmm": "X7", // <xs:enumeration value="xmm" />
|
||||||
// <xs:enumeration value="xmm{k}" />
|
// <xs:enumeration value="xmm{k}" />
|
||||||
// <xs:enumeration value="xmm{k}{z}" />
|
// <xs:enumeration value="xmm{k}{z}" />
|
||||||
// <xs:enumeration value="ymm" />
|
"ymm": "Y13", // <xs:enumeration value="ymm" />
|
||||||
// <xs:enumeration value="ymm{k}" />
|
// <xs:enumeration value="ymm{k}" />
|
||||||
// <xs:enumeration value="ymm{k}{z}" />
|
// <xs:enumeration value="ymm{k}{z}" />
|
||||||
// <xs:enumeration value="zmm" />
|
// <xs:enumeration value="zmm" />
|
||||||
@@ -152,6 +149,11 @@ func arg(t string) string {
|
|||||||
// <xs:enumeration value="rel32" />
|
// <xs:enumeration value="rel32" />
|
||||||
// <xs:enumeration value="{er}" />
|
// <xs:enumeration value="{er}" />
|
||||||
// <xs:enumeration value="{sae}" />
|
// <xs:enumeration value="{sae}" />
|
||||||
|
|
||||||
|
// Appear unused:
|
||||||
|
"r8l": "????", // <xs:enumeration value="r8l" />
|
||||||
|
"r16l": "????", // <xs:enumeration value="r16l" />
|
||||||
|
"r32l": "????", // <xs:enumeration value="r32l" />
|
||||||
}
|
}
|
||||||
return m[t]
|
return m[t]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,12 +96,20 @@ func (l Loader) include(f opcodesxml.Form) bool {
|
|||||||
// Exclude certain ISAs simply not present in Go
|
// Exclude certain ISAs simply not present in Go
|
||||||
for _, isa := range f.ISA {
|
for _, isa := range f.ISA {
|
||||||
switch isa.ID {
|
switch isa.ID {
|
||||||
// Most of these are AMD-only.
|
// AMD-only.
|
||||||
case "TBM", "CLZERO", "MONITORX", "FEMMS", "FMA4", "XOP", "SSE4A":
|
case "TBM", "CLZERO", "FMA4", "XOP", "SSE4A":
|
||||||
return false
|
return false
|
||||||
// Incomplete support for some prefetching instructions.
|
// Incomplete support for some prefetching instructions.
|
||||||
case "PREFETCH", "PREFETCHW", "PREFETCHWT1", "CLWB":
|
case "PREFETCH", "PREFETCHW", "PREFETCHWT1", "CLWB":
|
||||||
return false
|
return false
|
||||||
|
// Remaining oddities.
|
||||||
|
case "MONITORX", "FEMMS":
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(mbm): support AVX512
|
||||||
|
if strings.HasPrefix(isa.ID, "AVX512") {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,6 +158,22 @@ func (l Loader) gonames(f opcodesxml.Form) []string {
|
|||||||
return []string{"RETFW", "RETFL", "RETFQ"}
|
return []string{"RETFW", "RETFL", "RETFQ"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IMUL 3-operand forms are not recorded correctly in either x86 CSV or opcodes. They are supposed to be called IMUL3{W,L,Q}
|
||||||
|
//
|
||||||
|
// Reference: https://github.com/golang/go/blob/649b89377e91ad6dbe710784f9e662082d31a1ff/src/cmd/internal/obj/x86/asm6.go#L1112-L1114
|
||||||
|
//
|
||||||
|
// {AIMUL3W, yimul3, Pe, opBytes{0x6b, 00, 0x69, 00}},
|
||||||
|
// {AIMUL3L, yimul3, Px, opBytes{0x6b, 00, 0x69, 00}},
|
||||||
|
// {AIMUL3Q, yimul3, Pw, opBytes{0x6b, 00, 0x69, 00}},
|
||||||
|
//
|
||||||
|
// Reference: https://github.com/golang/arch/blob/b19384d3c130858bb31a343ea8fce26be71b5998/x86/x86.v0.2.csv#L549
|
||||||
|
//
|
||||||
|
// "IMUL r32, r/m32, imm32","IMULL imm32, r/m32, r32","imull imm32, r/m32, r32","69 /r id","V","V","","operand32","rw,r,r","Y","32"
|
||||||
|
//
|
||||||
|
if strings.HasPrefix(f.GASName, "imul") && len(f.Operands) == 3 {
|
||||||
|
return []string{strings.ToUpper(f.GASName[:4] + "3" + f.GASName[4:])}
|
||||||
|
}
|
||||||
|
|
||||||
// Use go opcode from Opcodes XML where available.
|
// Use go opcode from Opcodes XML where available.
|
||||||
if f.GoName != "" {
|
if f.GoName != "" {
|
||||||
return []string{f.GoName}
|
return []string{f.GoName}
|
||||||
@@ -165,7 +189,20 @@ func (l Loader) gonames(f opcodesxml.Form) []string {
|
|||||||
switch n {
|
switch n {
|
||||||
case "VCVTUSI2SS", "VCVTSD2USI", "VCVTSS2USI", "VCVTUSI2SD", "VCVTTSS2USI", "VCVTTSD2USI":
|
case "VCVTUSI2SS", "VCVTSD2USI", "VCVTSS2USI", "VCVTUSI2SD", "VCVTTSS2USI", "VCVTTSD2USI":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "RDRAND", "RDSEED", "MOVBEQ":
|
case "MOVBEW", "MOVBEL", "MOVBEQ":
|
||||||
|
// MOVEBE* instructions seem to be inconsistent with x86 CSV.
|
||||||
|
//
|
||||||
|
// Reference: https://github.com/golang/arch/blob/b19384d3c130858bb31a343ea8fce26be71b5998/x86/x86spec/format.go#L282-L287
|
||||||
|
//
|
||||||
|
// "MOVBE r16, m16": "movbeww",
|
||||||
|
// "MOVBE m16, r16": "movbeww",
|
||||||
|
// "MOVBE m32, r32": "movbell",
|
||||||
|
// "MOVBE r32, m32": "movbell",
|
||||||
|
// "MOVBE m64, r64": "movbeqq",
|
||||||
|
// "MOVBE r64, m64": "movbeqq",
|
||||||
|
//
|
||||||
|
fallthrough
|
||||||
|
case "RDRAND", "RDSEED":
|
||||||
n += suffix[s]
|
n += suffix[s]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user