[all-commits] [llvm/llvm-project] 3fe9d5: [SelectionDAG] Widen even 33-bit-magic udiv on fre...

MITSUNARI Shigeo via All-commits all-commits at lists.llvm.org
Thu Jul 9 03:01:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fe9d5d6d3d1a9bcec7959aa0cac7a6fe6808744
      https://github.com/llvm/llvm-project/commit/3fe9d5d6d3d1a9bcec7959aa0cac7a6fe6808744
  Author: MITSUNARI Shigeo <herumi at nifty.com>
  Date:   2026-07-09 (Thu, 09 Jul 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/AArch64/udiv-const-optimization.ll
    M llvm/test/CodeGen/RISCV/udiv-const-optimization.ll
    M llvm/test/CodeGen/X86/divide-by-constant.ll
    M llvm/test/CodeGen/X86/udiv-const-optimization.ll

  Log Message:
  -----------
  [SelectionDAG] Widen even 33-bit-magic udiv on free-zext targets (#207634)

On 64-bit targets, #181288 lowers a 32-bit unsigned division by a
constant with a 33-bit magic number (the `IsAdd` case) to a widened
64-bit high-multiply (`MULHU`/`UMUL_LOHI`), e.g. `x / 7` becomes a
single `mulq`/`umulh`/`mulhu`. That only reaches odd divisors. This
patch extends it to even divisors on targets where the `i32 -> i64`
zero-extension is free.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list