]> granicus.if.org Git - llvm/commitdiff
[X86][SSE] Improve comments describing combineTruncatedArithmetic. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Jan 2017 18:18:32 +0000 (18:18 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Jan 2017 18:18:32 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292502 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 4e4b2b1a6d3e83895785e409619c690888d9ade6..0d65c27772540daaffc4248b46e1d7b8c431681a 100644 (file)
@@ -32350,9 +32350,14 @@ static SDValue combineTruncatedArithmetic(SDNode *N, SelectionDAG &DAG,
 
   auto IsRepeatedOpOrFreeTruncation = [VT](SDValue Op0, SDValue Op1) {
     unsigned TruncSizeInBits = VT.getScalarSizeInBits();
+
+    // Repeated operand, so we are only trading one output truncation for
+    // one input truncation.
     if (Op0 == Op1)
       return true;
 
+    // See if either operand has been extended from a smaller/equal size to
+    // the truncation size, allowing a truncation to combine with the extend.
     unsigned Opcode0 = Op0.getOpcode();
     if ((Opcode0 == ISD::ANY_EXTEND || Opcode0 == ISD::SIGN_EXTEND ||
          Opcode0 == ISD::ZERO_EXTEND) &&
@@ -32365,6 +32370,8 @@ static SDValue combineTruncatedArithmetic(SDNode *N, SelectionDAG &DAG,
         Op1.getOperand(0).getScalarValueSizeInBits() <= TruncSizeInBits)
       return true;
 
+    // See if either operand is a single use constant which can be constant
+    // folded.
     SDValue BC0 = peekThroughOneUseBitcasts(Op0);
     SDValue BC1 = peekThroughOneUseBitcasts(Op1);
     return ISD::isBuildVectorOfConstantSDNodes(BC0.getNode()) ||