Skip to content

cmd/compile/internal/ssa: incorrect type width when folding widening ops #67884

@pmur

Description

@pmur

Go version

tip

Output of go env in your module/workspace:

GOARCH=ppc64le

What did you do?

Further exploration of lower rule improvements has uncovered problems when using a Value Type's size to determine whether to apply a rule.

E.g the rule in PPC64.rules:

(MOVWZreg y:(AND (MOVDconst [c]) _)) && uint64(c) <= 0xFFFFFFFF => y

And later in PPC64latelower.rules:

(AND <t> x:(MOVDconst [m]) n) && t.Size() == 4 && isPPC64WordRotateMask(m) => (RLWINM [encodePPC64RotateMask(0,m,32)] n)

If m is the value 0xF000000F or a similar wrapping mask on PPC64, the upper 32 bits of the value are not always 0. I think this only affects rules which use RLWINM and RLWNM. I believe they are the only GPR opcodes on PPC64 which have this behavior.

What did you see happen?

The latelower rule is triggered in cases where the result is expected to be wider than the assigned type

What did you expect to see?

The Type of the result in lower should reflected the widened type.

Metadata

Metadata

Assignees

Labels

NeedsFixThe path to resolution is known, but the work has not been done.arch-ppc64xcompiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions