Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: ppc64 miscompiles v>>32 == 0 #11987

Closed
mwhudson opened this issue Aug 3, 2015 · 8 comments
Closed

cmd/compile: ppc64 miscompiles v>>32 == 0 #11987

mwhudson opened this issue Aug 3, 2015 · 8 comments

Comments

@mwhudson
Copy link
Contributor

mwhudson commented Aug 3, 2015

(vivid-ppc64el)mwh@kelsey01:~/go/src$ GOARCH=amd64 ~/go/bin/go install -v runtime
runtime
# runtime
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00791 (/home/mwh/go/src/runtime/cpuprof.go:173)    ANDL    $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00867 (/home/mwh/go/src/runtime/cpuprof.go:176)    ORL $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00839 (/home/mwh/go/src/runtime/cpuprof.go:173)    ANDL    $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00915 (/home/mwh/go/src/runtime/cpuprof.go:176)    ORL $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00843 (/home/mwh/go/src/runtime/cpuprof.go:173)    ANDL    $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00919 (/home/mwh/go/src/runtime/cpuprof.go:176)    ORL $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00843 (/home/mwh/go/src/runtime/cpuprof.go:173)    ANDL    $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00919 (/home/mwh/go/src/runtime/cpuprof.go:176)    ORL $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=9 tt=20 00208 (/home/mwh/go/src/runtime/cpuprof.go:315)    ANDL    $2147483648, BX 9 20
runtime/alg.go:1: doasm: notfound ft=16 tt=9 01509 (/home/mwh/go/src/runtime/cpuprof.go:345)    CMPL    BP, $2147483648 16 9
runtime/alg.go:1: too many errors
(vivid-ppc64el)mwh@kelsey01:~/go/src$ GOARCH=arm ~/go/bin/go install -v runtime

Other architectures (tried arm, arm64, 386, ppc64) work.

@robpike
Copy link
Contributor

robpike commented Aug 3, 2015

I don't know if it's relevant but your prompt says ppc64el not ppc64le.

@mwhudson
Copy link
Contributor Author

mwhudson commented Aug 3, 2015

That's just the ubuntu architecture name (an old joke, I think BE vs EL). GOARCH is ppc64le (and ./all.bash passes -- this is the same sort of machine as the builder).

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Aug 3, 2015
@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

@mwhudson, please run this program on your ppc64le system and see what it prints:

package main

import "fmt"

func main() {
    var v int64
    v = 0x80000000
    fmt.Printf("v = %#x\n", v)
    fmt.Printf("v>>32 = %#x\n", v>>32)
    fmt.Printf("v>>32==0 = %v\n", v>>32==0)
}

If it doesn't say that v>>32 is 0, that's a ppc64le compiler bug.

@mwhudson
Copy link
Contributor Author

mwhudson commented Nov 5, 2015

(wily-ppc64el)mwh@kelsey01:~$ ~/go/bin/go run foo.go
v = 0x80000000
v>>32 = 0x0
v>>32==0 = false

Ding ding ding.

mwhudson added a commit to mwhudson/go that referenced this issue Nov 5, 2015
sradi and sradi. hide the top bit of their immediate argument apart from the
rest of it, but the code only handled the sradi case.

I'm pretty sure this is the only instruction missing (a couple of the rotate
instructions encode their immediate the same way but their handling looks OK).

This fixes the failure of "GOARCH=amd64 ~/go/bin/go install -v runtime" as
reported in the bug.

Fixes golang#11987

Change-Id: I0cdefcd7a04e0e8fce45827e7054ffde9a83f589
mwhudson added a commit to mwhudson/go that referenced this issue Nov 5, 2015
sradi and sradi. hide the top bit of their immediate argument apart from the
rest of it, but the code only handled the sradi case.

I'm pretty sure this is the only instruction missing (a couple of the rotate
instructions encode their immediate the same way but their handling looks OK).

This fixes the failure of "GOARCH=amd64 ~/go/bin/go install -v runtime" as
reported in the bug.

Fixes golang#11987

Change-Id: I0cdefcd7a04e0e8fce45827e7054ffde9a83f589
@gopherbot
Copy link

CL https://golang.org/cl/16710 mentions this issue.

@mwhudson
Copy link
Contributor Author

Can this be added to the 1.5.2 milestone?

@rsc rsc modified the milestones: Go1.5.2, Go1.6 Nov 12, 2015
@rsc
Copy link
Contributor

rsc commented Nov 12, 2015

OK.

@rsc rsc changed the title cmd/internal/obj: cross compiling from ppc64le to amd64 fails cmd/compile: ppc64 miscompiles v>>32 == 0 Nov 13, 2015
@gopherbot
Copy link

CL https://golang.org/cl/16983 mentions this issue.

aclements pushed a commit that referenced this issue Nov 17, 2015
… with immediate

sradi and sradi. hide the top bit of their immediate argument apart from the
rest of it, but the code only handled the sradi case.

I'm pretty sure this is the only instruction missing (a couple of the rotate
instructions encode their immediate the same way but their handling looks OK).

This fixes the failure of "GOARCH=amd64 ~/go/bin/go install -v runtime" as
reported in the bug.

Fixes #11987

Change-Id: I0cdefcd7a04e0e8fce45827e7054ffde9a83f589
Reviewed-on: https://go-review.googlesource.com/16710
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/16983
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
@golang golang locked and limited conversation to collaborators Nov 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants