Skip to content

Commit b47132d

Browse files
committed
Auto merge of #143183 - GuillaumeGomez:rollup-g60lr91, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang/rust#142078 (Add SIMD funnel shift and round-to-even intrinsics) - rust-lang/rust#142214 (`tests/ui`: A New Order [9/N]) - rust-lang/rust#142417 (`tests/ui`: A New Order [12/N]) - rust-lang/rust#143030 (Fix suggestion spans inside macros for the `unused_must_use` lint) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a32d884 + b75bb8f commit b47132d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/intrinsics/simd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3636
| "ceil"
3737
| "floor"
3838
| "round"
39+
| "round_ties_even"
3940
| "trunc"
4041
| "fsqrt"
4142
| "fsin"
@@ -71,6 +72,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7172
"ceil" => Op::Round(rustc_apfloat::Round::TowardPositive),
7273
"floor" => Op::Round(rustc_apfloat::Round::TowardNegative),
7374
"round" => Op::Round(rustc_apfloat::Round::NearestTiesToAway),
75+
"round_ties_even" => Op::Round(rustc_apfloat::Round::NearestTiesToEven),
7476
"trunc" => Op::Round(rustc_apfloat::Round::TowardZero),
7577
"ctlz" => Op::Numeric(sym::ctlz),
7678
"ctpop" => Op::Numeric(sym::ctpop),

tests/pass/intrinsics/portable-simd.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ fn simd_round() {
569569
f32x4::from_array([0.9, 1.001, 2.0, -4.5]).round(),
570570
f32x4::from_array([1.0, 1.0, 2.0, -5.0])
571571
);
572+
assert_eq!(
573+
unsafe { intrinsics::simd_round_ties_even(f32x4::from_array([0.9, 1.001, 2.0, -4.5])) },
574+
f32x4::from_array([1.0, 1.0, 2.0, -4.0])
575+
);
572576
assert_eq!(
573577
f32x4::from_array([0.9, 1.001, 2.0, -4.5]).trunc(),
574578
f32x4::from_array([0.0, 1.0, 2.0, -4.0])
@@ -586,6 +590,10 @@ fn simd_round() {
586590
f64x4::from_array([0.9, 1.001, 2.0, -4.5]).round(),
587591
f64x4::from_array([1.0, 1.0, 2.0, -5.0])
588592
);
593+
assert_eq!(
594+
unsafe { intrinsics::simd_round_ties_even(f64x4::from_array([0.9, 1.001, 2.0, -4.5])) },
595+
f64x4::from_array([1.0, 1.0, 2.0, -4.0])
596+
);
589597
assert_eq!(
590598
f64x4::from_array([0.9, 1.001, 2.0, -4.5]).trunc(),
591599
f64x4::from_array([0.0, 1.0, 2.0, -4.0])

0 commit comments

Comments
 (0)