[PATCH][X86] Lower unsigned vsetcc to psubus in certain cases
Quentin Colombet
qcolombet at apple.com
Wed Feb 26 13:45:17 PST 2014
Hi Adam,
Committed revision 202301.
Thanks,
-Quentin
On Feb 26, 2014, at 10:45 AM, Adam Nemet <anemet at apple.com> wrote:
>
> On Feb 25, 2014, at 5:07 PM, Quentin Colombet <qcolombet at apple.com> wrote:
>
>> Hi Adam,
>>
>> This LGTM with two comments:
>
> Hi Quentin,
>
> Thanks very much for the review.
>
>>
>> 1. Could you add a comment on why this is not useful for AVX?
>> + if (Subtarget->hasAVX())
>> + break;
>
> Done.
>
>>
>> 2. As it is your CHECK-LABEL lines may cause failure on pecoff target, see r201931 on how to fix that.
>
> Added colon after the label name and -mtriple to the command line.
>
> New version is attached including the check-in message. Please apply it for me, thank you.
>
> Adam
>
> <vsetcc-psubus-v2.patch>
>
>>
>> Thanks,
>> -Quentin
>>
>> On Feb 24, 2014, at 2:36 PM, Adam Nemet <anemet at apple.com> wrote:
>>
>>> This is another improvement for SingleSource/Benchmarks/Misc/lowercase.c.
>>>
>>> The current approach to lower a vsetult is to flip the sign bit of the operands, swap the operands and then use a (signed) pcmpgt. psubus (unsigned saturating subtract) can be used to emulate a vsetult more efficiently:
>>>
>>> + case ISD::SETULT: {
>>> + // If the comparison is against a constant we can turn this into a
>>> + // setule. With psubus, setule does not require a swap. This is
>>> + // beneficial because the constant in the register is no longer
>>> + // destructed as the destination so it can be hoisted out of a loop.
>>>
>>> I also enable lowering via psubus in a few other cases where it’s clearly beneficial: setule and setuge if minu/maxu cannot be used. You can see the improvements in the diff to the existing test vec_setcc.ll.
>>>
>>> I am leaving the other case alone for now because it’s harder to reason about profitability in those cases.
>>>
>>> Tested on x86_64-apple-darwin.
>>>
>>> Please apply if it looks good.
>>>
>>> Adam
>>>
>>> <rdar://problem/14338765>
>>>
>>> <vsetcc-psubus-v1.patch>_______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140226/25e9aea6/attachment.html>
More information about the llvm-commits
mailing list