[llvm-commits] Patch: Floating point optimizations for SimplifyInstruction

Michael Ilseman milseman at apple.com
Thu Dec 6 13:28:46 PST 2012


Here's two patches to follow the prior two. The first one removes the optimizations that are made redundant in InstCombine, and has InstCombine call the Simplify helpers for FAdd/FSub/FMul just like all the other parts of InstCombine. The second updates SimplifyBinOp to call the new helpers (using default, or zero, fast-math flags).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Remove-redunant-optimizations-from-InstCombine-inste.patch
Type: application/octet-stream
Size: 4155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121206/59c756c5/attachment.obj>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Have-SimplifyBinOp-call-the-new-FAdd-FSub-FMul-helpe.patch
Type: application/octet-stream
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121206/59c756c5/attachment-0001.obj>
-------------- next part --------------



On Dec 5, 2012, at 4:34 PM, Michael Ilseman <milseman at apple.com> wrote:

> Here's a second round of patches, incorporating the review feedback Duncan had given me earlier but I had spaced. The biggest difference is an extension to PatternMatch.h for pattern matching ConstantFP values of interest.
> 
> Patch1: Pattern matching for more floating point values: -0, +/-0, 1.0, and ConstantFPs
> 
> Patch2: Added a slew of SimplifyInstruction floating-point optimizations, many of which take advantage of fast-math flags. Test cases included.
> fsub X, 0 ==> X
> fsub 0, (fsub 0, X) ==> X
> fsub X, -0 ==> X
>   when X is known non-negative-zero, e.g. the fsub is nsz.
> fsub nnan ninf x, x ==> 0.0
> fadd X, -0 ==> X
> fadd X, 0 ==> X
>   when X is known non-negative-zero, e.g. the fadd is nsz.
> fadd [nnan ninf] X, (fsub [nnan ninf] 0, X) ==> 0
>   where nnan and ninf have to occur at least once somewhere in this expression
> fmul X, 1.0 ==> X
> 
> 
> 
> <0001-Pattern-matching-for-more-floating-point-values-0-0-.patch><0002-Added-a-slew-of-SimplifyInstruction-floating-point-o.patch>
> 
> 
> 
> On Dec 4, 2012, at 3:19 PM, Michael Ilseman <milseman at apple.com> wrote:
> 
>> Attached is a patch adding some floating-point optimizations to SimplifyInstruction, some of which take advantage of fast-math flags. Test cases included.
>> 
>> The optimizations themselves:
>> fsub X, 0 ==> X
>> 
>> fsub 0, (fsub 0, X) ==> X
>> 
>> fadd nsz X, 0 ==> X
>> 
>> fadd [nnan ninf] X, (fsub [nnan ninf] 0, X) ==> 0
>>  where nnan and ninf have to occur at least once somewhere in this expression
>> 
>> fsub nnan ninf x, x ==> 0.0
>> 
>> <0001-Added-a-slew-of-SimplifyInstruction-floating-point-o.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