Skip to content

Commit 9e60a6a

Browse files
committed
[X86] combinePMULH - pull out repeated IsTruncateFree helper. NFC.
1 parent 01be025 commit 9e60a6a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53021,12 +53021,12 @@ static SDValue combinePMULH(SDValue Src, EVT VT, const SDLoc &DL,
5302153021
return SDValue();
5302253022

5302353023
// Check if both inputs are extensions, which will be removed by truncation.
53024-
bool IsTruncateFree = (LHS.getOpcode() == ISD::SIGN_EXTEND ||
53025-
LHS.getOpcode() == ISD::ZERO_EXTEND) &&
53026-
(RHS.getOpcode() == ISD::SIGN_EXTEND ||
53027-
RHS.getOpcode() == ISD::ZERO_EXTEND) &&
53028-
LHS.getOperand(0).getScalarValueSizeInBits() <= 16 &&
53029-
RHS.getOperand(0).getScalarValueSizeInBits() <= 16;
53024+
auto isOpTruncateFree = [](SDValue Op) {
53025+
return (Op.getOpcode() == ISD::SIGN_EXTEND ||
53026+
Op.getOpcode() == ISD::ZERO_EXTEND) &&
53027+
Op.getOperand(0).getScalarValueSizeInBits() <= 16;
53028+
};
53029+
bool IsTruncateFree = isOpTruncateFree(LHS) && isOpTruncateFree(RHS);
5303053030

5303153031
// For AVX2+ targets, with the upper bits known zero, we can perform MULHU on
5303253032
// the (bitcasted) inputs directly, and then cheaply pack/truncate the result

0 commit comments

Comments
 (0)