[llvm] fe1f369 - [X86][SSE] combineShuffleWithHorizOp - avoid unnecessary subtraction. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 09:12:31 PDT 2020


Author: Simon Pilgrim
Date: 2020-08-11T17:07:32+01:00
New Revision: fe1f36986b23a67c218d7ca24741d5ebd6886473

URL: https://github.com/llvm/llvm-project/commit/fe1f36986b23a67c218d7ca24741d5ebd6886473
DIFF: https://github.com/llvm/llvm-project/commit/fe1f36986b23a67c218d7ca24741d5ebd6886473.diff

LOG: [X86][SSE] combineShuffleWithHorizOp - avoid unnecessary subtraction. NFCI.

We can safely replace ((M - NumElts) % NumEltsPerLane) with (M % NumEltsPerLane) as the modulo result will be the same.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1a98c4653a31..3a2dadb02282 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -35900,7 +35900,7 @@ static SDValue combineShuffleWithHorizOp(SDValue N, MVT VT, const SDLoc &DL,
           (M % NumEltsPerLane) >= NumHalfEltsPerLane)
         M -= NumHalfEltsPerLane;
       if (NumElts <= M && BC1.getOperand(0) == BC1.getOperand(1) &&
-          ((M - NumElts) % NumEltsPerLane) >= NumHalfEltsPerLane)
+          (M % NumEltsPerLane) >= NumHalfEltsPerLane)
         M -= NumHalfEltsPerLane;
     }
   }


        


More information about the llvm-commits mailing list