Skip to content

Commit 11e396b

Browse files
committed
Add roundeven float intrinsics
1 parent cb2effd commit 11e396b

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
497497
truncf64(flt) -> f64 => trunc,
498498
roundf32(flt) -> f32 => roundf,
499499
roundf64(flt) -> f64 => round,
500+
roundevenf32(flt) -> f32 => roundevenf,
501+
roundevenf64(flt) -> f64 => roundeven,
500502

501503
// trigonometry
502504
sinf32(flt) -> f32 => sinf,

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ impl CodegenCx<'b, 'tcx> {
573573
ifn!("llvm.copysign.f64", fn(t_f64, t_f64) -> t_f64);
574574
ifn!("llvm.round.f32", fn(t_f32) -> t_f32);
575575
ifn!("llvm.round.f64", fn(t_f64) -> t_f64);
576+
ifn!("llvm.roundeven.f32", fn(t_f32) -> t_f32);
577+
ifn!("llvm.roundeven.f64", fn(t_f64) -> t_f64);
576578

577579
ifn!("llvm.rint.f32", fn(t_f32) -> t_f32);
578580
ifn!("llvm.rint.f64", fn(t_f64) -> t_f64);

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ fn get_simple_intrinsic(cx: &CodegenCx<'ll, '_>, name: Symbol) -> Option<&'ll Va
6868
sym::nearbyintf64 => "llvm.nearbyint.f64",
6969
sym::roundf32 => "llvm.round.f32",
7070
sym::roundf64 => "llvm.round.f64",
71+
sym::roundevenf32 => "llvm.roundeven.f32",
72+
sym::roundevenf64 => "llvm.roundeven.f64",
7173
_ => return None,
7274
};
7375
Some(cx.get_intrinsic(&llvm_name))

compiler/rustc_span/src/symbol.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,8 @@ symbols! {
931931
rlib,
932932
rotate_left,
933933
rotate_right,
934+
roundevenf32,
935+
roundevenf64,
934936
roundf32,
935937
roundf64,
936938
rt,

compiler/rustc_typeck/src/check/intrinsic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
247247
sym::nearbyintf64 => (0, vec![tcx.types.f64], tcx.types.f64),
248248
sym::roundf32 => (0, vec![tcx.types.f32], tcx.types.f32),
249249
sym::roundf64 => (0, vec![tcx.types.f64], tcx.types.f64),
250+
sym::roundevenf32 => (0, vec![tcx.types.f32], tcx.types.f32),
251+
sym::roundevenf64 => (0, vec![tcx.types.f64], tcx.types.f64),
250252

251253
sym::volatile_load | sym::unaligned_volatile_load => {
252254
(1, vec![tcx.mk_imm_ptr(param(0))], param(0))

0 commit comments

Comments
 (0)