This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Cleanup dead complexity in RISCVMaskedPseudo after TA/TU merge refactoring [nfc]
ClosedPublic

Authored by reames on Jul 6 2023, 9:06 AM.

Details

Summary

After D154245 lands, we have greatly simplified the possible configurations for an entry in the RISCVMaskedPseudo table. This change goes through and reworks everything which uses that table to exploit the available simplifications.

To justify the correctness here, let me note that we no longer had any use of HasTU=true. We were left with only the HasTu=false, and IsCombined=true|false cases. The only usage is IsCombined=false was for the comparison operations. At the moment, these operations are the only ones in the table without vector policy operands. Instead of switching on the pseudo value, we can just check the VecPolicy flag instead.

It may be worth adding a passthru operand to the comparisons (which is actually needed to represent tail undefined vs tail agnostic), and a vector policy operand (which is strictly unneeded) just for consistency, but we can do that in a follow up patch for some further simplification if desired.

Note that we do have a few _TU pseudos left at this point. It's simply that none of them are in the RISCVMaskedPseudo table, and thus don't participate in our post-ISEL transforms.

Diff Detail

Event Timeline

reames created this revision.Jul 6 2023, 9:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 9:06 AM
reames requested review of this revision.Jul 6 2023, 9:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2023, 9:06 AM

"(which is actually needed to represent tail undefined vs tail agnostic)".

Comparisons have extra rule for tail agnostic, they're allowed to evaluate the comparison for the tail.

In addition, except for mask load instructions, any element in the tail of a mask result can also be written with the value the mask-producing operation would have calculated with vl=VLMAX. Furthermore, for mask-logical instructions and vmsbf.m, vmsif.m, vmsof.m mask-manipulation instructions, any element in the tail of the result can be written with the value the mask-producing operation would have calculated with vl=VLEN, SEW=8, and LMUL=8 (i.e., all bits of the mask register can be overwritten).

Is that enough to be considered "undefined" or could a user set the tail of the mask to all ones, and set the comparison operands past VL to evaluate to true? So they would always get a 1 for the tail.

This revision is now accepted and ready to land.Jul 7 2023, 5:01 PM
This revision was landed with ongoing or failed builds.Jul 11 2023, 10:33 AM
This revision was automatically updated to reflect the committed changes.