Skip to content

Commit d15569a

Browse files
committed
separate simd_shuffle test from other tests
1 parent d6c24b3 commit d15569a

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

src/test/cbmc/SIMD/Construction/main.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@
77
#[derive(Clone, Copy, PartialEq, Eq)]
88
pub struct i64x2(i64, i64);
99

10-
#[repr(simd)]
11-
#[allow(non_camel_case_types)]
12-
#[derive(Clone, Copy, PartialEq, Eq)]
13-
pub struct i64x4(i64, i64, i64, i64);
14-
1510
extern "platform-intrinsic" {
1611
fn simd_extract<T, U>(x: T, idx: u32) -> U;
1712
fn simd_insert<T, U>(x: T, idx: u32, b: U) -> T;
18-
fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
19-
fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
2013
}
2114

2215
fn main() {
@@ -43,17 +36,4 @@ fn main() {
4336
// Original unchanged
4437
assert!(y.0 == 0 && y.1 == 1);
4538
}
46-
{
47-
const I: [u32; 2] = [1, 2];
48-
let x: i64x2 = unsafe { simd_shuffle2(y, z, I) };
49-
assert!(x.0 == 1);
50-
assert!(x.1 == 1);
51-
}
52-
{
53-
let a = i64x4(1, 2, 3, 4);
54-
let b = i64x4(5, 6, 7, 8);
55-
const I: [u32; 4] = [1, 3, 5, 7];
56-
let c: i64x4 = unsafe { simd_shuffle4(a, b, I) };
57-
assert!(c == i64x4(2, 4, 6, 8));
58-
}
5939
}

src/test/cbmc/SIMD/Shuffle/main.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
#![feature(repr_simd, platform_intrinsics)]
4+
5+
#[repr(simd)]
6+
#[allow(non_camel_case_types)]
7+
#[derive(Clone, Copy, PartialEq, Eq)]
8+
pub struct i64x2(i64, i64);
9+
10+
#[repr(simd)]
11+
#[allow(non_camel_case_types)]
12+
#[derive(Clone, Copy, PartialEq, Eq)]
13+
pub struct i64x4(i64, i64, i64, i64);
14+
15+
extern "platform-intrinsic" {
16+
fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
17+
fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
18+
}
19+
20+
fn main() {
21+
{
22+
let y = i64x2(0, 1);
23+
let z = i64x2(1, 2);
24+
const I: [u32; 2] = [1, 2];
25+
let x: i64x2 = unsafe { simd_shuffle2(y, z, I) };
26+
assert!(x.0 == 1);
27+
assert!(x.1 == 1);
28+
}
29+
{
30+
let a = i64x4(1, 2, 3, 4);
31+
let b = i64x4(5, 6, 7, 8);
32+
const I: [u32; 4] = [1, 3, 5, 7];
33+
let c: i64x4 = unsafe { simd_shuffle4(a, b, I) };
34+
assert!(c == i64x4(2, 4, 6, 8));
35+
}
36+
}

0 commit comments

Comments
 (0)