This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use ComplexPattern to reduce the number of patterns for XVentanaCondOps.
ClosedPublic

Authored by craig.topper on Feb 23 2023, 10:55 PM.

Details

Summary

XVentanaCondOps check the condition operand for zero or non-zero.
We use this to optimize seteq/setne that would otherwise becomes
xor/xori/addi+snez/seqz. These patterns avoid the snez/seqz.

This patch adds two ComplexPatterns to match the varous cases and
emit the xor/xori/addi instruction.

These patterns can also be used by D144681.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 23 2023, 10:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 10:55 PM
craig.topper requested review of this revision.Feb 23 2023, 10:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 10:55 PM
llvm/lib/Target/RISCV/RISCVInstrInfoXVentana.td
37

Should we move this RISCVInstrInfo.td, as it will also be needed for Zicond?

philipp.tomsich accepted this revision.Feb 24 2023, 6:19 AM

LGTM (beyond the judgement call on whether to keep the new complex pattern in XVentana.td or more it).

This revision is now accepted and ready to land.Feb 24 2023, 6:19 AM

LGTM (beyond the judgement call on whether to keep the new complex pattern in XVentana.td or more it).

I'll move it. Just wanted to be sure it was useful for your patch first.