]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/simd-intrinsic-float-minmax.rs
Rollup merge of #56425 - scottmcm:redo-vec-set_len-docs, r=Centril
[rust.git] / src / test / codegen / simd-intrinsic-float-minmax.rs
1 // ignore-emscripten
2 // min-llvm-version 7.0
3
4 // compile-flags: -C no-prepopulate-passes
5
6 #![crate_type = "lib"]
7
8 #![feature(repr_simd, platform_intrinsics)]
9 #![allow(non_camel_case_types)]
10
11 #[repr(simd)]
12 #[derive(Copy, Clone, PartialEq, Debug)]
13 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
14
15 extern "platform-intrinsic" {
16     fn simd_fmin<T>(x: T, y: T) -> T;
17     fn simd_fmax<T>(x: T, y: T) -> T;
18 }
19
20 // CHECK-LABEL: @fmin
21 #[no_mangle]
22 pub unsafe fn fmin(a: f32x4, b: f32x4) -> f32x4 {
23     // CHECK: call <4 x float> @llvm.minnum.v4f32
24     simd_fmin(a, b)
25 }
26
27 // CHECK-LABEL: @fmax
28 #[no_mangle]
29 pub unsafe fn fmax(a: f32x4, b: f32x4) -> f32x4 {
30     // CHECK: call <4 x float> @llvm.maxnum.v4f32
31     simd_fmax(a, b)
32 }