miri: support simd_ctpop
This commit is contained in:
parent
1914c722b5
commit
1185a6486c
2 changed files with 17 additions and 0 deletions
|
@ -42,6 +42,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
| "flog2"
|
||||
| "flog10"
|
||||
| "ctlz"
|
||||
| "ctpop"
|
||||
| "cttz"
|
||||
| "bswap"
|
||||
| "bitreverse"
|
||||
|
@ -68,6 +69,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
"round" => Op::Round(rustc_apfloat::Round::NearestTiesToAway),
|
||||
"trunc" => Op::Round(rustc_apfloat::Round::TowardZero),
|
||||
"ctlz" => Op::Numeric(sym::ctlz),
|
||||
"ctpop" => Op::Numeric(sym::ctpop),
|
||||
"cttz" => Op::Numeric(sym::cttz),
|
||||
"bswap" => Op::Numeric(sym::bswap),
|
||||
"bitreverse" => Op::Numeric(sym::bitreverse),
|
||||
|
|
|
@ -505,6 +505,21 @@ fn simd_intrinsics() {
|
|||
assert!(simd_reduce_all(i32x4::splat(-1)));
|
||||
assert!(!simd_reduce_all(i32x2::from_array([0, -1])));
|
||||
|
||||
assert_eq!(
|
||||
simd_ctlz(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
|
||||
i32x4::from_array([32, 1, 0, 0])
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
simd_ctpop(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
|
||||
i32x4::from_array([0, 31, 1, 32])
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
simd_cttz(i32x4::from_array([0, i32::MAX, i32::MIN, -1_i32])),
|
||||
i32x4::from_array([32, 0, 31, 0])
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
simd_select(i8x4::from_array([0, -1, -1, 0]), a, b),
|
||||
i32x4::from_array([1, 10, 10, 4])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue