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: [email protected]
Reporter: [email protected]
CC: [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs