Skip to content

Commit e4172e5

Browse files
labogerbradfitz
authored andcommitted
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent f95ef94 commit e4172e5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/cmd/compile/internal/ssa/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ func (t *Types) SetTypPtrs() {
9393
t.UInt16 = types.Types[types.TUINT16]
9494
t.UInt32 = types.Types[types.TUINT32]
9595
t.UInt64 = types.Types[types.TUINT64]
96+
t.Int = types.Types[types.TINT]
9697
t.Float32 = types.Types[types.TFLOAT32]
9798
t.Float64 = types.Types[types.TFLOAT64]
98-
t.Int = types.Types[types.TINT]
99+
t.UInt = types.Types[types.TUINT]
99100
t.Uintptr = types.Types[types.TUINTPTR]
100101
t.String = types.Types[types.TSTRING]
101102
t.BytePtr = types.NewPtr(types.Types[types.TUINT8])

test/codegen/rotate.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func rot64nc(x uint64, z uint) uint64 {
101101
z &= 63
102102

103103
// amd64:"ROLQ"
104+
// ppc64le:"ROTL"
104105
a += x<<z | x>>(64-z)
105106

106107
// amd64:"RORQ"
@@ -115,6 +116,7 @@ func rot32nc(x uint32, z uint) uint32 {
115116
z &= 31
116117

117118
// amd64:"ROLL"
119+
// ppc64le:"ROTLW"
118120
a += x<<z | x>>(32-z)
119121

120122
// amd64:"RORL"

0 commit comments

Comments
 (0)