aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/slices.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/codegen/slices.go b/test/codegen/slices.go
index fccd711d71..cf569e27fb 100644
--- a/test/codegen/slices.go
+++ b/test/codegen/slices.go
@@ -113,3 +113,54 @@ func SliceNilCheck(s []int) {
// amd64:-`TESTB`
_ = *p
}
+
+// ---------------------- //
+// Init slice literal //
+// ---------------------- //
+// See issue 21561
+func InitSmallSliceLiteral() []int {
+ // amd64:`MOVQ\t[$]42`
+ return []int{42}
+}
+
+func InitNotSmallSliceLiteral() []int {
+ // amd64:`MOVQ\t.*autotmp_`
+ return []int{
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ 42,
+ }
+}