This is an archive of the discontinued LLVM Phabricator instance.

[X86][InstCombine] Add tests for simplifying pternlog intrinsics; NFC
ClosedPublic

Authored by goldstein.w.n on Mar 2 2023, 11:41 PM.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Mar 2 2023, 11:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2023, 11:42 PM
Herald added a subscriber: pengfei. · View Herald Transcript
goldstein.w.n requested review of this revision.Mar 2 2023, 11:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2023, 11:42 PM

It'd be useful to add tests to see if the relevant ternlog patterns get correctly canonicalized to the useful patterns listed here: http://www.0x80.pl/articles/avx512-ternary-functions.html

In particular - ensuring we fold ternlog -> bitselect -> regular select (if driven by a compare / sign-extended bool vector), and maybe the one-bit-set pattern are of particular interest?

Add some known patterns

It'd be useful to add tests to see if the relevant ternlog patterns get correctly canonicalized to the useful patterns listed here: http://www.0x80.pl/articles/avx512-ternary-functions.html

In particular - ensuring we fold ternlog -> bitselect -> regular select (if driven by a compare / sign-extended bool vector), and maybe the one-bit-set pattern are of particular interest?

So we already have tests for one_bit_set/two_bits_set/bitselect just as a function of exhaustive through all imm values, but I added carry-save-add and vselect (cmp; sext; bitselect) patterns.

RKSimon accepted this revision.Mar 31 2023, 2:00 AM

LGTM with a couple of minors

llvm/test/CodeGen/X86/ternlog.ll
3

Maybe run another test with a version that does opt -O3 as well? Just in case phase ordering is messing us up?

2334

Can you add a 512-bit version as well - we should hopefully see that use a predicate mask select move?

This revision is now accepted and ready to land.Mar 31 2023, 2:00 AM
llvm/test/CodeGen/X86/ternlog.ll