[llvm-commits] [Please Review] [PATCH] optimization of -(x != 0) to use neg in X86

Manman Ren mren at apple.com
Sun May 6 08:20:18 PDT 2012


Hi Duncan,

I created a ISD::SUB node with two outputs and used the 2nd output for X86ISD::SETCC_CARRY.

ISD::SUB is not supposed to have two outputs.
Now I used X86ISD::SUB with two outputs and added patterns to match X86ISD::SUB(0, r).

Thanks,
Manman
 
On May 5, 2012, at 4:15 AM, Duncan Sands wrote:

> Hi Manman,
> 
>> PING
> 
> why was it failing before, i.e. what did you fix?
> 
> Ciao, Duncan.
> 
>> 
>> On May 3, 2012, at 7:14 PM, manman ren wrote:
>> 
>>> 
>>> X86: optimization for -(x != 0)
>>> 
>>> This patch will optimize -(x != 0) on X86
>>> FROM
>>> cmpl	$0x01,%edi
>>> sbbl	%eax,%eax
>>> notl	%eax
>>> TO
>>> negl %edi
>>> sbbl %eax %eax
>>> 
>>> In order to generate negl, I added patterns in Target/X86/X86InstrCompiler.td:
>>> def : Pat<(X86sub_flag 0, GR32:$src), (NEG32r GR32:$src)>;
>>> 
>>> This is my first experience with tablegen, please review.
>>> The initial version of this patch (r155853) was the root cause of PR12720 and I did verify this patch against PR12720.
>>> 
>>> Thanks,
>>> Manman
>>> 
>>> <sext_ne.patch>
>>> 
>>> 
>>> 
>>> On Apr 30, 2012, at 11:38 AM, manman ren wrote:
>>> 
>>>>> 
>>>>> 
>>>>> On Apr 27, 2012, at 6:03 PM, manman ren wrote:
>>>>> 
>>>>>> 
>>>>>> This patch will optimize -(x != 0) on X86
>>>>>> FROM
>>>>>> cmpl	$0x01,%edi
>>>>>> sbbl	%eax,%eax
>>>>>> notl	%eax
>>>>>> TO
>>>>>> negl %edi
>>>>>> sbbl %eax %eax
>>>>>> 
>>>>>> Please review&  provide feedback,
>>>>>> Thanks,
>>>>>> Manman
>>>>>> 
>>>>>> <sext_ne.patch>
>>>>>> 
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>> 
>>>> 
>>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> 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