[llvm-bugs] [Bug 52178] New: [VectorCombine] transform shuffle of binops with common operand
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 14 09:09:34 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52178
Bug ID: 52178
Summary: [VectorCombine] transform shuffle of binops with
common operand
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Adapted/reduced from the regression test in https://reviews.llvm.org/D111800
(that example could have further shuffle combining which would eliminate a
shuffle and almost definitely be a win):
define <3 x i3> @src(<3 x i3> %x, <3 x i3> %y, <3 x i3> %z) {
%a1 = sub <3 x i3> %x, %y
%a2 = sub <3 x i3> %x, %z
%r = shufflevector <3 x i3> %a1, <3 x i3> %a2, <3 x i32> <i32 0, i32 5, i32
3>
ret <3 x i3> %r
}
define <3 x i3> @tgt(<3 x i3> %x, <3 x i3> %y, <3 x i3> %z) {
%s1 = shufflevector <3 x i3> %x, <3 x i3> %x, <3 x i32> <i32 0, i32 5, i32 3>
%s2 = shufflevector <3 x i3> %y, <3 x i3> %z, <3 x i32> <i32 0, i32 5, i32 3>
%r2 = sub <3 x i3> %s1, %s2
ret <3 x i3> %r2
}
https://alive2.llvm.org/ce/z/d8zB4D
Note: the shuffle of '%x' can be reduced to a unary shuffle; I left the mask
as-is to show that we're re-using the incoming shuffle mask.
As long as the shuffle is no more expensive than the binop, this should be a
win and would potentially allow subsequent combines.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211014/eabc0619/attachment-0001.html>
More information about the llvm-bugs
mailing list