Skip to content

Implement arithmetic operation traits for x86 SIMD types #1898

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sayantn
Copy link
Contributor

@sayantn sayantn commented Aug 7, 2025

ACP: rust-lang/libs-team#628
Tracking Issue: rust-lang/rust#145066

Unresolved questions: Should we have Not and Rem implementations? At least Not seems quite useful.

I will send the PRs of other archs after this is merged, as they also use the common macro

@rustbot
Copy link
Collaborator

rustbot commented Aug 7, 2025

r? @folkertdev

rustbot has assigned @folkertdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@sayantn
Copy link
Contributor Author

sayantn commented Aug 7, 2025

CI is stuck on #1897 🤦🏽

@folkertdev
Copy link
Contributor

yeah that will likely take a couple of days at least

macro_rules! impl_arith_op {
(__internal $op:ident, $intrinsic:ident $_:ident) => {
#[inline]
fn $op(self, rhs: Self) -> Self {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are missing a #[target_feature(enable = "...")] matching the _mm* caller, so the MIR inliner will not inline them and LLVM may not inline them either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simd_* intrinsics call the platform-independent LLVM intrinsics/instructions. The conversion to ASM checks the available feature flags, and uses them as available. See rust-lang/libs-team#628 (comment)

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.

4 participants