This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add support for predication AND/OR/XOR/ADD/SUB with short-forward-branch-opt.
ClosedPublic

Authored by craig.topper on Dec 14 2022, 1:55 PM.

Details

Summary

sifive-7-series can predicate ALU instructions in the shadow of a
branch not just move instruction instructions.

This patch implements analyzeSelect/optimizeSelect to predicate
these operations. This is based on ARM's implementation.

I've restricted it to just the instructions we have test cases for,
but it can be extended in the future.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 14 2022, 1:55 PM
craig.topper requested review of this revision.Dec 14 2022, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 1:55 PM
reames accepted this revision.Dec 16 2022, 11:58 AM

LGTM w/minor comment.

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1068

Can you rename this into something like canFoldIntoPredicateOp? CCMOV doesn't seem to be quite right here.

This revision is now accepted and ready to land.Dec 16 2022, 11:58 AM
craig.topper added inline comments.Dec 16 2022, 10:36 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1068

Sure. I took the name from ARM I think. Though theirs is MOVCC. I think their "Into" was kind of like "can fold with MOVCC."

This revision was landed with ongoing or failed builds.Dec 16 2022, 10:59 PM
This revision was automatically updated to reflect the committed changes.