Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bcmp missing #352

Closed
repmop opened this issue May 1, 2020 · 2 comments
Closed

bcmp missing #352

repmop opened this issue May 1, 2020 · 2 comments

Comments

@repmop
Copy link

repmop commented May 1, 2020

LLVM emits bcmp for #![no_builtins], #![no_std] enabled crates on rustc 1.43.0 while targeting i686-unknown-linux-musl.

This was supposedly resolved in #303, but still appears to be a problem.

Specifically, the memcmp here is being converted to a bcmp.

@josephlr
Copy link
Contributor

josephlr commented Jul 8, 2020

This doesn't seem like a bug, emitting bcmp instead of memcmp on musl seems fine.

What's worked for me is either:

  • Using musl's libc, which has bcmp
  • Using this crate with the mem feature enabled (which is done by default with cargo-xbuild)

EDIT: It should be noted that the call in SlicePartialEq should be converted to a bcmp, as LLVM converts all memcmp(...) == 0 calls to bcmp(...) == 0, as this is sometimes faster.

@Amanieu
Copy link
Member

Amanieu commented Feb 6, 2022

compiler-builtins provides an implementation of bcmp so this should work fine.

@Amanieu Amanieu closed this as completed Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants