Home | History | Annotate | Download | only in x86asm
      1 // Copyright 2014 The Go Authors.  All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package x86asm
      6 
      7 import (
      8 	"strings"
      9 	"testing"
     10 )
     11 
     12 func TestPlan932Manual(t *testing.T)   { testPlan932(t, hexCases(t, plan9ManualTests)) }
     13 func TestPlan932Testdata(t *testing.T) { testPlan932(t, concat(basicPrefixes, testdataCases(t))) }
     14 func TestPlan932ModRM(t *testing.T)    { testPlan932(t, concat(basicPrefixes, enumModRM)) }
     15 func TestPlan932OneByte(t *testing.T)  { testBasic(t, testPlan932) }
     16 func TestPlan9320F(t *testing.T)       { testBasic(t, testPlan932, 0x0F) }
     17 func TestPlan9320F38(t *testing.T)     { testBasic(t, testPlan932, 0x0F, 0x38) }
     18 func TestPlan9320F3A(t *testing.T)     { testBasic(t, testPlan932, 0x0F, 0x3A) }
     19 func TestPlan932Prefix(t *testing.T)   { testPrefix(t, testPlan932) }
     20 
     21 func TestPlan964Manual(t *testing.T)   { testPlan964(t, hexCases(t, plan9ManualTests)) }
     22 func TestPlan964Testdata(t *testing.T) { testPlan964(t, concat(basicPrefixes, testdataCases(t))) }
     23 func TestPlan964ModRM(t *testing.T)    { testPlan964(t, concat(basicPrefixes, enumModRM)) }
     24 func TestPlan964OneByte(t *testing.T)  { testBasic(t, testPlan964) }
     25 func TestPlan9640F(t *testing.T)       { testBasic(t, testPlan964, 0x0F) }
     26 func TestPlan9640F38(t *testing.T)     { testBasic(t, testPlan964, 0x0F, 0x38) }
     27 func TestPlan9640F3A(t *testing.T)     { testBasic(t, testPlan964, 0x0F, 0x3A) }
     28 func TestPlan964Prefix(t *testing.T)   { testPrefix(t, testPlan964) }
     29 
     30 func TestPlan964REXTestdata(t *testing.T) {
     31 	testPlan964(t, filter(concat3(basicPrefixes, rexPrefixes, testdataCases(t)), isValidREX))
     32 }
     33 func TestPlan964REXModRM(t *testing.T)   { testPlan964(t, concat3(basicPrefixes, rexPrefixes, enumModRM)) }
     34 func TestPlan964REXOneByte(t *testing.T) { testBasicREX(t, testPlan964) }
     35 func TestPlan964REX0F(t *testing.T)      { testBasicREX(t, testPlan964, 0x0F) }
     36 func TestPlan964REX0F38(t *testing.T)    { testBasicREX(t, testPlan964, 0x0F, 0x38) }
     37 func TestPlan964REX0F3A(t *testing.T)    { testBasicREX(t, testPlan964, 0x0F, 0x3A) }
     38 func TestPlan964REXPrefix(t *testing.T)  { testPrefixREX(t, testPlan964) }
     39 
     40 // plan9ManualTests holds test cases that will be run by TestPlan9Manual32 and TestPlan9Manual64.
     41 // If you are debugging a few cases that turned up in a longer run, it can be useful
     42 // to list them here and then use -run=Plan9Manual, particularly with tracing enabled.
     43 var plan9ManualTests = `
     44 `
     45 
     46 // allowedMismatchPlan9 reports whether the mismatch between text and dec
     47 // should be allowed by the test.
     48 func allowedMismatchPlan9(text string, size int, inst *Inst, dec ExtInst) bool {
     49 	return false
     50 }
     51 
     52 // Instructions known to us but not to plan9.
     53 var plan9Unsupported = strings.Fields(`
     54 `)
     55