This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/GlobalISel: Avoid illegal vector exts for add/sub/mul
ClosedPublic

Authored by arsenm on Feb 19 2020, 1:55 PM.

Details

Summary

When expanding scalar packed operations, we should not introduce
illegal vector casts LegalizerHelper introduces. We're not in a
legalizer context, and there's no RegBankSelect apply or legalize
worklist.

Diff Detail

Event Timeline

arsenm created this revision.Feb 19 2020, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 19 2020, 1:55 PM
foad accepted this revision.Feb 20 2020, 9:27 AM

LGTM. Some possible improvements noted inline.

llvm/test/CodeGen/AMDGPU/GlobalISel/add.v2i16.ll
95

Shouldn't this get constant folded to s_mov_b32 s4, 0xffc0ffc0 ? Or even folded into the v_pk_add_u16 if you can do that?

170

This s_and is redundant. Since we're going to add something to it and then shift it left by 16 the high order bits will be lost anyway.

253–256

All four of these are redundant.

This revision is now accepted and ready to land.Feb 20 2020, 9:27 AM
arsenm marked 3 inline comments as done.Feb 20 2020, 9:36 AM
arsenm added inline comments.
llvm/test/CodeGen/AMDGPU/GlobalISel/add.v2i16.ll
95

We don't have any constant folding or really anything needed to get good vector code

170

We don't have any optimizations, and don't run anything after RegBankSelect yet. Eventually a combiner pass is needed to cleanup here

253–256

Same, we don't try to clean anything up yet