Skip to content

Commit cc9c7ad

Browse files
author
The Miri Cronjob Bot
committed
Merge ref '5f9dd05862d2' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 5f9dd05862d2e4bceb3be1031b6c936e35671501 Filtered ref: 0498b26 Upstream diff: rust-lang/rust@c5dabe8...5f9dd05 This merge was created using https://github.com/rust-lang/josh-sync.
2 parents f20407d + 0498b26 commit cc9c7ad

File tree

8 files changed

+285
-139
lines changed

8 files changed

+285
-139
lines changed

src/intrinsics/simd.rs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use rand::Rng;
2-
use rustc_apfloat::Float;
31
use rustc_middle::ty;
42
use rustc_middle::ty::FloatTy;
53

@@ -83,62 +81,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8381
this.write_scalar(val, &dest)?;
8482
}
8583
}
86-
"fma" | "relaxed_fma" => {
87-
let [a, b, c] = check_intrinsic_arg_count(args)?;
88-
let (a, a_len) = this.project_to_simd(a)?;
89-
let (b, b_len) = this.project_to_simd(b)?;
90-
let (c, c_len) = this.project_to_simd(c)?;
91-
let (dest, dest_len) = this.project_to_simd(dest)?;
92-
93-
assert_eq!(dest_len, a_len);
94-
assert_eq!(dest_len, b_len);
95-
assert_eq!(dest_len, c_len);
96-
97-
for i in 0..dest_len {
98-
let a = this.read_scalar(&this.project_index(&a, i)?)?;
99-
let b = this.read_scalar(&this.project_index(&b, i)?)?;
100-
let c = this.read_scalar(&this.project_index(&c, i)?)?;
101-
let dest = this.project_index(&dest, i)?;
102-
103-
let fuse: bool = intrinsic_name == "fma"
104-
|| (this.machine.float_nondet && this.machine.rng.get_mut().random());
105-
106-
// Works for f32 and f64.
107-
// FIXME: using host floats to work around https://github.com/rust-lang/miri/issues/2468.
108-
let ty::Float(float_ty) = dest.layout.ty.kind() else {
109-
span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
110-
};
111-
let val = match float_ty {
112-
FloatTy::F16 => unimplemented!("f16_f128"),
113-
FloatTy::F32 => {
114-
let a = a.to_f32()?;
115-
let b = b.to_f32()?;
116-
let c = c.to_f32()?;
117-
let res = if fuse {
118-
a.mul_add(b, c).value
119-
} else {
120-
((a * b).value + c).value
121-
};
122-
let res = this.adjust_nan(res, &[a, b, c]);
123-
Scalar::from(res)
124-
}
125-
FloatTy::F64 => {
126-
let a = a.to_f64()?;
127-
let b = b.to_f64()?;
128-
let c = c.to_f64()?;
129-
let res = if fuse {
130-
a.mul_add(b, c).value
131-
} else {
132-
((a * b).value + c).value
133-
};
134-
let res = this.adjust_nan(res, &[a, b, c]);
135-
Scalar::from(res)
136-
}
137-
FloatTy::F128 => unimplemented!("f16_f128"),
138-
};
139-
this.write_scalar(val, &dest)?;
140-
}
141-
}
14284
"expose_provenance" => {
14385
let [op] = check_intrinsic_arg_count(args)?;
14486
let (op, op_len) = this.project_to_simd(op)?;

src/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,8 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
13471347
}
13481348

13491349
#[inline(always)]
1350-
fn float_fuse_mul_add(ecx: &mut InterpCx<'tcx, Self>) -> bool {
1351-
ecx.machine.float_nondet && ecx.machine.rng.get_mut().random()
1350+
fn float_fuse_mul_add(ecx: &InterpCx<'tcx, Self>) -> bool {
1351+
ecx.machine.float_nondet && ecx.machine.rng.borrow_mut().random()
13521352
}
13531353

13541354
#[inline(always)]

src/shims/x86/avx.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -217,50 +217,6 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
217217
)?;
218218
}
219219
}
220-
// Used to implement the _mm256_permute2f128_ps, _mm256_permute2f128_pd and
221-
// _mm256_permute2f128_si256 functions. Regardless of the suffix in the name
222-
// thay all can be considered to operate on vectors of 128-bit elements.
223-
// For each 128-bit element of `dest`, copies one from `left`, `right` or
224-
// zero, according to `imm`.
225-
"vperm2f128.ps.256" | "vperm2f128.pd.256" | "vperm2f128.si.256" => {
226-
let [left, right, imm] =
227-
this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
228-
229-
assert_eq!(dest.layout, left.layout);
230-
assert_eq!(dest.layout, right.layout);
231-
assert_eq!(dest.layout.size.bits(), 256);
232-
233-
// Transmute to `[u128; 2]` to process each 128-bit chunk independently.
234-
let u128x2_layout =
235-
this.layout_of(Ty::new_array(this.tcx.tcx, this.tcx.types.u128, 2))?;
236-
let left = left.transmute(u128x2_layout, this)?;
237-
let right = right.transmute(u128x2_layout, this)?;
238-
let dest = dest.transmute(u128x2_layout, this)?;
239-
240-
let imm = this.read_scalar(imm)?.to_u8()?;
241-
242-
for i in 0..2 {
243-
let dest = this.project_index(&dest, i)?;
244-
245-
let imm = match i {
246-
0 => imm & 0xF,
247-
1 => imm >> 4,
248-
_ => unreachable!(),
249-
};
250-
if imm & 0b100 != 0 {
251-
this.write_scalar(Scalar::from_u128(0), &dest)?;
252-
} else {
253-
let src = match imm {
254-
0b00 => this.project_index(&left, 0)?,
255-
0b01 => this.project_index(&left, 1)?,
256-
0b10 => this.project_index(&right, 0)?,
257-
0b11 => this.project_index(&right, 1)?,
258-
_ => unreachable!(),
259-
};
260-
this.copy_op(&src, &dest)?;
261-
}
262-
}
263-
}
264220
// Used to implement the _mm_maskload_ps, _mm_maskload_pd, _mm256_maskload_ps
265221
// and _mm256_maskload_pd functions.
266222
// For the element `i`, if the high bit of the `i`-th element of `mask`

0 commit comments

Comments
 (0)