Skip to content

Commit

Permalink
Sync from rust 798fb83
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Oct 17, 2024
2 parents 76dfce7 + 270fb21 commit bf2da67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/discriminant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
//! Adapted from <https://github.com/rust-lang/rust/blob/31c0645b9d2539f47eecb096142474b29dc542f7/compiler/rustc_codegen_ssa/src/mir/place.rs>
//! (<https://github.com/rust-lang/rust/pull/104535>)
use rustc_target::abi::{Int, TagEncoding, Variants};
use rustc_abi::Primitive::Int;
use rustc_abi::{TagEncoding, Variants};

use crate::prelude::*;

Expand Down
5 changes: 4 additions & 1 deletion src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ fn codegen_float_intrinsic_call<'tcx>(
sym::fabsf64 => ("fabs", 1, fx.tcx.types.f64, types::F64),
sym::fmaf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32),
sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64),
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64
sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32),
sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64),
sym::floorf32 => ("floorf", 1, fx.tcx.types.f32, types::F32),
Expand Down Expand Up @@ -381,7 +384,7 @@ fn codegen_float_intrinsic_call<'tcx>(

let layout = fx.layout_of(ty);
let res = match intrinsic {
sym::fmaf32 | sym::fmaf64 => {
sym::fmaf32 | sym::fmaf64 | sym::fmuladdf32 | sym::fmuladdf64 => {
CValue::by_val(fx.bcx.ins().fma(args[0], args[1], args[2]), layout)
}
sym::copysignf32 | sym::copysignf64 => {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
extern crate jobserver;
#[macro_use]
extern crate rustc_middle;
extern crate rustc_abi;
extern crate rustc_ast;
extern crate rustc_codegen_ssa;
extern crate rustc_data_structures;
Expand Down

0 comments on commit bf2da67

Please sign in to comment.