[llvm] [GlobalISel] Handle div-by-pow2 (PR #83155)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 3 23:36:36 PST 2024


================
@@ -5286,6 +5286,141 @@ MachineInstr *CombinerHelper::buildSDivUsingMul(MachineInstr &MI) {
   return MIB.buildMul(Ty, Res, Factor);
 }
 
+bool CombinerHelper::matchSDivByPow2(MachineInstr &MI) {
+  assert(MI.getOpcode() == TargetOpcode::G_SDIV && "Expected SDIV");
+  if (MI.getFlag(MachineInstr::MIFlag::IsExact))
----------------
Pierre-vh wrote:

You can check that with https://llvm.org/docs/GlobalISel/MIRPatterns.html#instruction-flags

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


More information about the llvm-commits mailing list