[PATCH][X86] Add target specific combine rules to fold SSE/AVX/AVX2 blend intrinsics.

Andrea Di Biagio andrea.dibiagio at gmail.com
Thu May 15 15:19:11 PDT 2014


Hi Alex,

> On Thu, May 15, 2014 at 1:45 PM, Alex Rosenberg <alexr at leftfield.org> wrote:
>>
>> After r208664, most of those patch is dead code since Clang no longer
>> generates these intrinsics except the blendv variants. We have to keep the
>> intrinsics as is until the next release because they may exist in IR, but we
>> should remove unused ones when possible.

Right, since clang no longer generates some of those intrinsics, the
'dead' cases should be removed from the switch.

>>
>> Also, it seems to me that this kind of folding belongs in InstCombine
>> since it enables other optimizations and does not generate new shuffles. The
>> only benefit here to SelectionDAG is carrying code for X86 intrinsics in
>> non-X86 builds of LLVM. In this case, the code is small, so I'd still favor
>> InstCombine.

I don't have a strong opinion on this.
Unless Nadav has a different opinion on this, then I am ok to send
another patch that moves this logic into InstCombineCalls.cpp.

Cheers,
Andrea

>>
>> Alex
>>
>> > On May 15, 2014, at 8:26 AM, Andrea Di Biagio
>> > <andrea.dibiagio at gmail.com> wrote:
>> >
>> > Thanks Nadav!
>> >
>> > Committed revision 208895.
>> >
>> >> On Thu, May 15, 2014 at 4:04 PM, Nadav Rotem <nrotem at apple.com> wrote:
>> >> LGTM.  Thanks Andrea.
>> >>
>> >>> On May 15, 2014, at 7:41, Andrea Di Biagio <andrea.dibiagio at gmail.com>
>> >>> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> This patch teaches the x86 backend how to fold SSE4.1/AVX/AVX2 blend
>> >>> intrinsics in the following trivial cases:
>> >>> 1)  fold (blend A, A, Mask) -> A;
>> >>> 2)  fold (blend A, B, <allZeros>) -> A;
>> >>> 3) fold (blend A, B, <allOnes>) -> B;
>> >>>
>> >>> Added two new tests to verify that the new folding rules work for all
>> >>> the optimized blend intrinsics.
>> >>>
>> >>> Please let me know if ok to submit.
>> >>>
>> >>> Thanks,
>> >>> Andrea Di Biagio
>> >>> <patch-combine-x86-blend.diff>
>> > _______________________________________________
>> > llvm-commits mailing list
>> > llvm-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>
> --
> ~Craig



More information about the llvm-commits mailing list