Skip to content

Register allocation weirdness with VPGATHERDD #479

@dominikh

Description

@dominikh

This

func foobar() {
	TEXT("foobar", 0, "func()")

	mask := YMM()
	base := GP64()
	indices := YMM()
	for range 10 {
		out := YMM()
		VPGATHERDD(mask, Mem{Base: base, Index: indices, Scale: 4}, out)
	}
}

generates this:

TEXT ·foobar(SB), $0
	VPGATHERDD Y0, (AX)(Y1*4), Y2
	VPGATHERDD Y0, (AX)(Y1*4), Y3
	VPGATHERDD Y0, (AX)(Y1*4), Y4
	VPGATHERDD Y0, (AX)(Y1*4), Y5
	VPGATHERDD Y0, (AX)(Y1*4), Y6
	VPGATHERDD Y0, (AX)(Y1*4), Y7
	VPGATHERDD Y0, (AX)(Y1*4), Y8
	VPGATHERDD Y0, (AX)(Y1*4), Y9
	VPGATHERDD Y0, (AX)(Y1*4), Y10
	VPGATHERDD Y0, (AX)(Y1*4), Y1

If we bump the number up to 32, we'll get an allocation failure because we've run out of registers. I don't see why the destination registers would be kept alive indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions