You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The context for this is #116344: some target features change the way floats are passed between functions. Changing those target features is unsound as code compiled for the same target may now use different ABIs.
In #134794, I am adding the infrastructure to have the compiler recognize this. But this infrastructure needs to be fed with information about which ABIs exist (e.g. softfloat/hardfloat), and which target features they require or are incompatible with. This will have to be done for each architecture we support.
x86 (32bit and 64bit):
soft-float can be set to swap the ABI; if unset, a hardfloat ABI is used
32bit: uses float registers if !soft-float && x87 (see here). IOW, hardfloat ABI requires x87.
"RISC-V has a similar ABI split. -F/-D/-Q is your softfloat/nofloat, but it also comes with the Zfinx/Zdinx/Zqinx variants where floating-point values are carried in the regular registers and the floating-point register file is deleted. Your float-function-features would be +F,-Zfinx, +D,-Zdinx for riscv64gc-unknown-linux (linux does not permit finx). Although I don't think this is as much of a problem because the platform states that +F,+Zfinx is illegal?" (from here)
For RISC-V targets, the float ABI can be specified by the llvm_abiname target option. As long as this happens, f/d can be enabled without changing the ABI (LLVM doesn't support q yet). Disabling target features required by the requested ABI will cause LLVM to ignore the ABI. The zfinx/zdinx features don't affect the ABI.
View all comments
The context for this is #116344: some target features change the way floats are passed between functions. Changing those target features is unsound as code compiled for the same target may now use different ABIs.
In #134794, I am adding the infrastructure to have the compiler recognize this. But this infrastructure needs to be fed with information about which ABIs exist (e.g. softfloat/hardfloat), and which target features they require or are incompatible with. This will have to be done for each architecture we support.
soft-floatcan be set to swap the ABI; if unset, a hardfloat ABI is used!soft-float && x87(see here). IOW, hardfloat ABI requiresx87.f16uses SSE registers so that's extra fun, see x86-32 "f16" ABI needs SSE, incompatible with i586 targets #131819!soft-float && sseis the relevant check -- IOW, hardfloat ABI requiressse/sse2.soft-floatcan be set to swap the ABI; if unset, a hardfloat ABI is used!soft-float && fpregs(see here), so hardfloat ABI requiresfpregsfp-armv8; Rust makes-neonimply-fp-armv8so we have to forbid both -- butneonis stable! See The (stable)neonaarch64 target feature is unsound: it changes the float ABI #131058-Ctarget-features must be restrained on RISCV #132618Tier 3 only: