[llvm] [AArch64] Convert negative constant aarch64_neon_sshl to VASHR (PR #68918)
Sam Tebbs via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 06:52:38 PDT 2023
================
@@ -19100,9 +19100,14 @@ static SDValue tryCombineShiftImm(unsigned IID, SDNode *N, SelectionDAG &DAG) {
case Intrinsic::aarch64_neon_sshl:
case Intrinsic::aarch64_neon_ushl:
// For positive shift amounts we can use SHL, as ushl/sshl perform a regular
- // left shift for positive shift amounts. Below, we only replace the current
- // node with VSHL, if this condition is met.
- Opcode = AArch64ISD::VSHL;
+ // left shift for positive shift amounts. For negative shifts we can use a
+ // VASHR/VLSHR as appropiate.
+ if (ShiftAmount < 0) {
+ Opcode = IID == Intrinsic::aarch64_neon_sshl ? AArch64ISD::VASHR
+ : AArch64ISD::VLSHR;
+ ShiftAmount = -ShiftAmount;
+ } else
+ Opcode = AArch64ISD::VSHL;
IsRightShift = false;
----------------
SamTebbs33 wrote:
Does this need to be true if we use a right shift?
https://github.com/llvm/llvm-project/pull/68918
More information about the llvm-commits
mailing list