[PATCH] D140297: [AArch64] Add RSHRN and RSHRN2 patterns

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 08:24:12 PST 2022


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:18000
+    SDValue Imm =
+        DAG.getConstant(1LLU << (N->getConstantOperandVal(2) - 1), DL, VT);
+    SDValue Add = DAG.getNode(ISD::ADD, DL, VT, N->getOperand(1), Imm);
----------------
samtebbs wrote:
> is it possible for the shift amount here to be greater than `VT.getScalarSizeInBits() / 2` and so not be selected by `SelectRoundingVLShr`? If it is possible then a check here would be good.
Yep this should be OK. The aarch64_neon_rshrn intrinsics should only allow shift amounts that are valid for the instruction, which is upto half the input type size. They will be checked in clang: https://godbolt.org/z/99M53cWKz (and would have generated invalid instructions otherwise).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140297/new/

https://reviews.llvm.org/D140297



More information about the llvm-commits mailing list