aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/bits.go
diff options
context:
space:
mode:
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>2025-05-19 17:02:48 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-05-20 20:24:09 -0700
commitd37a1bdd48458e48de13cdc320c8ddf9b021e356 (patch)
treed357d9b2df8dc154e208d92ec0f91fda02d673ea /test/codegen/bits.go
parent74304cda29381fd5ba07a4090b701f8a670896c6 (diff)
downloadgo-d37a1bdd48458e48de13cdc320c8ddf9b021e356.tar.xz
cmd/compile: fix the implementation of NORconst on loong64
In the loong64 instruction set, there is no NORI instruction, so the immediate value in NORconst need to be stored in register and then use the three-register NOR instruction. Change-Id: I5ef697450619317218cb3ef47fc07e238bdc2139 Reviewed-on: https://go-review.googlesource.com/c/go/+/673836 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test/codegen/bits.go')
-rw-r--r--test/codegen/bits.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/codegen/bits.go b/test/codegen/bits.go
index c20e4d6733..95e0ed85e4 100644
--- a/test/codegen/bits.go
+++ b/test/codegen/bits.go
@@ -335,6 +335,15 @@ func op_orn(x, y uint32) uint32 {
return x | ^y
}
+func op_nor(x int64, a []int64) {
+ // loong64: "MOVV\t[$]0","NOR\tR"
+ a[0] = ^(0x1234 | x)
+ // loong64:"NOR",-"XOR"
+ a[1] = (-1) ^ x
+ // loong64: "MOVV\t[$]-55",-"OR",-"NOR"
+ a[2] = ^(0x12 | 0x34)
+}
+
// check bitsets
func bitSetPowerOf2Test(x int) bool {
// amd64:"BTL\t[$]3"