Skip to content

Failure to vectorize @llvm.lrint.i64.f32 #55208

Closed
@RKSimon

Description

@RKSimon

Pulled out of Issue #55202

https://godbolt.org/z/xqcjnTPhj

#include <cmath>
void testrint( const float * __restrict arg, float *out) {
    *out++ = std::rint( *arg++ );
    *out++ = std::rint( *arg++ );
    *out++ = std::rint( *arg++ );
    *out++ = std::rint( *arg++ );
}
void testlrint( const float * __restrict arg, long *out) {
    *out++ = std::lrint( *arg++ );
    *out++ = std::lrint( *arg++ );
    *out++ = std::lrint( *arg++ );
    *out++ = std::lrint( *arg++ );
}

while rint gets vectorized, lrint doesn't:

testrint(float const*, float*):                       # @testrint(float const*, float*)
        vroundps        $4, (%rdi), %xmm0
        vmovups %xmm0, (%rsi)
        retq
testlrint(float const*, long*):                      # @testlrint(float const*, long*)
        vcvtss2si       (%rdi), %rax
        movq    %rax, (%rsi)
        vcvtss2si       4(%rdi), %rax
        movq    %rax, 8(%rsi)
        vcvtss2si       8(%rdi), %rax
        movq    %rax, 16(%rsi)
        vcvtss2si       12(%rdi), %rax
        movq    %rax, 24(%rsi)
        retq

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions