diff options
| author | bors <bors@rust-lang.org> | 2025-08-21 22:57:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-21 22:57:46 +0000 |
| commit | 8e3710ef31a0b2cdf5a1c2f3929b7735d1e28c20 (patch) | |
| tree | fd4b586c55cb9c9d40c84180d4ece8c70110963e /tests/codegen-llvm/s390x-simd.rs | |
| parent | 6ba0ce40941eee1ca02e9ba49c791ada5158747a (diff) | |
| parent | 7d2993daf3866947877e285d99235a00332a4e99 (diff) | |
| download | rust-8e3710ef31a0b2cdf5a1c2f3929b7735d1e28c20.tar.gz rust-8e3710ef31a0b2cdf5a1c2f3929b7735d1e28c20.zip | |
Auto merge of #145728 - jhpratt:rollup-nwbw8de, r=jhpratt
Rollup of 16 pull requests Successful merges: - rust-lang/rust#137494 (libstd: init(): dup() subsequent /dev/nulls instead of opening them again) - rust-lang/rust#144541 (c-variadic: multiple ABIs in the same program for arm) - rust-lang/rust#144613 (aarch64-nintendo-switch-freestanding - Enable CPU features that are always available in a live system (crypto instructions, plus explicit NEON).) - rust-lang/rust#144780 (Add a method to dump MIR in the middle of MIR building) - rust-lang/rust#145137 (Consolidate panicking functions in `slice/index.rs`) - rust-lang/rust#145507 (Refactor attribute parsing to improve ergonomics and some diagnostics) - rust-lang/rust#145604 (Gate static closures behind a parser feature) - rust-lang/rust#145648 (Add two tidy dependency checks) - rust-lang/rust#145661 (update some s390x codegen tests) - rust-lang/rust#145672 (Instantiate higher-ranked binder with erased when checking `IntoIterator` predicate for query instability) - rust-lang/rust#145689 (Migrate `panic_unwind` to use `cfg_select!`) - rust-lang/rust#145700 (Handle `ReEarlyParam` in `type_name`.) - rust-lang/rust#145703 (Remove MIPS targets from CI LLVM platforms) - rust-lang/rust#145704 (ci: don't cleanup windows disk) - rust-lang/rust#145705 (remove an `as` cast in prefetch codegen) - rust-lang/rust#145712 (Update outdated link in bound region comments) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen-llvm/s390x-simd.rs')
| -rw-r--r-- | tests/codegen-llvm/s390x-simd.rs | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/tests/codegen-llvm/s390x-simd.rs b/tests/codegen-llvm/s390x-simd.rs index ac39357519e..464c1be11f1 100644 --- a/tests/codegen-llvm/s390x-simd.rs +++ b/tests/codegen-llvm/s390x-simd.rs @@ -6,7 +6,7 @@ #![crate_type = "rlib"] #![feature(no_core, asm_experimental_arch)] -#![feature(s390x_target_feature, simd_ffi, link_llvm_intrinsics, repr_simd)] +#![feature(s390x_target_feature, simd_ffi, intrinsics, repr_simd)] #![no_core] extern crate minicore; @@ -30,16 +30,20 @@ struct f32x4([f32; 4]); #[repr(simd)] struct f64x2([f64; 2]); -#[allow(improper_ctypes)] -extern "C" { - #[link_name = "llvm.smax.v16i8"] - fn vmxb(a: i8x16, b: i8x16) -> i8x16; - #[link_name = "llvm.smax.v8i16"] - fn vmxh(a: i16x8, b: i16x8) -> i16x8; - #[link_name = "llvm.smax.v4i32"] - fn vmxf(a: i32x4, b: i32x4) -> i32x4; - #[link_name = "llvm.smax.v2i64"] - fn vmxg(a: i64x2, b: i64x2) -> i64x2; +impl Copy for i8x16 {} +impl Copy for i16x8 {} +impl Copy for i32x4 {} +impl Copy for i64x2 {} + +#[rustc_intrinsic] +unsafe fn simd_ge<T, U>(x: T, y: T) -> U; + +#[rustc_intrinsic] +unsafe fn simd_select<M, V>(mask: M, a: V, b: V) -> V; + +#[inline(always)] +unsafe fn simd_max<T: Copy>(a: T, b: T) -> T { + simd_select(simd_ge::<T, T>(a, b), a, b) } // CHECK-LABEL: define <16 x i8> @max_i8x16 @@ -48,7 +52,7 @@ extern "C" { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i8x16(a: i8x16, b: i8x16) -> i8x16 { - vmxb(a, b) + simd_max(a, b) } // CHECK-LABEL: define <8 x i16> @max_i16x8 @@ -57,7 +61,7 @@ pub unsafe extern "C" fn max_i8x16(a: i8x16, b: i8x16) -> i8x16 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i16x8(a: i16x8, b: i16x8) -> i16x8 { - vmxh(a, b) + simd_max(a, b) } // CHECK-LABEL: define <4 x i32> @max_i32x4 @@ -66,7 +70,7 @@ pub unsafe extern "C" fn max_i16x8(a: i16x8, b: i16x8) -> i16x8 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i32x4(a: i32x4, b: i32x4) -> i32x4 { - vmxf(a, b) + simd_max(a, b) } // CHECK-LABEL: define <2 x i64> @max_i64x2 @@ -75,7 +79,7 @@ pub unsafe extern "C" fn max_i32x4(a: i32x4, b: i32x4) -> i32x4 { #[no_mangle] #[target_feature(enable = "vector")] pub unsafe extern "C" fn max_i64x2(a: i64x2, b: i64x2) -> i64x2 { - vmxg(a, b) + simd_max(a, b) } // CHECK-LABEL: define <4 x float> @choose_f32x4 @@ -108,7 +112,7 @@ pub unsafe extern "C" fn max_wrapper_i8x16(a: Wrapper<i8x16>, b: Wrapper<i8x16>) // CHECK: call <16 x i8> @llvm.smax.v16i8 // CHECK-SAME: <16 x i8> // CHECK-SAME: <16 x i8> - Wrapper(vmxb(a.0, b.0)) + Wrapper(simd_max(a.0, b.0)) } #[no_mangle] @@ -122,7 +126,7 @@ pub unsafe extern "C" fn max_wrapper_i64x2(a: Wrapper<i64x2>, b: Wrapper<i64x2>) // CHECK: call <2 x i64> @llvm.smax.v2i64 // CHECK-SAME: <2 x i64> // CHECK-SAME: <2 x i64> - Wrapper(vmxg(a.0, b.0)) + Wrapper(simd_max(a.0, b.0)) } #[no_mangle] |
