[llvm] [GlobalISel][LLT] Introduce FPInfo for LLT (Enable bfloat, ppc128float and others in GlobalISel) (PR #155107)
Ryan Cowan via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 2 04:17:00 PST 2026
HolyMolyCowMan wrote:
I've encountered a few new issues when porting the AArch64 backend to use the new types. The first of which is, there are places in common infrastructure that build types. Currently these build generic scalars which breaks backends with extended types enabled. Switching these constructors to construct the extended type causes the non-extended backends to fail.
We therefore need a way to fallback to building scalars if extended types are disabled. The problem is, the .inc file used for pattern matching and instruction selection is generated before the target machine has the chance to set `LLT:useExtended`. Therefore, just adding a check to the constructors will cause all backends to use generic scalars for selection (which breaks backends with extended types).
The only workaround I've found is to create a wrapper around these builders that fallback to scalars if `useExtended` is false. This way, the `.inc` file can continue to fallback to scalars like it does via the command line flag, and the shared infrastructure can use this builder & therefore fallback if necessary.
I've attached a patch here: [constructor-fallback.patch](https://github.com/user-attachments/files/24407205/constructor-fallback.patch)
The next issue I mentioned earlier, Legalizer mutations often change the type to a generic scalar of the requested size. This causes issues with selection & combining with extended types enabled. I have attached a patch that attempts to mutate sizes of types instead of just constructing a scalar.
Please note the changes to `changeElementSize`. Being able to mutate the size of floating point types is very useful to have, as it can otherwise be quite cumbersome to check what type of float (bfloat, ppcf128, IEEE etc) is being used and creating the correct type.
Attempt at a patch here: [modify-size.patch](https://github.com/user-attachments/files/24407149/modify-size.patch)
https://github.com/llvm/llvm-project/pull/155107
More information about the llvm-commits
mailing list