================
@@ -2840,6 +2841,46 @@ static Instruction *matchFunnelShift(Instruction &Or, 
InstCombinerImpl &IC) {
       return nullptr;
 
     FShiftArgs = {ShVal0, ShVal1, ShAmt};
+  } else if (isa<ZExtInst>(Or0) || isa<ZExtInst>(Or1)) {
+    // If there are two 'or' instructions concat variables in opposite order,
+    // the latter one can be safely convert to fshl.
+    //
+    // LowHigh = or (shl (zext Low), Width - ZextHighShlAmt), (zext High)
+    // HighLow = or (shl (zext High), ZextHighShlAmt), (zext Low)
+    // ->
+    // HighLow = fshl LowHigh, LowHigh, ZextHighShlAmt
----------------
goldsteinn wrote:

Comment doesn't seem to match the code.

Seem to matching:
`LowHigh = (zext (or Shl, Low, Width-ZExtHighShlAmt), High))`, (likewise for 
high). Not `zext` on the `or` operands.

https://github.com/llvm/llvm-project/pull/68502
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to