From c6ef69e7d7f79f6fc72e51aa7b1ff3c7373b7b53 Mon Sep 17 00:00:00 2001 From: Xiaodong Liu Date: Thu, 19 May 2022 20:01:10 +0800 Subject: [PATCH] misc, test: fix test error for loong64 Contributors to the loong64 port are: Weining Lu Lei Wang Lingqin Gong Xiaolin Zhao Meidan Li Xiaojuan Zhai Qiyuan Pu Guoqi Chen This port has been updated to Go 1.15.6: https://github.com/loongson/go Updates #46229 Change-Id: I6760b4a7e51646773cd0f48baa1baba01b213b7d Reviewed-on: https://go-review.googlesource.com/c/go/+/342325 Reviewed-by: Ian Lance Taylor Reviewed-by: David Chase Reviewed-by: Michael Knyszek Run-TryBot: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor --- .../cgo/test/testdata/issue9400/asm_loong64.s | 28 +++++++++++++++++++ test/intrinsic_atomic.go | 2 +- test/nosplit.go | 3 ++ test/run.go | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 misc/cgo/test/testdata/issue9400/asm_loong64.s diff --git a/misc/cgo/test/testdata/issue9400/asm_loong64.s b/misc/cgo/test/testdata/issue9400/asm_loong64.s new file mode 100644 index 0000000000..c242fc6c62 --- /dev/null +++ b/misc/cgo/test/testdata/issue9400/asm_loong64.s @@ -0,0 +1,28 @@ +// Copyright 2022 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. + +#include "textflag.h" + +TEXT ·RewindAndSetgid(SB),NOSPLIT|NOFRAME,$0-0 + // Rewind stack pointer so anything that happens on the stack + // will clobber the test pattern created by the caller + ADDV $(1024*8), R3 + + // Ask signaller to setgid + MOVW $1, R12 + DBAR + MOVW R12, ·Baton(SB) + DBAR + + // Wait for setgid completion +loop: + DBAR + MOVW ·Baton(SB), R12 + OR R13, R13, R13 // hint that we're in a spin loop + BNE R12, loop + DBAR + + // Restore stack + ADDV $(-1024*8), R3 + RET diff --git a/test/intrinsic_atomic.go b/test/intrinsic_atomic.go index 61911b7a46..a1004c89d9 100644 --- a/test/intrinsic_atomic.go +++ b/test/intrinsic_atomic.go @@ -1,5 +1,5 @@ // errorcheck -0 -d=ssa/intrinsics/debug -// +build amd64 arm64 mips mipsle mips64 mips64le ppc64 ppc64le riscv64 s390x +// +build amd64 arm64 loong64 mips mipsle mips64 mips64le ppc64 ppc64le riscv64 s390x // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/nosplit.go b/test/nosplit.go index 9cedb93ec3..218eb73727 100644 --- a/test/nosplit.go +++ b/test/nosplit.go @@ -284,6 +284,9 @@ TestCases: case "mips64", "mips64le": ptrSize = 8 fmt.Fprintf(&buf, "#define REGISTER (R0)\n") + case "loong64": + ptrSize = 8 + fmt.Fprintf(&buf, "#define REGISTER (R0)\n") case "ppc64", "ppc64le": ptrSize = 8 fmt.Fprintf(&buf, "#define REGISTER (CTR)\n") diff --git a/test/run.go b/test/run.go index 7553302a76..cb1622ccc9 100644 --- a/test/run.go +++ b/test/run.go @@ -1585,6 +1585,7 @@ var ( "amd64": {"GOAMD64", "v1", "v2", "v3", "v4"}, "arm": {"GOARM", "5", "6", "7"}, "arm64": {}, + "loong64": {}, "mips": {"GOMIPS", "hardfloat", "softfloat"}, "mips64": {"GOMIPS64", "hardfloat", "softfloat"}, "ppc64": {"GOPPC64", "power8", "power9"}, -- 2.50.0