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

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 08:39:34 PST 2023


hvdijk wrote:

There are extra complications because `f16` is not a legal type, and non-legal types are ignored in calling conventions, so the calling convention can set that they should be handled as `f32`, but that means nothing, they will be passed in whatever `NumRegistersForVT[MVT::f16]` is set to. But it is possible to override `getRegisterTypeForCallingConv` to handle that, and `getNumRegistersForCallingConv`, if we want.

The bigger issue is that legalising to `i16` causes internal errors because on ARM, like `f16`, `i16` is also not a legal type. We can legalise to `f32`, or we can legalise to `i32`, but not to `i16`. Since legalising to `f32` also avoids the former problem as well, I'd prefer to stick with that.

I'll have another look at your "You need to update all the "SoftPromoteHalf..." functions" comment and see if I can find a test case that shows something that needs updating.

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


More information about the llvm-commits mailing list