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

Implement copysign for libcalls #710

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

workingjubilee
Copy link
Member

As mentioned elsewhere1, it's suspiciously easy to do this, so why doesn't LLVM handle it?

The answer is it might, in fact, do that2, so accepting this would be a paranoid stopgap at best. Nonetheless, if it pleases you, you may!

Footnotes

  1. https:/rust-lang/rust/pull/131304

  2. https:/llvm/llvm-project/pull/111269

@tgross35
Copy link
Contributor

tgross35 commented Oct 6, 2024

abs is useful enough that you should just put it on the Float trait in src/float/mod.rs honestly, we use it everywhere (e..g.

let sign_bit = F::SIGN_MASK;
let abs_mask = sign_bit - one;
).

This should get something in testcrate/tests, and a call in examples/intrinsics.rs to make sure either linking or a fallback works (I think you can just call the intrinsic here since the API isn't in core).

@tgross35
Copy link
Contributor

tgross35 commented Oct 6, 2024

Also we do have this symbol in libm (excluding the f128 version), it just isn't exposed (though we would like it to be). It seems fine to have it here until the libm situation improves somewhat, but I think this would be the first symbol that isn't part of compiler-rt.

I'll still defer to @Amanieu to confirm that though

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

Successfully merging this pull request may close these issues.

3 participants