Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #4686
Closed
Open
Issue created Jan 22, 2021 by Derek Bruening@derekbrueningContributor

On newer processors, use BMI2 eflags-less mask and shift to avoid eflags saving in IBL

This is a proposal to implement eflags-less hashtable lookup, thus avoiding spilling and restoring eflags, by using BMI2 instructions on processors that support them: SHLX for the shift (though a series of LEA could also be used) and SHLX plus SHRX (or PEXT or PDEP) for the mask (unfortunately BZHI, tailor-made for this type of masking, modifies eflags), and LEA plus JECXZ for the cmp. (Actually the SHRX or PDEP can be merged with the scaling SHLX.) We would then load the table base into a register for a LEA, which may need an extra scratch register vs the add-memory we have now? The mask/shift also needs a register (the same one should work) since none of those take an immediate: so we're only saving the flags ops themselves, and not the xax spill/restore.

We can use -unsafe_ignore_eflags to help estimate some of the potential savings but it should not be hard to implement the final scheme and try to measure the impact.

Assignee
Assign to
Time tracking