From 9c3cce661f619e21534110755ece02e8d18d5d51 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sat, 15 Jan 2022 11:13:35 -0500 Subject: [PATCH] Implement simd_neg --- src/intrinsic/simd.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/intrinsic/simd.rs b/src/intrinsic/simd.rs index aff27f71d91c4..7d7811c878219 100644 --- a/src/intrinsic/simd.rs +++ b/src/intrinsic/simd.rs @@ -163,5 +163,26 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, simd_xor: Uint, Int => xor; } + macro_rules! arith_unary { + ($($name: ident: $($($p: ident),* => $call: ident),*;)*) => { + $(if name == sym::$name { + match in_elem.kind() { + $($(ty::$p(_))|* => { + return Ok(bx.$call(args[0].immediate())) + })* + _ => {}, + } + require!(false, + "unsupported operation on `{}` with element `{}`", + in_ty, + in_elem) + })* + } + } + + arith_unary! { + simd_neg: Int => neg, Float => fneg; + } + unimplemented!("simd {}", name); }