-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #84274 - nagisa:fix-simd, r=nikic
Don't set fast-math for the SIMD operations we set it for previously Instead of `fast-math`. `fast-math` implies things like functions not being able to accept as an argument or return as a result, say, `inf` which made these functions confusingly named or behaving incorrectly, depending on how you interpret it. It seems that the intended behaviour was to set a `afn` flag instead. In doing so we also renamed the intrinsics to say `_approx` so that it is clear these are not precision oriented and the users can act accordingly. Fixes #84268
- Loading branch information
Showing
19 changed files
with
154 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// compile-flags: -O --crate-type=rlib | ||
#![feature(platform_intrinsics, repr_simd)] | ||
|
||
extern "platform-intrinsic" { | ||
fn simd_fabs<T>(x: T) -> T; | ||
fn simd_eq<T, U>(x: T, y: T) -> U; | ||
} | ||
|
||
#[repr(simd)] | ||
pub struct V([f32; 4]); | ||
|
||
#[repr(simd)] | ||
pub struct M([i32; 4]); | ||
|
||
#[no_mangle] | ||
// CHECK-LABEL: @is_infinite | ||
pub fn is_infinite(v: V) -> M { | ||
// CHECK: fabs | ||
// CHECK: cmp oeq | ||
unsafe { | ||
simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.