From bac6a2925c50964e9387da5d37f2f23d4e5e7ac4 Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Tue, 9 Oct 2018 06:56:49 +0000 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- test/codegen/memcombine.go | 40 +++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go index 9c4b36818e2..230aadfb74a 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" }