[PATCH] D110926: [GlobalISel] Support vectors in LegalizerHelper::narrowScalarMul
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 01:43:30 PDT 2021
foad added a comment.
The problem here is that having narrowed:
%2:_(<2 x s64>) = G_UMULH %0:_, %1:_
into:
%3:_(<2 x s32>), %4:_(<2 x s32>) = G_UNMERGE_VALUES %0:_(<2 x s64>)
%5:_(<2 x s32>), %6:_(<2 x s32>) = G_UNMERGE_VALUES %1:_(<2 x s64>)
%7:_(<2 x s32>) = G_MUL %3:_, %5:_
%8:_(<2 x s32>) = G_MUL %4:_, %5:_
%9:_(<2 x s32>) = G_MUL %3:_, %6:_
%10:_(<2 x s32>) = G_UMULH %3:_, %5:_
%11:_(<2 x s32>), %12:_(<2 x s1>) = G_UADDO %8:_, %9:_
%13:_(<2 x s32>) = G_ZEXT %12:_(<2 x s1>)
%14:_(<2 x s32>), %15:_(<2 x s1>) = G_UADDO %11:_, %10:_
%16:_(<2 x s32>) = G_ZEXT %15:_(<2 x s1>)
%17:_(<2 x s32>) = G_ADD %13:_, %16:_
%18:_(<2 x s32>) = G_MUL %4:_, %6:_
%19:_(<2 x s32>) = G_UMULH %4:_, %5:_
%20:_(<2 x s32>) = G_UMULH %3:_, %6:_
%21:_(<2 x s32>), %22:_(<2 x s1>) = G_UADDO %18:_, %19:_
%23:_(<2 x s32>) = G_ZEXT %22:_(<2 x s1>)
%24:_(<2 x s32>), %25:_(<2 x s1>) = G_UADDO %21:_, %20:_
%26:_(<2 x s32>) = G_ZEXT %25:_(<2 x s1>)
%27:_(<2 x s32>) = G_ADD %23:_, %26:_
%28:_(<2 x s32>), %29:_(<2 x s1>) = G_UADDO %24:_, %17:_
%30:_(<2 x s32>) = G_ZEXT %29:_(<2 x s1>)
%31:_(<2 x s32>) = G_ADD %27:_, %30:_
%32:_(<2 x s32>) = G_UMULH %4:_, %6:_
%33:_(<2 x s32>) = G_ADD %32:_, %31:_
we need a way to merge %28:_(<2 x s32>) (a vector of the low parts of each element of the result) and %33:_(<2 x s32>) (same for the high parts) into a <2 x s64> result. I don't know how to do that. G_MERGE_VALUES only works on scalars, though I don't see why it couldn't be extended to work element-wise on vectors that all have the same length. And I can't see any existing helper functions in LegalizerHelper.cpp that do what I want either.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110926/new/
https://reviews.llvm.org/D110926
More information about the llvm-commits
mailing list