Skip to content

cmd/compile: lack of constant folding in array addressing for the stack on ppc64le #17134

@laboger

Description

@laboger

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

gotip

What operating system and processor architecture are you using (go env)?

Ubuntu 16.04 ppc64le

What did you do?

Compiled a simple testcase using arrays declared on the stack, then looked at an objdump.
package main
arrtest1.go.txt

What did you expect to see?

Efficient generated code.

What did you see instead?

Opportunities for improvement.

11024: 00 01 61 38 addi r3,r1,256
11028: 98 00 83 38 addi r4,r3,152
1102c: f8 ff 63 38 addi r3,r3,-8
11030: 09 00 03 f8 stdu r0,8(r3)

Instead of 3 addi, the constant values could all be combined and a single addi used:

addi r3,r1,400 // 256+152-8

I know this might be due to the way I wrote this rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions