Skip to content

Commit

Permalink
miri: shims for erf & friends
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigorenkoPV committed Feb 14, 2025
1 parent b8f0ed3 commit 5b0c80a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tools/miri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![feature(rustc_private)]
#![feature(cell_update)]
#![feature(float_gamma)]
#![feature(float_erf)]
#![feature(map_try_insert)]
#![feature(never_type)]
#![feature(try_blocks)]
Expand Down
8 changes: 8 additions & 0 deletions src/tools/miri/src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
| "log1pf"
| "expm1f"
| "tgammaf"
| "erff"
| "erfcf"
=> {
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
let f = this.read_scalar(f)?.to_f32()?;
Expand All @@ -759,6 +761,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
"log1pf" => f_host.ln_1p(),
"expm1f" => f_host.exp_m1(),
"tgammaf" => f_host.gamma(),
"erff" => f_host.erf(),
"erfcf" => f_host.erfc(),
_ => bug!(),
};
let res = res.to_soft();
Expand Down Expand Up @@ -799,6 +803,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
| "log1p"
| "expm1"
| "tgamma"
| "erf"
| "erfc"
=> {
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
let f = this.read_scalar(f)?.to_f64()?;
Expand All @@ -816,6 +822,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
"log1p" => f_host.ln_1p(),
"expm1" => f_host.exp_m1(),
"tgamma" => f_host.gamma(),
"erf" => f_host.erf(),
"erfc" => f_host.erfc(),
_ => bug!(),
};
let res = res.to_soft();
Expand Down

0 comments on commit 5b0c80a

Please sign in to comment.