This commit updates the `#[cfg]` annotations used to select the
implementation of 128-bit division in compiler-builtins on wasm targets.
This is done with relation to
https://github.com/WebAssembly/128-bit-arithmetic where performance of
128-bit operations is being investigated on WebAssembly. While I don't
know much about the particulars of the two algorithms involved here the
comments indicate that the "trifecta" variant is preferred if possible
but it's not selected on 32-bit architectures. This rationale isn't as
applicable to WebAssembly targets because despite the 32-bit pointer
width there are often wider-than-pointer operations available as it's
typically run on 64-bit machines.
Locally in testing a benchmark that performs division with a Rust-based
bignum libraries whent from 350% slower-than-native to 220%
slower-than-native with this change, a nice increase in speed. While
this was tested with Wasmtime other runtimes are likely to see an
improvement as well.
These hexagon builtins incorrectly created aliases in the global
namespace which can (and in at least one case, did) conflict
with symbols defined by other programs.
This should address the issue reported as https://github.com/rust-lang/rust/issues/129823:
Compiling compiler_builtins v0.1.123
Compiling core v0.0.0 (/home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling rustc-std-workspace-core v1.99.0 (/home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling byteorder v1.5.0
Compiling zerocopy v0.7.34
error: symbol 'fma' is already defined
error: could not compile `compiler_builtins` (lib) due to 1 previous error
Also: some of the symbols defined were not just aliases, so those are
now qualified with `__hexagon_`. The compiler does not yet emit calls
to these particular ones, but if/when it does, it can use the new names.
This fixes such as (https://github.com/rust-lang/rust/issues/128386)
where, our implementation is being used on systems where there is
already `math` library and its more performant and accurate.
So with this change, linux will go back to the previous behavior and not
include these functions, windows and apple were generally not affected.
Looking at the targets we have builtin now in rust, everything else is
probably good to have the math symbols.
> A note on the above, the `hermit` os uses `libm` directly for itself,
> but I think its Ok to keep providing math in `compiler_builtin` for it,
> its technically the same implementation either from `compiler_builtin`
> or `hermit-builtins`.
Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
There were some issues regarding windows and apple platform, we were
exporting symbols that are already provided by the compiler but weren't
marked as `weak` which resulted in conflicted symbols in the linking
process.
Initially, we didn't add `weak` because we thought it is not supported
on windows and apple platforms, but it looks like its only not supported
on windows-gnu platforms
Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
Make the following changes:
- Add `rerun-if-changed` to the new `configure.rs`, it seems this was
causing incorrect caching.
- Change from matching `i686` to `x86`. The target triple starts with
`i686` so that is what we were checking before, but the architecture
is `x86`. This change should have been made when we added `struct
Target`, update it now instead.
Replace `public_test_dep!` by placing optionally public items into new
modules, then controlling what is exported with the `public-test-deps`
feature.
This is nicer for automatic formatting and diagnostics.
Since there are more platforms that do not have symbols present, we need
to use `rustc_apfloat` for more conversion tests. Make use of the
fallback like other tests, and refactor so each test gets its own
function.
Previously we were testing both apfloat and system conversion methods
when possible. This changes to only test one or the other, depending on
whether or not the system version is available. This seems reasonable
because it is consistent with all other tests, but we should consider
updating all tests to check both at some point.
This also includes an adjustment of PowerPC configuration to account for
the linking errors at [1].
[1]: https://github.com/rust-lang/compiler-builtins/issues/655
Previously we were building the C versions of these symbols. Since we
added the Rust version and updated compiler builtins, these are no
longer available by default. This is unintentional, but it gives a
better indicator of which symbol versions are not actually provided by
the system.
Use the list of build failures to correct the list of platforms that do
not have `f16` symbols.
By moving the logic for which platforms get symbols to
`compiler_builtins` rather than rust-lang/rust, we can control where
symbols get enabled without relying on Cargo features. Using Cargo
features turned out to be a problem in [1].
This will help resolve errors like [2].
[1]: https://github.com/rust-lang/rust/issues/128358
[2]: https://github.com/rust-lang/rust/issues/128401
This is what `cc-rs` is using and should create a release PR whenever a
change to `master` is made. If the branch is merged, it should publish
the new version.
Includes configuration to disable semver checks and not keep a changelog
since this is an implementation detail.