@@ -4263,7 +4263,6 @@ SDValue SystemZTargetLowering::lowerXALUO(SDValue Op,
4263
4263
if (N->getValueType (0 ) == MVT::i128 ) {
4264
4264
unsigned BaseOp = 0 ;
4265
4265
unsigned FlagOp = 0 ;
4266
- bool IsBorrow = false ;
4267
4266
switch (Op.getOpcode ()) {
4268
4267
default : llvm_unreachable (" Unknown instruction!" );
4269
4268
case ISD::UADDO:
@@ -4273,17 +4272,13 @@ SDValue SystemZTargetLowering::lowerXALUO(SDValue Op,
4273
4272
case ISD::USUBO:
4274
4273
BaseOp = ISD::SUB;
4275
4274
FlagOp = SystemZISD::VSCBI;
4276
- IsBorrow = true ;
4277
4275
break ;
4278
4276
}
4279
4277
SDValue Result = DAG.getNode (BaseOp, DL, MVT::i128 , LHS, RHS);
4280
4278
SDValue Flag = DAG.getNode (FlagOp, DL, MVT::i128 , LHS, RHS);
4281
4279
Flag = DAG.getNode (ISD::AssertZext, DL, MVT::i128 , Flag,
4282
4280
DAG.getValueType (MVT::i1));
4283
4281
Flag = DAG.getZExtOrTrunc (Flag, DL, N->getValueType (1 ));
4284
- if (IsBorrow)
4285
- Flag = DAG.getNode (ISD::XOR, DL, Flag.getValueType (),
4286
- Flag, DAG.getConstant (1 , DL, Flag.getValueType ()));
4287
4282
return DAG.getNode (ISD::MERGE_VALUES, DL, N->getVTList (), Result, Flag);
4288
4283
}
4289
4284
@@ -4356,7 +4351,6 @@ SDValue SystemZTargetLowering::lowerUADDSUBO_CARRY(SDValue Op,
4356
4351
if (VT == MVT::i128 ) {
4357
4352
unsigned BaseOp = 0 ;
4358
4353
unsigned FlagOp = 0 ;
4359
- bool IsBorrow = false ;
4360
4354
switch (Op.getOpcode ()) {
4361
4355
default : llvm_unreachable (" Unknown instruction!" );
4362
4356
case ISD::UADDO_CARRY:
@@ -4366,21 +4360,14 @@ SDValue SystemZTargetLowering::lowerUADDSUBO_CARRY(SDValue Op,
4366
4360
case ISD::USUBO_CARRY:
4367
4361
BaseOp = SystemZISD::VSBI;
4368
4362
FlagOp = SystemZISD::VSBCBI;
4369
- IsBorrow = true ;
4370
4363
break ;
4371
4364
}
4372
- if (IsBorrow)
4373
- Carry = DAG.getNode (ISD::XOR, DL, Carry.getValueType (),
4374
- Carry, DAG.getConstant (1 , DL, Carry.getValueType ()));
4375
4365
Carry = DAG.getZExtOrTrunc (Carry, DL, MVT::i128 );
4376
4366
SDValue Result = DAG.getNode (BaseOp, DL, MVT::i128 , LHS, RHS, Carry);
4377
4367
SDValue Flag = DAG.getNode (FlagOp, DL, MVT::i128 , LHS, RHS, Carry);
4378
4368
Flag = DAG.getNode (ISD::AssertZext, DL, MVT::i128 , Flag,
4379
4369
DAG.getValueType (MVT::i1));
4380
4370
Flag = DAG.getZExtOrTrunc (Flag, DL, N->getValueType (1 ));
4381
- if (IsBorrow)
4382
- Flag = DAG.getNode (ISD::XOR, DL, Flag.getValueType (),
4383
- Flag, DAG.getConstant (1 , DL, Flag.getValueType ()));
4384
4371
return DAG.getNode (ISD::MERGE_VALUES, DL, N->getVTList (), Result, Flag);
4385
4372
}
4386
4373
@@ -6584,27 +6571,6 @@ SDValue SystemZTargetLowering::combineTruncateExtract(
6584
6571
}
6585
6572
}
6586
6573
}
6587
- // Convert (zext (xor (trunc X), C)) into (xor (trunc X), C') if the size
6588
- // of the result is smaller than the size of X and all the truncated bits
6589
- // of X are already zero.
6590
- if (N0.getOpcode () == ISD::XOR &&
6591
- N0.hasOneUse () && N0.getOperand (0 ).hasOneUse () &&
6592
- N0.getOperand (0 ).getOpcode () == ISD::TRUNCATE &&
6593
- N0.getOperand (1 ).getOpcode () == ISD::Constant) {
6594
- SDValue X = N0.getOperand (0 ).getOperand (0 );
6595
- if (VT.isScalarInteger () && VT.getSizeInBits () < X.getValueSizeInBits ()) {
6596
- KnownBits Known = DAG.computeKnownBits (X);
6597
- APInt TruncatedBits = APInt::getBitsSet (X.getValueSizeInBits (),
6598
- N0.getValueSizeInBits (),
6599
- VT.getSizeInBits ());
6600
- if (TruncatedBits.isSubsetOf (Known.Zero )) {
6601
- X = DAG.getNode (ISD::TRUNCATE, SDLoc (X), VT, X);
6602
- APInt Mask = N0.getConstantOperandAPInt (1 ).zext (VT.getSizeInBits ());
6603
- return DAG.getNode (ISD::XOR, SDLoc (N0), VT,
6604
- X, DAG.getConstant (Mask, SDLoc (N0), VT));
6605
- }
6606
- }
6607
- }
6608
6574
return SDValue ();
6609
6575
}
6610
6576
0 commit comments