2021-04-17 12:40:59 -05:00
|
|
|
//@ compile-flags: -O --crate-type=rlib
|
2024-02-23 11:36:24 -06:00
|
|
|
#![feature(intrinsics, repr_simd)]
|
2021-04-17 12:40:59 -05:00
|
|
|
|
2024-02-23 11:36:24 -06:00
|
|
|
extern "rust-intrinsic" {
|
2021-04-17 12:40:59 -05:00
|
|
|
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
|
2024-05-28 23:11:20 -05:00
|
|
|
unsafe { simd_eq(simd_fabs(v), V([f32::INFINITY; 4])) }
|
2021-04-17 12:40:59 -05:00
|
|
|
}
|