[PATCH] Add support for fast-math flags to the FCmp instruction.
Michael Ilseman
milseman at apple.com
Fri May 15 10:23:32 PDT 2015
> On May 15, 2015, at 9:58 AM, James Molloy <james at jamesmolloy.co.uk> wrote:
>
> Hi Michael,
>
> Primarily, I'm upgrading InstCombine to recognize patterns for min and max better. Part of that is adding matching for floating point min and max.
>
> The fcmp/select pattern isn't exactly equivalent to a FMINNUM/FMAXNUM operation in several cases involving NaNs and signed zeroes. There is currently logic in the backends to match these late - I'm trying to move it all to one place.
>
> I can query the function, but that's really lame.
>
Oh, of course. I was imagining querying each operand to the fcmp to see if it is e.g. known non-NaN (it itself is flagged nnan), but I can see having the flag directly on the fcmp being convenient. LGTM.
> Cheers,
>
> James
>
> On Fri, 15 May 2015 at 17:54 Michael Ilseman <milseman at apple.com <mailto:milseman at apple.com>> wrote:
> What are you hoping to accomplish with the information from the flags? When I looked into this way back when, it wasn’t quite compelling, but I’m sure I missed a lot of the cases you’re seeing.
>
> > On May 15, 2015, at 6:58 AM, James Molloy <james.molloy at arm.com <mailto:james.molloy at arm.com>> wrote:
> >
> > Hi hfinkel, majnemer, chandlerc,
> >
> > FCmp behaves a lot like a floating-point binary operator in many ways,
> > and can benefit from fast-math information. Flags such as nsz and nnan
> > can affect if this fcmp (in combination with a select) can be treated
> > as a fminnum/fmaxnum operation.
> >
> > This adds backwards-compatible bitcode support, IR parsing and writing,
> > LangRef changes and IRBuilder changes. I'll need to audit InstSimplify
> > and InstCombine in a followup to find places where flags should be
> > copied.
> >
> > REPOSITORY
> > rL LLVM
> >
> > http://reviews.llvm.org/D9793 <http://reviews.llvm.org/D9793>
> >
> > Files:
> > docs/LangRef.rst
> > include/llvm/IR/IRBuilder.h
> > include/llvm/IR/Operator.h
> > lib/AsmParser/LLParser.cpp
> > lib/Bitcode/Reader/BitcodeReader.cpp
> > lib/Bitcode/Writer/BitcodeWriter.cpp
> > test/Bitcode/fcmp-fast.ll
> > unittests/IR/IRBuilderTest.cpp
> >
> > EMAIL PREFERENCES
> > http://reviews.llvm.org/settings/panel/emailpreferences/ <http://reviews.llvm.org/settings/panel/emailpreferences/>
> > <D9793.25866.patch>_______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150515/58722843/attachment.html>
More information about the llvm-commits
mailing list