[PATCH] D48768: [X86] When have BMI2, prefer shifts to clear low/high bits, rather than variable mask.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 4 11:19:02 PDT 2018
lebedev.ri added a comment.
In https://reviews.llvm.org/D48768#1152526, @reames wrote:
> I may be missing something but isn't this a pessimization for the case where the mask is an immediate that can be directly encoded into the and instruction? Why should we prefer dual shifts over something like an AND RAX, 0xfff?
Correct, i'm pretty sure we do not want to pessimize constant masks.
This is looking for a pattern like: `x & (-1 << y)`
That is, an `And`, with one side being a shift.
If `y` is constant, the pattern is `x & (-1 << C)`,
and i'm somewhat expecting that `(-1 << C)` will be constant-folded into a constant.
So we //shouldn't// be able to match that.
Repository:
rL LLVM
https://reviews.llvm.org/D48768
More information about the llvm-commits
mailing list