]> git.lizzy.rs Git - rust.git/blob - tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
[rust.git] / tests / codegen / simd-intrinsic / simd-intrinsic-float-minmax.rs
1 // compile-flags: -C no-prepopulate-passes
2
3 #![crate_type = "lib"]
4
5 #![feature(repr_simd, platform_intrinsics)]
6 #![allow(non_camel_case_types)]
7
8 #[repr(simd)]
9 #[derive(Copy, Clone, PartialEq, Debug)]
10 pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
11
12 extern "platform-intrinsic" {
13     fn simd_fmin<T>(x: T, y: T) -> T;
14     fn simd_fmax<T>(x: T, y: T) -> T;
15 }
16
17 // CHECK-LABEL: @fmin
18 #[no_mangle]
19 pub unsafe fn fmin(a: f32x4, b: f32x4) -> f32x4 {
20     // CHECK: call <4 x float> @llvm.minnum.v4f32
21     simd_fmin(a, b)
22 }
23
24 // CHECK-LABEL: @fmax
25 #[no_mangle]
26 pub unsafe fn fmax(a: f32x4, b: f32x4) -> f32x4 {
27     // CHECK: call <4 x float> @llvm.maxnum.v4f32
28     simd_fmax(a, b)
29 }