From a1a164083ea9cdf8f3d6f053cdfb6b3355787c44 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 9 Jan 2022 16:44:54 +0100 Subject: [PATCH] Move call_intrinsic_match macro into codegen_float_intrinsic_call --- src/intrinsics/mod.rs | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 29b30631d0f..27e3b1b11f1 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -73,31 +73,6 @@ macro intrinsic_match { } } -macro call_intrinsic_match { - ($fx:expr, $intrinsic:expr, $ret:expr, $args:expr, $( - $name:ident($($arg:ident),*) -> $ty:ident => $func:ident, - )*) => { - match $intrinsic { - $( - sym::$name => { - if let [$(ref $arg),*] = *$args { - let ($($arg,)*) = ( - $(codegen_operand($fx, $arg),)* - ); - let res = $fx.easy_call(stringify!($func), &[$($arg),*], $fx.tcx.types.$ty); - $ret.write_cvalue($fx, res); - - return true; - } - } - )* - _ => return false, - } - - bug!("wrong number of args for intrinsic {:?}", $intrinsic); - } -} - macro validate_atomic_type($fx:ident, $intrinsic:ident, $span:ident, $ty:expr) { match $ty.kind() { ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} @@ -428,6 +403,31 @@ fn codegen_float_intrinsic_call<'tcx>( args: &[mir::Operand<'tcx>], ret: CPlace<'tcx>, ) -> bool { + macro call_intrinsic_match { + ($fx:expr, $intrinsic:expr, $ret:expr, $args:expr, $( + $name:ident($($arg:ident),*) -> $ty:ident => $func:ident, + )*) => { + match $intrinsic { + $( + sym::$name => { + if let [$(ref $arg),*] = *$args { + let ($($arg,)*) = ( + $(codegen_operand($fx, $arg),)* + ); + let res = $fx.easy_call(stringify!($func), &[$($arg),*], $fx.tcx.types.$ty); + $ret.write_cvalue($fx, res); + + return true; + } + } + )* + _ => return false, + } + + bug!("wrong number of args for intrinsic {:?}", $intrinsic); + } + } + call_intrinsic_match! { fx, intrinsic, ret, args, expf32(flt) -> f32 => expf,