[llvm] [GlobalIsel][AArch64] Replace N bit G_ADD with N/2 bit G_ADD if the lower bits are known to be zeros (PR #101327)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 05:18:57 PDT 2024


================
@@ -5099,6 +5099,67 @@ bool CombinerHelper::matchAddEToAddO(MachineInstr &MI, BuildFnTy &MatchInfo) {
   return true;
 }
 
+bool CombinerHelper::matchAddWithKnownZeroLowerHalfBits(MachineInstr &MI,
+                                                        BuildFnTy &MatchInfo) {
+  GAdd *Add = cast<GAdd>(&MI);
+
+  const Register DstReg = Add->getReg(0);
+  const LLT FullTy = MRI.getType(DstReg);
+
+  if (!FullTy.isScalar())
+    return false;
+
+  const std::uint64_t FullSize = FullTy.getSizeInBits();
+  const std::uint64_t HalfSize = (FullSize + 1) / 2;
----------------
arsenm wrote:

Don't need these std::s

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


More information about the llvm-commits mailing list