Skip to content

Commit 5b0c80a

Browse files
committed
miri: shims for erf & friends
1 parent b8f0ed3 commit 5b0c80a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/tools/miri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![feature(rustc_private)]
33
#![feature(cell_update)]
44
#![feature(float_gamma)]
5+
#![feature(float_erf)]
56
#![feature(map_try_insert)]
67
#![feature(never_type)]
78
#![feature(try_blocks)]

src/tools/miri/src/shims/foreign_items.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
742742
| "log1pf"
743743
| "expm1f"
744744
| "tgammaf"
745+
| "erff"
746+
| "erfcf"
745747
=> {
746748
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
747749
let f = this.read_scalar(f)?.to_f32()?;
@@ -759,6 +761,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
759761
"log1pf" => f_host.ln_1p(),
760762
"expm1f" => f_host.exp_m1(),
761763
"tgammaf" => f_host.gamma(),
764+
"erff" => f_host.erf(),
765+
"erfcf" => f_host.erfc(),
762766
_ => bug!(),
763767
};
764768
let res = res.to_soft();
@@ -799,6 +803,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
799803
| "log1p"
800804
| "expm1"
801805
| "tgamma"
806+
| "erf"
807+
| "erfc"
802808
=> {
803809
let [f] = this.check_shim(abi, Conv::C , link_name, args)?;
804810
let f = this.read_scalar(f)?.to_f64()?;
@@ -816,6 +822,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
816822
"log1p" => f_host.ln_1p(),
817823
"expm1" => f_host.exp_m1(),
818824
"tgamma" => f_host.gamma(),
825+
"erf" => f_host.erf(),
826+
"erfc" => f_host.erfc(),
819827
_ => bug!(),
820828
};
821829
let res = res.to_soft();

0 commit comments

Comments
 (0)