Skip to content

Commit e0cc93e

Browse files
committed
Add "algebraic" versions of the fast-math intrinsics
1 parent 03d6ce1 commit e0cc93e

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

core/src/intrinsics.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,46 @@ extern "rust-intrinsic" {
18821882
#[rustc_nounwind]
18831883
pub fn frem_fast<T: Copy>(a: T, b: T) -> T;
18841884

1885+
/// Float addition that allows optimizations based on algebraic rules.
1886+
///
1887+
/// This intrinsic does not have a stable counterpart.
1888+
#[rustc_nounwind]
1889+
#[rustc_safe_intrinsic]
1890+
#[cfg(not(bootstrap))]
1891+
pub fn fadd_algebraic<T: Copy>(a: T, b: T) -> T;
1892+
1893+
/// Float subtraction that allows optimizations based on algebraic rules.
1894+
///
1895+
/// This intrinsic does not have a stable counterpart.
1896+
#[rustc_nounwind]
1897+
#[rustc_safe_intrinsic]
1898+
#[cfg(not(bootstrap))]
1899+
pub fn fsub_algebraic<T: Copy>(a: T, b: T) -> T;
1900+
1901+
/// Float multiplication that allows optimizations based on algebraic rules.
1902+
///
1903+
/// This intrinsic does not have a stable counterpart.
1904+
#[rustc_nounwind]
1905+
#[rustc_safe_intrinsic]
1906+
#[cfg(not(bootstrap))]
1907+
pub fn fmul_algebraic<T: Copy>(a: T, b: T) -> T;
1908+
1909+
/// Float division that allows optimizations based on algebraic rules.
1910+
///
1911+
/// This intrinsic does not have a stable counterpart.
1912+
#[rustc_nounwind]
1913+
#[rustc_safe_intrinsic]
1914+
#[cfg(not(bootstrap))]
1915+
pub fn fdiv_algebraic<T: Copy>(a: T, b: T) -> T;
1916+
1917+
/// Float remainder that allows optimizations based on algebraic rules.
1918+
///
1919+
/// This intrinsic does not have a stable counterpart.
1920+
#[rustc_nounwind]
1921+
#[rustc_safe_intrinsic]
1922+
#[cfg(not(bootstrap))]
1923+
pub fn frem_algebraic<T: Copy>(a: T, b: T) -> T;
1924+
18851925
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
18861926
/// (<https://github.com/rust-lang/rust/issues/10184>)
18871927
///

0 commit comments

Comments
 (0)