From 6e207a26fc6cc81b01918bcebf6a57fc19e37b5f Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 28 Feb 2024 03:55:14 -0500 Subject: [PATCH 1/3] Add stubs for `f16` and `f128` to miri --- src/shims/intrinsics/simd.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shims/intrinsics/simd.rs b/src/shims/intrinsics/simd.rs index ca8773cac1..bb18fba5c9 100644 --- a/src/shims/intrinsics/simd.rs +++ b/src/shims/intrinsics/simd.rs @@ -83,8 +83,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let op = op.to_scalar(); // "Bitwise" operation, no NaN adjustments match float_ty { + FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F32 => Scalar::from_f32(op.to_f32()?.abs()), FloatTy::F64 => Scalar::from_f64(op.to_f64()?.abs()), + FloatTy::F128 => unimplemented!("f16_f128"), } } Op::Sqrt => { @@ -93,6 +95,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { }; // FIXME using host floats match float_ty { + FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F32 => { let f = op.to_scalar().to_f32()?; let res = f.to_host().sqrt().to_soft(); @@ -105,6 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.adjust_nan(res, &[f]); Scalar::from(res) } + FloatTy::F128 => unimplemented!("f16_f128"), } } Op::Round(rounding) => { @@ -112,6 +116,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name) }; match float_ty { + FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F32 => { let f = op.to_scalar().to_f32()?; let res = f.round_to_integral(rounding).value; @@ -124,6 +129,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.adjust_nan(res, &[f]); Scalar::from_f64(res) } + FloatTy::F128 => unimplemented!("f16_f128"), } } Op::Numeric(name) => { @@ -267,6 +273,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name) }; let val = match float_ty { + FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F32 => { let a = a.to_f32()?; let b = b.to_f32()?; @@ -283,6 +290,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.adjust_nan(res, &[a, b, c]); Scalar::from(res) } + FloatTy::F128 => unimplemented!("f16_f128"), }; this.write_scalar(val, &dest)?; } @@ -724,6 +732,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let left = left.to_scalar(); let right = right.to_scalar(); Ok(match float_ty { + FloatTy::F16 => unimplemented!("f16_f128"), FloatTy::F32 => { let left = left.to_f32()?; let right = right.to_f32()?; @@ -744,6 +753,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.adjust_nan(res, &[left, right]); Scalar::from_f64(res) } + FloatTy::F128 => unimplemented!("f16_f128"), }) } } From b3fef65dc418390f651f970362aaaf67d4d350e0 Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Sat, 2 Mar 2024 04:54:03 +0000 Subject: [PATCH 2/3] Preparing for merge from rustc --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index 75124dc8ff..28a6194bf7 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -1a1876c9790f168fb51afa335a7ba3e6fc267d75 +eaee1e9453bfb4e1fb3753aa37450bb47cd7629d From 947a0d507b88b911f81497594c727a8153fbfae5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Mar 2024 10:06:50 +0100 Subject: [PATCH 3/3] reorder rustc crate imports a bit --- src/bin/miri.rs | 7 +++++-- src/lib.rs | 13 +++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 281a32b77c..c09e19e8c0 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -8,6 +8,11 @@ rustc::untranslatable_diagnostic )] +// Some "regular" crates we want to share with rustc +#[macro_use] +extern crate tracing; + +// The rustc crates we need extern crate rustc_data_structures; extern crate rustc_driver; extern crate rustc_hir; @@ -16,8 +21,6 @@ extern crate rustc_log; extern crate rustc_metadata; extern crate rustc_middle; extern crate rustc_session; -#[macro_use] -extern crate tracing; use std::env::{self, VarError}; use std::num::NonZero; diff --git a/src/lib.rs b/src/lib.rs index c567949102..855a32cb70 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,8 +49,12 @@ // Needed for rustdoc from bootstrap (with `-Znormalize-docs`). #![recursion_limit = "256"] -extern crate either; // the one from rustc +// Some "regular" crates we want to share with rustc +extern crate either; +#[macro_use] +extern crate tracing; +// The rustc crates we need extern crate rustc_apfloat; extern crate rustc_ast; extern crate rustc_const_eval; @@ -63,11 +67,8 @@ extern crate rustc_middle; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; -#[macro_use] -extern crate tracing; - -// Necessary to pull in object code as the rest of the rustc crates are shipped only as rmeta -// files. +// Linking `rustc_driver` pulls in the required object code as the rest of the rustc crates are +// shipped only as rmeta files. #[allow(unused_extern_crates)] extern crate rustc_driver;