aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2018-10-09 06:56:49 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2018-10-11 15:14:06 +0000
commitbac6a2925c50964e9387da5d37f2f23d4e5e7ac4 (patch)
treef0551149b8d892ad1f26e992c7ec14ada94b3163
parent1d0e94b1e13d5e8a323a63cd1cc1ef95290c9c36 (diff)
downloadgo-bac6a2925c50964e9387da5d37f2f23d4e5e7ac4.tar.xz
test/codegen: add more arm64 test cases
This CL adds 3 combined load test cases for arm64. Change-Id: I2c67308c40fd8a18f9f2d16c6d12911dcdc583e2 Reviewed-on: https://go-review.googlesource.com/c/140700 Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--test/codegen/memcombine.go40
1 files changed, 18 insertions, 22 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index 9c4b36818e..230aadfb74 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -468,6 +468,24 @@ func store_be_byte_2_idx2(b []byte, idx int, val uint16) {
b[(idx<<1)+0], b[(idx<<1)+1] = byte(val>>8), byte(val)
}
+func store_le_byte_2_idx2(b []byte, idx int, val uint16) {
+ _, _ = b[(idx<<1)+0], b[(idx<<1)+1]
+ // arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+<<1\)`,-`MOVB`
+ b[(idx<<1)+1], b[(idx<<1)+0] = byte(val>>8), byte(val)
+}
+
+func store_be_byte_4_idx4(b []byte, idx int, val uint32) {
+ _, _, _, _ = b[(idx<<2)+0], b[(idx<<2)+1], b[(idx<<2)+2], b[(idx<<2)+3]
+ // arm64:`REVW`,`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`MOVB`,-`MOVH`,-`REV16W`
+ b[(idx<<2)+0], b[(idx<<2)+1], b[(idx<<2)+2], b[(idx<<2)+3] = byte(val>>24), byte(val>>16), byte(val>>8), byte(val)
+}
+
+func store_le_byte_4_idx4_inv(b []byte, idx int, val uint32) {
+ _, _, _, _ = b[(idx<<2)+0], b[(idx<<2)+1], b[(idx<<2)+2], b[(idx<<2)+3]
+ // arm64:`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`MOVB`,-`MOVH`
+ b[(idx<<2)+3], b[(idx<<2)+2], b[(idx<<2)+1], b[(idx<<2)+0] = byte(val>>24), byte(val>>16), byte(val>>8), byte(val)
+}
+
// ------------- //
// Zeroing //
// ------------- //
@@ -501,28 +519,6 @@ func zero_byte_16(b []byte) {
b[12], b[13], b[14], b[15] = 0, 0, 0, 0 // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
}
-/* TODO: enable them when corresponding optimization are implemented
-func zero_byte_4_idx(b []byte, idx int) {
- // arm64(DISABLED): `MOVW\sZR,\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`MOV[BH]`
- b[(idx<<2)+0] = 0
- b[(idx<<2)+1] = 0
- b[(idx<<2)+2] = 0
- b[(idx<<2)+3] = 0
-}
-
-func zero_byte_8_idx(b []byte, idx int) {
- // arm64(DISABLED): `MOVD\sZR,\s\(R[0-9]+\)\(R[0-9]+<<3\)`,-`MOV[BHW]`
- b[(idx<<3)+0] = 0
- b[(idx<<3)+1] = 0
- b[(idx<<3)+2] = 0
- b[(idx<<3)+3] = 0
- b[(idx<<3)+4] = 0
- b[(idx<<3)+5] = 0
- b[(idx<<3)+6] = 0
- b[(idx<<3)+7] = 0
-}
-*/
-
func zero_byte_30(a *[30]byte) {
*a = [30]byte{} // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
}