From c674a32ab8ac535463021e655c91ba5283d5148d Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 1 May 2020 17:35:20 +0200 Subject: [PATCH] Implement f*_fast intrinsics --- src/intrinsics/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 98509847b83..58eed4c2f59 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -987,6 +987,18 @@ pub(crate) fn codegen_intrinsic_call<'tcx>( let ret_val = CValue::const_val(fx, ret.layout(), 0); ret.write_cvalue(fx, ret_val); }; + + fadd_fast | fsub_fast | fmul_fast | fdiv_fast | frem_fast, (c x, c y) { + let res = crate::num::trans_float_binop(fx, match intrinsic { + "fadd_fast" => BinOp::Add, + "fsub_fast" => BinOp::Sub, + "fmul_fast" => BinOp::Mul, + "fdiv_fast" => BinOp::Div, + "frem_fast" => BinOp::Rem, + _ => unreachable!(), + }, x, y); + ret.write_cvalue(fx, res); + }; } if let Some((_, dest)) = destination {