[llvm-bugs] [Bug 45306] New: fold signbit(x) ? -x : x -> fneg x

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 25 11:52:34 PDT 2020


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

            Bug ID: 45306
           Summary: fold signbit(x) ? -x : x -> fneg x
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Keywords: code-quality
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: nok.raven at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

This is essentially the bug 44153 but copysign replaced with conditional fneg.
Probably blocked by bug 44622.

float changesign_std2(float x) {
  bool isneg = std::signbit(x);
  return isneg ? -x : x;
}

define dso_local float @_Z15changesign_std2f(float %0) local_unnamed_addr #0 {
  %2 = bitcast float %0 to i32
  %3 = icmp slt i32 %2, 0
  %4 = fneg float %0
  %5 = select i1 %3, float %4, float %0
  ret float %5
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200325/d57edc09/attachment.html>


More information about the llvm-bugs mailing list