Skip to content

Commit

Permalink
cmd/compile: fix load int32 to FP register on big-endian MIPS64
Browse files Browse the repository at this point in the history
Fixes golang#16903.

Change-Id: I1f6fcd57e14b2b62e208b7bb3adccd5fd7f8bdbc
Reviewed-on: https://go-review.googlesource.com/27933
Run-TryBot: Cherry Zhang <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Minux Ma <[email protected]>
  • Loading branch information
cherrymui committed Aug 28, 2016
1 parent 8c15a17 commit 2f679d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmd/compile/internal/mips64/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ func isHILO(r int16) bool {
// loadByType returns the load instruction of the given type.
func loadByType(t ssa.Type, r int16) obj.As {
if isFPreg(r) {
if t.IsFloat() && t.Size() == 4 { // float32
if t.Size() == 4 { // float32 or int32
return mips.AMOVF
} else { // float64 or integer in FP register
} else { // float64 or int64
return mips.AMOVD
}
} else {
Expand Down Expand Up @@ -138,9 +138,9 @@ func loadByType(t ssa.Type, r int16) obj.As {
// storeByType returns the store instruction of the given type.
func storeByType(t ssa.Type, r int16) obj.As {
if isFPreg(r) {
if t.IsFloat() && t.Size() == 4 { // float32
if t.Size() == 4 { // float32 or int32
return mips.AMOVF
} else { // float64 or integer in FP register
} else { // float64 or int64
return mips.AMOVD
}
} else {
Expand Down

0 comments on commit 2f679d7

Please sign in to comment.