2018-03-22 08:49:46 +00:00
|
|
|
//@ compile-flags: -C no-prepopulate-passes
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
2025-02-24 16:26:56 +00:00
|
|
|
#![feature(repr_simd, core_intrinsics)]
|
2018-05-04 16:40:46 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
2018-03-22 08:49:46 +00:00
|
|
|
|
2025-02-24 16:26:56 +00:00
|
|
|
use std::intrinsics::simd::{simd_fmax, simd_fmin};
|
|
|
|
|
2018-03-22 08:49:46 +00:00
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
2024-08-22 08:28:20 +00:00
|
|
|
pub struct f32x4(pub [f32; 4]);
|
2018-03-22 08:49:46 +00:00
|
|
|
|
|
|
|
// CHECK-LABEL: @fmin
|
|
|
|
#[no_mangle]
|
|
|
|
pub unsafe fn fmin(a: f32x4, b: f32x4) -> f32x4 {
|
|
|
|
// CHECK: call <4 x float> @llvm.minnum.v4f32
|
|
|
|
simd_fmin(a, b)
|
|
|
|
}
|
|
|
|
|
2018-06-01 17:20:00 +00:00
|
|
|
// CHECK-LABEL: @fmax
|
|
|
|
#[no_mangle]
|
|
|
|
pub unsafe fn fmax(a: f32x4, b: f32x4) -> f32x4 {
|
|
|
|
// CHECK: call <4 x float> @llvm.maxnum.v4f32
|
|
|
|
simd_fmax(a, b)
|
|
|
|
}
|