[llvm] [NFC] Add useFPRegsForHalfType(). (PR #74147)

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 17:36:49 PST 2024


hvdijk wrote:

In my previous comment, when I wrote `TypeToPromoteTo`, I meant `RegisterTypeForVT`. Apologies for the confusion. `TypeToPromoteTo` is used, but is always set to `MVT::f32` and I am not changing that.

I have gone over all the `SoftPromoteHalfRes_*` functions. Two (`BITCAST` and `EXTRACT_VECTOR_ELT`) return an integer the same with as the float input, which for `f16` always results in `i16`. Three (`FCOPYSIGN`, `SELECT`, `SELECT_CC`) return the same type as a promoted operand (`GetSoftPromotedHalf`) where the operand was originally `f16`. Two (`VECREDUCE`, `VECREDUCE_SEQ`) keep the element type as `f16` for further legalization. Everything else unconditionally returns `i16`, nothing there appears to check `RegisterTypeForVT` directly or indirectly, so I think no functions there need updating to behave as we talked about, all of them already do. With the updated comments, can we merge this as is after all?

I have updated both this and [my `softpromotehalf-fpreg-arm` branch](https://github.com/hvdijk/llvm-project/commit/softpromotehalf-fpreg-arm) which enables this for ARM, which I would hope to submit as a PR right after this one.

https://github.com/llvm/llvm-project/pull/74147


More information about the llvm-commits mailing list