]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/gc/asm_test.go
all: merge dev.inline into master
[gostls13.git] / src / cmd / compile / internal / gc / asm_test.go
index e6082edbeb29b98e389d1c2188eb037dac1e26fc..9eb31e152a22a1d5f9dceb9fea62dcb801b2c7cf 100644 (file)
@@ -175,6 +175,14 @@ func f(b []byte, i int) uint64 {
        },
        {"amd64", "linux", `
 import "encoding/binary"
+func f(b []byte, v uint64) {
+       binary.BigEndian.PutUint64(b, v)
+}
+`,
+               []string{"\tBSWAPQ\t"},
+       },
+       {"amd64", "linux", `
+import "encoding/binary"
 func f(b []byte) uint32 {
        return binary.BigEndian.Uint32(b)
 }
@@ -186,6 +194,14 @@ import "encoding/binary"
 func f(b []byte, i int) uint32 {
        return binary.BigEndian.Uint32(b[i:])
 }
+`,
+               []string{"\tBSWAPL\t"},
+       },
+       {"amd64", "linux", `
+import "encoding/binary"
+func f(b []byte, v uint32) {
+       binary.BigEndian.PutUint32(b, v)
+}
 `,
                []string{"\tBSWAPL\t"},
        },
@@ -205,6 +221,19 @@ func f(b []byte, i int) uint32 {
 `,
                []string{"\tMOVL\t\\(.*\\)\\(.*\\*1\\),"},
        },
+
+       // Structure zeroing.  See issue #18370.
+       {"amd64", "linux", `
+type T struct {
+       a, b, c int
+}
+func f(t *T) {
+       *t = T{}
+}
+`,
+               []string{"\tMOVQ\t\\$0, \\(.*\\)", "\tMOVQ\t\\$0, 8\\(.*\\)", "\tMOVQ\t\\$0, 16\\(.*\\)"},
+       },
+       // TODO: add a test for *t = T{3,4,5} when we fix that.
 }
 
 // mergeEnvLists merges the two environment lists such that