aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewrite.go
diff options
context:
space:
mode:
authorfanzha02 <fannie.zhang@arm.com>2020-05-14 17:01:11 +0800
committerKeith Randall <khr@golang.org>2020-08-24 14:38:38 +0000
commit85902b6786bbe40b297cbbf823f489b07c654bbd (patch)
tree6b7eabd4cdffc97c1af52a680e42b5cd1f100294 /src/cmd/compile/internal/ssa/rewrite.go
parent0e031676288ddd56fb410b6b27807a180a585db3 (diff)
downloadgo-85902b6786bbe40b297cbbf823f489b07c654bbd.tar.gz
go-85902b6786bbe40b297cbbf823f489b07c654bbd.zip
cmd/compile: convert rest ARM64.rules lines to typed aux mode
This patch adds the ARM6464Bitfield auxInt to auxIntType() and returns its Go type as "arm64Bitfield" type, which is defined as int16 type. And the Go type of SymOff auxInt is int32, but some functions (such as min(), areAdjacentOffsets() and read16/32/64(),etc.) use SymOff as an input parameter and treat its type as int64, this patch adds the type conversion for these rules. Passes toolstash-check -all. Change-Id: Ib234b48d0a97ef244dd37878e06b5825316dd782 Reviewed-on: https://go-review.googlesource.com/c/go/+/234378 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewrite.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewrite.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index 0b35abf06d..fb35691296 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -618,6 +618,9 @@ func auxIntToFloat64(i int64) float64 {
func auxIntToValAndOff(i int64) ValAndOff {
return ValAndOff(i)
}
+func auxIntToArm64BitField(i int64) arm64BitField {
+ return arm64BitField(i)
+}
func auxIntToInt128(x int64) int128 {
if x != 0 {
panic("nonzero int128 not allowed")
@@ -658,6 +661,9 @@ func float64ToAuxInt(f float64) int64 {
func valAndOffToAuxInt(v ValAndOff) int64 {
return int64(v)
}
+func arm64BitFieldToAuxInt(v arm64BitField) int64 {
+ return int64(v)
+}
func int128ToAuxInt(x int128) int64 {
if x != 0 {
panic("nonzero int128 not allowed")
@@ -1295,24 +1301,24 @@ func hasSmallRotate(c *Config) bool {
}
// encodes the lsb and width for arm(64) bitfield ops into the expected auxInt format.
-func armBFAuxInt(lsb, width int64) int64 {
+func armBFAuxInt(lsb, width int64) arm64BitField {
if lsb < 0 || lsb > 63 {
panic("ARM(64) bit field lsb constant out of range")
}
if width < 1 || width > 64 {
panic("ARM(64) bit field width constant out of range")
}
- return width | lsb<<8
+ return arm64BitField(width | lsb<<8)
}
// returns the lsb part of the auxInt field of arm64 bitfield ops.
-func getARM64BFlsb(bfc int64) int64 {
+func (bfc arm64BitField) getARM64BFlsb() int64 {
return int64(uint64(bfc) >> 8)
}
// returns the width part of the auxInt field of arm64 bitfield ops.
-func getARM64BFwidth(bfc int64) int64 {
- return bfc & 0xff
+func (bfc arm64BitField) getARM64BFwidth() int64 {
+ return int64(bfc) & 0xff
}
// checks if mask >> rshift applied at lsb is a valid arm64 bitfield op mask.