This is an archive of the discontinued LLVM Phabricator instance.

[X86][AVX] Add missing X86ISD::VBROADCAST(128->256) isel patterns for AVX1 targets
ClosedPublic

Authored by RKSimon on Sep 8 2021, 5:43 AM.

Details

Summary

An alternative to D109348, this adds fallback broadcast patterns on AVX1 targets instead.

I've added AVX2 test coverage to help show a missing fold - where the vbroadcastsd_ymm(vbroadcastss_load_xmm()) should be foldable to a single vbroadcastss_load_ymm() on AVX1 and AVX2 targets if we create the broadcast nodes.

Diff Detail

Event Timeline

RKSimon created this revision.Sep 8 2021, 5:43 AM
RKSimon requested review of this revision.Sep 8 2021, 5:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 5:43 AM
yubing added inline comments.Sep 8 2021, 6:09 AM
llvm/test/CodeGen/X86/combine-concatvectors.ll
44

Thanks for creating this bugfix. This case only cover the code:

def : Pat<(v4f64 (X86VBroadcast v2f64:$src)),
          (VINSERTF128rr (INSERT_SUBREG (v4f64 (IMPLICIT_DEF)),
            (v2f64 (VMOVDDUPrr VR128:$src)), sub_xmm),
            (v2f64 (VMOVDDUPrr VR128:$src)), 1)>;

I think we'd better add more cases.

RKSimon added inline comments.Sep 8 2021, 1:10 PM
llvm/test/CodeGen/X86/combine-concatvectors.ll
44

Its proving tricky to create tests for the other types, what about just adding this one isel pattern initially?

yubing added inline comments.Sep 8 2021, 8:22 PM
llvm/test/CodeGen/X86/combine-concatvectors.ll
44

I am OK with that.

yubing added a comment.Sep 8 2021, 8:22 PM
This comment was removed by yubing.
yubing accepted this revision.Sep 8 2021, 8:23 PM

LGTM

This revision is now accepted and ready to land.Sep 8 2021, 8:23 PM