Skip to content

Why not return quotient and remainder in one instruction? #1386

Open
@KloudKoder

Description

@KloudKoder

Perhaps this due to instruction formatting constraints, but it seems silly not to provide both when computing one implies computing the other. I guess you could leave it to compiler optimization, but that seems painful. Intel's DIV and IDIV do this natively, although of course they only do it if the quotient fits in half the space available to the dividend.

Alternatively, I suppose you could provide performance guidance along the lines of: "please make sure there are no branch instructions or branch targets between the divide and remainder instructions (and have the divide first, maybe) so that the compiler can optimize them into a unified instruction under the hood".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions