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

manman ren mren at apple.com
Thu May 3 19:14:04 PDT 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sext_ne.patch
Type: application/octet-stream
Size: 3098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120503/944f80de/attachment.obj>
-------------- next part --------------




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
>> 
> 



More information about the llvm-commits mailing list