Skip to content

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

Closed

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.

Activity

  1. added this to the Go1.10 milestone on Aug 28, 2017
  2. gopherbot commented on Oct 3, 2017

    @gopherbot
    Contributor

    Change https://golang.org/cl/67950 mentions this issue: cmd/compile/internal/amd64: add SETccmem

  3. locked and limited conversation to collaborators on Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions