-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/asm: fix encoding for arm right shift by constant 0
Right shifts, for some odd reasons, can encode shifts of constant 1-32 instead of 0-31. Left shifts, however, can encode shifts 0-31. When the shift amount is 0, arm recommends encoding right shifts using left shifts. Fixes golang#64715 Change-Id: Id3825349aa7195028037893dfe01fa0e405eaa51 Reviewed-on: https://go-review.googlesource.com/c/go/+/549955 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// run | ||
|
||
// Copyright 2023 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 main | ||
|
||
func boolInt32(b bool) int32 { | ||
if b { | ||
return 1 | ||
} | ||
|
||
return 0 | ||
} | ||
|
||
func f(left uint16, right int32) (r uint16) { | ||
return left >> right | ||
} | ||
|
||
var n = uint16(65535) | ||
|
||
func main() { | ||
println(f(n, boolInt32(int64(n^n) > 1))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
65535 |