diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-01-11 09:35:04 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-01-11 09:35:04 +0000 |
commit | 93b7358fc9657cbe4c82f750bac5b9d259923e04 (patch) | |
tree | 68c90e071c225943944193a1ed5a2b666e256cb4 /lib | |
parent | dddcd78e24babb4ca6b35d99abe40bdedde71fab (diff) |
Simplify the AND-rooted mask+shift checking code to match that of the
SRL-rooted code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86ISelDAGToDAG.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 7499182c27..64cea47843 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -1255,23 +1255,21 @@ bool X86DAGToDAGISel::MatchAddressRecursively(SDValue N, X86ISelAddressMode &AM, // addressing mode optimizations. if (X.getValueSizeInBits() > 64) break; - ConstantSDNode *C2 = dyn_cast<ConstantSDNode>(N.getOperand(1)); - ConstantSDNode *C1 = dyn_cast<ConstantSDNode>(Shift.getOperand(1)); - if (!C1 || !C2) break; + if (!isa<ConstantSDNode>(N.getOperand(1))) + break; + uint64_t Mask = N.getConstantOperandVal(1); // Try to fold the mask and shift into an extract and scale. - if (!FoldMaskAndShiftToExtract(*CurDAG, N, C2->getZExtValue(), - Shift, X, AM)) + if (!FoldMaskAndShiftToExtract(*CurDAG, N, Mask, Shift, X, AM)) return false; // Try to fold the mask and shift directly into the scale. - if (!FoldMaskAndShiftToScale(*CurDAG, N, C2->getZExtValue(), Shift, X, AM)) + if (!FoldMaskAndShiftToScale(*CurDAG, N, Mask, Shift, X, AM)) return false; // Try to swap the mask and shift to place shifts which can be done as // a scale on the outside of the mask. - if (!FoldMaskedShiftToScaledMask(*CurDAG, N, C2->getZExtValue(), - Shift, X, AM)) + if (!FoldMaskedShiftToScaledMask(*CurDAG, N, Mask, Shift, X, AM)) return false; break; } |