Skip to content

cmd/compile: possible issue in optimization of -(c+-x) #31888

@josharian

Description

@josharian

amd64.rules contains this rule:

(NEGQ (ADDQconst [c] (NEGQ x))) && c != -(1<<31) -> (ADDQconst [-c] x)

It was added in https://go-review.googlesource.com/c/go/+/38311/.

I don't understand the constraint c != -(1<<31): Why it is necessary at all, and if it is necessary, why it isn't say -(1<<63). If it does need to be -(1<<63), then we may be generating bad code. As such, tentatively marking Go 1.13.

cc @randall77

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions