You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
}
Extended Description
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.
The text was updated successfully, but these errors were encountered: