[RISCV] Give CSImm12MulBy4 PatLeaf priority over CSImm12MulBy8. NFC
authorCraig Topper <craig.topper@sifive.com>
Fri, 3 Jun 2022 03:49:15 +0000 (20:49 -0700)
committerCraig Topper <craig.topper@sifive.com>
Fri, 3 Jun 2022 03:51:14 +0000 (20:51 -0700)
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.

llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

index ea9f5f1..33fe909 100644 (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, [{