-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add mul_add_relaxed methods for floating-point types #151793
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
base: main
Are you sure you want to change the base?
Add mul_add_relaxed methods for floating-point types #151793
Conversation
Implements mul_add_relaxed for f16, f32, f64, and f128, which computes (self * a) + b with relaxed precision semantics. Unlike mul_add which guarantees a fused operation, this variant allows the compiler to choose between fused or separate operations based on target performance. This fills the gap between the precision-guaranteed mul_add and the fully-optimizable algebraic operators, providing target-specific optimization while maintaining reasonable floating-point semantics. Tracking issue: rust-lang#151770
|
rustbot has assigned @Mark-Simulacrum. Use |
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
- Use core::intrinsics::fmuladd* directly in std impl - Remove trailing whitespace from test file
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
These doc tests require platform-specific f16/f128 support and should not be run during standard doc builds.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| @@ -0,0 +1,49 @@ | |||
| //@ run-pass | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f16 and f128 should be covered here too. They just need to be gated behing #[cfg(target_has_reliable_f16_math)] / target_has_reliable_f128_math
Implements mul_add_relaxed for f16, f32, f64, and f128, which computes (self * a) + b with relaxed precision semantics. Unlike mul_add which guarantees a fused operation, this variant allows the compiler to choose between fused or separate operations based on target performance.
This fills the gap between the precision-guaranteed mul_add and the fully-optimizable algebraic operators, providing target-specific optimization while maintaining reasonable floating-point semantics.
Tracking issue: #151770
#151770