[llvm-bugs] [Bug 39477] New: Failure to simplify floor(float(int x)) -> float(int x)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 29 06:54:55 PDT 2018


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

            Bug ID: 39477
           Summary: Failure to simplify floor(float(int x)) -> float(int
                    x)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: filcab at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com, tilkax at gmail.com

#include <math.h>

float floor_s32(int a)
{
    return floorf(a);
}

double floor_s64(long long a)
{
    return floor(a);
}

-O3 -march=btver2

https://godbolt.org/z/3xAI3L

clang:

_Z9floor_s32i: # @_Z9floor_s32i
  vcvtsi2ssl %edi, %xmm0, %xmm0
  vroundss $9, %xmm0, %xmm0, %xmm0
  retq
_Z9floor_s64x: # @_Z9floor_s64x
  vcvtsi2sdq %rdi, %xmm0, %xmm0
  vroundsd $9, %xmm0, %xmm0, %xmm0
  retq

gcc:

_Z9floor_s32i:
  vcvtsi2ss %edi, %xmm0, %xmm0
  ret
_Z9floor_s64x:
  vcvtsi2sdq %rdi, %xmm0, %xmm0
  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/20181029/b32a00f3/attachment.html>


More information about the llvm-bugs mailing list