This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Don't use vector G_EXTRACT in arg lowering
ClosedPublic

Authored by arsenm on Feb 25 2020, 9:22 PM.

Details

Summary

Create a wider source vector, and unmerge with dead defs like the
legalizer. The legalization handling for G_EXTRACT is incomplete, and
it's preferrable to keep everything in 32-bit pieces.

Diff Detail

Event Timeline

arsenm created this revision.Feb 25 2020, 9:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2020, 9:22 PM
foad added a comment.Feb 26 2020, 2:59 AM

Looks OK to me technically, but it seems a shame if even simple cases like %1:(<3 x s16>) = G_EXTRACT %0:(<4 x s16>), 0 don't work well.

What do you mean about keeping everything in 32-bit pieces? I don't see anything in the test case diffs where we were not already doing that.

Also I have slight theoretical reservations about ever using getLCMType because of pathological cases like <17 x s32> vs <19 x s32> which would create <323 x s32>. But I suppose it's never that bad in practice.

Is there a helper function already in LegalizerHelper that does what mergeVectorRegsToResultRegs does?

Looks OK to me technically, but it seems a shame if even simple cases like %1:(<3 x s16>) = G_EXTRACT %0:(<4 x s16>), 0 don't work well.

What do you mean about keeping everything in 32-bit pieces? I don't see anything in the test case diffs where we were not already doing that.

The <3 x s16> results are not even

Also I have slight theoretical reservations about ever using getLCMType because of pathological cases like <17 x s32> vs <19 x s32> which would create <323 x s32>. But I suppose it's never that bad in practice.

In this context, it's only getting legal register pieces, and we break every calling convention argument into 32-bit registers. The worst case is 1 implicit_def and 1 dead def on the unmerge. I wrote it more generally to prepare for a cleanup

Is there a helper function already in LegalizerHelper that does what mergeVectorRegsToResultRegs does?

No

kerbowa accepted this revision.Mar 4 2020, 12:13 PM

This LGTM if Jay does not object.

Avoiding generating these G_EXTRACT seems preferable ATM.

This revision is now accepted and ready to land.Mar 4 2020, 12:13 PM
foad added a comment.Mar 4 2020, 1:24 PM

I don't object.