Skip to content

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

@D0ntPanic

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

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