forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests (
simd_shuffle
/simd_swizzle
)
- Loading branch information
1 parent
6f1569d
commit fa92da2
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! Ensure we can safely swizzle between SIMD types of different sizes. | ||
#![feature(portable_simd)] | ||
|
||
use std::simd::{simd_swizzle, u32x4, u32x8}; | ||
|
||
#[kani::proof] | ||
fn harness_from_u32x4_to_u32x4() { | ||
let a = u32x4::from_array([0, 1, 2, 3]); | ||
let b = u32x4::from_array([4, 5, 6, 7]); | ||
let r: u32x4 = simd_swizzle!(a, b, [0, 1, 6, 7]); | ||
assert_eq!(r.to_array(), [0, 1, 6, 7]); | ||
} | ||
|
||
#[kani::proof] | ||
fn harness_from_u32x4_to_u32x8() { | ||
let a = u32x4::from_array([0, 1, 2, 3]); | ||
let b = u32x4::from_array([4, 5, 6, 7]); | ||
let r: u32x8 = simd_swizzle!(a, b, [0, 1, 2, 3, 4, 5, 6, 7]); | ||
assert_eq!(r.to_array(), [0, 1, 2, 3, 4, 5, 6, 7]); | ||
} | ||
|
||
#[kani::proof] | ||
fn harness_from_u32x8_to_u32x4() { | ||
let a = u32x8::from_array([0, 1, 2, 3, 4, 5, 6, 7]); | ||
let b = u32x8::from_array([0, 1, 2, 3, 4, 5, 6, 7]); | ||
let r: u32x4 = simd_swizzle!(a, b, [0, 1, 2, 3]); | ||
assert_eq!(r.to_array(), [0, 1, 2, 3]); | ||
} |