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

Manman Ren mren at apple.com
Thu Apr 26 09:19:35 PDT 2012


This can be beneficial to other architectures as well.
The main idea is to remove the comparison (b > a) and use the result from sub (b-a).
But first, I need to figure out how to use cmova instead of cmovs. Thanks Steve for pointing that out.
I didn't see an ISD opcode which can be used to get the flags out of the sub SDNode.
The other option is to implement this in Lowering, which is likely to be target dependent.

Thanks,
Manman

On Apr 25, 2012, at 2:24 PM, Evan Cheng <evan.cheng at apple.com> wrote:

> Have you considered making this into a target independent dag combine?
> 
> Evan
> 
> On Apr 25, 2012, at 9:33 AM, 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,
>> 
>> <opt_max_x86.patch>_______________________________________________
>> 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