[llvm] [AArch64][SVE2] Do not emit RSHRNB for large shifts (PR #66672)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 05:22:30 PDT 2023


================
@@ -20241,6 +20241,10 @@ static SDValue trySimplifySrlAddToRshrnb(SDValue Srl, SelectionDAG &DAG,
     return SDValue();
   unsigned ShiftValue = SrlOp1->getZExtValue();
 
+  uint64_t EltSize = ResVT.getScalarSizeInBits();
+  if (ShiftValue > EltSize)
----------------
david-arm wrote:

I discussed this with @paulwalker-arm offline and we don't think this is right after all. I think we should just bail out of the optimisation if the ShiftValue exceeds the truncated element width. Also, it would be good to at least add an assert here that the shift value is zero. From what you're saying it should never happen, which makes sense.

https://github.com/llvm/llvm-project/pull/66672


More information about the llvm-commits mailing list