cmd/compile/internal/ssa: initialize t.UInt in SetTypPtrs()

Initialization of t.UInt is missing from SetTypPtrs in config.go,
preventing rules that use it from matching when they should.
This adds the initialization to allow those rules to work.

Updated test/codegen/rotate.go to test for this case, which
appears in math/bits RotateLeft32 and RotateLeft64. There had been
a testcase for this in go 1.10 but that went away when asm_test.go
was removed.

Change-Id: I82fc825ad8364df6fc36a69a1e448214d2e24ed5
Reviewed-on: https://go-review.googlesource.com/112518
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Lynn Boger 2018-05-09 17:35:10 -04:00 committed by Brad Fitzpatrick
parent f95ef94ad5
commit e4172e5f5e
2 changed files with 4 additions and 1 deletions

View file

@ -93,9 +93,10 @@ func (t *Types) SetTypPtrs() {
t.UInt16 = types.Types[types.TUINT16]
t.UInt32 = types.Types[types.TUINT32]
t.UInt64 = types.Types[types.TUINT64]
t.Int = types.Types[types.TINT]
t.Float32 = types.Types[types.TFLOAT32]
t.Float64 = types.Types[types.TFLOAT64]
t.Int = types.Types[types.TINT]
t.UInt = types.Types[types.TUINT]
t.Uintptr = types.Types[types.TUINTPTR]
t.String = types.Types[types.TSTRING]
t.BytePtr = types.NewPtr(types.Types[types.TUINT8])

View file

@ -101,6 +101,7 @@ func rot64nc(x uint64, z uint) uint64 {
z &= 63
// amd64:"ROLQ"
// ppc64le:"ROTL"
a += x<<z | x>>(64-z)
// amd64:"RORQ"
@ -115,6 +116,7 @@ func rot32nc(x uint32, z uint) uint32 {
z &= 31
// amd64:"ROLL"
// ppc64le:"ROTLW"
a += x<<z | x>>(32-z)
// amd64:"RORL"