mirror of https://github.com/golang/go.git
cmd/internal/obj/arm64: add test coverage for VMOVS and VMOVD
Change-Id: I31ba6696e124dccf37d674d090fdf04ba0a049a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/515616 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
This commit is contained in:
parent
14f5eb7f31
commit
26d4ce70d4
|
|
@ -301,13 +301,25 @@ func TestPCALIGN(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func testvmovs() (r1, r2 uint64)
|
||||
func testvmovd() (r1, r2 uint64)
|
||||
func testvmovq() (r1, r2 uint64)
|
||||
|
||||
// TestVMOVQ checks if the arm64 VMOVQ instruction is working properly.
|
||||
func TestVMOVQ(t *testing.T) {
|
||||
a, b := testvmovq()
|
||||
if a != 0x7040201008040201 || b != 0x3040201008040201 {
|
||||
t.Errorf("TestVMOVQ got: a=0x%x, b=0x%x, want: a=0x7040201008040201, b=0x3040201008040201", a, b)
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -318,6 +330,6 @@ func TestMOVK(t *testing.T) {
|
|||
x := testmovk()
|
||||
want := uint64(40000 << 48)
|
||||
if x != want {
|
||||
t.Errorf("TestMOVK got %x want %x\n", x, want)
|
||||
t.Errorf("Got %x want %x\n", x, want)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,24 @@
|
|||
|
||||
#include "textflag.h"
|
||||
|
||||
// testvmovs() (r1, r2 uint64)
|
||||
TEXT ·testvmovs(SB), NOSPLIT, $0-16
|
||||
VMOVS $0x80402010, V1
|
||||
VMOV V1.D[0], R0
|
||||
VMOV V1.D[1], R1
|
||||
MOVD R0, r1+0(FP)
|
||||
MOVD R1, r2+8(FP)
|
||||
RET
|
||||
|
||||
// testvmovd() (r1, r2 uint64)
|
||||
TEXT ·testvmovd(SB), NOSPLIT, $0-16
|
||||
VMOVD $0x7040201008040201, V1
|
||||
VMOV V1.D[0], R0
|
||||
VMOV V1.D[1], R1
|
||||
MOVD R0, r1+0(FP)
|
||||
MOVD R1, r2+8(FP)
|
||||
RET
|
||||
|
||||
// testvmovq() (r1, r2 uint64)
|
||||
TEXT ·testvmovq(SB), NOSPLIT, $0-16
|
||||
VMOVQ $0x7040201008040201, $0x3040201008040201, V1
|
||||
|
|
|
|||
Loading…
Reference in New Issue