Skip to content

Commit

Permalink
[X86] LowerABD - remove freeze from abd*(lhs, rhs) -> trunc(abs(sub(*…
Browse files Browse the repository at this point in the history
…ext(lhs), *ext(rhs))))

Single use each of lhs/rhs so we shouldn't need them.
  • Loading branch information
RKSimon committed Nov 8, 2023
1 parent 33ecd93 commit f416f6c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28180,10 +28180,8 @@ static SDValue LowerABD(SDValue Op, const X86Subtarget &Subtarget,
// abds(lhs, rhs) -> trunc(abs(sub(sext(lhs), sext(rhs))))
// abdu(lhs, rhs) -> trunc(abs(sub(zext(lhs), zext(rhs))))
unsigned ExtOpc = IsSigned ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
SDValue LHS = DAG.getFreeze(Op.getOperand(0));
SDValue RHS = DAG.getFreeze(Op.getOperand(1));
LHS = DAG.getNode(ExtOpc, dl, WideVT, LHS);
RHS = DAG.getNode(ExtOpc, dl, WideVT, RHS);
SDValue LHS = DAG.getNode(ExtOpc, dl, WideVT, Op.getOperand(0));
SDValue RHS = DAG.getNode(ExtOpc, dl, WideVT, Op.getOperand(1));
SDValue Diff = DAG.getNode(ISD::SUB, dl, WideVT, LHS, RHS);
SDValue AbsDiff = DAG.getNode(ISD::ABS, dl, WideVT, Diff);
return DAG.getNode(ISD::TRUNCATE, dl, VT, AbsDiff);
Expand Down

0 comments on commit f416f6c

Please sign in to comment.