[PATCH] D94535: [RISCV] Optimize Branch Comparisons
Sam Elliott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 12 11:22:11 PST 2021
lenary created this revision.
lenary added reviewers: luismarques, craig.topper, mundaym, asb.
Herald added subscribers: frasercrmck, NickHung, evandro, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
lenary requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
I noticed in D94450 <https://reviews.llvm.org/D94450> that there were quite a few places where we generate
the sequence:
xN <- comparison ...
xN <- xor xN, 1
bnez xN, symbol
Given we know the XOR will be used by BRCOND, which only looks at the lowest
bit, I think we can remove the XOR and just invert the branch condition in
these cases?
The case mostly seems to come up in floating point tests, where there is often
more logic to combine the results of multiple SETCCs, rather than a single
(BRCOND (SETCC ...) ...).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94535
Files:
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/test/CodeGen/RISCV/double-br-fcmp.ll
llvm/test/CodeGen/RISCV/float-br-fcmp.ll
llvm/test/CodeGen/RISCV/half-br-fcmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94535.316171.patch
Type: text/x-patch
Size: 14889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210112/95ca7448/attachment-0001.bin>
More information about the llvm-commits
mailing list