about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs b/compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
index ad46e18c11c..b7491b7e522 100644
--- a/compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
+++ b/compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
@@ -11,6 +11,12 @@
 #[derive(Copy, Clone, PartialEq, Debug)]
 struct f32x4(pub [f32; 4]);
 
+impl f32x4 {
+    fn into_array(self) -> [f32; 4] {
+        unsafe { std::mem::transmute(self) }
+    }
+}
+
 use std::intrinsics::simd::*;
 
 fn main() {
@@ -29,22 +35,22 @@ fn main() {
     unsafe {
         let min0 = simd_fmin(x, y);
         let min1 = simd_fmin(y, x);
-        assert_eq!(min0, min1);
+        assert_eq!(min0.into_array(), min1.into_array());
         let e = f32x4([1.0, 1.0, 3.0, 3.0]);
-        assert_eq!(min0, e);
+        assert_eq!(min0.into_array(), e.into_array());
         let minn = simd_fmin(x, n);
-        assert_eq!(minn, x);
+        assert_eq!(minn.into_array(), x.into_array());
         let minn = simd_fmin(y, n);
-        assert_eq!(minn, y);
+        assert_eq!(minn.into_array(), y.into_array());
 
         let max0 = simd_fmax(x, y);
         let max1 = simd_fmax(y, x);
-        assert_eq!(max0, max1);
+        assert_eq!(max0.into_array(), max1.into_array());
         let e = f32x4([2.0, 2.0, 4.0, 4.0]);
-        assert_eq!(max0, e);
+        assert_eq!(max0.into_array(), e.into_array());
         let maxn = simd_fmax(x, n);
-        assert_eq!(maxn, x);
+        assert_eq!(maxn.into_array(), x.into_array());
         let maxn = simd_fmax(y, n);
-        assert_eq!(maxn, y);
+        assert_eq!(maxn.into_array(), y.into_array());
     }
 }