Skip to content

Commit b45de48

Browse files
authored
[MVE] Expand64BitShift - handle all constant shift amounts less than 32 (#81261)
Expand64BitShift was always dropping to generic shift legalization if the shift amount type was larger than i64, even if the constant shift amount was actually very small. I've adjusted the constant bounds checks to work with APInt types so we can always perform the comparison. This results in the MVE long shift instructions being used more often, and it looks like this is preventing some additional combines from happening. This could be addressed in the future. This came about while I was trying to extend the DAGTypeLegalizer::ExpandShift* helpers and need to move to consistently using the legal shift amount types instead of reusing the shift amount type from the original wider shift.
1 parent e3f684d commit b45de48

File tree

3 files changed

+1545
-1489
lines changed

3 files changed

+1545
-1489
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6702,8 +6702,8 @@ static SDValue Expand64BitShift(SDNode *N, SelectionDAG &DAG,
67026702

67036703
// If the shift amount is greater than 32 or has a greater bitwidth than 64
67046704
// then do the default optimisation
6705-
if (ShAmt->getValueType(0).getSizeInBits() > 64 ||
6706-
(Con && (Con->getZExtValue() == 0 || Con->getZExtValue() >= 32)))
6705+
if ((!Con && ShAmt->getValueType(0).getSizeInBits() > 64) ||
6706+
(Con && (Con->getAPIntValue() == 0 || Con->getAPIntValue().uge(32))))
67076707
return SDValue();
67086708

67096709
// Extract the lower 32 bits of the shift amount if it's not an i32

0 commit comments

Comments
 (0)