https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129061
Bug ID: 129061
Summary: RISC-V RVB23 profiles enable optional extensions by
default and RVB23U64 omits Zfa and Zawrs
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: majin at gcc dot gnu.org
Target Milestone: ---
Description:
With -march=rvb23u64 or -march=rvb23s64 and no additional extensions,
GCC emits an ISA attribute in the assembly that differs from the baseline
specified in RVB23 Profiles v1.0.
Compiler information
GCC 17.0.0 20261123 (experimental), targeting riscv64-unknown-linux-gnu.
The tested build, g54013e136f4-dirty, included uncommitted changes on top
of local commit 54013e136f4d90f9da0767cf002da9ae6799551d.
The upstream master base was 50fa5ffebbd6dc02dd045fff75923a5409d9f169.
Reproducer
Save the following line as testcase.c.
int i;
riscv64-unknown-linux-gnu-gcc -march=rvb23u64 -mabi=lp64d -S testcase.c -o
rvb23u64.s
riscv64-unknown-linux-gnu-gcc -march=rvb23s64 -mabi=lp64d -S testcase.c -o
rvb23s64.s
grep -F '.attribute arch,' rvb23u64.s rvb23s64.s
Actual result
The ISA attribute in rvb23u64.s omits zfa1p0 and zawrs1p0 and includes
zfhmin1p0.
The attribute in rvb23s64.s includes zfhmin1p0, zvfhmin1p0, zvbb1p0,
zvkt1p0, and supm1p0.
In a separate test with -O3 -march=rvb23s64, GCC emitted vsetvli for a
byte loop computing d[i] = s[i] + 1. The program terminated with SIGILL
under QEMU with vector support disabled.
Expected result
RVB23U64 must include Zfa and Zawrs. Zfhmin, Zvfhmin, Zvbb, Zvkt, and
Supm are optional in RVB23U64, and RVB23S64 inherits these options.
Code compiled with just the profile name should run on a processor that
implements only the mandatory extensions for that profile.
Specification
RVB23 Profiles v1.0, sections 3.1.1.2, 3.1.1.3.3, and 3.1.2.3.
https://docs.riscv.org/reference/rvb23/v1.0/rvb23.html#3-1-1-2-rvb23u64-mandatory-extensions
https://docs.riscv.org/reference/rvb23/v1.0/rvb23.html#3-1-1-3-3-expansion-options
https://docs.riscv.org/reference/rvb23/v1.0/rvb23.html#3-1-2-3-rvb23s64-optional-extensions