[PATCH] D60532: [X86] Teach foldMaskedShiftToScaledMask to look throw an any_extend from i32 to i64 between the and & shl

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 12:33:09 PDT 2019


craig.topper marked an inline comment as done.
craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1877
 
-    // Try to fold the mask and shift into an extract and scale.
-    if (!foldMaskAndShiftToExtract(*CurDAG, N, Mask, Shift, X, AM))
-      return false;
+    if (N.getOperand(0).getOpcode() == ISD::SRL) {
+      SDValue Shift = N.getOperand(0);
----------------
This is a little hard to see here, but 3 of the functions look for SRL and one looks for SHL. But we used to check for either SHL or SRL earlier. Now that we also need to consider ANY_EXTEND. I've removed the early check for SHL/SHR. Covered the 3 functions that use SRL with a check for that. Each of the functions all check ISD::SRL internally, but expect the input to be passed as X. This could probably be cleaned up a little though one of the functions does have 2 callers.

The SHL function is now unqualified and will check for ANY_EXTEND/SHL and create X internally.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60532/new/

https://reviews.llvm.org/D60532





More information about the llvm-commits mailing list