[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 08:53:24 PDT 2021


foad added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h:848
 
+  /// Widen the scalar to the next multiple of Size, but only if Size is greater
+  /// than MinSize.
----------------
I still find this comment confusing. It says "only if **Size** is greater than MinSize". Do you mean "only if the type is wider than MinSize"?

But I still don't think you really need a MinSize parameter. Instead I think you could change the legalization rules to something like:
```
    getActionDefinitionsBuilder({G_ADD, G_SUB, G_MUL})
      .legalFor({S32, S16, V2S16})
      .minScalar(0, S16)
      .clampMaxNumElements(0, S16, 2)
      .widenScalarToNextMultipleOf(0, 32)
      .maxScalar(0, S32)
      .scalarize(0);
```
Would that work?


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

https://reviews.llvm.org/D109228



More information about the llvm-commits mailing list