]> git.lizzy.rs Git - rust.git/commit
Auto merge of #55650 - nikic:funnel-shift, r=nagisa
authorbors <bors@rust-lang.org>
Sat, 10 Nov 2018 19:58:14 +0000 (19:58 +0000)
committerbors <bors@rust-lang.org>
Sat, 10 Nov 2018 19:58:14 +0000 (19:58 +0000)
commit6e9b84296223126a0a59bde63a0f97011bb7b0f5
tree5c9fdd5de3e7e7c4f1d1b82344deaa9d1ae5c53e
parent42959a24a14e86804b81a3f8f8ecf78c367f370f
parent4c40ff6a2472124cd061721463f329184ca76fa3
Auto merge of #55650 - nikic:funnel-shift, r=nagisa

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.

Fixes #52457.
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/llvm_util.rs
src/librustc_mir/interpret/intrinsics.rs