Implement simd_round_ties_even for miri, cg_clif and cg_gcc
This commit is contained in:
parent
2038405ff7
commit
2ffa1dd392
4 changed files with 16 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
| "ceil"
|
||||
| "floor"
|
||||
| "round"
|
||||
| "round_ties_even"
|
||||
| "trunc"
|
||||
| "fsqrt"
|
||||
| "fsin"
|
||||
|
|
@ -72,6 +73,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
"ceil" => Op::Round(rustc_apfloat::Round::TowardPositive),
|
||||
"floor" => Op::Round(rustc_apfloat::Round::TowardNegative),
|
||||
"round" => Op::Round(rustc_apfloat::Round::NearestTiesToAway),
|
||||
"round_ties_even" => Op::Round(rustc_apfloat::Round::NearestTiesToEven),
|
||||
"trunc" => Op::Round(rustc_apfloat::Round::TowardZero),
|
||||
"ctlz" => Op::Numeric(sym::ctlz),
|
||||
"ctpop" => Op::Numeric(sym::ctpop),
|
||||
|
|
|
|||
|
|
@ -569,6 +569,10 @@ fn simd_round() {
|
|||
f32x4::from_array([0.9, 1.001, 2.0, -4.5]).round(),
|
||||
f32x4::from_array([1.0, 1.0, 2.0, -5.0])
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { intrinsics::simd_round_ties_even(f32x4::from_array([0.9, 1.001, 2.0, -4.5])) },
|
||||
f32x4::from_array([1.0, 1.0, 2.0, -4.0])
|
||||
);
|
||||
assert_eq!(
|
||||
f32x4::from_array([0.9, 1.001, 2.0, -4.5]).trunc(),
|
||||
f32x4::from_array([0.0, 1.0, 2.0, -4.0])
|
||||
|
|
@ -586,6 +590,10 @@ fn simd_round() {
|
|||
f64x4::from_array([0.9, 1.001, 2.0, -4.5]).round(),
|
||||
f64x4::from_array([1.0, 1.0, 2.0, -5.0])
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { intrinsics::simd_round_ties_even(f64x4::from_array([0.9, 1.001, 2.0, -4.5])) },
|
||||
f64x4::from_array([1.0, 1.0, 2.0, -4.0])
|
||||
);
|
||||
assert_eq!(
|
||||
f64x4::from_array([0.9, 1.001, 2.0, -4.5]).trunc(),
|
||||
f64x4::from_array([0.0, 1.0, 2.0, -4.0])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue