Open nick-knight opened 2 years ago
Looks like we need to expand the test
to be something like
The expectation is that the compiler needs to define the __riscv_zve64f macro. @issuehsu , do you know if the compiler will set this one?
@paul-walmsley-sifive The preprocessor macro is one part of the problem. We're solving that problem here: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/22
The bigger problem is misa.V
. I sketched a workaround for that above.
The following code fails to execute when using the Zve* (embedded vector) extensions, because they don't set misa.V:
https://github.com/sifive/freedom-metal/blob/e21891cad8365b21a961444adb3d40b2aab39e93/gloss/crt0.S#L255-L268
(This code should continue to work for the V extension.)
Unfortunately, the RISC-V standard discovery mechanism hasn’t been finalized yet. In the meanwhile, @aswaterman has suggested a workaround that can be used in this case: 1) Unconditionally initialize mstatus.VS to Dirty. This is safe on any processor. 2) Read back mstatus.VS and see if it’s set to Off. If so, there is no vector unit, and you should skip initialization.
This works for both V and Zve*.