Skip to content

cmd/compile: instructions being lifted before arch support tests #78997

@randall77

Description

@randall77
package main

import "math/bits"

func f(x uint64) int {
	r := 0
	for range 5 {
		r += bits.OnesCount64(x)
	}
	return r
}
GOAMD64=v1 go build -gcflags=-S test.go

In the assembly output, the POPCNTQ instruction has been lifted to before the start of the loop. We can't do that, unless we also lift the x86HasPOPCNT test that wraps POPCNTQ instructions in v1 mode.

This is a consequence of https://go-review.googlesource.com/c/go/+/697235 . Maybe we should revert it. (It was also responsible for #78892. I'm not sure what else might be lurking.)

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.release-blocker

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions