-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking issue for f32 and f64 methods in libcore #50145
Copy link
Copy link
Closed
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-intrinsicsArea: IntrinsicsArea: IntrinsicsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-intrinsicsArea: IntrinsicsArea: IntrinsicsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
#49896 removes from libcore (and moves to libstd) three methods of
f32andf64(that were only usable through the unstable traitcore::num::Float) because they’re implemented by calling LLVM intrinsics, and it’s not clear whether those intrinsics are lowered on any platform to calls to C’slibmor something else that requires runtime support that we don’t want in libcore:abs: callsllvm.fabs.f32orllvm.fabs.f64signum: callsllvm.copysign.f32orllvm.copysign.f64powi: callsllvm.powi.f32orllvm.powi.f32The first two seem like they’d be easy to implement in a small number of lower-level instructions (such as a couple lines with
if, or even bit twiddling based on IEEE 754).absin particular seems like a rather common operation, and it’s unfortunate not to have it in libcore.The
compiler-builtinscrate has Rust implementations of__powisf2and__powidf2, but in LLVM code those are only mentioned inlib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cppso I haven’t found evidence thatllvm.powi.f32andllvm.powi.f32call those functions.PR #27823 “Remove dependencies on libm functions from libcore” similarly moved a number of other
f32andf64methods to libstd, but left these three behind specifically. (And unfortunately doesn’t discuss why.)Maybe it’s fine to move them back in libcore? (As inherent methods, assuming #49896 lands.)
CC @alexcrichton