[llvm] r292502 - [X86][SSE] Improve comments describing combineTruncatedArithmetic. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 10:18:32 PST 2017


Author: rksimon
Date: Thu Jan 19 12:18:32 2017
New Revision: 292502

URL: http://llvm.org/viewvc/llvm-project?rev=292502&view=rev
Log:
[X86][SSE] Improve comments describing combineTruncatedArithmetic. NFCI.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=292502&r1=292501&r2=292502&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Jan 19 12:18:32 2017
@@ -32350,9 +32350,14 @@ static SDValue combineTruncatedArithmeti
 
   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 combineTruncatedArithmeti
         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()) ||




More information about the llvm-commits mailing list