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 :/
This commit is contained in:
commit
31ae4f9fde
7 changed files with 148 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue