kito-cheng added inline comments.

================
Comment at: clang/lib/Headers/riscv_zbb_intrin.h:18
+// Zbb
+static __inline__ int_xlen_t __DEFAULT_FN_ATTRS _rv_orc_b(int_xlen_t rs1) {
+  return __builtin_riscv_orc_b(rs1);
----------------
craig.topper wrote:
> craig.topper wrote:
> > I think rather than int_xlen_t we want an int32_t version for RV32/RV64 and 
> > an int64_t version for RV64. I think it is safe to use the 64-bit orc.b 
> > instruction for int32_t on RV64 since each output byte is only affected by 
> > the bits in the same input byte. So we can put garbage in the upper 4 bytes 
> > and ignore the results in the upper bytes.
> > 
> > We couldn't do this for crc32(c) from Zbr.
> To do this you'll need to modify ReplaceNodeResults in RISCVISelLowering.cpp 
> to detect the this intrinsic. I think there's already handling for some other 
> intrinsics in there. Look for INTRINSIC_WO_CHAIN. For this you need to add an 
> ANY_EXTEND to the operand, create a new INTRINSIC_WO_CHAIN node with i64 
> type, and truncate the result back to i32.
> 
> I think you'll need this in the RISCVTargetLowering constructor when Zbb is 
> enabled. We only do it for the V extension right now.
> ```
> setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::i32, Custom);
> ```
In Claire's proposal, there is 3 different version of intrinsic for orc.b:
- _rv_orc_b for int_xlen_t
- _rv32_orc_b for int32_t only
- _rv64_orc_b for int64_t only

https://github.com/riscv/riscv-bitmanip/blob/master/cproofs/rvintrin.h#L989


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99319/new/

https://reviews.llvm.org/D99319

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to