• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016 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
5package arm64
6
7import "testing"
8
9func testvmovs() (r1, r2 uint64)
10func testvmovd() (r1, r2 uint64)
11func testvmovq() (r1, r2 uint64)
12
13func 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
31func testmovk() uint64
32
33// TestMOVK makes sure MOVK with a very large constant works. See issue 52261.
34func 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