[PATCH] D109228: [AMDGPU][GlobalISel] Legalize G_MUL for non-standard types

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 6 01:50:02 PDT 2021


foad added reviewers: aemerson, paquette, dsanders.
foad added a comment.

Adding some more globalisel reviewers in case they have comments on the new "size is multiple of" legality predicates.



================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h:298
+/// of 32.
+LegalityPredicate sizeNotMultiple32(unsigned TypeIdx);
+
----------------
I think the generic predicates should probably be named like `sizeNotMultipleOf`, and take the value 32 as an extra `Size` (or `Unit`?) argument.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalityPredicates.cpp:159
+    const LLT QueryTy = Query.Types[TypeIdx];
+    return QueryTy.isScalar() && (QueryTy.getSizeInBits() % 32);
+  };
----------------
Nit: don't need the parentheses but please do add a `!= 0`.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizeMutations.cpp:71
+    unsigned NewEltSizeInBits =
+        std::max((Ty.getScalarSizeInBits() & ~0x1f) + 32, Min);
+    return std::make_pair(TypeIdx, Ty.changeElementSize(NewEltSizeInBits));
----------------
Use `alignTo(Ty.getScalarSizeInBits(), 32)`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109228/new/

https://reviews.llvm.org/D109228



More information about the llvm-commits mailing list