summaryrefslogtreecommitdiffstats
path: root/tests/codegen/simd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/codegen/simd
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/codegen/simd')
-rw-r--r--tests/codegen/simd/simd-wide-sum.rs26
-rw-r--r--tests/codegen/simd/unpadded-simd.rs9
2 files changed, 20 insertions, 15 deletions
diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen/simd/simd-wide-sum.rs
index 3116f9597..6e7d3d931 100644
--- a/tests/codegen/simd/simd-wide-sum.rs
+++ b/tests/codegen/simd/simd-wide-sum.rs
@@ -11,14 +11,14 @@
#![feature(portable_simd)]
use std::simd::{Simd, SimdUint};
-const N: usize = 8;
+const N: usize = 16;
#[no_mangle]
// CHECK-LABEL: @wider_reduce_simd
pub fn wider_reduce_simd(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
let x: Simd<u16, N> = x.cast();
x.reduce_sum()
}
@@ -26,9 +26,9 @@ pub fn wider_reduce_simd(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_loop
pub fn wider_reduce_loop(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
let mut sum = 0_u16;
for i in 0..N {
sum += u16::from(x[i]);
@@ -39,9 +39,9 @@ pub fn wider_reduce_loop(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_iter
pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // CHECK: zext <16 x i8>
+ // CHECK-SAME: to <16 x i16>
+ // CHECK: call i16 @llvm.vector.reduce.add.v16i16(<16 x i16>
x.as_array().iter().copied().map(u16::from).sum()
}
@@ -52,8 +52,8 @@ pub fn wider_reduce_iter(x: Simd<u8, N>) -> u16 {
#[no_mangle]
// CHECK-LABEL: @wider_reduce_into_iter
pub fn wider_reduce_into_iter(x: Simd<u8, N>) -> u16 {
- // CHECK: zext <8 x i8>
- // CHECK-SAME: to <8 x i16>
- // CHECK: call i16 @llvm.vector.reduce.add.v8i16(<8 x i16>
+ // FIXME: It would be nice if this was exactly the same as the above tests,
+ // but at the time of writing this comment, that didn't happen on LLVM main.
+ // CHECK: call i16 @llvm.vector.reduce.add
x.to_array().into_iter().map(u16::from).sum()
}
diff --git a/tests/codegen/simd/unpadded-simd.rs b/tests/codegen/simd/unpadded-simd.rs
index eb44dbd93..797bca38f 100644
--- a/tests/codegen/simd/unpadded-simd.rs
+++ b/tests/codegen/simd/unpadded-simd.rs
@@ -5,10 +5,15 @@
#![crate_type = "lib"]
#![feature(repr_simd)]
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
#[repr(simd)]
pub struct int16x4_t(pub i16, pub i16, pub i16, pub i16);
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone)]
pub struct int16x4x2_t(pub int16x4_t, pub int16x4_t);
+
// CHECK: %int16x4x2_t = type { <4 x i16>, <4 x i16> }
+#[no_mangle]
+fn takes_int16x4x2_t(t: int16x4x2_t) -> int16x4x2_t {
+ t
+}