Skip to content

Commit 44690ee

Browse files
authored
Merge pull request #5300 from rust-lang/rustup-2026-09-02
Automatic Rustup
2 parents e455483 + 7a62513 commit 44690ee

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17fd5b8a37b6667b6cc137f3cc35f09759768a3b
1+
edc52f87c28f328c61685a02c47887a5cec7d767

src/intrinsics/math.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,11 @@ fn sqrt<'tcx, F: Float + FloatConvert<F> + Into<Scalar>>(
1717
}
1818

1919
/// Determine which float operation on which type this is.
20-
fn is_host_unary_float_op(intrinsic_name: &str) -> Option<(FloatTy, HostUnaryFloatOp)> {
21-
let (op, ty) = intrinsic_name.rsplit_once('f')?;
22-
23-
let float_ty = match ty {
24-
"16" => FloatTy::F16,
25-
"32" => FloatTy::F32,
26-
"64" => FloatTy::F64,
27-
"128" => FloatTy::F128,
28-
_ => return None,
29-
};
30-
31-
let host_float_op = match op {
20+
fn is_host_unary_float_op(
21+
intrinsic_name: &str,
22+
generic_args: ty::GenericArgsRef<'_>,
23+
) -> Option<(FloatTy, HostUnaryFloatOp)> {
24+
let host_float_op = match intrinsic_name {
3225
"sin" => HostUnaryFloatOp::Sin,
3326
"cos" => HostUnaryFloatOp::Cos,
3427
"exp" => HostUnaryFloatOp::Exp,
@@ -39,6 +32,9 @@ fn is_host_unary_float_op(intrinsic_name: &str) -> Option<(FloatTy, HostUnaryFlo
3932
_ => return None,
4033
};
4134

35+
let ty::Float(float_ty) = *generic_args.type_at(0).kind() else {
36+
bug!("`{intrinsic_name}` intrinsic called on non-float type");
37+
};
4238
Some((float_ty, host_float_op))
4339
}
4440

@@ -96,7 +92,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9692
fn emulate_math_intrinsic(
9793
&mut self,
9894
intrinsic_name: &str,
99-
_generic_args: ty::GenericArgsRef<'tcx>,
95+
generic_args: ty::GenericArgsRef<'tcx>,
10096
args: &[OpTy<'tcx>],
10197
dest: &PlaceTy<'tcx>,
10298
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -179,7 +175,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
179175
}
180176

181177
// Operations that need host floats.
182-
_ if let Some((float_ty, op)) = is_host_unary_float_op(intrinsic_name) => {
178+
_ if let Some((float_ty, op)) =
179+
is_host_unary_float_op(intrinsic_name, generic_args) =>
180+
{
183181
let [f] = check_intrinsic_arg_count(args)?;
184182
match float_ty {
185183
FloatTy::F16 => host_unary_float_op::<HalfS>(this, f, op, dest)?,

src/math.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ where
230230
}
231231

232232
/// For the intrinsics:
233-
/// - sinf32, sinf64, sinhf, sinh
234-
/// - cosf32, cosf64, coshf, cosh
233+
/// - sin, sinhf, sinh
234+
/// - cos, coshf, cosh
235235
/// - tanhf, tanh, atanf, atan, atan2f, atan2
236-
/// - expf32, expf64, exp2f32, exp2f64
237-
/// - logf32, logf64, log2f32, log2f64, log10f32, log10f64
236+
/// - exp, exp2
237+
/// - log, log2, log10
238238
/// - powf32, powf64
239239
/// - erff, erf, erfcf, erfc
240240
/// - hypotf, hypot

0 commit comments

Comments
 (0)