Skip to content

Infinite recursion in sqrt #649

Open
@antoyo

Description

Hi.
This is a continuation of this Zulip discussion as it seems this might be a bug in compiler-builtins (please close if this is not the case).

The context was:

I'm trying to update compiler-builtins in rustc_codegen_gcc that was pinned to 0.1.109 until the support for f16 and f128 was implemented.
I used to not generate symbols like sqrt from compiler_builtins (instead, we were using the one from libgcc) in order to avoid infinite recursion like:

compiler_builtins::math::libm::sqrt::sqrt
compiler_builtins::math::sqrt
sqrt
core::core_arch::x86::sse2::_mm_sqrt_pd

because rustc_codegen_gcc implements SIMD sqrt by calling sqrt on each element of the vector for now.
But with the new update, it seems I cannot do that anymore. This workaround seemed like a hack anyway.

@Amanieu mentioned the following which might be the solution:

Really compiler_builtins shouldn't be calling the native instruction, it should only contain the fallback.
Since the compiler is responsible for emitting the proper instruction and not calling the builtin in the first place.

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions