Implemented register to register instructions
This commit is contained in:
parent
1c27f0cad2
commit
a9d43a8716
11 changed files with 171 additions and 16 deletions
34
src/build/arch/x64/REX_test.go
Normal file
34
src/build/arch/x64/REX_test.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package x64_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/build/arch/x64"
|
||||
"git.akyoto.dev/go/assert"
|
||||
)
|
||||
|
||||
func TestREX(t *testing.T) {
|
||||
testData := []struct{ w, r, x, b, expected byte }{
|
||||
{0, 0, 0, 0, 0b_0100_0000},
|
||||
{0, 0, 0, 1, 0b_0100_0001},
|
||||
{0, 0, 1, 0, 0b_0100_0010},
|
||||
{0, 0, 1, 1, 0b_0100_0011},
|
||||
{0, 1, 0, 0, 0b_0100_0100},
|
||||
{0, 1, 0, 1, 0b_0100_0101},
|
||||
{0, 1, 1, 0, 0b_0100_0110},
|
||||
{0, 1, 1, 1, 0b_0100_0111},
|
||||
{1, 0, 0, 0, 0b_0100_1000},
|
||||
{1, 0, 0, 1, 0b_0100_1001},
|
||||
{1, 0, 1, 0, 0b_0100_1010},
|
||||
{1, 0, 1, 1, 0b_0100_1011},
|
||||
{1, 1, 0, 0, 0b_0100_1100},
|
||||
{1, 1, 0, 1, 0b_0100_1101},
|
||||
{1, 1, 1, 0, 0b_0100_1110},
|
||||
{1, 1, 1, 1, 0b_0100_1111},
|
||||
}
|
||||
|
||||
for _, test := range testData {
|
||||
rex := x64.REX(test.w, test.r, test.x, test.b)
|
||||
assert.Equal(t, rex, test.expected)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue