[llvm-commits] [PATCH] optimization of max-like struct for x86

Sean Silva silvas at purdue.edu
Wed Apr 25 17:37:19 PDT 2012


Ah, I see. That's definitely better if three registers are available and
the instructions have to be adjacent. The version I proposed might still be
preferred since it uses one fewer register.

--Sean Silva

On Wed, Apr 25, 2012 at 4:52 PM, Manman Ren <mren at apple.com> wrote:

>
> Hi Sean,
>
> Thanks for providing the feedback.
> This patch will generate
> xorl %ecx, %ecx
> subl %edx, %eax
> cmovsl %ecx, %eax
> while the proposed sequence has a dependency chain from 1st instruction to
> 2nd then to 3rd.
>
> -- Manman
>
> On Apr 25, 2012, at 11:01 AM, Sean Silva <silvas at purdue.edu> wrote:
>
> Why not turn it into e.g.
>
> cmp ebx, eax
> cmovg ebx, eax
> sub ebx, eax
>
> ?
>
> --Sean Silva
>
>
>
> On Wed, Apr 25, 2012 at 12:33 PM, Manman Ren <mren at apple.com> wrote:
>
>>
>> This patch is intended to optimize the following cases for x86:
>> (b > a) ? (b-a) : 0
>> (a < b) ? (b-a) : 0
>> It will use cmovs in generated x86 code.
>>
>> The patch modified one source file: lib/Target/X86/X86ISelLowering.cpp
>>
>> Please review & provide feedback.
>> Thanks,
>>
>>
>> _______________________________________________
>> 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/20120425/0b9ac386/attachment.html>


More information about the llvm-commits mailing list