2018-03-03 08:00:43 -07:00
// asmcheck
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package codegen
2018-04-11 09:03:14 -06:00
import (
"encoding/binary"
"runtime"
)
2018-03-03 08:00:43 -07:00
2018-03-30 06:15:15 -06:00
// ------------- //
// Loading //
// ------------- //
2022-04-04 02:32:29 -06:00
func load_le64 ( b [ ] byte ) uint64 {
2019-02-06 15:12:36 -07:00
// amd64:`MOVQ\s\(.*\),`,-`MOV[BWL]\t[^$]`,-`OR`
2018-03-03 08:00:43 -07:00
// s390x:`MOVDBR\s\(.*\),`
2018-04-16 08:04:26 -06:00
// arm64:`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]`
2018-03-03 08:00:43 -07:00
// ppc64le:`MOVD\s`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVDBR\s`,-`MOV[BHW]Z`
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint64 ( b )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_le64_idx ( b [ ] byte , idx int ) uint64 {
2019-02-06 15:12:36 -07:00
// amd64:`MOVQ\s\(.*\)\(.*\*1\),`,-`MOV[BWL]\t[^$]`,-`OR`
2018-03-03 08:00:43 -07:00
// s390x:`MOVDBR\s\(.*\)\(.*\*1\),`
2018-04-16 08:04:26 -06:00
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[BHW]`
2018-03-03 08:00:43 -07:00
// ppc64le:`MOVD\s`,-`MOV[BHW]Z\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVDBR\s`,-`MOV[BHW]Z\s`
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint64 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_le32 ( b [ ] byte ) uint32 {
2019-03-11 11:57:44 -06:00
// amd64:`MOVL\s\(.*\),`,-`MOV[BW]`,-`OR`
// 386:`MOVL\s\(.*\),`,-`MOV[BW]`,-`OR`
2018-03-03 08:00:43 -07:00
// s390x:`MOVWBR\s\(.*\),`
2018-04-16 08:04:26 -06:00
// arm64:`MOVWU\s\(R[0-9]+\),`,-`MOV[BH]`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVWZ\s`,-`MOV[BH]Z\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWBR\s`,-`MOV[BH]Z\s`
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint32 ( b )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_le32_idx ( b [ ] byte , idx int ) uint32 {
2019-03-11 11:57:44 -06:00
// amd64:`MOVL\s\(.*\)\(.*\*1\),`,-`MOV[BW]`,-`OR`
2020-03-24 10:45:38 -06:00
// 386:`MOVL\s\(.*\)\(.*\*1\),`,-`MOV[BW]`,-`OR`
2018-03-03 08:00:43 -07:00
// s390x:`MOVWBR\s\(.*\)\(.*\*1\),`
2018-04-16 08:04:26 -06:00
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[BH]`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVWZ\s`,-`MOV[BH]Z\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWBR\s`,-`MOV[BH]Z\s'
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint32 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_le16 ( b [ ] byte ) uint16 {
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\(.*\),`,-`MOVB`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVHZ\s`,-`MOVBZ`
2018-04-16 08:04:26 -06:00
// arm64:`MOVHU\s\(R[0-9]+\),`,-`MOVB`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHBR\s\(.*\),`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHBR\s`,-`MOVBZ`
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint16 ( b )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_le16_idx ( b [ ] byte , idx int ) uint16 {
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\(.*\),`,-`MOVB`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVHZ\s`,-`MOVBZ`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHBR\s`,-`MOVBZ`
2018-04-16 08:04:26 -06:00
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOVB`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHBR\s\(.*\)\(.*\*1\),`
2022-04-04 02:32:29 -06:00
return binary . LittleEndian . Uint16 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_be64 ( b [ ] byte ) uint64 {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR`
// amd64/v3:`MOVBEQ`
2018-03-03 08:00:43 -07:00
// s390x:`MOVD\s\(.*\),`
2018-04-16 08:04:26 -06:00
// arm64:`REV`,`MOVD\s\(R[0-9]+\),`,-`MOV[BHW]`,-`REVW`,-`REV16W`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVDBR`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD`,-`MOV[BHW]Z`
2022-04-04 02:32:29 -06:00
return binary . BigEndian . Uint64 ( b )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_be64_idx ( b [ ] byte , idx int ) uint64 {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR`
2022-03-24 08:53:41 -06:00
// amd64/v3: `MOVBEQ\t\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
2018-03-03 08:00:43 -07:00
// s390x:`MOVD\s\(.*\)\(.*\*1\),`
2018-04-16 08:04:26 -06:00
// arm64:`REV`,`MOVD\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[WHB]`,-`REVW`,-`REV16W`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVDBR`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD`,-`MOV[BHW]Z`
2022-04-04 02:32:29 -06:00
return binary . BigEndian . Uint64 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_be32 ( b [ ] byte ) uint32 {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPL`,-`MOV[BW]`,-`OR`
// amd64/v3: `MOVBEL`
2018-03-03 08:00:43 -07:00
// s390x:`MOVWZ\s\(.*\),`
2018-04-16 08:04:26 -06:00
// arm64:`REVW`,`MOVWU\s\(R[0-9]+\),`,-`MOV[BH]`,-`REV16W`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVWBR`,-`MOV[BH]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWZ`,-MOV[BH]Z`
2022-04-04 02:32:29 -06:00
return binary . BigEndian . Uint32 ( b )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func load_be32_idx ( b [ ] byte , idx int ) uint32 {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPL`,-`MOV[BW]`,-`OR`
2022-03-24 08:53:41 -06:00
// amd64/v3: `MOVBEL\t\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*`
2018-03-03 08:00:43 -07:00
// s390x:`MOVWZ\s\(.*\)\(.*\*1\),`
2018-04-16 08:04:26 -06:00
// arm64:`REVW`,`MOVWU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOV[HB]`,-`REV16W`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVWBR`,-`MOV[BH]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWZ`,-MOV[BH]Z`
2022-04-04 02:32:29 -06:00
return binary . BigEndian . Uint32 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2022-03-30 05:27:21 -06:00
func load_be16 ( b [ ] byte ) uint16 {
2019-03-11 11:57:44 -06:00
// amd64:`ROLW\s\$8`,-`MOVB`,-`OR`
2018-05-18 01:19:17 -06:00
// arm64:`REV16W`,`MOVHU\s\(R[0-9]+\),`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHBR`,-`MOVBZ`
// ppc64:`MOVHZ`,-`MOVBZ`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHZ\s\(.*\),`,-`OR`,-`ORW`,-`SLD`,-`SLW`
2022-03-30 05:27:21 -06:00
return binary . BigEndian . Uint16 ( b )
2018-03-03 08:00:43 -07:00
}
2022-03-30 05:27:21 -06:00
func load_be16_idx ( b [ ] byte , idx int ) uint16 {
2019-03-11 11:57:44 -06:00
// amd64:`ROLW\s\$8`,-`MOVB`,-`OR`
2018-05-18 01:19:17 -06:00
// arm64:`REV16W`,`MOVHU\s\(R[0-9]+\)\(R[0-9]+\),`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHBR`,-`MOVBZ`
// ppc64:`MOVHZ`,-`MOVBZ`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHZ\s\(.*\)\(.*\*1\),`,-`OR`,-`ORW`,-`SLD`,-`SLW`
2022-03-30 05:27:21 -06:00
return binary . BigEndian . Uint16 ( b [ idx : ] )
2018-03-03 08:00:43 -07:00
}
2018-05-18 01:19:17 -06:00
func load_le_byte2_uint16 ( s [ ] byte ) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB`
2019-03-11 11:57:44 -06:00
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVHZ\t\(R[0-9]+\)`,-`MOVBZ`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHBR`,-`MOVBZ`
2018-04-11 09:03:14 -06:00
return uint16 ( s [ 0 ] ) | uint16 ( s [ 1 ] ) << 8
}
2018-07-08 04:02:47 -06:00
func load_le_byte2_uint16_inv ( s [ ] byte ) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,-`ORR`,-`MOVB`
2019-03-11 11:57:44 -06:00
// 386:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
// amd64:`MOVWLZX\s\([A-Z]+\)`,-`MOVB`,-`OR`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHZ\t\(R[0-9]+\)`,-`MOVBZ`
// ppc64:`MOVHBR`,-`MOVBZ`
2018-07-08 04:02:47 -06:00
return uint16 ( s [ 1 ] ) << 8 | uint16 ( s [ 0 ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte4_uint32 ( s [ ] byte ) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
2019-03-11 11:57:44 -06:00
// 386:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
// amd64:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVWZ\t\(R[0-9]+\)`,-`MOV[BH]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWBR`,-MOV[BH]Z`
2018-05-18 01:19:17 -06:00
return uint32 ( s [ 0 ] ) | uint32 ( s [ 1 ] ) << 8 | uint32 ( s [ 2 ] ) << 16 | uint32 ( s [ 3 ] ) << 24
}
2018-07-08 04:02:47 -06:00
func load_le_byte4_uint32_inv ( s [ ] byte ) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWZ`,-`MOV[BH]Z`
// ppc64:`MOVWBR`,-`MOV[BH]Z`
2018-07-08 04:02:47 -06:00
return uint32 ( s [ 3 ] ) << 24 | uint32 ( s [ 2 ] ) << 16 | uint32 ( s [ 1 ] ) << 8 | uint32 ( s [ 0 ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte8_uint64 ( s [ ] byte ) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
2019-02-06 15:12:36 -07:00
// amd64:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,-`MOV[BWL]\t[^$]`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVD\t\(R[0-9]+\)`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVDBR`,-`MOVW[WHB]Z`
2018-05-18 01:19:17 -06:00
return uint64 ( s [ 0 ] ) | uint64 ( s [ 1 ] ) << 8 | uint64 ( s [ 2 ] ) << 16 | uint64 ( s [ 3 ] ) << 24 | uint64 ( s [ 4 ] ) << 32 | uint64 ( s [ 5 ] ) << 40 | uint64 ( s [ 6 ] ) << 48 | uint64 ( s [ 7 ] ) << 56
}
2018-07-08 04:02:47 -06:00
func load_le_byte8_uint64_inv ( s [ ] byte ) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVD`,-`MOV[WHB]Z`
// ppc64:`MOVDBR`,-`MOV[WHB]Z`
2018-07-08 04:02:47 -06:00
return uint64 ( s [ 7 ] ) << 56 | uint64 ( s [ 6 ] ) << 48 | uint64 ( s [ 5 ] ) << 40 | uint64 ( s [ 4 ] ) << 32 | uint64 ( s [ 3 ] ) << 24 | uint64 ( s [ 2 ] ) << 16 | uint64 ( s [ 1 ] ) << 8 | uint64 ( s [ 0 ] )
}
2018-05-18 01:19:17 -06:00
func load_be_byte2_uint16 ( s [ ] byte ) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
2020-03-27 23:03:33 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVHBR\t\(R[0-9]+\)`,-`MOVBZ`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHZ`,-`MOVBZ`
2018-05-18 01:19:17 -06:00
return uint16 ( s [ 0 ] ) << 8 | uint16 ( s [ 1 ] )
}
2018-07-08 04:02:47 -06:00
func load_be_byte2_uint16_inv ( s [ ] byte ) uint16 {
// arm64:`MOVHU\t\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
2020-03-27 23:03:33 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)`,`ROLW`,-`MOVB`,-`OR`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVHBR\t\(R[0-9]+\)`,-`MOVBZ`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHZ`,-`MOVBZ`
2018-07-08 04:02:47 -06:00
return uint16 ( s [ 1 ] ) | uint16 ( s [ 0 ] ) << 8
}
2018-05-18 01:19:17 -06:00
func load_be_byte4_uint32 ( s [ ] byte ) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWBR`,-`MOV[HB]Z`
// ppc64:`MOVWZ`,-`MOV[HB]Z`
2018-05-18 01:19:17 -06:00
return uint32 ( s [ 0 ] ) << 24 | uint32 ( s [ 1 ] ) << 16 | uint32 ( s [ 2 ] ) << 8 | uint32 ( s [ 3 ] )
}
2018-07-08 04:02:47 -06:00
func load_be_byte4_uint32_inv ( s [ ] byte ) uint32 {
// arm64:`MOVWU\t\(R[0-9]+\)`,`REVW`,-`ORR`,-`REV16W`,-`MOV[BH]`
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`MOVL\s\([A-Z]+\)`,`BSWAPL`,-`MOV[BW]`,-`OR`
// amd64/v3: `MOVBEL`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWBR`,-`MOV[HB]Z`
// ppc64:`MOVWZ`,-`MOV[HB]Z`
2018-07-08 04:02:47 -06:00
return uint32 ( s [ 3 ] ) | uint32 ( s [ 2 ] ) << 8 | uint32 ( s [ 1 ] ) << 16 | uint32 ( s [ 0 ] ) << 24
}
2018-05-18 01:19:17 -06:00
func load_be_byte8_uint64 ( s [ ] byte ) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVDBR\t\(R[0-9]+\)`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD`,-`MOV[WHB]Z`
2018-05-18 01:19:17 -06:00
return uint64 ( s [ 0 ] ) << 56 | uint64 ( s [ 1 ] ) << 48 | uint64 ( s [ 2 ] ) << 40 | uint64 ( s [ 3 ] ) << 32 | uint64 ( s [ 4 ] ) << 24 | uint64 ( s [ 5 ] ) << 16 | uint64 ( s [ 6 ] ) << 8 | uint64 ( s [ 7 ] )
}
2018-07-08 04:02:47 -06:00
func load_be_byte8_uint64_inv ( s [ ] byte ) uint64 {
// arm64:`MOVD\t\(R[0-9]+\)`,`REV`,-`ORR`,-`REVW`,-`REV16W`,-`MOV[BHW]`
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`MOVQ\s\([A-Z]+\),\s[A-Z]+`,`BSWAPQ`,-`MOV[BWL]\t[^$]`,-`OR`
// amd64/v3: `MOVBEQ`
2019-05-01 07:56:11 -06:00
// ppc64le:`MOVDBR\t\(R[0-9]+\)`,-`MOV[BHW]Z`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD`,-`MOV[BHW]Z`
2018-07-08 04:02:47 -06:00
return uint64 ( s [ 7 ] ) | uint64 ( s [ 6 ] ) << 8 | uint64 ( s [ 5 ] ) << 16 | uint64 ( s [ 4 ] ) << 24 | uint64 ( s [ 3 ] ) << 32 | uint64 ( s [ 2 ] ) << 40 | uint64 ( s [ 1 ] ) << 48 | uint64 ( s [ 0 ] ) << 56
}
2018-05-18 01:19:17 -06:00
func load_le_byte2_uint16_idx ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOVB`
2020-03-24 10:45:38 -06:00
// 386:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`ORL`,-`MOVB`
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`MOVB`,-`OR`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHZ`,-`MOVBZ`
// ppc64:`MOVHBR`,-`MOVBZ`
2018-05-18 01:19:17 -06:00
return uint16 ( s [ idx ] ) | uint16 ( s [ idx + 1 ] ) << 8
}
2018-07-08 04:02:47 -06:00
func load_le_byte2_uint16_idx_inv ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOVB`
2020-03-24 10:45:38 -06:00
// 386:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`ORL`,-`MOVB`
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`MOVB`,-`OR`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHZ`,-`MOVBZ`
// ppc64:`MOVHBR`,-`MOVBZ`
2018-07-08 04:02:47 -06:00
return uint16 ( s [ idx + 1 ] ) << 8 | uint16 ( s [ idx ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte4_uint32_idx ( s [ ] byte , idx int ) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
2019-03-11 11:57:44 -06:00
// amd64:`MOVL\s\([A-Z]+\)\([A-Z]+`,-`MOV[BW]`,-`OR`
2018-05-18 01:19:17 -06:00
return uint32 ( s [ idx ] ) | uint32 ( s [ idx + 1 ] ) << 8 | uint32 ( s [ idx + 2 ] ) << 16 | uint32 ( s [ idx + 3 ] ) << 24
}
2018-07-08 04:02:47 -06:00
func load_le_byte4_uint32_idx_inv ( s [ ] byte , idx int ) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BH]`
return uint32 ( s [ idx + 3 ] ) << 24 | uint32 ( s [ idx + 2 ] ) << 16 | uint32 ( s [ idx + 1 ] ) << 8 | uint32 ( s [ idx ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte8_uint64_idx ( s [ ] byte , idx int ) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
2019-03-11 11:57:44 -06:00
// amd64:`MOVQ\s\([A-Z]+\)\([A-Z]+`,-`MOV[BWL]`,-`OR`
2018-05-18 01:19:17 -06:00
return uint64 ( s [ idx ] ) | uint64 ( s [ idx + 1 ] ) << 8 | uint64 ( s [ idx + 2 ] ) << 16 | uint64 ( s [ idx + 3 ] ) << 24 | uint64 ( s [ idx + 4 ] ) << 32 | uint64 ( s [ idx + 5 ] ) << 40 | uint64 ( s [ idx + 6 ] ) << 48 | uint64 ( s [ idx + 7 ] ) << 56
}
2018-07-08 04:02:47 -06:00
func load_le_byte8_uint64_idx_inv ( s [ ] byte , idx int ) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\)`,-`ORR`,-`MOV[BHW]`
return uint64 ( s [ idx + 7 ] ) << 56 | uint64 ( s [ idx + 6 ] ) << 48 | uint64 ( s [ idx + 5 ] ) << 40 | uint64 ( s [ idx + 4 ] ) << 32 | uint64 ( s [ idx + 3 ] ) << 24 | uint64 ( s [ idx + 2 ] ) << 16 | uint64 ( s [ idx + 1 ] ) << 8 | uint64 ( s [ idx ] )
}
2018-05-18 01:19:17 -06:00
func load_be_byte2_uint16_idx ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`MOVB`,-`OR`
2018-05-18 01:19:17 -06:00
return uint16 ( s [ idx ] ) << 8 | uint16 ( s [ idx + 1 ] )
}
2018-07-08 04:02:47 -06:00
func load_be_byte2_uint16_idx_inv ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`ORR`,-`MOVB`
2019-03-11 11:57:44 -06:00
// amd64:`MOVWLZX\s\([A-Z]+\)\([A-Z]+`,-`MOVB`,-`OR`
2018-07-08 04:02:47 -06:00
return uint16 ( s [ idx + 1 ] ) | uint16 ( s [ idx ] ) << 8
}
2018-05-18 01:19:17 -06:00
func load_be_byte4_uint32_idx ( s [ ] byte , idx int ) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+\)`,`REVW`,-`ORR`,-`MOV[BH]`,-`REV16W`
return uint32 ( s [ idx ] ) << 24 | uint32 ( s [ idx + 1 ] ) << 16 | uint32 ( s [ idx + 2 ] ) << 8 | uint32 ( s [ idx + 3 ] )
}
func load_be_byte8_uint64_idx ( s [ ] byte , idx int ) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+\)`,`REV`,-`ORR`,-`MOV[BHW]`,-`REVW`,-`REV16W`
return uint64 ( s [ idx ] ) << 56 | uint64 ( s [ idx + 1 ] ) << 48 | uint64 ( s [ idx + 2 ] ) << 40 | uint64 ( s [ idx + 3 ] ) << 32 | uint64 ( s [ idx + 4 ] ) << 24 | uint64 ( s [ idx + 5 ] ) << 16 | uint64 ( s [ idx + 6 ] ) << 8 | uint64 ( s [ idx + 7 ] )
}
func load_le_byte2_uint16_idx2 ( s [ ] byte , idx int ) uint16 {
2018-04-21 18:51:00 -06:00
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+<<1\)`,-`ORR`,-`MOVB`
return uint16 ( s [ idx << 1 ] ) | uint16 ( s [ ( idx << 1 ) + 1 ] ) << 8
}
2018-07-08 04:02:47 -06:00
func load_le_byte2_uint16_idx2_inv ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+<<1\)`,-`ORR`,-`MOVB`
return uint16 ( s [ ( idx << 1 ) + 1 ] ) << 8 | uint16 ( s [ idx << 1 ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte4_uint32_idx4 ( s [ ] byte , idx int ) uint32 {
2018-04-21 18:51:00 -06:00
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`ORR`,-`MOV[BH]`
return uint32 ( s [ idx << 2 ] ) | uint32 ( s [ ( idx << 2 ) + 1 ] ) << 8 | uint32 ( s [ ( idx << 2 ) + 2 ] ) << 16 | uint32 ( s [ ( idx << 2 ) + 3 ] ) << 24
}
2018-07-08 04:02:47 -06:00
func load_le_byte4_uint32_idx4_inv ( s [ ] byte , idx int ) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`ORR`,-`MOV[BH]`
return uint32 ( s [ ( idx << 2 ) + 3 ] ) << 24 | uint32 ( s [ ( idx << 2 ) + 2 ] ) << 16 | uint32 ( s [ ( idx << 2 ) + 1 ] ) << 8 | uint32 ( s [ idx << 2 ] )
}
2018-05-18 01:19:17 -06:00
func load_le_byte8_uint64_idx8 ( s [ ] byte , idx int ) uint64 {
2018-04-21 18:51:00 -06:00
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+<<3\)`,-`ORR`,-`MOV[BHW]`
return uint64 ( s [ idx << 3 ] ) | uint64 ( s [ ( idx << 3 ) + 1 ] ) << 8 | uint64 ( s [ ( idx << 3 ) + 2 ] ) << 16 | uint64 ( s [ ( idx << 3 ) + 3 ] ) << 24 | uint64 ( s [ ( idx << 3 ) + 4 ] ) << 32 | uint64 ( s [ ( idx << 3 ) + 5 ] ) << 40 | uint64 ( s [ ( idx << 3 ) + 6 ] ) << 48 | uint64 ( s [ ( idx << 3 ) + 7 ] ) << 56
}
2018-07-08 04:02:47 -06:00
func load_le_byte8_uint64_idx8_inv ( s [ ] byte , idx int ) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+<<3\)`,-`ORR`,-`MOV[BHW]`
return uint64 ( s [ ( idx << 3 ) + 7 ] ) << 56 | uint64 ( s [ ( idx << 3 ) + 6 ] ) << 48 | uint64 ( s [ ( idx << 3 ) + 5 ] ) << 40 | uint64 ( s [ ( idx << 3 ) + 4 ] ) << 32 | uint64 ( s [ ( idx << 3 ) + 3 ] ) << 24 | uint64 ( s [ ( idx << 3 ) + 2 ] ) << 16 | uint64 ( s [ ( idx << 3 ) + 1 ] ) << 8 | uint64 ( s [ idx << 3 ] )
}
2018-05-18 01:19:17 -06:00
func load_be_byte2_uint16_idx2 ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+<<1\)`,`REV16W`,-`ORR`,-`MOVB`
return uint16 ( s [ idx << 1 ] ) << 8 | uint16 ( s [ ( idx << 1 ) + 1 ] )
}
2018-07-08 04:02:47 -06:00
func load_be_byte2_uint16_idx2_inv ( s [ ] byte , idx int ) uint16 {
// arm64:`MOVHU\s\(R[0-9]+\)\(R[0-9]+<<1\)`,`REV16W`,-`ORR`,-`MOVB`
return uint16 ( s [ ( idx << 1 ) + 1 ] ) | uint16 ( s [ idx << 1 ] ) << 8
}
2018-05-18 01:19:17 -06:00
func load_be_byte4_uint32_idx4 ( s [ ] byte , idx int ) uint32 {
// arm64:`MOVWU\s\(R[0-9]+\)\(R[0-9]+<<2\)`,`REVW`,-`ORR`,-`MOV[BH]`,-`REV16W`
return uint32 ( s [ idx << 2 ] ) << 24 | uint32 ( s [ ( idx << 2 ) + 1 ] ) << 16 | uint32 ( s [ ( idx << 2 ) + 2 ] ) << 8 | uint32 ( s [ ( idx << 2 ) + 3 ] )
}
func load_be_byte8_uint64_idx8 ( s [ ] byte , idx int ) uint64 {
// arm64:`MOVD\s\(R[0-9]+\)\(R[0-9]+<<3\)`,`REV`,-`ORR`,-`MOV[BHW]`,-`REVW`,-`REV16W`
return uint64 ( s [ idx << 3 ] ) << 56 | uint64 ( s [ ( idx << 3 ) + 1 ] ) << 48 | uint64 ( s [ ( idx << 3 ) + 2 ] ) << 40 | uint64 ( s [ ( idx << 3 ) + 3 ] ) << 32 | uint64 ( s [ ( idx << 3 ) + 4 ] ) << 24 | uint64 ( s [ ( idx << 3 ) + 5 ] ) << 16 | uint64 ( s [ ( idx << 3 ) + 6 ] ) << 8 | uint64 ( s [ ( idx << 3 ) + 7 ] )
}
2023-05-09 14:25:40 -06:00
// Some tougher cases for the memcombine pass.
func reassoc_load_uint32 ( b [ ] byte ) uint32 {
// amd64:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
return ( uint32 ( b [ 0 ] ) | uint32 ( b [ 1 ] ) << 8 ) | ( uint32 ( b [ 2 ] ) << 16 | uint32 ( b [ 3 ] ) << 24 )
}
func extrashift_load_uint32 ( b [ ] byte ) uint32 {
// amd64:`MOVL\s\([A-Z]+\)`,`SHLL\s[$]2`,-`MOV[BW]`,-`OR`
return uint32 ( b [ 0 ] ) << 2 | uint32 ( b [ 1 ] ) << 10 | uint32 ( b [ 2 ] ) << 18 | uint32 ( b [ 3 ] ) << 26
}
func outoforder_load_uint32 ( b [ ] byte ) uint32 {
// amd64:`MOVL\s\([A-Z]+\)`,-`MOV[BW]`,-`OR`
return uint32 ( b [ 0 ] ) | uint32 ( b [ 2 ] ) << 16 | uint32 ( b [ 1 ] ) << 8 | uint32 ( b [ 3 ] ) << 24
}
func extraOr_load_uint32 ( b [ ] byte , x , y uint32 ) uint32 {
// amd64:`ORL\s\([A-Z]+\)`,-`MOV[BW]`
return x | binary . LittleEndian . Uint32 ( b ) | y
// TODO: Note that
// x | uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 | y
// doesn't work because it associates in a way that memcombine can't detect it.
}
2018-04-09 01:52:40 -06:00
// Check load combining across function calls.
2021-04-12 12:00:49 -06:00
func fcall_byte ( a [ 2 ] byte ) [ 2 ] byte {
return fcall_byte ( fcall_byte ( a ) ) // amd64:`MOVW`
2018-04-09 01:52:40 -06:00
}
2021-04-12 12:00:49 -06:00
func fcall_uint16 ( a [ 2 ] uint16 ) [ 2 ] uint16 {
return fcall_uint16 ( fcall_uint16 ( a ) ) // amd64:`MOVL`
2018-04-09 01:52:40 -06:00
}
2021-04-12 12:00:49 -06:00
func fcall_uint32 ( a [ 2 ] uint32 ) [ 2 ] uint32 {
return fcall_uint32 ( fcall_uint32 ( a ) ) // amd64:`MOVQ`
2018-04-09 01:52:40 -06:00
}
// We want to merge load+op in the first function, but not in the
// second. See Issue 19595.
func load_op_merge ( p , q * int ) {
2019-10-09 16:06:06 -06:00
x := * p // amd64:`ADDQ\t\(`
* q += x // The combined nilcheck and load would normally have this line number, but we want that combined operation to have the line number of the nil check instead (see #33724).
2018-04-09 01:52:40 -06:00
}
func load_op_no_merge ( p , q * int ) {
x := * p
for i := 0 ; i < 10 ; i ++ {
* q += x // amd64:`ADDQ\t[A-Z]`
}
}
// Make sure offsets are folded into loads and stores.
func offsets_fold ( _ , a [ 20 ] byte ) ( b [ 20 ] byte ) {
cmd/compile: set LocalPkg.Path to -p flag
Since CL 391014, cmd/compile now requires the -p flag to be set the
build system. This CL changes it to initialize LocalPkg.Path to the
provided path, rather than relying on writing out `"".` into object
files and expecting cmd/link to substitute them.
However, this actually involved a rather long tail of fixes. Many have
already been submitted, but a few notable ones that have to land
simultaneously with changing LocalPkg:
1. When compiling package runtime, there are really two "runtime"
packages: types.LocalPkg (the source package itself) and
ir.Pkgs.Runtime (the compiler's internal representation, for synthetic
references). Previously, these ended up creating separate link
symbols (`"".xxx` and `runtime.xxx`, respectively), but now they both
end up as `runtime.xxx`, which causes lsym collisions (notably
inittask and funcsyms).
2. test/codegen tests need to be updated to expect symbols to be named
`command-line-arguments.xxx` rather than `"".foo`.
3. The issue20014 test case is sensitive to the sort order of field
tracking symbols. In particular, the local package now sorts to its
natural place in the list, rather than to the front.
Thanks to David Chase for helping track down all of the fixes needed
for this CL.
Updates #51734.
Change-Id: Iba3041cf7ad967d18c6e17922fa06ba11798b565
Reviewed-on: https://go-review.googlesource.com/c/go/+/393715
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-03-17 14:27:40 -06:00
// arm64:`MOVD\tcommand-line-arguments\.a\+[0-9]+\(FP\), R[0-9]+`,`MOVD\tR[0-9]+, command-line-arguments\.b\+[0-9]+\(FP\)`
2018-04-09 01:52:40 -06:00
b = a
return
}
2018-04-11 09:03:14 -06:00
// 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`
}
2018-03-30 06:15:15 -06:00
// ------------- //
// Storing //
// ------------- //
2022-04-04 02:32:29 -06:00
func store_le64 ( b [ ] byte , x uint64 ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVQ\s.*\(.*\)$`,-`SHR.`
// arm64:`MOVD`,-`MOV[WBH]`
// ppc64le:`MOVD\s`,-`MOV[BHW]\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVDBR`,-MOVB\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVDBR\s.*\(.*\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint64 ( b , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_le64_idx ( b [ ] byte , x uint64 , idx int ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVQ\s.*\(.*\)\(.*\*1\)$`,-`SHR.`
2018-04-16 08:04:26 -06:00
// arm64:`MOVD\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BHW]`
2018-03-03 08:00:43 -07:00
// ppc64le:`MOVD\s`,-`MOV[BHW]\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVDBR`,-`MOVBZ`
2019-04-25 07:41:46 -06:00
// s390x:`MOVDBR\s.*\(.*\)\(.*\*1\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint64 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2022-08-05 08:01:57 -06:00
func store_le64_idx2 ( dst [ ] byte , d , length , offset int ) [ ] byte {
a := dst [ d : d + length ]
b := dst [ d - offset : ]
// amd64:`MOVQ\s.*\(.*\)\(.*\*1\)$`,-`SHR.`
binary . LittleEndian . PutUint64 ( a , binary . LittleEndian . Uint64 ( b ) )
return dst
}
2022-06-10 05:06:30 -06:00
func store_le64_idx_const ( b [ ] byte , idx int ) {
// amd64:`MOVQ\s\$123, \(.*\)\(.*\*1\)$`
binary . LittleEndian . PutUint64 ( b [ idx : ] , 123 )
}
2020-12-30 10:41:36 -07:00
func store_le64_load ( b [ ] byte , x * [ 8 ] byte ) {
_ = b [ 8 ]
// amd64:-`MOV[BWL]`
// arm64:-`MOV[BWH]`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVD\s`,-`MOV[BWH]Z`
// ppc64:`MOVDBR`
2020-12-30 10:41:36 -07:00
// s390x:-`MOVB`,-`MOV[WH]BR`
binary . LittleEndian . PutUint64 ( b , binary . LittleEndian . Uint64 ( x [ : ] ) )
}
2022-04-04 02:32:29 -06:00
func store_le32 ( b [ ] byte , x uint32 ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVL\s`
2018-03-04 20:50:25 -07:00
// arm64:`MOVW`,-`MOV[BH]`
2018-03-03 08:00:43 -07:00
// ppc64le:`MOVW\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWBR`
2019-04-25 07:41:46 -06:00
// s390x:`MOVWBR\s.*\(.*\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint32 ( b , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_le32_idx ( b [ ] byte , x uint32 , idx int ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVL\s`
2018-04-16 08:04:26 -06:00
// arm64:`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BH]`
2018-03-03 08:00:43 -07:00
// ppc64le:`MOVW\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVWBR`
2019-04-25 07:41:46 -06:00
// s390x:`MOVWBR\s.*\(.*\)\(.*\*1\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint32 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2022-06-10 05:06:30 -06:00
func store_le32_idx_const ( b [ ] byte , idx int ) {
// amd64:`MOVL\s\$123, \(.*\)\(.*\*1\)$`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVW\s`,-MOV[HB]`
2022-06-10 05:06:30 -06:00
binary . LittleEndian . PutUint32 ( b [ idx : ] , 123 )
}
2022-04-04 02:32:29 -06:00
func store_le16 ( b [ ] byte , x uint16 ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVW\s`
2018-03-04 20:50:25 -07:00
// arm64:`MOVH`,-`MOVB`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVH\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHBR`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHBR\s.*\(.*\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint16 ( b , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_le16_idx ( b [ ] byte , x uint16 , idx int ) {
2018-03-03 08:00:43 -07:00
// amd64:`MOVW\s`
2018-04-16 08:04:26 -06:00
// arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVH\s`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVHBR\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVHBR\s.*\(.*\)\(.*\*1\)$`
2022-04-04 02:32:29 -06:00
binary . LittleEndian . PutUint16 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2022-06-10 05:06:30 -06:00
func store_le16_idx_const ( b [ ] byte , idx int ) {
// amd64:`MOVW\s\$123, \(.*\)\(.*\*1\)$`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVH\s`
2022-06-10 05:06:30 -06:00
binary . LittleEndian . PutUint16 ( b [ idx : ] , 123 )
}
2022-04-04 02:32:29 -06:00
func store_be64 ( b [ ] byte , x uint64 ) {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPQ`,-`SHR.`
// amd64/v3: `MOVBEQ`
2018-04-16 08:04:26 -06:00
// arm64:`MOVD`,`REV`,-`MOV[WBH]`,-`REVW`,-`REV16W`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVDBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVD\s.*\(.*\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint64 ( b , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_be64_idx ( b [ ] byte , x uint64 , idx int ) {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPQ`,-`SHR.`
2022-03-24 08:53:41 -06:00
// amd64/v3:`MOVBEQ\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
2018-04-16 08:04:26 -06:00
// arm64:`REV`,`MOVD\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BHW]`,-`REV16W`,-`REVW`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVDBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVD\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVD\s.*\(.*\)\(.*\*1\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint64 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_be32 ( b [ ] byte , x uint32 ) {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPL`,-`SHR.`
// amd64/v3:`MOVBEL`
2018-04-16 08:04:26 -06:00
// arm64:`MOVW`,`REVW`,-`MOV[BH]`,-`REV16W`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVWBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVW\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVW\s.*\(.*\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint32 ( b , x )
2018-03-03 08:00:43 -07:00
}
2021-05-14 10:42:16 -06:00
func store_be64_load ( b , x * [ 8 ] byte ) {
// arm64:-`REV`
// amd64:-`BSWAPQ`
binary . BigEndian . PutUint64 ( b [ : ] , binary . BigEndian . Uint64 ( x [ : ] ) )
}
func store_be32_load ( b , x * [ 8 ] byte ) {
// arm64:-`REVW`
// amd64:-`BSWAPL`
binary . BigEndian . PutUint32 ( b [ : ] , binary . BigEndian . Uint32 ( x [ : ] ) )
}
2022-04-04 02:32:29 -06:00
func store_be32_idx ( b [ ] byte , x uint32 , idx int ) {
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`BSWAPL`,-`SHR.`
2022-03-24 08:53:41 -06:00
// amd64/v3:`MOVBEL\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
2018-04-16 08:04:26 -06:00
// arm64:`REVW`,`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOV[BH]`,-`REV16W`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVWBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVW\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVW\s.*\(.*\)\(.*\*1\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint32 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_be16 ( b [ ] byte , x uint16 ) {
2022-03-30 05:27:21 -06:00
// amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.`
// amd64/v3:`MOVBEW`,-`ROLW`
2018-03-04 20:50:25 -07:00
// arm64:`MOVH`,`REV16W`,-`MOVB`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVHBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVH\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVH\s.*\(.*\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint16 ( b , x )
2018-03-03 08:00:43 -07:00
}
2022-04-04 02:32:29 -06:00
func store_be16_idx ( b [ ] byte , x uint16 , idx int ) {
2022-03-30 05:27:21 -06:00
// amd64/v1,amd64/v2:`ROLW\s\$8`,-`SHR.`
2022-03-24 08:53:41 -06:00
// amd64/v3:`MOVBEW\t[A-Z]+[0-9]*, \([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\)`
2018-04-16 08:04:26 -06:00
// arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,`REV16W`,-`MOVB`
2018-03-01 09:40:36 -07:00
// ppc64le:`MOVHBR`
2023-05-04 08:42:58 -06:00
// ppc64:`MOVH\s`
2019-04-25 07:41:46 -06:00
// s390x:`MOVH\s.*\(.*\)\(.*\*1\)$`,-`SRW\s`,-`SRD\s`
2022-04-04 02:32:29 -06:00
binary . BigEndian . PutUint16 ( b [ idx : ] , x )
2018-03-03 08:00:43 -07:00
}
2018-03-30 06:15:15 -06:00
2018-07-10 04:32:04 -06:00
func store_le_byte_2 ( b [ ] byte , val uint16 ) {
_ = b [ 2 ]
// arm64:`MOVH\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`
2018-10-14 19:19:48 -06:00
// 386:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
2018-10-17 04:24:28 -06:00
// amd64:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVH\s`,-`MOVB`
// ppc64:`MOVHBR`,-`MOVB`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] = byte ( val ) , byte ( val >> 8 )
}
2018-10-14 19:19:48 -06:00
func store_le_byte_2_inv ( b [ ] byte , val uint16 ) {
_ = b [ 2 ]
// 386:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
2018-10-17 23:11:38 -06:00
// amd64:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVH\s`,-`MOVB`
// ppc64:`MOVHBR`,-`MOVB`
2018-10-14 19:19:48 -06:00
b [ 2 ] , b [ 1 ] = byte ( val >> 8 ) , byte ( val )
}
2018-07-10 04:32:04 -06:00
func store_le_byte_4 ( b [ ] byte , val uint32 ) {
_ = b [ 4 ]
// arm64:`MOVW\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`
2018-10-17 04:24:28 -06:00
// 386:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
// amd64:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVW\s`
// ppc64:`MOVWBR\s`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] , b [ 3 ] , b [ 4 ] = byte ( val ) , byte ( val >> 8 ) , byte ( val >> 16 ) , byte ( val >> 24 )
}
func store_le_byte_8 ( b [ ] byte , val uint64 ) {
_ = b [ 8 ]
// arm64:`MOVD\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`MOVW`
2018-10-17 04:24:28 -06:00
// amd64:`MOVQ\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`,-`MOVL`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVD\s`,-`MOVW`
// ppc64:`MOVDBR\s`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] , b [ 3 ] , b [ 4 ] , b [ 5 ] , b [ 6 ] , b [ 7 ] , b [ 8 ] = byte ( val ) , byte ( val >> 8 ) , byte ( val >> 16 ) , byte ( val >> 24 ) , byte ( val >> 32 ) , byte ( val >> 40 ) , byte ( val >> 48 ) , byte ( val >> 56 )
}
func store_be_byte_2 ( b [ ] byte , val uint16 ) {
_ = b [ 2 ]
// arm64:`REV16W`,`MOVH\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`
2022-03-30 05:27:21 -06:00
// amd64/v1,amd64/v2:`MOVW\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`
// amd64/v3: `MOVBEW`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHBR`
// ppc64:`MOVH\s`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] = byte ( val >> 8 ) , byte ( val )
}
func store_be_byte_4 ( b [ ] byte , val uint32 ) {
_ = b [ 4 ]
// arm64:`REVW`,`MOVW\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`REV16W`
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`MOVL\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`
// amd64/v3:`MOVBEL\s[A-Z]+,\s1\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWBR`
// ppc64:`MOVW\s`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] , b [ 3 ] , b [ 4 ] = byte ( val >> 24 ) , byte ( val >> 16 ) , byte ( val >> 8 ) , byte ( val )
}
func store_be_byte_8 ( b [ ] byte , val uint64 ) {
_ = b [ 8 ]
// arm64:`REV`,`MOVD\sR[0-9]+,\s1\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`MOVW`,-`REV16W`,-`REVW`
2021-10-19 05:39:21 -06:00
// amd64/v1,amd64/v2:`MOVQ\s[A-Z]+,\s1\([A-Z]+\)`,-`MOVB`,-`MOVW`,-`MOVL`
// amd64/v3:`MOVBEQ\s[A-Z]+,\s1\([A-Z]+\)`, -`MOVBEL`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVDBR`
// ppc64:`MOVD`
2018-07-10 04:32:04 -06:00
b [ 1 ] , b [ 2 ] , b [ 3 ] , b [ 4 ] , b [ 5 ] , b [ 6 ] , b [ 7 ] , b [ 8 ] = byte ( val >> 56 ) , byte ( val >> 48 ) , byte ( val >> 40 ) , byte ( val >> 32 ) , byte ( val >> 24 ) , byte ( val >> 16 ) , byte ( val >> 8 ) , byte ( val )
}
func store_le_byte_2_idx ( b [ ] byte , idx int , val uint16 ) {
_ , _ = b [ idx + 0 ] , b [ idx + 1 ]
// arm64:`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`
2020-03-24 10:45:38 -06:00
// 386:`MOVW\s[A-Z]+,\s\([A-Z]+\)\([A-Z]+`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVH\s`
// ppc64:`MOVHBR`
2018-07-10 04:32:04 -06:00
b [ idx + 1 ] , b [ idx + 0 ] = byte ( val >> 8 ) , byte ( val )
}
2018-10-14 19:19:48 -06:00
func store_le_byte_2_idx_inv ( b [ ] byte , idx int , val uint16 ) {
_ , _ = b [ idx + 0 ] , b [ idx + 1 ]
2020-03-24 10:45:38 -06:00
// 386:`MOVW\s[A-Z]+,\s\([A-Z]+\)\([A-Z]+`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVH\s`
// ppc64:`MOVHBR`
2018-10-14 19:19:48 -06:00
b [ idx + 0 ] , b [ idx + 1 ] = byte ( val ) , byte ( val >> 8 )
}
2018-07-10 04:32:04 -06:00
func store_le_byte_4_idx ( b [ ] byte , idx int , val uint32 ) {
_ , _ , _ , _ = b [ idx + 0 ] , b [ idx + 1 ] , b [ idx + 2 ] , b [ idx + 3 ]
// arm64:`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`,-`MOVH`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVW\s`
// ppc64:`MOVWBR`
2018-07-10 04:32:04 -06:00
b [ idx + 3 ] , b [ idx + 2 ] , b [ idx + 1 ] , b [ idx + 0 ] = byte ( val >> 24 ) , byte ( val >> 16 ) , byte ( val >> 8 ) , byte ( val )
}
2018-05-18 01:19:17 -06:00
func store_be_byte_2_idx ( b [ ] byte , idx int , val uint16 ) {
_ , _ = b [ idx + 0 ] , b [ idx + 1 ]
// arm64:`REV16W`,`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHBR`
// ppc64:`MOVH\s`
2018-05-18 01:19:17 -06:00
b [ idx + 0 ] , b [ idx + 1 ] = byte ( val >> 8 ) , byte ( val )
}
2018-07-10 04:32:04 -06:00
func store_be_byte_4_idx ( b [ ] byte , idx int , val uint32 ) {
_ , _ , _ , _ = b [ idx + 0 ] , b [ idx + 1 ] , b [ idx + 2 ] , b [ idx + 3 ]
// arm64:`REVW`,`MOVW\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`,-`MOVH`,-`REV16W`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWBR`
// ppc64:`MOVW\s`
2018-07-10 04:32:04 -06:00
b [ idx + 0 ] , b [ idx + 1 ] , b [ idx + 2 ] , b [ idx + 3 ] = byte ( val >> 24 ) , byte ( val >> 16 ) , byte ( val >> 8 ) , byte ( val )
}
2018-05-18 01:19:17 -06:00
func store_be_byte_2_idx2 ( b [ ] byte , idx int , val uint16 ) {
_ , _ = b [ ( idx << 1 ) + 0 ] , b [ ( idx << 1 ) + 1 ]
// arm64:`REV16W`,`MOVH\sR[0-9]+,\s\(R[0-9]+\)\(R[0-9]+<<1\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVHBR`
// ppc64:`MOVH\s`
2018-05-18 01:19:17 -06:00
b [ ( idx << 1 ) + 0 ] , b [ ( idx << 1 ) + 1 ] = byte ( val >> 8 ) , byte ( val )
}
2018-10-09 00:56:49 -06:00
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`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVH\s`
// ppc64:`MOVHBR`
2018-10-09 00:56:49 -06:00
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`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVWBR`
// ppc64:`MOVW\s`
2018-10-09 00:56:49 -06:00
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`
2023-05-04 08:42:58 -06:00
// ppc64le:`MOVW\s`
// ppc64:`MOVWBR`
2018-10-09 00:56:49 -06:00
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 )
}
2018-03-30 06:15:15 -06:00
// ------------- //
// Zeroing //
// ------------- //
// Check that zero stores are combined into larger stores
2018-04-06 10:44:00 -06:00
func zero_byte_2 ( b1 , b2 [ ] byte ) {
2018-03-30 06:15:15 -06:00
// bounds checks to guarantee safety of writes below
_ , _ = b1 [ 1 ] , b2 [ 1 ]
2018-10-17 04:24:28 -06:00
// arm64:"MOVH\tZR",-"MOVB"
// amd64:`MOVW\s[$]0,\s\([A-Z]+\)`
// 386:`MOVW\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVH\s`
2018-10-17 04:24:28 -06:00
b1 [ 0 ] , b1 [ 1 ] = 0 , 0
// arm64:"MOVH\tZR",-"MOVB"
2018-10-17 23:11:38 -06:00
// 386:`MOVW\s[$]0,\s\([A-Z]+\)`
// amd64:`MOVW\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVH`
2018-10-17 04:24:28 -06:00
b2 [ 1 ] , b2 [ 0 ] = 0 , 0
2018-03-30 06:15:15 -06:00
}
2018-04-06 10:44:00 -06:00
func zero_byte_4 ( b1 , b2 [ ] byte ) {
2018-03-30 06:15:15 -06:00
_ , _ = b1 [ 3 ] , b2 [ 3 ]
2018-10-17 04:24:28 -06:00
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVW\s`
2018-10-17 04:24:28 -06:00
b1 [ 0 ] , b1 [ 1 ] , b1 [ 2 ] , b1 [ 3 ] = 0 , 0 , 0 , 0
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVW\s`
2018-10-17 04:24:28 -06:00
b2 [ 2 ] , b2 [ 3 ] , b2 [ 1 ] , b2 [ 0 ] = 0 , 0 , 0 , 0
2018-03-30 06:15:15 -06:00
}
2018-04-06 10:44:00 -06:00
func zero_byte_8 ( b [ ] byte ) {
2018-03-30 06:15:15 -06:00
_ = b [ 7 ]
2023-08-21 16:55:35 -06:00
b [ 0 ] , b [ 1 ] , b [ 2 ] , b [ 3 ] = 0 , 0 , 0 , 0 // arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
b [ 4 ] , b [ 5 ] , b [ 6 ] , b [ 7 ] = 0 , 0 , 0 , 0
2018-03-30 06:15:15 -06:00
}
2018-04-06 10:44:00 -06:00
func zero_byte_16 ( b [ ] byte ) {
2018-03-30 06:15:15 -06:00
_ = b [ 15 ]
2023-08-21 16:55:35 -06:00
b [ 0 ] , b [ 1 ] , b [ 2 ] , b [ 3 ] = 0 , 0 , 0 , 0 // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
2018-03-30 06:15:15 -06:00
b [ 4 ] , b [ 5 ] , b [ 6 ] , b [ 7 ] = 0 , 0 , 0 , 0
b [ 8 ] , b [ 9 ] , b [ 10 ] , b [ 11 ] = 0 , 0 , 0 , 0
2023-08-21 16:55:35 -06:00
b [ 12 ] , b [ 13 ] , b [ 14 ] , b [ 15 ] = 0 , 0 , 0 , 0
2018-03-30 06:15:15 -06:00
}
2018-04-06 10:44:00 -06:00
func zero_byte_30 ( a * [ 30 ] byte ) {
* a = [ 30 ] byte { } // arm64:"STP",-"MOVB",-"MOVH",-"MOVW"
}
func zero_byte_39 ( a * [ 39 ] byte ) {
* a = [ 39 ] byte { } // arm64:"MOVD",-"MOVB",-"MOVH",-"MOVW"
}
2018-05-18 01:19:17 -06:00
func zero_byte_2_idx ( b [ ] byte , idx int ) {
_ , _ = b [ idx + 0 ] , b [ idx + 1 ]
// arm64:`MOVH\sZR,\s\(R[0-9]+\)\(R[0-9]+\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVH\s`
2018-05-18 01:19:17 -06:00
b [ idx + 0 ] , b [ idx + 1 ] = 0 , 0
}
func zero_byte_2_idx2 ( b [ ] byte , idx int ) {
_ , _ = b [ ( idx << 1 ) + 0 ] , b [ ( idx << 1 ) + 1 ]
// arm64:`MOVH\sZR,\s\(R[0-9]+\)\(R[0-9]+<<1\)`,-`MOVB`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVH\s`
2018-05-18 01:19:17 -06:00
b [ ( idx << 1 ) + 0 ] , b [ ( idx << 1 ) + 1 ] = 0 , 0
}
2018-04-06 10:44:00 -06:00
func zero_uint16_2 ( h1 , h2 [ ] uint16 ) {
_ , _ = h1 [ 1 ] , h2 [ 1 ]
2018-10-17 04:24:28 -06:00
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVW\s`
2018-10-17 04:24:28 -06:00
h1 [ 0 ] , h1 [ 1 ] = 0 , 0
// arm64:"MOVW\tZR",-"MOVB",-"MOVH"
2018-10-17 23:11:38 -06:00
// amd64:`MOVL\s[$]0,\s\([A-Z]+\)`
// 386:`MOVL\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVW`
2018-10-17 04:24:28 -06:00
h2 [ 1 ] , h2 [ 0 ] = 0 , 0
2018-04-06 10:44:00 -06:00
}
func zero_uint16_4 ( h1 , h2 [ ] uint16 ) {
_ , _ = h1 [ 3 ] , h2 [ 3 ]
2018-10-17 04:24:28 -06:00
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVD\s`
2018-10-17 04:24:28 -06:00
h1 [ 0 ] , h1 [ 1 ] , h1 [ 2 ] , h1 [ 3 ] = 0 , 0 , 0 , 0
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVD\s`
2018-10-17 04:24:28 -06:00
h2 [ 2 ] , h2 [ 3 ] , h2 [ 1 ] , h2 [ 0 ] = 0 , 0 , 0 , 0
2018-04-06 10:44:00 -06:00
}
func zero_uint16_8 ( h [ ] uint16 ) {
_ = h [ 7 ]
2023-08-21 16:55:35 -06:00
h [ 0 ] , h [ 1 ] , h [ 2 ] , h [ 3 ] = 0 , 0 , 0 , 0 // arm64:"STP",-"MOVB",-"MOVH"
h [ 4 ] , h [ 5 ] , h [ 6 ] , h [ 7 ] = 0 , 0 , 0 , 0
2018-04-06 10:44:00 -06:00
}
func zero_uint32_2 ( w1 , w2 [ ] uint32 ) {
_ , _ = w1 [ 1 ] , w2 [ 1 ]
2018-10-17 04:24:28 -06:00
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVD\s`
2018-10-17 04:24:28 -06:00
w1 [ 0 ] , w1 [ 1 ] = 0 , 0
// arm64:"MOVD\tZR",-"MOVB",-"MOVH",-"MOVW"
2018-10-17 23:11:38 -06:00
// amd64:`MOVQ\s[$]0,\s\([A-Z]+\)`
2023-05-04 08:42:58 -06:00
// ppc64x:`MOVD\s`
2018-10-17 04:24:28 -06:00
w2 [ 1 ] , w2 [ 0 ] = 0 , 0
2018-04-06 10:44:00 -06:00
}
func zero_uint32_4 ( w1 , w2 [ ] uint32 ) {
_ , _ = w1 [ 3 ] , w2 [ 3 ]
w1 [ 0 ] , w1 [ 1 ] , w1 [ 2 ] , w1 [ 3 ] = 0 , 0 , 0 , 0 // arm64:"STP",-"MOVB",-"MOVH"
w2 [ 2 ] , w2 [ 3 ] , w2 [ 1 ] , w2 [ 0 ] = 0 , 0 , 0 , 0 // arm64:"STP",-"MOVB",-"MOVH"
}
func zero_uint64_2 ( d1 , d2 [ ] uint64 ) {
_ , _ = d1 [ 1 ] , d2 [ 1 ]
d1 [ 0 ] , d1 [ 1 ] = 0 , 0 // arm64:"STP",-"MOVB",-"MOVH"
d2 [ 1 ] , d2 [ 0 ] = 0 , 0 // arm64:"STP",-"MOVB",-"MOVH"
}
2023-06-10 09:26:34 -06:00
func loadstore ( p , q * [ 4 ] uint8 ) {
// amd64:"MOVL",-"MOVB"
// arm64:"MOVWU",-"MOVBU"
x0 , x1 , x2 , x3 := q [ 0 ] , q [ 1 ] , q [ 2 ] , q [ 3 ]
// amd64:"MOVL",-"MOVB"
// arm64:"MOVW",-"MOVB"
p [ 0 ] , p [ 1 ] , p [ 2 ] , p [ 3 ] = x0 , x1 , x2 , x3
}
type S1 struct {
a , b int16
}
func loadstore2 ( p , q * S1 ) {
// amd64:"MOVL",-"MOVWLZX"
// arm64:"MOVWU",-"MOVH"
a , b := p . a , p . b
// amd64:"MOVL",-"MOVW"
// arm64:"MOVW",-"MOVH"
q . a , q . b = a , b
}
2023-08-21 16:55:35 -06:00
func wideStore ( p * [ 8 ] uint64 ) {
if p == nil {
return
}
// amd64:"MOVUPS",-"MOVQ"
// arm64:"STP",-"MOVD"
p [ 0 ] = 0
// amd64:-"MOVUPS",-"MOVQ"
// arm64:-"STP",-"MOVD"
p [ 1 ] = 0
}
func wideStore2 ( p * [ 8 ] uint64 , x , y uint64 ) {
if p == nil {
return
}
// s390x:"STMG"
p [ 0 ] = x
// s390x:-"STMG",-"MOVD"
p [ 1 ] = y
}
2023-11-30 11:04:16 -07:00
func store32le ( p * struct { a , b uint32 } , x uint64 ) {
// amd64:"MOVQ",-"MOVL",-"SHRQ"
// arm64:"MOVD",-"MOVW",-"LSR"
// ppc64le:"MOVD",-"MOVW",-"SRD"
p . a = uint32 ( x )
// amd64:-"MOVL",-"SHRQ"
// arm64:-"MOVW",-"LSR"
// ppc64le:-"MOVW",-"SRD"
p . b = uint32 ( x >> 32 )
}
func store32be ( p * struct { a , b uint32 } , x uint64 ) {
// ppc64:"MOVD",-"MOVW",-"SRD"
// s390x:"MOVD",-"MOVW",-"SRD"
p . a = uint32 ( x >> 32 )
// ppc64:-"MOVW",-"SRD"
// s390x:-"MOVW",-"SRD"
p . b = uint32 ( x )
}
func store16le ( p * struct { a , b uint16 } , x uint32 ) {
// amd64:"MOVL",-"MOVW",-"SHRL"
// arm64:"MOVW",-"MOVH",-"UBFX"
// ppc64le:"MOVW",-"MOVH",-"SRW"
p . a = uint16 ( x )
// amd64:-"MOVW",-"SHRL"
// arm64:-"MOVH",-"UBFX"
// ppc64le:-"MOVH",-"SRW"
p . b = uint16 ( x >> 16 )
}
func store16be ( p * struct { a , b uint16 } , x uint32 ) {
// ppc64:"MOVW",-"MOVH",-"SRW"
// s390x:"MOVW",-"MOVH",-"SRW"
p . a = uint16 ( x >> 16 )
// ppc64:-"MOVH",-"SRW"
// s390x:-"MOVH",-"SRW"
p . b = uint16 ( x )
}
2024-03-21 10:15:30 -06:00
func storeBoolConst ( p * struct { a , b bool } ) {
// amd64:"MOVW",-"MOVB"
// arm64:"MOVH",-"MOVB"
p . a = true
p . b = true
}
func issue66413 ( p * struct {
a byte
b bool
c bool
d int8
} ) {
// amd64:"MOVL",-"MOVB"
// arm64:"MOVW",-"MOVB"
p . a = 31
p . b = false
p . c = true
p . d = 12
}