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

Benjamin Kramer benny.kra at gmail.com
Sun Jul 14 11:36:25 PDT 2013


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

> 
> Cheers,
> Juergen
> 
> <vec_setcc.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list