[PATCH] Use PMINU/PMAXU for UGE/ULE vector comparison on X86

Juergen Ributzka juergen at apple.com
Mon Jul 15 11:10:02 PDT 2013


On Jul 14, 2013, at 11:36 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:

> 
> On 12.07.2013, at 02:04, Juergen Ributzka <juergen at apple.com> wrote:
> 
>> Hi,
>> 
>> there are no unsigned integer vector comparisons on x86. Therefore they are converted to signed comparisons that require flipping of the sign bits and sometimes negation of the result. There are two special cases that can be expressed with min/max instead and reduce the overall required instructions.
>> 
>> a <= b —> a == min(a,b)
>> a >= b —> a == max(a,b)
>> 
>> Depending on if SSE2 or SSE41 is available this can be applied to only i8 or i8/i16/i32 based vectors.
>> 
>> This patch is based on the idea from Ian Ollmann who originally suggested this improvement.
>> 
>> Please see the attached diff file for the patch to LowerVSETCC and a small test case.
> 
> Nice trick! Patch looks good to me, do you have commit access?
> 
> - Ben

Hi Ben,

I don’t have commit access yet. Let me check first if this trick is also profitable for ULT and UGT as suggested by Matti and revise the patch if necessary. I will also ask for commit access.

Thanks

-Juergen

> 
>> 
>> Cheers,
>> Juergen
>> 
>> <vec_setcc.diff>_______________________________________________
>> 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/20130715/ed901657/attachment.html>


More information about the llvm-commits mailing list