This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Look through bitcast when looking for extract_high subvector
ClosedPublic

Authored by dmgreen on Jun 1 2022, 7:48 AM.

Details

Summary

Since D61806, DAGCombiner has folded subvector_extract(bitcast(..)) to bitcast(subvector_extract(..)), which would place a bitcast between a subvector_extract and the operation that could be converted to a "high" neon instruction (like smull2). This adds better matching for the subvector_extract, through the tablegen extract_high PatFrags to optionally skip the bitcast under little ending, still matchings an extract of the high half of the input vector.

I didn't update the extract_high of a duplicate patterns, as the ComplexPattern need names operands. I did add a extract_high_dup_v8i16 PatFrag to abstract away the common code, which can be extended in a future patch.

Diff Detail

Event Timeline

dmgreen created this revision.Jun 1 2022, 7:48 AM
dmgreen requested review of this revision.Jun 1 2022, 7:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 7:48 AM
samtebbs accepted this revision.Jun 6 2022, 4:00 AM

LGTM

llvm/lib/Target/AArch64/AArch64InstrFormats.td
6516–6518

Out of curiosity, what changes when being explicit about the operand's type?

This revision is now accepted and ready to land.Jun 6 2022, 4:00 AM
dmgreen added inline comments.Jun 7 2022, 9:56 AM
llvm/lib/Target/AArch64/AArch64InstrFormats.td
6516–6518

Yeah all these types are a bit unfortunate - the old tablegen patterns for extract_high_v16i8 were able to deduce them automatically, but now that they are ComplexPattern they need to be explicit. The important parts are the extract_high and SelectExtractHigh parts above, these extra types are unfortunately just needed to make that work.

This revision was landed with ongoing or failed builds.Jun 12 2022, 2:59 AM
This revision was automatically updated to reflect the committed changes.