On 9/4/24 2:26 PM, Palmer Dabbelt wrote:
Now that we've got the riscv_vector_cc attribute it's pretty much free
to add a system-wide ABI -- at least in terms of implementation. So
this just adds a new ABI command-line value that defaults to enabling
the vector calling convention, essentially the same as scattering the
attribute on every function.
gcc/ChangeLog:
* config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Add LP64DV.
* config/riscv/riscv-d.cc (riscv_d_handle_target_float_abi):
Likewise.
* config/riscv/riscv-opts.h (enum riscv_abi_type): Likewise.
* config/riscv/riscv.cc (riscv_vector_cc_function_p): Use
LP64DV.
(riscv_option_override): Likewise.
* config/riscv/riscv.opt: Add LP64DV.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/base/lp64dv.c: New test.
---
So this is very much an RFC, again. As such it's basically not tested,
I just manually inspected the test case and it looks sane.
This concept of a yes-V-by-default ABI has come up a bunch of times.
There's some marginal performance benefit here (the added test saves a
stack spill, for example). I have no idea how exciting this would be in
real code, but I don't think having autovectorized values with lifetimes
that cross function calls is super esoteric or anything. The
implementation is basically free, though, and it seems kind of odd to
just leave some performance on the floor for the sake of compatibility
with the pre-official distro ABIs.
Well, that's really the question, isn't it. Will the distros pick it up
or not? If they don't, then it's just an academic exercise. I don't
think we've ever managed to get any kind of distro level buy-in on a
baseline architecture.
So I don't object to the idea, I just don't know if it's going to end up
being a dead end of effort or not.
jeff