[DynInst_API:] [dyninst/dyninst] 0ce19e: Extract, update isPowerOf2 (#2250)


Date: Mon, 18 May 2026 11:10:41 -0700
From: Tim Haines <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 0ce19e: Extract, update isPowerOf2 (#2250)
  Branch: refs/heads/master
  Home:   https://github.com/dyninst/dyninst
  Commit: 0ce19efd5199f5d816eb9f1f5ed8296f684706f6
      https://github.com/dyninst/dyninst/commit/0ce19efd5199f5d816eb9f1f5ed8296f684706f6
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2026-05-18 (Mon, 18 May 2026)

  Changed paths:
    M common/CMakeLists.txt
    A common/src/bitmath.h
    M dyninstAPI/CMakeLists.txt
    M dyninstAPI/src/ASTs/operatorAST.C
    M dyninstAPI/src/BPatch/BPatch_addressSpace.C
    M dyninstAPI/src/BPatch/BPatch_binaryEdit.C
    M dyninstAPI/src/BPatch/BPatch_process.C
    M dyninstAPI/src/RegisterConversion-aarch64.C
    M dyninstAPI/src/RegisterConversion-ppc.C
    M dyninstAPI/src/Relocation/Widgets/RelDataWidget.h
    M dyninstAPI/src/codegen/emitters/x86/Emitterx86.C
    M dyninstAPI/src/codegen/emitters/x86/Emitterx86.h
    M dyninstAPI/src/codegen/emitters/x86/IA32/EmitterIA32.C
    M dyninstAPI/src/dynProcess.h
    M dyninstAPI/src/emit-x86.C
    M dyninstAPI/src/image.C
    M dyninstAPI/src/inst-aarch64.C
    M dyninstAPI/src/inst-power.C
    M dyninstAPI/src/inst-winnt.C
    M dyninstAPI/src/inst-x86.C
    M dyninstAPI/src/inst-x86.h
    R dyninstAPI/src/inst.h
    M dyninstAPI/src/instPoint.C
    M dyninstAPI/src/instPoint.h
    M dyninstAPI/src/registerSpace/registerSpace-amdgpu.C
    M dyninstAPI/src/registerSpace/registerSpace.C
    M dyninstAPI/src/registerSpace/registerSpace.h
    M dyninstAPI/src/syscall-nt.C
    M dyninstAPI/src/syscallNotification.C
    M tests/unit/common/CMakeLists.txt
    A tests/unit/common/bitmath.cpp

  Log Message:
  -----------
  Extract, update isPowerOf2 (#2250)

This introduces a redundant calculation of ilog2 (e.g., once in
Emitterx86::can_optimize_as_shift and again in Emitterx86::emitDivImm). However
for GNU-ish compilers that use the instrinsics, the number of instructions is a
quarter of the number needed for the previous loop implementation.

I don't know why aarch doesn't use this optimization for mul and div or why ppc
only uses it for mul.



To unsubscribe from these emails, change your notification settings at https://github.com/dyninst/dyninst/settings/notifications
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 0ce19e: Extract, update isPowerOf2 (#2250), Tim Haines <=