1
2
3
4
5 package arm64
6
7 import "testing"
8
9 func testvmovs() (r1, r2 uint64)
10 func testvmovd() (r1, r2 uint64)
11 func testvmovq() (r1, r2 uint64)
12
13 func TestVMOV(t *testing.T) {
14 tests := []struct {
15 op string
16 vmovFunc func() (uint64, uint64)
17 wantA, wantB uint64
18 }{
19 {"VMOVS", testvmovs, 0x80402010, 0},
20 {"VMOVD", testvmovd, 0x7040201008040201, 0},
21 {"VMOVQ", testvmovq, 0x7040201008040201, 0x3040201008040201},
22 }
23 for _, test := range tests {
24 gotA, gotB := test.vmovFunc()
25 if gotA != test.wantA || gotB != test.wantB {
26 t.Errorf("%v: got: a=0x%x, b=0x%x, want: a=0x%x, b=0x%x", test.op, gotA, gotB, test.wantA, test.wantB)
27 }
28 }
29 }
30
31 func testmovk() uint64
32
33
34 func TestMOVK(t *testing.T) {
35 x := testmovk()
36 want := uint64(40000 << 48)
37 if x != want {
38 t.Errorf("Got %x want %x\n", x, want)
39 }
40 }
41
View as plain text