This is an archive of the discontinued LLVM Phabricator instance.

[X86] Improve i8 all-ones element insertion in pre-SSE4.1
ClosedPublic

Authored by lebedev.ri on Sep 17 2021, 11:33 AM.

Details

Diff Detail

Event Timeline

lebedev.ri created this revision.Sep 17 2021, 11:33 AM
lebedev.ri requested review of this revision.Sep 17 2021, 11:33 AM
lebedev.ri added inline comments.
llvm/test/CodeGen/X86/insertelement-ones.ll
314–316

Are we intentionally not merging constant vectors in hope of promoting their reuse?

RKSimon added inline comments.Sep 17 2021, 12:40 PM
llvm/test/CodeGen/X86/insertelement-ones.ll
314–316

Have these been lowered to constant pool loads before reassociation sees it?

lebedev.ri added inline comments.Sep 17 2021, 12:49 PM
llvm/test/CodeGen/X86/insertelement-ones.ll
314–316

As far as i can tell from -debug, yes.

Simplify the code - i forgot about BUILD_VECTOR..

RKSimon added a subscriber: craig.topper.

@craig.topper Can you recall if there was any reason why we don't already support pre-SSE41 v16i8 lowering?

@craig.topper Can you recall if there was any reason why we don't already support pre-SSE41 v16i8 lowering?

I don't recall anything.

llvm/lib/Target/X86/X86ISelLowering.cpp
19315

Why references?

19317

Can't you just fill the vector with the Keep value using the SmallVector constructor, and then just replace element i with the OverrideElt after its constructed? No loop required.

19320

Is the AND case not tested? All the test changes have Or.

lebedev.ri marked 3 inline comments as done.

Thanks for taking a look!
Addressed review notes.

llvm/lib/Target/X86/X86ISelLowering.cpp
19320

It appears to get handled already, so i've dropped it here.

craig.topper added inline comments.Sep 17 2021, 3:03 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
19319

Drop the IsZeroElt here?

lebedev.ri marked an inline comment as done.

LGTM unless we're considered about the failure to merge constant pools? I suppose the easiest fix for that would be to move this to a DAG combine between LegalizeVectorOps and LegalizeDAG?

LGTM unless we're considered about the failure to merge constant pools? I suppose the easiest fix for that would be to move this to a DAG combine between LegalizeVectorOps and LegalizeDAG?

Thank you! I think this is already better than it was before, not sure we have to fix this all the way on a single go :)
@RKSimon ?

This revision is now accepted and ready to land.Sep 18 2021, 12:11 PM
This revision was landed with ongoing or failed builds.Sep 18 2021, 12:24 PM
This revision was automatically updated to reflect the committed changes.