[llvm-commits] [Patch] Optimize integer ABS on X86
mren at apple.com
Wed Jun 6 18:01:48 CDT 2012
Optimize generated code for integer ABS on X86:
movl %edi, %ecx
sarl $31, %ecx
leal (%rdi,%rcx), %eax
xorl %ecx, %eax
movl %edi, %eax
cmovll %edi, %eax
This reduces code size and has better performance on sandy bridge.
There exists a target-independent DAG combine for integer ABS, which converts abs to sar+add+xor.
For X86, I tried to match this pattern back to neg+cmov. This is implemented in PerformXorCombine.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3356 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20120606/c53c8c11/attachment-0001.obj
More information about the llvm-commits