[PATCH] D138545: [VectorCombine] Enable scalarizeBinopOrCmp for scalable vectors
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 04:46:51 PST 2022
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - see inline for a couple of additions.
================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:1724
+
+ if (isa<VectorType>(I.getType()))
+ MadeChange |= scalarizeBinopOrCmp(I);
----------------
Add a comment here to make the logic difference explicit:
// This transform works with scalable and fixed vectors.
Should there be a TODO comment about allowing more scalable transforms?
================
Comment at: llvm/test/Transforms/VectorCombine/AArch64/scalarize-scalable.ll:4
+
+define <vscale x 4 x float> @scalarize_scalable(float %0, float %1, float %2, float %3) {
+; CHECK-LABEL: @scalarize_scalable(
----------------
This shows a series of folds, but it would be good to have a couple of minimum tests too. Something like this should give us coverage for integer types and compares?
```
define <vscale x 4 x i32> @scalarize_scalable_udiv(i32 %x, i32 %y) {
%splatx = insertelement <vscale x 4 x i32> poison, i32 %x, i64 0
%splaty = insertelement <vscale x 4 x i32> poison, i32 %y, i64 0
%r = udiv <vscale x 4 x i32> %splatx, %splaty
ret <vscale x 4 x i32> %r
}
define <vscale x 4 x i1> @scalarize_scalable_icmp(i32 %x, i32 %y) {
%splatx = insertelement <vscale x 4 x i32> poison, i32 %x, i64 0
%splaty = insertelement <vscale x 4 x i32> poison, i32 %y, i64 0
%r = icmp sgt <vscale x 4 x i32> %splatx, %splaty
ret <vscale x 4 x i1> %r
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138545/new/
https://reviews.llvm.org/D138545
More information about the llvm-commits
mailing list