[llvm-dev] EuroLLVM Numerics info

Sanjay Patel via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 4 08:51:20 PDT 2019


1. Do you have a larger code example that shows the missed sqrt/div
optimization?

We optimize the example you provided already in IR:
#include <math.h>
float sqrt_squared(float x) {
  return 1.0f/sqrtf(x) * 1.0f/sqrtf(x);
}

$ clang -O1 -ffast-math -emit-llvm  sqrt.c -S -o -
define float @sqrt_squared(float) local_unnamed_addr #0 {
  %2 = fdiv fast float 1.000000e+00, %0
  ret float %2
}

2. Yes, transforms like the above should work with vector types. If not,
please file a bug.

On Wed, Apr 3, 2019 at 11:47 PM Venkataramanan Kumar via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi Micheal,
>
> Thanks for the blog post.  Just like to point out few things that I
> thought is related to FP Numerics.
> LLVM could do some additional transformation with "sqrt" and "division"
> under fast math on X86 like 1/sqrt(x)* 1/sqrt(x) to 1/x.   These are long
> latency instructions and could get benefit if enabled under unsafe math.
>
> Also are we considering doing such FP transforms on vector floating point
> types?
>
> regards,
> Venkat.
>
>
>
>
>
> On Mon, 1 Apr 2019 at 19:56, Cameron McInally via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hey Michael,
>>
>> Thank you for working on this!
>>
>> I'd like to touch on a topic mentioned in the blog post. The constrained
>> intrinsics work is at a road block on how to proceed with the constrained
>>  implementation in the backends, i.e. D55506. Reviews/ideas in this area
>> would be greatly appreciated (attn: target code owners).
>>
>> Thanks,
>> Cameron
>>
>>
>> On Thu, Mar 28, 2019 at 5:54 PM Michael Berg via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> All:  There will be a BoF talk at the EuroLLVM conference regarding
>>> Numerics (FMF and module flags which control fp behavior and optimization).
>>>
>>> Even if you are not going to be in attendance, please reply to this
>>> thread as we are collecting open issues and ideas for future direction in
>>> all layers of LLVM for which optimizations are controlled by numerics flags.
>>> Please read over the numerics blog if you like for reference material:
>>>
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.llvm.org_2019_03_llvm-2Dnumerics-2Dblog.html&d=DwIGaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=O_4M49EtSpZ_-BQYeigzGv0P4__noMcSu2RYEjS1vKs&m=CHHCGUAnxC91rtvrnhhoN0jXGXgXv8EQb8C4XiUEoxY&s=xzUyP83nqSY1h9GrDdHch4INrIFIU-Ycij4S4Tmxdko&e=
>>>
>>> Regards,
>>> Michael
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=O_4M49EtSpZ_-BQYeigzGv0P4__noMcSu2RYEjS1vKs&m=CHHCGUAnxC91rtvrnhhoN0jXGXgXv8EQb8C4XiUEoxY&s=5CVfTGSHNKAmAzx4dc0HQzDTXMucnDgx_NPimota5m8&e=
>>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190404/846d0de8/attachment.html>


More information about the llvm-dev mailing list