diff options
| author | bors <bors@rust-lang.org> | 2021-03-20 09:01:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-20 09:01:35 +0000 |
| commit | 41b315a470d583f6446599984ff9ad3bd61012b2 (patch) | |
| tree | ee5ba87b3e2538e4656e84984a55575c1d521984 /compiler/rustc_codegen_llvm/src | |
| parent | eb9ec311686b6b6d8f8fea6c86468d7ce6fa3d38 (diff) | |
| parent | b93590e5d8e0ba1755450b66e85e87ca4a653fa3 (diff) | |
| download | rust-41b315a470d583f6446599984ff9ad3bd61012b2.tar.gz rust-41b315a470d583f6446599984ff9ad3bd61012b2.zip | |
Auto merge of #83271 - SparrowLii:simd_neg, r=Amanieu
Add simd_neg platform intrinsic Stdarch needs to add simd_neg to support the implementation of vneg neon instructions. Look [here](https://github.com/rust-lang/stdarch/pull/1087)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index f445d708c94..af366f93b91 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1628,7 +1628,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, out_elem ); } - macro_rules! arith { + macro_rules! arith_binary { ($($name: ident: $($($p: ident),* => $call: ident),*;)*) => { $(if name == sym::$name { match in_elem.kind() { @@ -1644,7 +1644,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, })* } } - arith! { + arith_binary! { simd_add: Uint, Int => add, Float => fadd; simd_sub: Uint, Int => sub, Float => fsub; simd_mul: Uint, Int => mul, Float => fmul; @@ -1659,6 +1659,25 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, simd_fmin: Float => minnum; } + 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; + } if name == sym::simd_saturating_add || name == sym::simd_saturating_sub { let lhs = args[0].immediate(); |
