diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-07-12 17:11:47 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-07-20 10:15:14 -0700 |
| commit | 493fd9a54110dc9d0d60566140e65f701070e34c (patch) | |
| tree | 86de62c10b4d50e83bdec2ec864bb57fe636838f /compiler | |
| parent | 25a804ab062582bba55bf5cd9844bd13aae00f21 (diff) | |
| download | rust-493fd9a54110dc9d0d60566140e65f701070e34c.tar.gz rust-493fd9a54110dc9d0d60566140e65f701070e34c.zip | |
Update cranelift tests
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs | 22 | ||||
| -rw-r--r-- | compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs | 3 |
2 files changed, 16 insertions, 9 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()); } } diff --git a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs index 246bd3104ec..86602c6b2a3 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs @@ -348,7 +348,8 @@ fn main() { struct V([f64; 2]); let f = V([0.0, 1.0]); - let _a = f.0[0]; + let fp = (&raw const f) as *const [f64; 2]; + let _a = (unsafe { &*fp })[0]; stack_val_align(); } |
