Skip to content

Commit bf2da67

Browse files
committed
Sync from rust 798fb83
2 parents 76dfce7 + 270fb21 commit bf2da67

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/discriminant.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
//! Adapted from <https://github.com/rust-lang/rust/blob/31c0645b9d2539f47eecb096142474b29dc542f7/compiler/rustc_codegen_ssa/src/mir/place.rs>
44
//! (<https://github.com/rust-lang/rust/pull/104535>)
55
6-
use rustc_target::abi::{Int, TagEncoding, Variants};
6+
use rustc_abi::Primitive::Int;
7+
use rustc_abi::{TagEncoding, Variants};
78

89
use crate::prelude::*;
910

src/intrinsics/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ fn codegen_float_intrinsic_call<'tcx>(
328328
sym::fabsf64 => ("fabs", 1, fx.tcx.types.f64, types::F64),
329329
sym::fmaf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32),
330330
sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64),
331+
// FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation
332+
sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32
333+
sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64
331334
sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32),
332335
sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64),
333336
sym::floorf32 => ("floorf", 1, fx.tcx.types.f32, types::F32),
@@ -381,7 +384,7 @@ fn codegen_float_intrinsic_call<'tcx>(
381384

382385
let layout = fx.layout_of(ty);
383386
let res = match intrinsic {
384-
sym::fmaf32 | sym::fmaf64 => {
387+
sym::fmaf32 | sym::fmaf64 | sym::fmuladdf32 | sym::fmuladdf64 => {
385388
CValue::by_val(fx.bcx.ins().fma(args[0], args[1], args[2]), layout)
386389
}
387390
sym::copysignf32 | sym::copysignf64 => {

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
extern crate jobserver;
1616
#[macro_use]
1717
extern crate rustc_middle;
18+
extern crate rustc_abi;
1819
extern crate rustc_ast;
1920
extern crate rustc_codegen_ssa;
2021
extern crate rustc_data_structures;

0 commit comments

Comments
 (0)