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

Reply via email to