diff options
| author | bors <bors@rust-lang.org> | 2018-03-27 04:46:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-03-27 04:46:32 +0000 |
| commit | 31ae4f9fde9b23100c26e5642030128a7e1444ef (patch) | |
| tree | b63dae1cd9281a7e71732837b10dbad0f94ac929 /src/rustllvm/RustWrapper.cpp | |
| parent | 989b25718bbfdcc5615cdc5880e5573eb8b9688f (diff) | |
| parent | 56aaf344c444943f3c9cefe9d88ed27b43f0a731 (diff) | |
| download | rust-31ae4f9fde9b23100c26e5642030128a7e1444ef.tar.gz rust-31ae4f9fde9b23100c26e5642030128a7e1444ef.zip | |
Auto merge of #49249 - gnzlbg:simd_minmax, r=alexcrichton
implement minmax intrinsics
This adds the `simd_{fmin,fmax}` intrinsics, which do a vertical (lane-wise) `min`/`max` for floating point vectors that's equivalent to Rust's `min`/`max` for `f32`/`f64`.
It might make sense to make `{f32,f64}::{min,max}` use the `minnum` and `minmax` intrinsics as well.
---
~~HELP: I need some help with these. Either I should go to sleep or there must be something that I must be missing. AFAICT I am calling the `maxnum` builder correctly, yet rustc/LLVM seem to insert a call to `llvm.minnum` there instead...~~ EDIT: Rust's LLVM version is too old :/
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 0ef9643f4ca..df8602d0803 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -1503,3 +1503,23 @@ LLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS, return wrap(unwrap(B)->CreateExactUDiv(unwrap(LHS), unwrap(RHS), Name)); } #endif + +#if LLVM_VERSION_GE(6, 0) +extern "C" LLVMValueRef +LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { + return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS))); +} +extern "C" LLVMValueRef +LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { + return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS))); +} +#else +extern "C" LLVMValueRef +LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { + return nullptr; +} +extern "C" LLVMValueRef +LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { + return nullptr; +} +#endif |
