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

Move arch-specific behavior and intrinsics to a separate module #316

Merged
merged 5 commits into from
Oct 29, 2024

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Oct 24, 2024

Introduce math/arch/* as a home for architecture-specific behavior and intrinsic usage, and move relevant existing code there.

This allows us to declutter things a bit and also commonize the logic of cfg flags so we don't accidentally disobey force-soft-floats.

@tgross35 tgross35 changed the title Experiment with moving arch-specific implemntations to a separate module Experiment with moving arch-specific implementations to a separate module Oct 26, 2024
@tgross35 tgross35 force-pushed the arch-module branch 2 times, most recently from 035b1ca to 8302cf7 Compare October 27, 2024 04:10
@tgross35 tgross35 changed the title Experiment with moving arch-specific implementations to a separate module Move arch-specific behavior and intrinsics to a separate module Oct 27, 2024
@tgross35
Copy link
Contributor Author

The commit history is a mess so please don't merge directly, but this is ready for a look. The diff makes a lot more sense with "hide whitespace" checked.

@tgross35 tgross35 marked this pull request as ready for review October 27, 2024 06:02
@tgross35 tgross35 force-pushed the arch-module branch 13 times, most recently from 3c110e1 to fdeba8c Compare October 29, 2024 02:40
Don't try to generate tests for directories, or for files that contain
`f16` or `f128` (as these types are not provided by musl's math
implementations).

(cherry picked from commit fd7ad36)
`cfg_if` is helpful for applying `cfg` attributes to groups of items,
like we will need to do with architecture-specific modules of `f16` and
`f128`. However, `libm` can't have dependencies.

The `cfg_if` macro is complex but small, so just vendor it here.
Introduce a Cargo feature to enable or disable architecture-specific
features (SIMD, assembly), which is on by default. This allows for more
fine grained control compared to relying on the `force-soft-floats`
feature.

Similar to "unstable-intrinsics", introduce a build.rs config option for
`unstable-intrinsics AND NOT force-soft-floats`, which makes this easier
to work with in code.

Effectively, this allows moving our non-additive Cargo feature
(force-soft-floats) to a positive one by default, allowing for an
override when needed.
Move the code and call into its new location with
`select_implementation`.
@tgross35 tgross35 enabled auto-merge October 29, 2024 03:17
@tgross35 tgross35 merged commit d9bfeca into rust-lang:master Oct 29, 2024
28 checks passed
@tgross35 tgross35 deleted the arch-module branch November 1, 2024 01:41
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.

1 participant