Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow libm_intrinsics fallback #985

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions crates/rustc_codegen_spirv/src/builder/libm_intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use rustc_codegen_ssa::traits::BuilderMethods;
pub enum LibmCustomIntrinsic {
CopySign,
Cbrt,
Erf,
Erfc,
Exp10,
Expm1,
Fdim,
Expand Down Expand Up @@ -70,10 +68,6 @@ pub const TABLE: &[(&str, LibmIntrinsic)] = &[
("cosf", LibmIntrinsic::GLOp(GLOp::Cos)),
("cosh", LibmIntrinsic::GLOp(GLOp::Cosh)),
("coshf", LibmIntrinsic::GLOp(GLOp::Cosh)),
("erf", LibmIntrinsic::Custom(LibmCustomIntrinsic::Erf)),
("erff", LibmIntrinsic::Custom(LibmCustomIntrinsic::Erf)),
("erfc", LibmIntrinsic::Custom(LibmCustomIntrinsic::Erfc)),
("erfcf", LibmIntrinsic::Custom(LibmCustomIntrinsic::Erfc)),
("exp10", LibmIntrinsic::Custom(LibmCustomIntrinsic::Exp10)),
("exp10f", LibmIntrinsic::Custom(LibmCustomIntrinsic::Exp10)),
("exp2", LibmIntrinsic::GLOp(GLOp::Exp2)),
Expand Down Expand Up @@ -258,16 +252,6 @@ impl Builder<'_, '_> {
let one = self.constant_float(exp.ty, 1.0);
self.sub(exp, one)
}
LibmIntrinsic::Custom(LibmCustomIntrinsic::Erf) => {
let undef = self.undef(result_type);
self.zombie(undef.def(self), "Erf not supported yet");
undef
}
LibmIntrinsic::Custom(LibmCustomIntrinsic::Erfc) => {
let undef = self.undef(result_type);
self.zombie(undef.def(self), "Erfc not supported yet");
undef
}
LibmIntrinsic::Custom(LibmCustomIntrinsic::Fdim) => {
let undef = self.undef(result_type);
self.zombie(undef.def(self), "Fdim not supported yet");
Expand Down
11 changes: 2 additions & 9 deletions crates/rustc_codegen_spirv/src/codegen_cx/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,8 @@ impl<'tcx> CodegenCx<'tcx> {
let item_name = self.tcx.item_name(instance_def_id);
let intrinsic = self.sym.libm_intrinsics.get(&item_name);
if self.tcx.visibility(instance.def_id()) == ty::Visibility::Public {
match intrinsic {
Some(&intrinsic) => {
self.libm_intrinsics.borrow_mut().insert(fn_id, intrinsic);
}
None => {
self.tcx.sess.err(format!(
"missing libm intrinsic {symbol_name}, which is {instance}"
));
}
if let Some(&intrinsic) = intrinsic {
self.libm_intrinsics.borrow_mut().insert(fn_id, intrinsic);
}
}
}
Expand Down