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: unassignedb...@nondot.org
          Reporter: nok.ra...@gmail.com
                CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk, spatel+l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to