From 27235485a6a0657e781b86440b1398c0d0e38981 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Thu, 22 Nov 2018 15:24:28 -0600 Subject: [PATCH] m256 arguments, MMX exception --- internal/gen/loadertest.go | 26 +++++++++++++------------- internal/load/load.go | 13 ++++++++++++- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/internal/gen/loadertest.go b/internal/gen/loadertest.go index 039ba05..55d267d 100644 --- a/internal/gen/loadertest.go +++ b/internal/gen/loadertest.go @@ -86,18 +86,18 @@ func arg(t string) string { "imm32": fmt.Sprintf("$%d", math.MaxInt32), // "imm64": fmt.Sprintf("$%d", math.MaxInt64), // - "al": "AL", // - "cl": "CL", // - "r8": "CH", // - "ax": "AX", // - "r16": "SI", // - "eax": "AX", // - "r32": "DX", // - "rax": "AX", // - "r64": "R15", // - // - "xmm0": "X0", // - "xmm": "X7", // + "al": "AL", // + "cl": "CL", // + "r8": "CH", // + "ax": "AX", // + "r16": "SI", // + "eax": "AX", // + "r32": "DX", // + "rax": "AX", // + "r64": "R15", // + "mm": "M5", // + "xmm0": "X0", // + "xmm": "X7", // // // "ymm": "Y13", // @@ -122,7 +122,7 @@ func arg(t string) string { // "m128": "128(AX)(CX*2)", // // - // + "m256": "256(AX)(CX*2)", // // // // diff --git a/internal/load/load.go b/internal/load/load.go index 013c66b..d456a95 100644 --- a/internal/load/load.go +++ b/internal/load/load.go @@ -97,7 +97,7 @@ func (l Loader) include(f opcodesxml.Form) bool { for _, isa := range f.ISA { switch isa.ID { // AMD-only. - case "TBM", "CLZERO", "FMA4", "XOP", "SSE4A": + case "TBM", "CLZERO", "FMA4", "XOP", "SSE4A", "3dnow!", "3dnow!+": return false // Incomplete support for some prefetching instructions. case "PREFETCH", "PREFETCHW", "PREFETCHWT1", "CLWB": @@ -113,6 +113,17 @@ func (l Loader) include(f opcodesxml.Form) bool { } } + // Go appears to have skeleton support for MMX instructions. See the many TODO lines in the testcases: + // Reference: https://github.com/golang/go/blob/649b89377e91ad6dbe710784f9e662082d31a1ff/src/cmd/asm/internal/asm/testdata/amd64enc.s#L3310-L3312 + // + // //TODO: PALIGNR $7, (BX), M2 // 0f3a0f1307 + // //TODO: PALIGNR $7, (R11), M2 // 410f3a0f1307 + // //TODO: PALIGNR $7, M2, M2 // 0f3a0fd207 + // + if f.MMXMode == "MMX" { + return false + } + // x86 csv contains a number of CMOV* instructions which are actually not valid // Go instructions. The valid Go forms should have different opcodes from GNU. // Therefore a decent "heuristic" is CMOV* instructions that do not have