Skip to content

cmd/compile: SETcc could directly write to memory on 386/amd64 #21630

@rasky

Description

@rasky
package main

type Foo struct {
	a bool
}

var f Foo
var x int = 2

func main() {
	f.a = x <= 4
}

Code generated for main:

	main.go:11	0x104bfe4	4883f804		CMPQ $0x4, AX
	main.go:11	0x104bfe8	0f9ec0			SETLE AL
	main.go:11	0x104bfeb	8844240f		MOVB AL, 0xf(SP)

should be:

	CMPQ $0x4, AX
	SETLE 0xf(SP)

more compact, and saves one register.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions