[llvm-bugs] [Bug 39534] New: suboptimal codegen for conditional float return?

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 2 05:10:33 PDT 2018


            Bug ID: 39534
           Summary: suboptimal codegen for conditional float return?
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: trass3r 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

bool isNanOrInf(float x)
        return (reinterpret_cast<unsigned&>(x) & 0x7F800000) == 0x7F800000;

float test(float x)
        return isNanOrInf(x) ? 0 : x;

  vmovd eax, xmm0
  not eax
  vpxor xmm1, xmm1, xmm1
  and eax, 2139095040
  je .LBB1_2
  vmovdqa xmm1, xmm0
  vmovdqa xmm0, xmm1

In contrast gcc does not use xmm1 at all:

  vmovd eax, xmm0
  mov edx, 2139095040
  and edx, eax
  cmp edx, 2139095040
  je .L5
  vxorps xmm0, xmm0, xmm0


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/20181102/739cc7d1/attachment.html>

More information about the llvm-bugs mailing list