[PATCH] D20897: [AVX512/AVX][Intrinsics] Fix Variable Bit Shift Right Arithmetic intrinsic lowering.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 11:07:15 PDT 2016


RKSimon added a comment.

In http://reviews.llvm.org/D20897#449204, @delena wrote:

> In http://reviews.llvm.org/D20897#447281, @RKSimon wrote:
>
> > I just think we're better off handling simplification of intrinsics as early as possible - in this case in InstCombiner::visitCallInst instead of waiting until lowering.
>
>
> I agree. But today we are going towards generation IR from clang whenever it is possible. As far as this specific intrinsic (SAR), LLVM-IR specification and Intel intrinsic specification are different for out-of-range constants. You can generate a constant if the both arguments are constants, but replacing intrinsic with generic IR instruction is incorrect in this case.
>
> > Also, should we be adding constant folding (or other optimizations) to LowerINTRINSIC_WO_CHAIN ? I understood that is for cleanup + canonicalization only.
>
>
> We should generate an optimal code, if we can. So, we, probably,  should fold constants whenever it is possible.
>
> IMO, once we are visiting SAR intrinsic in LowerINTRINSIC_WO_CHAIN, we should try to fold constants there. And it is actual for all intrinsics where IR and architecture specification does not match.


Are there many examples of where these SAR intrinsics can only be folded at lowering? And is it just SAR or are SLR/SHL shifts likely as well? What prevented them from being folded earlier in instcombine? I'm happier now with the idea of adding it to LowerINTRINSIC_WO_CHAIN - I just want to know it will be useful.


Repository:
  rL LLVM

http://reviews.llvm.org/D20897





More information about the llvm-commits mailing list