In AArch64ISelLowering.cpp this patch implements this fold:
- GEP (%ptr, SHL ((stepvector(A) + splat(%offset))) << splat(B)))
into GEP (%ptr + (%offset << B), step_vector (A << B))
The above transform simplifies the index operand so that it can be expressed
as i32 elements.
This allows using only one gather/scatter assembly instruction instead of two.
Patch by Paul Walker (@paulwalker-arm).
Depends on D117900
I'd suggest creating some variables here, so that further on you don't need to write something like:
Instead, if you create some variables:
Then the code below becomes a bit more readable:
if (auto *Shift = dyn_cast_or_null<ConstantSDNode>(DAG.getSplatValue(ShiftOp))) { if (SDValue Offset = DAG.getSplatValue(OffsetOp)) { int64_t Step = cast<ConstantSDNode>(StepOp.getOperand(0))->getSExtValue(); ... } }