[PATCH][X86] Lower unsigned vsetcc to psubus in certain cases
Adam Nemet
anemet at apple.com
Mon Feb 24 14:36:46 PST 2014
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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vsetcc-psubus-v1.patch
Type: application/octet-stream
Size: 9688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140224/ea19df7d/attachment.obj>
More information about the llvm-commits
mailing list