[llvm] [RISCV] Split TuneShiftedZExtFusion (PR #76032)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 07:49:41 PST 2023


================
@@ -58,27 +58,74 @@ static bool isLDADD(const MachineInstr *FirstMI, const MachineInstr &SecondMI) {
   return checkRegisters(FirstMI->getOperand(0).getReg(), SecondMI);
 }
 
-// Fuse these patterns:
-//
-// slli rd, rs1, 32
-// srli rd, rd, x
-// where 0 <= x <= 32
-//
-// and
-//
+// Fuse zero extension of halfword:
 // slli rd, rs1, 48
+// srli rd, rd, 48
+static bool isZExtH(const MachineInstr *FirstMI, const MachineInstr &SecondMI) {
+  if (SecondMI.getOpcode() != RISCV::SRLI)
----------------
preames wrote:

Minor, but a utility which matches a SRLI and a separate one which matches a SRLI and returns the immediate might reduce some code duplication through this.  

https://github.com/llvm/llvm-project/pull/76032


More information about the llvm-commits mailing list