Implement rotate using funnel shift on LLVM >= 7
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
This commit is contained in:
parent
2ad8c7b350
commit
4c40ff6a24
10 changed files with 93 additions and 8 deletions
|
@ -256,6 +256,10 @@ pub fn print_version() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_major_version() -> u32 {
|
||||
unsafe { llvm::LLVMRustVersionMajor() }
|
||||
}
|
||||
|
||||
pub fn print_passes() {
|
||||
// Can be called without initializing LLVM
|
||||
unsafe { llvm::LLVMRustPrintPasses(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue