[llvm] [clang] [AArch64] Add soft-float ABI (PR #74460)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 06:51:06 PST 2023


ostannard wrote:

I originally implemented it this way to avoid making two ABIs valid for one target, but I agree that it would be confusing to have the ABI change automatically. How about we use the `-mabi=` option as you suggest, with values `aapcs` (already accepted by clang) and `aapcs-soft` (new)?

* `-mabi=aapcs` is always the default
* If `-mabi=aapcs` (or the default) is used without an FPU, then floating-point argument and return values are rejected with an error. This matches GCC's current behaviour, and would be a change for clang, though clang previously used a non-compliant ABI. Code which is accepted with this combination is compatible with both ABIs.
* If `-mabi=aapcs-soft` is used with an FPU, then we reject the command-line options with an error. This avoids having two incompatible ABIs for one target. We will always have the option to relax this in future without breaking existing code, but I'd like to avoid that unless there's a very good reason.

> Does this also happen when using +nosimd?
No, in clang `+nosimd` leaves the FPU turned on. That's probably a bad thing, since that isn't a valid combination for AArch64, but that's a different issue.

> What about users like the Linux kernel that build with -mgeneral-regs-only?
In clang, that has the same behaviour as `+nofp`. I vaguely remember something about GCC still allowing FP instructions in inline assembly with this option, but we don't do that in clang because the assembler is integrated into the compiler, and gets the same target options. For the purposes of the ABI, I think we should treat it the same way as `+nofp`.

https://github.com/llvm/llvm-project/pull/74460


More information about the cfe-commits mailing list