diff options
| author | Ralf Jung <post@ralfj.de> | 2024-06-08 18:05:44 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-06-08 21:38:32 +0200 |
| commit | 2f2031d2b22d64d015625db2dd11e44e7ab37091 (patch) | |
| tree | 60d35c6c73626aab991d5c7157b135cb987ee513 /tests/codegen | |
| parent | 655600c5cba4d1e76fa0652c72258ec4996f48b8 (diff) | |
| download | rust-2f2031d2b22d64d015625db2dd11e44e7ab37091.tar.gz rust-2f2031d2b22d64d015625db2dd11e44e7ab37091.zip | |
simd packed types: update outdated check, extend codegen test
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/simd/packed-simd.rs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/codegen/simd/packed-simd.rs b/tests/codegen/simd/packed-simd.rs index f0911b6e360..1df09c96e6c 100644 --- a/tests/codegen/simd/packed-simd.rs +++ b/tests/codegen/simd/packed-simd.rs @@ -9,10 +9,11 @@ use core::intrinsics::simd as intrinsics; use core::{mem, ptr}; // Test codegen for not only "packed" but also "fully aligned" SIMD types, and conversion between -// A repr(packed,simd) type with 3 elements can't exceed its element alignment, -// whereas the same type as repr(simd) will instead have padding. +// them. A repr(packed,simd) type with 3 elements can't exceed its element alignment, whereas the +// same type as repr(simd) will instead have padding. #[repr(simd, packed)] +#[derive(Copy, Clone)] pub struct Simd<T, const N: usize>([T; N]); #[repr(simd)] @@ -28,11 +29,11 @@ fn load<T, const N: usize>(v: Simd<T, N>) -> FullSimd<T, N> { } } -// CHECK-LABEL: square_packed +// CHECK-LABEL: square_packed_full // CHECK-SAME: ptr{{[a-z_ ]*}} sret([[RET_TYPE:[^)]+]]) [[RET_ALIGN:align (8|16)]]{{[^%]*}} [[RET_VREG:%[_0-9]*]] // CHECK-SAME: ptr{{[a-z_ ]*}} align 4 #[no_mangle] -pub fn square_packed(x: Simd<f32, 3>) -> FullSimd<f32, 3> { +pub fn square_packed_full(x: Simd<f32, 3>) -> FullSimd<f32, 3> { // CHECK-NEXT: start // noopt: alloca [[RET_TYPE]], [[RET_ALIGN]] // CHECK: load <3 x float> @@ -42,3 +43,17 @@ pub fn square_packed(x: Simd<f32, 3>) -> FullSimd<f32, 3> { // CHECK-NEXT: ret void unsafe { intrinsics::simd_mul(x, x) } } + +// CHECK-LABEL: square_packed +// CHECK-SAME: ptr{{[a-z_ ]*}} sret([[RET_TYPE:[^)]+]]) [[RET_ALIGN:align 4]]{{[^%]*}} [[RET_VREG:%[_0-9]*]] +// CHECK-SAME: ptr{{[a-z_ ]*}} align 4 +#[no_mangle] +pub fn square_packed(x: Simd<f32, 3>) -> Simd<f32, 3> { + // CHECK-NEXT: start + // CHECK-NEXT: load <3 x float> + // noopt-NEXT: load <3 x float> + // CHECK-NEXT: [[VREG:%[a-z0-9_]+]] = fmul <3 x float> + // CHECK-NEXT: store <3 x float> [[VREG]], ptr [[RET_VREG]], [[RET_ALIGN]] + // CHECK-NEXT: ret void + unsafe { intrinsics::simd_mul(x, x) } +} |
