Add Intrinsics and test for B extension (updating coming soon (:
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The "B extension" terminology no longer exists.
clang/include/clang/Basic/BuiltinsRISCV.def | ||
---|---|---|
29 | The only ones of these we need is ctz_32 and ctz_64 and they should be implemented the same as clz_32/clz_64. I guess we might also need max_32/max_64/maxu_32/maxu_64/min_32/min_64/minu_32/minu_64 for -O0. For -O1 and above (x > y) ? x : y already works. They can use the existing llvm.smax/smin/umax/umin intrinsics. andn can be represented directly in C with X & ~Y | |
llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
90 ↗ | (On Diff #424790) | We don't need any of these intrinsics. Max already has llvm.smax and llvm.umax. |
Thank you for your comments. I will consider them carefully. And I want to know that do you have any documents about intrinsic of bitmanip extension, like RISC-V Vector Extension Intrinsic Document.
And I want to know that do you have any documents about intrinsic of bitmanip extension, like RISC-V Vector Extension Intrinsic Document.
No, we didn't have a formal document for that, I expect we will have one once this finalized https://github.com/riscv-non-isa/riscv-c-api-doc/pull/25 ...
LGTM, but please fix the title to not use "B extension" since the "B extension" was never ratified. Only Zba, Zbb, Zbc, Zbs were ratified and there will never be a B.
The only ones of these we need is ctz_32 and ctz_64 and they should be implemented the same as clz_32/clz_64.
I guess we might also need max_32/max_64/maxu_32/maxu_64/min_32/min_64/minu_32/minu_64 for -O0. For -O1 and above (x > y) ? x : y already works. They can use the existing llvm.smax/smin/umax/umin intrinsics.
andn can be represented directly in C with X & ~Y
orn is X | ~Y
cpop_32 is builtin_popcount
cpop_64 is builtin_popcountll
clzw_32 is __builtin_riscv_clz_32 sign extended to 64 bits. Similar for ctzw_64.