Skip to content

Commit e8e4060

Browse files
committed
Fix sext_in_reg from i1 to i128
The combineSIGN_EXTEND_INREG routine was using DAG.getConstant(-1, DL, VT), which does not result in the expected value when VT has more than 64 bits. Fix this by using DAG.getAllOnesConstant(DL, VT) instead. Also add test cases for v1i128 comparisons (which triggers the bug).
1 parent 8fcb822 commit e8e4060

File tree

2 files changed

+414
-2
lines changed

2 files changed

+414
-2
lines changed

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6727,8 +6727,8 @@ SDValue SystemZTargetLowering::combineSIGN_EXTEND_INREG(
67276727
if (EVT == MVT::i1 && N0.hasOneUse() && N0.getOpcode() == ISD::SETCC) {
67286728
SDLoc DL(N0);
67296729
SDValue Ops[] = { N0.getOperand(0), N0.getOperand(1),
6730-
DAG.getConstant(-1, DL, VT), DAG.getConstant(0, DL, VT),
6731-
N0.getOperand(2) };
6730+
DAG.getAllOnesConstant(DL, VT),
6731+
DAG.getConstant(0, DL, VT), N0.getOperand(2) };
67326732
return DAG.getNode(ISD::SELECT_CC, DL, VT, Ops);
67336733
}
67346734
return SDValue();

0 commit comments

Comments
 (0)