summaryrefslogtreecommitdiffstats
path: root/tests/codegen/issue-84268.rs
blob: 7ca1954470075ded1d98c43ee52b523624c4364b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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]))
    }
}