https://bugs.llvm.org/show_bug.cgi?id=46406

            Bug ID: 46406
           Summary: [X86] rsqrt and div generated for 1/sqrt(x * x * x)
                    with -Ofast
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: craig.top...@gmail.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@rotateright.com

InstCombine transforms sqrt(x * x * x) into fabs(x) * sqrt(x) under fast math.

This means (1 / sqrt(x*x*x)) becomes (1 / (fabs(x) * sqrt(x))) which the
backend is unable to match to reciprocal sqrt approximation. Instead we do a
square root approximation which uses rsqrt followed by a regular divide.

Ideally we'd just do the x*x*x and then approximate the reciprocal square root
of that.

https://godbolt.org/z/fR66c4

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to