[PATCH] D25987: [X86] New pattern to generate PSUBUS from SELECT

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 12 07:30:01 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D25987#752968, @yulia_koval wrote:

> I agree, that it looks better as canonical, then my example, when trunc is in between the pattern's instructions. What do you think about defining trunc(sub(select())) canonical for this pattern? Then we can canonicalize my initial pattern using the InstCombine patch I attached(https://reviews.llvm.org/D33118) - it looks like this way the .ll code generated for both of them would be the same. After this transformation, the initial pattern can be transformed into 32bit sub(max). I haven't yet investigated how to transform it into psubus, but at least max is more profitable then currently generated instructions.
>
> What do you think about this idea?


I think it's a good idea to form canonical min/max in IR when possible. There is precedent for a canonicalization that is similar to this one:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html

But please send a note to llvm-dev requesting feedback for this canonicalization. We want to make sure there are no objections before proceeding.

I think the example can be minimized to this:
http://rise4fun.com/Alive/qBn

(ie, the leading zext is not needed, and this pattern is not limited to vectors)


https://reviews.llvm.org/D25987





More information about the llvm-commits mailing list