[LLVMdev] [llvm-commits] [PATCH] fast-math patches!
Michael Ilseman
milseman at apple.com
Fri Nov 16 09:35:10 PST 2012
On Nov 15, 2012, at 8:07 PM, Joe Abbey <joe.abbey at gmail.com> wrote:
> Michael,
>
> Overall the code looks good.
>
> 80-cols:
>
> 2046 FMF.UnsafeAlgebra = 0 != (Record[OpNum] & (1 << bitc::FMF_UNSAFE_ALGEBRA));
> 2047 FMF.NoNaNs = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_NANS));
> 2048 FMF.NoInfs = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_INFS));
> 2049 FMF.NoSignedZeros = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_SIGNED_ZEROS));
> 2050 FMF.AllowReciprocal = 0 != (Record[OpNum] & (1 << bitc::FMF_ALLOW_RECIPROCAL));
>
> I found some more in BitcodeReader::ParseConstants(), which I'll scrub after this commits.
>
> Will there be a // fmul N 1, x ==> x? perhaps a // fadd N S 0, x ==> x? as well as other arithmetic identities?
>
Yes, that is the intent. You can see more examples in the original RFC. For you specific examples:
> fmul N 1, x ==> x
I think that the 'N' (now spelled 'nnan') flag isn't relevant to the optimization, as NaN * 1 ==> NaN.
> fadd N S 0, x ==> x
Again, 'N' shouldn't apply. I don't think 'S' ('nsz') is needed here either, but it would be if it was x - 0 ==> x.
> Cheers,
>
> Joe
>
>
> On Nov 15, 2012, at 9:54 PM, Michael Ilseman <milseman at apple.com> wrote:
>
>> Another round of improved patches, and a patch for documentation changes to LangRef.
>> * Make comments more up to date
>> * Use 'arcp' instead of 'ar'
>> * Use logical ||
>>
>> Still based off of r168110
>>
>> <0001-Fast-math-flags-added-to-FPMathOperator.patch>
>> <0002-Fast-math-interfaces-for-Instructions.patch>
>> <0003-Fast-math-flags-for-LLVM-IR-parsing-and-printing.patch>
>> <0004-Fast-math-flags-for-the-bitcode.patch>
>> <0005-Fast-math-test-case-for-bitcode-and-textual-reading-.patch>
>> <0006-Fast-math-optimization-fold-multiply-by-zero.patch>
>> <0007-Fast-math-test-for-SimplifyInstruction-fold-multiply.patch>
>> <0008-Fast-math-flags-documentation-added-to-LangRef.patch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121116/5956881b/attachment.html>
More information about the llvm-dev
mailing list