Renamed x64 to x86

This commit is contained in:
Eduard Urbach 2025-02-05 23:16:18 +01:00
parent f558a69366
commit 9c53235e7e
Signed by: eduard
GPG key ID: 49226B848C78F6C8
80 changed files with 1757 additions and 1757 deletions

39
src/x86/Div_test.go Normal file
View file

@ -0,0 +1,39 @@
package x86_test
import (
"testing"
"git.akyoto.dev/cli/q/src/cpu"
"git.akyoto.dev/cli/q/src/x86"
"git.akyoto.dev/go/assert"
)
func TestDivRegister(t *testing.T) {
usagePatterns := []struct {
Register cpu.Register
Code []byte
}{
{x86.RAX, []byte{0x48, 0xF7, 0xF8}},
{x86.RCX, []byte{0x48, 0xF7, 0xF9}},
{x86.RDX, []byte{0x48, 0xF7, 0xFA}},
{x86.RBX, []byte{0x48, 0xF7, 0xFB}},
{x86.RSP, []byte{0x48, 0xF7, 0xFC}},
{x86.RBP, []byte{0x48, 0xF7, 0xFD}},
{x86.RSI, []byte{0x48, 0xF7, 0xFE}},
{x86.RDI, []byte{0x48, 0xF7, 0xFF}},
{x86.R8, []byte{0x49, 0xF7, 0xF8}},
{x86.R9, []byte{0x49, 0xF7, 0xF9}},
{x86.R10, []byte{0x49, 0xF7, 0xFA}},
{x86.R11, []byte{0x49, 0xF7, 0xFB}},
{x86.R12, []byte{0x49, 0xF7, 0xFC}},
{x86.R13, []byte{0x49, 0xF7, 0xFD}},
{x86.R14, []byte{0x49, 0xF7, 0xFE}},
{x86.R15, []byte{0x49, 0xF7, 0xFF}},
}
for _, pattern := range usagePatterns {
t.Logf("idiv %s", pattern.Register)
code := x86.DivRegister(nil, pattern.Register)
assert.DeepEqual(t, code, pattern.Code)
}
}