Skip to content

INC vs. ADD RAX, 1 and DEC vs. SUB RAX, 1 #6

@gaul

Description

@gaul

This has some nuance since INC and DEC partially update flags but these can be the same speed but smaller than ADD RAX, 1 and SUB RAX, 1 on modern CPUs:

https://stackoverflow.com/a/36510865

and much faster on one AMD variant:

https://msrc-blog.microsoft.com/2021/01/11/building-faster-amd64-memset-routines/#post-12548:~:text=Mysterious%20AMD%2DFX%208100%20Perf%20Regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions