[PATCH] D141962: [RISCV] Use vfirst insead of vcpop for i1 reduce.and/or.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 17 12:38:59 PST 2023
craig.topper created this revision.
craig.topper added reviewers: reames, michaelmaitland, rogfer01, frasercrmck, kito-cheng.
Herald added subscribers: luke, VincentWu, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
vfirst has the chance of an early out in a microarchitecture, but
vcpop does not. Though I don't know of such a microarchitecture.
For and/or we only need to know if any 1 exists in the mask (after
invering for AND). So we can use vfirst.
Unfortunately, there is no sgez instruction so we end up needing
to invert an sltz for OR. That might make this not worthwhile if there
isn't a microarchitecture that optimizes vfirst. If the start value
is known to be 0 and the result is used by a branch we will hopefully
end up with a bgez instead.
Posting to collect other opinions.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141962
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-reduction-mask-vp.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vreductions-mask.ll
llvm/test/CodeGen/RISCV/rvv/vreductions-mask-vp.ll
llvm/test/CodeGen/RISCV/rvv/vreductions-mask.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141962.489920.patch
Type: text/x-patch
Size: 94390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230117/a2a4f42d/attachment-0001.bin>
More information about the llvm-commits
mailing list