aaron.ballman added inline comments.
================ Comment at: clang/docs/UsersManual.rst:1393 + + Allow substitution of approximate calculations for functions. + Defaults to ``-fno-approx-func``. ---------------- erichkeane wrote: > masoud.ataei wrote: > > erichkeane wrote: > > > masoud.ataei wrote: > > > > erichkeane wrote: > > > > > This seems pretty incomplete to me, I have no idea what it does from > > > > > this description. Can you elaborate? > > > > If I didn't miss to say it is about math function calls, then I guess > > > > it would be more clear. > > > > ``` > > > > Allow substitution of approximate calculations for math function calls. > > > > ``` > > > > This option just adds `afn` fast-math flag to the function calls and in > > > > backend the math function call can be replaced by an approximate > > > > calculation (either another math function call or not). > > > > https://llvm.org/docs/LangRef.html#fast-math-flags > > > allow substitution of approximate calculations for math function with > > > what? I'm not clear as to what this does still. I'm not sure that I get > > > what the 'afn' documentation means there either. Typically we'd want the > > > clang frontend flags to be more accurate/descriptive than the LLVM-IR > > > documentation. > > This option adds `afn` fast-math flag to function calls in IR. And in the > > case of math function calls (like `log`, `sqrt`, `pow`, ...), `afn` flag > > allows LLVM to substitute the math calls with an "approximate calculation". > > What an approximate calculation is may differ based on which math call it > > is, what other fast-math flags are set, what is the target machine, and > > other factors. > > > > An approximate calculation can be > > 1. sequence of instructions (inlining): for example, inlining sqrt call > > needs `afn` flag to be present in the call. > > 2. a substituted math function call (which may be less accurate but > > faster): > > this substitution can be > > (a) for general targets: for example: `pow(x,0.25)` to > > `sqrt(sqrt(x))`. or > > (b) for a specific target: for example, in the case of PowerPC, we are > > proposing to substitute math calls to MASS library calls > > https://reviews.llvm.org/D101759 > > > > Note that, `afn` flag is necessary for these approximate calculation but > > may not be sufficient. Most of them need at lease one or two other > > fast-math flags to be set too. > > > > I agree the term "approximate calculation" is a very general term. But I > > guess it is needed to describe this general situation. > Perhaps then something like: > `Allow certain math function calls (such as log, sqrt, pow, etc) to be > replaced with an approximately equivalent set of instructions or alternative > math function calls. For example, a pow(x, 0.25) may be replaced with > sqrt(sqrt(x), despite being an inexact result in cases where <expand a > little>.` > > > For Options.td we can be a little more terse, so perhaps something a little > more like: > > `Allow certain math function calls to be replaced with an approximately > equivalent calculation.` > > @aaron.ballman WDYT? > I think the docs suggestion makes sense (though please be sure to add backticks to all the syntax components, correct the missing paren on `sqrt(sqrt(x))`, and finish the <expand a little> bit. I think the suggested wording for Options.td looks good. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D106191/new/ https://reviews.llvm.org/D106191 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits