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

wrong code generated on arm64 #26438

Closed
benshi001 opened this issue Jul 18, 2018 · 2 comments
Closed

wrong code generated on arm64 #26438

benshi001 opened this issue Jul 18, 2018 · 2 comments
Milestone

Comments

@benshi001
Copy link
Member

The follow go code should output 1, but wrongly to 100.

package main
import "fmt"
//go:noinline
func ssa(a, b uint64) uint32 {
	if uint32(a)&uint32(b) == 0 {
		return 1
	}
	return 100
}
func main() {
	fmt.Println(ssa(0x000000ff00000000, 0x000000aa00000000))
}

only arm64 is affected, other archs are right.

@benshi001
Copy link
Member Author

A "TST" is wrongly generated, which should be"TSTW"

       	00000 (6)	TEXT	"".ssa(SB)
       	00001 (6)	FUNCDATA	$0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
       	00002 (6)	FUNCDATA	$1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
       	00003 (6)	FUNCDATA	$3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
 v19   	00004 (7)	PCDATA	$2, $0
 v19   	00005 (7)	PCDATA	$0, $0
 v19   	00006 (7)	MOVD	"".a(RSP), R0
 v13   	00007 (7)	MOVD	"".b+8(RSP), R1
 v15   	00008 (7)	TST	R1, R0
 b1    	00009 (7)	BNE	13
 v12   	00010 (8)	MOVD	$1, R0
 v17   	00011 (8)	MOVW	R0, "".~r2+16(RSP)
 b2    	00012 (8)	RET
 v9    	00013 (10)	MOVD	$100, R0
 v21   	00014 (10)	MOVW	R0, "".~r2+16(RSP)
 b3    	00015 (10)	RET
       	00016 (?)	END

@benshi001 benshi001 self-assigned this Jul 18, 2018
@benshi001 benshi001 added this to the Go1.11 milestone Jul 18, 2018
@gopherbot
Copy link

Change https://golang.org/cl/124637 mentions this issue: cmd/compile: fix an arm64's comparison bug

@golang golang locked and limited conversation to collaborators Jul 18, 2019
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

2 participants