-
Notifications
You must be signed in to change notification settings - Fork 17.4k
/
asm_arm64_test.go
40 lines (34 loc) · 1.03 KB
/
asm_arm64_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package arm64
import "testing"
func testvmovs() (r1, r2 uint64)
func testvmovd() (r1, r2 uint64)
func testvmovq() (r1, r2 uint64)
func TestVMOV(t *testing.T) {
tests := []struct {
op string
vmovFunc func() (uint64, uint64)
wantA, wantB uint64
}{
{"VMOVS", testvmovs, 0x80402010, 0},
{"VMOVD", testvmovd, 0x7040201008040201, 0},
{"VMOVQ", testvmovq, 0x7040201008040201, 0x3040201008040201},
}
for _, test := range tests {
gotA, gotB := test.vmovFunc()
if gotA != test.wantA || gotB != test.wantB {
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)
}
}
}
func testmovk() uint64
// TestMOVK makes sure MOVK with a very large constant works. See issue 52261.
func TestMOVK(t *testing.T) {
x := testmovk()
want := uint64(40000 << 48)
if x != want {
t.Errorf("Got %x want %x\n", x, want)
}
}