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

Mirko Brkusanin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 06:33:00 PDT 2021


mbrkusanin added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:552
+      .minScalar(0, S16)
+      .widenScalarToNextMultipleOf(0, 32)
+      .maxScalar(0, S32)
----------------
foad wrote:
> For this case (have 16 insts but no 16 bit packed insts) I think the order should be something like:
> ```
>       .legalFor({S32, S16})
>       .minScalar(0, S16)
>       .scalarize(0)
>       .widenScalarToNextMultipleOf(0, 32)
>       .maxScalar(0, S32)
> ```
> Otherwise v2s16 would be widened to v2s32 and then scalarized to s32. Instead we want to scalarize it to s16.
llvm/test/CodeGen/AMDGPU/GlobalISel/mul.v2i16.ll has those tests and current version of the patch does not seem to affect it.
It is still scalarized to s16.

Either way //scalarize()// will be called first. //widenScalarToNextMultipleOf()// checks if type is scalar.


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

https://reviews.llvm.org/D109228



More information about the llvm-commits mailing list