`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. Since the time when these intrinsics have been implemented the intrinsics user's (stdsimd) approach has changed significantly and so now it is required that these intrinsics operate normally rather than in "whatever" way. Fixes #84268
23 lines
455 B
Rust
23 lines
455 B
Rust
// 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]))
|
|
}
|
|
}
|