On 08/12/2021 15:47, FX via Gcc-patches wrote:
Hi Richard,
This isn't a full review, but I do have a question: is this really specific to
Darwin? or is it really generic aarch64 code? If the former, then the file
name is not right and it should reflect the darwin-specific nature of the
contents. If the latter, then I wonder why most other fortran targets don't
seem to have specific implementations of this.
The code is not specific to Darwin, but right now I chose to only enable on
Darwin because:
- All glibc targets are covered already by using glibc <fenv.h> function calls
- I don’t know if there are other aarch64 targets that exist, support Fortran
and IEEE, but don’t have glibc
I’d suggest other non-glibc aarch64 targets could be added to the support and
enable this code, but I don’t want to do it unless it’s been tested there. IEEE
support is optional in Fortran, so I suggest we keep it “opt-in”: targets where
it’s known to work enable it, but it’s off by default on other targets.
I hope this explains the rationale.
FX
OK, that makes sense. I wonder if a comment to that effect is warranted
somewhere.
One tricky thing about aarch64 IEEE support is that trapping exceptions
(raising a software exception, as opposed to just setting an exceptional
condition bit in the FPSR) is implementation defined. The only way to
tell if your implementation can support trapping an exception is to try
to set the trapping enable bit in the FPCR. If the bit is read back and
is non-zero then that exception supports trapping; if it reads back as
zero, then trapping that exception is not supported. More details can
be found in the armv8 Arm ARM.
HTH,
R.