ppc64asm: cleanup objdump comparison tests

The objdump comparison test compares the instructions encoded
in decode.txt with a ppc64 objdump.  We can reduce the number
of exceptions (cases where objdump and golang disagree) to those
which are contained in decode.txt.

With ISA 3.1 many of the more exotic instructions which never
appeared in go have been removed.  Likewise, we may consider
removing this test as the additional generated tests for ISA 3.1
cover all instructions and do not require a ppc64 gnu objdump.

Change-Id: Ica84c3e8f977da2e9df2c138456ea5b791aaec9f
Reviewed-on: https://go-review.googlesource.com/c/arch/+/295194
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
This commit is contained in:
Paul E. Murphy 2020-12-16 17:25:16 -06:00 коммит произвёл Lynn Boger
Родитель a3652b17be
Коммит 05f8f0431f
1 изменённых файлов: 3 добавлений и 85 удалений

Просмотреть файл

@ -17,7 +17,7 @@ func TestObjdumpPowerManual(t *testing.T) { testObjdump(t, hexCases(t, objdump
// generates lots of ppc64x instructions not possible with golang so not worth supporting..
//func TestObjdumpPowerRandom(t *testing.T) { testObjdump(t, randomCases(t)) }
// objdumpManualTests holds test cases that will be run by TestObjdumpARMManual.
// objdumpManualTests holds test cases that will be run by TestObjdumpPowerManual.
// If you are debugging a few cases that turned up in a longer run, it can be useful
// to list them here and then use -run=Manual, particularly with tracing enabled.
// Note that these are byte sequences, so they must be reversed from the usual
@ -31,38 +31,19 @@ var objdumpManualTests = `
// allowedMismatchObjdump reports whether the mismatch between text and dec
// should be allowed by the test.
func allowedMismatchObjdump(text string, size int, inst *Inst, dec ExtInst) bool {
if hasPrefix(dec.text, deleted...) {
return true
}
// we support more instructions than binutils
if strings.Contains(dec.text, ".long") {
return true
}
if hasPrefix(text, "error:") {
if hasPrefix(dec.text, unsupported...) {
return true
}
}
switch inst.Op {
case BC, BCA, BL, BLA, BCL, BCLA, TDI, TWI, TW, TD:
return true // TODO(minux): we lack the support for extended opcodes here
case RLWNM, RLWNMCC, RLDICL, RLDICLCC, RLWINM, RLWINMCC, RLDCL, RLDCLCC:
return true // TODO(minux): we lack the support for extended opcodes here
case DCBTST, DCBT:
return true // objdump uses the embedded argument order, we use the server argument order
case MTFSF, MTFSFCC: // objdump doesn't show the last two arguments
case BC: // We don't print PC relative branches the same way.
return true
case VSPLTB, VSPLTH, VSPLTW: // objdump generates unreasonable result "vspltw v6,v19,4" for 10c49a8c, the last 4 should be 0.
case DCBF, DCBT: // We only support extended mnemonics, and may not print 0 where R0 == 0.
return true
case MTVSRWA, MTVSRWZ, MFVSRWZ, MFVSRD, MTVSRD: // We don't support extended mnemonics using VRs or FPRs
return true
}
if hasPrefix(text, "evm", "evl", "efs") { // objdump will disassemble them wrong (e.g. evmhoumia as vsldoi)
return true
}
if len(dec.enc) >= 4 {
_ = binary.BigEndian.Uint32(dec.enc[:4])
@ -70,66 +51,3 @@ func allowedMismatchObjdump(text string, size int, inst *Inst, dec ExtInst) bool
return false
}
// Instructions known to libopcodes (or xed) but not to us.
// TODO(minux): those single precision instructions are missing from ppc64.csv
// those data cache instructions are deprecated, but must be treated as no-ops, see 4.3.2.1 pg. 774.
var unsupported = strings.Fields(`
fmsubs
fmsubs.
fnmadds
fnmadds.
fnmsubs
fnmsubs.
fmuls
fmuls.
fdivs
fdivs.
fadds
fadds.
fsubs
fsubs.
dst
dstst
dssall
`)
// Instructions explicitly dropped in Power ISA that were in POWER architecture.
// See A.30 Deleted Instructions and A.31 Discontiued Opcodes
var deleted = strings.Fields(`
abs
clcs
clf
cli
dclst
div
divs
doz
dozi
lscbx
maskg
maskir
mfsri
mul
nabs
rac
rfi
rfsvc
rlmi
rrib
sle
sleq
sliq
slliq
sllq
slq
sraiq
sraq
sre
srea
sreq
sriq
srliq
srlq
srq
maskg`)