Skip to content

Extend the -march syntax to accept CPU name #88

@kito-cheng

Description

@kito-cheng

GCC community just got a patch[1] that accept CPU name for -march, the reason is -mcpu has lower priority even it appeared after -march, that means it's hard to specify a arch string via -mcpu in a build system, because sometime you don't know the whole CFLAGS/CXXFLAGS.

The only way to make sure to using arch string from -mcpu=xxx is expand that to -mcpu=xxx + -march=, however as we know the arch string is become terribly long.

So the idea is maybe we should just allow that on -march to prevent that.

The main decision point is: should we allow CPU name in -march=?

And few extra decision point is:

  • Should we allow it append extensions with the same mechanism as profile.
  • Should we allow it to subtract/remove extensions from a CPU?
  • Should -march=<cpu> also implicitly set -mtune?

[1] https://gcc.gnu.org/pipermail/gcc-patches/2025-May/684398.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions