Skip to content

proposal: cmd/compile: add a flag to support riscv optional extension #76065

@newborn22

Description

@newborn22

Proposal Details

The RVA23U64 profile specifies a set of extensions, some mandatory and some optional (such as Zacas and Zabha). Currently, however, there is no flag to instruct the Go compiler when to generate code for these optional extensions.

A potential solution is to introduce an environment variable named GORISCV64OPT, which would accept a string array as input. This array would be converted into a map within the compiler. Additionally, macros derived from the input could be passed to the assembler, allowing the use of conditional compilation directives like #ifdef GORISCV64OPT_XXX to control whether optional extension assembly code is included. I also wrote a demo here: https://github.com/zte-riscv/go/pull/64/files#diff-7eb232fb2003a7305dd50315d163ac65a4f06658fecc5f3bf214330995b80e17

Metadata

Metadata

Assignees

No one assigned

    Labels

    ProposalToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions