[llvm] [AArch64][GlobalISel] Legalize 128-bit types for FABS (PR #104753)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 14:15:06 PDT 2024


================
@@ -89,6 +89,13 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
   const bool HasFP16 = ST.hasFullFP16();
   const LLT &MinFPScalar = HasFP16 ? s16 : s32;
 
+  // A legality predicate that returns true if the subtarget has FP16 support.
+  // To be used in combination with other predicates, e.g:
+  //     .legalIf(all(hasFP16(), typeInSet(0, {v8s16, v4s16})))
+  const auto hasFP16 = [=]() -> LegalityPredicate {
----------------
davemgreen wrote:

This feels like it has more layers than it needs.

But it might be worth keeping as it was before. I feel like we will have a lot of conditions like these, and we should have something like `.legalFor(hasFP16, {v4f16, v8f16})`

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


More information about the llvm-commits mailing list