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

Juergen Ributzka juergen at apple.com
Thu Jul 11 17:04:00 PDT 2013


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.

Cheers,
Juergen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vec_setcc.diff
Type: application/octet-stream
Size: 5469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130711/ca7015cf/attachment.obj>


More information about the llvm-commits mailing list