Skip to content

Commit 09fb8c5

Browse files
committed
remove some SSE/SSE2 intrinsics that are no longer used by stdarch
1 parent b0dd0a8 commit 09fb8c5

File tree

3 files changed

+3
-56
lines changed

3 files changed

+3
-56
lines changed

src/shims/x86/mod.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
159159

160160
#[derive(Copy, Clone)]
161161
enum FloatBinOp {
162-
/// Arithmetic operation
163-
Arith(mir::BinOp),
164162
/// Comparison
165163
///
166164
/// The semantics of this operator is a case distinction: we compare the two operands,
@@ -247,16 +245,11 @@ impl FloatBinOp {
247245
/// Performs `which` scalar operation on `left` and `right` and returns
248246
/// the result.
249247
fn bin_op_float<'tcx, F: rustc_apfloat::Float>(
250-
this: &crate::MiriInterpCx<'tcx>,
251248
which: FloatBinOp,
252249
left: &ImmTy<'tcx>,
253250
right: &ImmTy<'tcx>,
254251
) -> InterpResult<'tcx, Scalar> {
255252
match which {
256-
FloatBinOp::Arith(which) => {
257-
let res = this.binary_op(which, left, right)?;
258-
Ok(res.to_scalar())
259-
}
260253
FloatBinOp::Cmp { gt, lt, eq, unord } => {
261254
let left = left.to_scalar().to_float::<F>()?;
262255
let right = right.to_scalar().to_float::<F>()?;
@@ -323,7 +316,6 @@ fn bin_op_simd_float_first<'tcx, F: rustc_apfloat::Float>(
323316
assert_eq!(dest_len, right_len);
324317

325318
let res0 = bin_op_float::<F>(
326-
this,
327319
which,
328320
&this.read_immediate(&this.project_index(&left, 0)?)?,
329321
&this.read_immediate(&this.project_index(&right, 0)?)?,
@@ -358,7 +350,7 @@ fn bin_op_simd_float_all<'tcx, F: rustc_apfloat::Float>(
358350
let right = this.read_immediate(&this.project_index(&right, i)?)?;
359351
let dest = this.project_index(&dest, i)?;
360352

361-
let res = bin_op_float::<F>(this, which, &left, &right)?;
353+
let res = bin_op_float::<F>(which, &left, &right)?;
362354
this.write_scalar(res, &dest)?;
363355
}
364356

src/shims/x86/sse.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_apfloat::ieee::Single;
2-
use rustc_middle::mir;
32
use rustc_span::Symbol;
43
use rustc_target::spec::abi::Abi;
54

@@ -29,18 +28,14 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2928
// performed only on the first element, copying the remaining elements from the input
3029
// vector (for binary operations, from the left-hand side).
3130
match unprefixed_name {
32-
// Used to implement _mm_{add,sub,mul,div,min,max}_ss functions.
31+
// Used to implement _mm_{min,max}_ss functions.
3332
// Performs the operations on the first component of `left` and
3433
// `right` and copies the remaining components from `left`.
35-
"add.ss" | "sub.ss" | "mul.ss" | "div.ss" | "min.ss" | "max.ss" => {
34+
"min.ss" | "max.ss" => {
3635
let [left, right] =
3736
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
3837

3938
let which = match unprefixed_name {
40-
"add.ss" => FloatBinOp::Arith(mir::BinOp::Add),
41-
"sub.ss" => FloatBinOp::Arith(mir::BinOp::Sub),
42-
"mul.ss" => FloatBinOp::Arith(mir::BinOp::Mul),
43-
"div.ss" => FloatBinOp::Arith(mir::BinOp::Div),
4439
"min.ss" => FloatBinOp::Min,
4540
"max.ss" => FloatBinOp::Max,
4641
_ => unreachable!(),

src/shims/x86/sse2.rs

-40
Original file line numberDiff line numberDiff line change
@@ -227,46 +227,6 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
227227

228228
bin_op_simd_float_all::<Double>(this, which, left, right, dest)?;
229229
}
230-
// Used to implement _mm_sqrt_sd functions.
231-
// Performs the operations on the first component of `op` and
232-
// copies the remaining components from `op`.
233-
"sqrt.sd" => {
234-
let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
235-
236-
let (op, op_len) = this.operand_to_simd(op)?;
237-
let (dest, dest_len) = this.mplace_to_simd(dest)?;
238-
239-
assert_eq!(dest_len, op_len);
240-
241-
let op0 = this.read_scalar(&this.project_index(&op, 0)?)?.to_u64()?;
242-
// FIXME using host floats
243-
let res0 = Scalar::from_u64(f64::from_bits(op0).sqrt().to_bits());
244-
this.write_scalar(res0, &this.project_index(&dest, 0)?)?;
245-
246-
for i in 1..dest_len {
247-
this.copy_op(&this.project_index(&op, i)?, &this.project_index(&dest, i)?)?;
248-
}
249-
}
250-
// Used to implement _mm_sqrt_pd functions.
251-
// Performs the operations on all components of `op`.
252-
"sqrt.pd" => {
253-
let [op] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
254-
255-
let (op, op_len) = this.operand_to_simd(op)?;
256-
let (dest, dest_len) = this.mplace_to_simd(dest)?;
257-
258-
assert_eq!(dest_len, op_len);
259-
260-
for i in 0..dest_len {
261-
let op = this.read_scalar(&this.project_index(&op, i)?)?.to_u64()?;
262-
let dest = this.project_index(&dest, i)?;
263-
264-
// FIXME using host floats
265-
let res = Scalar::from_u64(f64::from_bits(op).sqrt().to_bits());
266-
267-
this.write_scalar(res, &dest)?;
268-
}
269-
}
270230
// Used to implement the _mm_cmp*_sd functions.
271231
// Performs a comparison operation on the first component of `left`
272232
// and `right`, returning 0 if false or `u64::MAX` if true. The remaining

0 commit comments

Comments
 (0)