Skip to content

Optimized modulus using a combination of divide and shifted multiply with masking of low bits fails to simplify #4362

Description

@D0ntPanic

Optimized modulus that combines the steps of an optimized divide with a multiplication using shifts, adds,
and masking of lower bits can fail to simplify into a modulus expression. An example is given below:

combined_with_mask

Binaries with examples:

combined_with_mask.zip

u32_mod_4k_x86.so: See 3, 5, 17, 36, and others
u64_mod_4k_arm64.so: See 3, 5, 9, 11, 17, and others
u64_mod_4k_x64.dylib: See 6, 10, 12, 18, 20, and others
u64_mod_4k_x64.so: See 3, 5, 9, 17, 22, and others

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CoreIssue needs changes to the coreCore: HLILIssue involves High Level ILEffort: LowIssues require < 1 week of workIL OptimizationIssue involving optimization of representation (not correctness)Impact: LowIssue is a papercut or has a good, supported workaround

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions