This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen][AArch64][SVE] Fold [rdffr, ptest] => rdffrs for RDFFR_P
AbandonedPublic

Authored by peterwaller-arm on May 12 2021, 8:05 AM.

Details

Summary

Follow up to D101357 / 3fa6510f6.

Use flags setting rdffrs instead of rddfr.

RDFFR_P has to be handled differently from the other optimizations in
optimizePTestInstr: It requires introducing an additional operand, since
there is no RDFFRS_P, only RDFFRS_PP. In order to use a flag setting
version, we need to move the mask operand from the PTest into the
flags-setting instruction.

The mask therefore needs to be defined before the RDFFR. If it is not,
bail out for now, which seems to be sufficient for typical code where
this is encountered. This could be extended to move the definition of
the mask up so long as there are no other users.

Diff Detail

Event Timeline

peterwaller-arm requested review of this revision.May 12 2021, 8:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2021, 8:05 AM

Run clang-format.

paulwalker-arm added inline comments.May 12 2021, 8:16 AM
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
1372

This is only equivalent when p0 is all true or when the result of the rdffr is not used (i.e. dead).

peterwaller-arm planned changes to this revision.May 12 2021, 8:53 AM
peterwaller-arm abandoned this revision.May 13 2021, 9:10 AM

I plan to follow this up early next week with an alternative approach.