Skip to content

cmd/compile: unaligned load constant offsets on ppc64 #44739

@randall77

Description

@randall77
package main

type T struct {
	x [4]byte
	y [8]byte
}

func f(a T, _ byte, b T) bool {
	return a.y == b.y
}
% GOOS=linux GOARCH=ppc64le ~/go1.16/bin/go tool compile -S ~/gowork/tmp1.go
compile: invalid offset for DS form load/store 00004 (/Users/khr/gowork/tmp1.go:9)	MOVD	"".b+17(R1), R4

This has been failing since at least 1.13.

My reading of the PPC64.rules is that 2 byte and 4 byte operations can be at any offset, but 8 byte operations need to be at a multiple of 4. (Search for %4 == 0 in those rules). To be precise, the operations can happen at any address, but we can't encode constant offsets that aren't a multiple of 4. Do I have that correct?

Split off from #42385

@laboger

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions