Bug ID: 36617
           Summary: Missing float truncation rounding patterns
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code

Rounding floats/doubles patterns could be converted to truncation rounding
instructions (roundss on x86/sse etc.). AFAICT these don't need to be
-ffast-math only.

float rnd(float x) {
  return (float)((int)x);
__v4sf rnd(__v4sf x) {
    return __builtin_convertvector(__builtin_convertvector(x, __v4si), __v4sf);

define dso_local float @_Z3rndf {
  %2 = fptosi float %0 to i32
  %3 = sitofp i32 %2 to float
  ret float %3
define dso_local <4 x float> @_Z3rndDv4_f {
  %2 = fptosi <4 x float> %0 to <4 x i32>
  %3 = sitofp <4 x i32> %2 to <4 x float>
  ret <4 x float> %3

  cvttss2si %xmm0, %eax
  xorps %xmm0, %xmm0
  cvtsi2ssl %eax, %xmm0
  cvttps2dq %xmm0, %xmm0
  cvtdq2ps %xmm0, %xmm0

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to