This patch adds rvv codegen support for vp.fptrunc. The lowering of fp_round and vp.fptrunc share most code so use a common lowering function to handle those two, similar to vp.trunc.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The incongruousness of lowering vp.fptrunc to VP_FPTRUNC but calling a "RoundLike" function was a bit confusing. I opened D123847 to try and make them more consistent.
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4438 | We're returning here after already creating the VL ops. Ideally we'd only create nodes once we know we're going to commit to returning something. This is a smaller issue in the original code but I don't think it needs to be like this. The early-exit check isn't dependent on any previous computations. |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
4438 | Done, I moved it to the begin of the function. |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
3284 | This check wasn't in the original code. Why is it needed now? |
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
---|---|---|
3284 | There is a branch that will just return Op when Op is not a vector in the original code. if (!VT.isVector() || VT.getVectorElementType() != MVT::f16 || SrcVT.getVectorElementType() != MVT::f64) { // For scalable vectors, we only need to close the gap between // vXf64<->vXf16. if (!VT.isFixedLengthVector()) return Op; ... } These two ifs contain the no vector type situation, I split it out because this new lowering function only focus the vector FP round. |
This check wasn't in the original code. Why is it needed now?