[PATCH] D115724: [InstCombine] Fold for masked scatters to a uniform address
Caroline via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 17 05:57:36 PST 2021
CarolineConcatto marked an inline comment as done and an inline comment as not done.
CarolineConcatto added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/vscale_masked_intrinsics.ll:16
+ %broadcast.splatvalue = shufflevector <vscale x 4 x i16> %broadcast.value, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
+ call void @llvm.masked.scatter.nxv4i16.nxv4p0i16(<vscale x 4 x i16> %broadcast.splatvalue, <vscale x 4 x i16*> %broadcast.splat, i32 2, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 1), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer))
+ ret void
----------------
sdesmalen wrote:
> CarolineConcatto wrote:
> > sdesmalen wrote:
> > > instead of passing an all true mask, you could simply insert 1 `i1 1` element into a zeroinitializer
> > I have updated the all zero mask to be:
> > <vscale x 4 x i1> zeroinitializer,
> > I don't know if I follow what you want here.
> The comment says:
> ;; Value splat and mask is not not all active/one
>
> Yet in the test it uses an all-poison mask:
>
> <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 1), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
>
> this inserts `i1 1` into element 1 (not zero) of a poison vector, so you get:
> <poison, 1, poison, poison, ... >
>
> and then does a splat of element 0, leading to
> <poison, poison, poison, poison, ...>
>
> If you want to pass a mask that is not all active *and* not all ones *and* not all `poison`, I think you want something like this:
>
> <vscale x 4 x i1> insertelement (<vscale x 4 x i1> zeroinitializer, i1 true, i32 1)
> <=>
> <0, 1, 0, 0, ...>
I have done something different, suggested by David.
Mask is an input, so we don't know if it is all active or inactive.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115724/new/
https://reviews.llvm.org/D115724
More information about the llvm-commits
mailing list