[llvm] [GlobalISel][LLT] Introduce FPInfo for LLT (Enable bfloat, ppc128float and others in GlobalISel) (PR #155107)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 01:21:04 PDT 2025
================
@@ -36,6 +36,41 @@ LLT llvm::getLLTForType(Type &Ty, const DataLayout &DL) {
// concerned.
auto SizeInBits = DL.getTypeSizeInBits(&Ty);
assert(SizeInBits != 0 && "invalid zero-sized type");
+
+ // Return simple scalar
+ if (!AllowExtendedLLT)
+ return LLT::scalar(SizeInBits);
+
+ // Choose more precise LLT variant
+ if (Ty.isFloatingPointTy()) {
+ if (Ty.isHalfTy())
+ return LLT::float16();
+
+ if (Ty.isBFloatTy())
+ return LLT::bfloat16();
+
+ if (Ty.isFloatTy())
+ return LLT::float32();
+
+ if (Ty.isDoubleTy())
+ return LLT::float64();
+
+ if (Ty.isX86_FP80Ty())
+ return LLT::x86fp80();
+
+ if (Ty.isFP128Ty())
+ return LLT::float128();
+
+ if (Ty.isPPC_FP128Ty())
+ return LLT::ppcf128();
+
+ llvm_unreachable("Unhandled LLVM IR floating point type");
+ }
+
+ if (Ty.isIntegerTy()) {
+ return LLT::integer(SizeInBits);
+ }
----------------
Pierre-vh wrote:
```suggestion
if (Ty.isIntegerTy())
return LLT::integer(SizeInBits);
```
https://github.com/llvm/llvm-project/pull/155107
More information about the llvm-commits
mailing list