mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: PPC64, elide unnecessary sign extension
Inputs to store[BHW] and cmpW(U) need not be correct
in more bits than are used by the instruction.
Added a pattern tailored to what appears to be cgo boilerplate.
Added a pattern (also seen in cgo boilerplate and hashing)
to replace {EQ,NE}-CMP-ANDconst with {EQ-NE}-ANDCCconst.
Added a pattern to clean up ANDconst shift distance inputs
(this was seen in hashing).
Simplify repeated and,or,xor.
Fixes #17109.
Change-Id: I68eac83e3e614d69ffe473a08953048c8b066d88
Reviewed-on: https://go-review.googlesource.com/30455
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
672e579444
commit
2f0b8f88df
6 changed files with 1192 additions and 60 deletions
|
|
@ -229,11 +229,16 @@ func is16Bit(n int64) bool {
|
|||
return n == int64(int16(n))
|
||||
}
|
||||
|
||||
// is16Bit reports whether n can be represented as an unsigned 16 bit integer.
|
||||
// isU16Bit reports whether n can be represented as an unsigned 16 bit integer.
|
||||
func isU16Bit(n int64) bool {
|
||||
return n == int64(uint16(n))
|
||||
}
|
||||
|
||||
// isU32Bit reports whether n can be represented as an unsigned 32 bit integer.
|
||||
func isU32Bit(n int64) bool {
|
||||
return n == int64(uint32(n))
|
||||
}
|
||||
|
||||
// is20Bit reports whether n can be represented as a signed 20 bit integer.
|
||||
func is20Bit(n int64) bool {
|
||||
return -(1<<19) <= n && n < (1<<19)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue