aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/memcombine.go19
-rw-r--r--test/codegen/stack.go12
2 files changed, 30 insertions, 1 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index ec86a79317..17323bd2ab 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -6,7 +6,10 @@
package codegen
-import "encoding/binary"
+import (
+ "encoding/binary"
+ "runtime"
+)
var sink64 uint64
var sink32 uint32
@@ -98,6 +101,11 @@ func load_be16_idx(b []byte, idx int) {
sink16 = binary.BigEndian.Uint16(b[idx:])
}
+func load_byte2_uint16(s []byte) uint16 {
+ // arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR\tR[0-9]+<<8`
+ return uint16(s[0]) | uint16(s[1])<<8
+}
+
// Check load combining across function calls.
func fcall_byte(a, b byte) (byte, byte) {
@@ -132,6 +140,15 @@ func offsets_fold(_, a [20]byte) (b [20]byte) {
return
}
+// Make sure we don't put pointers in SSE registers across safe
+// points.
+
+func safe_point(p, q *[2]*int) {
+ a, b := p[0], p[1] // amd64:-`MOVUPS`
+ runtime.GC()
+ q[0], q[1] = a, b // amd64:-`MOVUPS`
+}
+
// ------------- //
// Storing //
// ------------- //
diff --git a/test/codegen/stack.go b/test/codegen/stack.go
index 987d6a5b1f..da5ef24e13 100644
--- a/test/codegen/stack.go
+++ b/test/codegen/stack.go
@@ -6,6 +6,8 @@
package codegen
+import "runtime"
+
// This file contains code generation tests related to the use of the
// stack.
@@ -22,3 +24,13 @@ func StackStore() int {
var x int
return *(&x)
}
+
+// Check that assembly output has matching offset and base register
+// (Issue #21064).
+
+// amd64:`.*b\+24\(SP\)`
+// arm:`.*b\+4\(FP\)`
+func check_asmout(a, b int) int {
+ runtime.GC() // use some frame
+ return b
+}