[RISCV] Give CSImm12MulBy4 PatLeaf priority over CSImm12MulBy8. NFC

The immediate range check for CSImm12MulBy8 included some values
covered by CSImm12MulBy4. I assume CSImm12MulBy4 had priority due
to pattern order in the td file, but this makes the priority
explicit in the predicate.
This commit is contained in:
Craig Topper 2022-06-02 20:49:15 -07:00
parent e33af271ea
commit 1d67adbfbf
1 changed files with 3 additions and 2 deletions

View File

@ -218,8 +218,9 @@ def CSImm12MulBy8 : PatLeaf<(imm), [{
if (!N->hasOneUse())
return false;
int64_t C = N->getSExtValue();
// Skip if C is simm12 or can be optimized by the PatLeaf AddiPair.
return !isInt<13>(C) && isInt<15>(C) && (C & 7) == 0;
// Skip if C is simm12 or can be optimized by the PatLeaf AddiPair or
// CSImm12MulBy4.
return !isInt<14>(C) && isInt<15>(C) && (C & 7) == 0;
}]>;
def SimmShiftRightBy2XForm : SDNodeXForm<imm, [{