[llvm-bugs] [Bug 45305] New: fold away float to double promotion in signbit

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 25 11:14:18 PDT 2020


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

            Bug ID: 45305
           Summary: fold away float to double promotion in signbit
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Keywords: code-quality
          Severity: normal
          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

#include <cmath>
bool foo(float x) {
  return std::signbit(double(x));
}
bool bar(float x) {
  return std::signbit(x);
}

define dso_local zeroext i1 @_Z3foof(float %0) local_unnamed_addr #0 {
  %2 = fpext float %0 to double
  %3 = bitcast double %2 to i64
  %4 = icmp slt i64 %3, 0
  ret i1 %4
}
define dso_local zeroext i1 @_Z3barf(float %0) local_unnamed_addr #0 {
  %2 = bitcast float %0 to i32
  %3 = icmp slt i32 %2, 0
  ret i1 %3
}

foo(float):
  cvtss2sd xmm0, xmm0
  movmskpd eax, xmm0
  and      eax, 1
  ret
bar(float):
  movmskps eax, xmm0
  and      eax, 1
  ret

-- 
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/815bfc28/attachment.html>


More information about the llvm-bugs mailing list