The ARM Runtime ABI document (IHI0043) defines the AEABI floating point helper functions in section 4.1 Floating-point library. These functions always use the base PCS (soft-fp). However helper functions defined outside of this document such as the complex-number multiply and divide helpers are not covered by this requirement and should use hard-float PCS if the target is hard-float. All of the floating point helper functions that are explicitly soft float are expanded in the llvm ARM backend. This change makes clang not force the BuiltinCC to AAPCS for AAPCS_VFP.
With this change clang matches the behavior of gcc and the expected calling convention of the hard-float compiled compiler-rt and libgcc.a libraries as these functions do not have the attribute((pcs("aapcs"))).
fixes https://bugs.llvm.org/show_bug.cgi?id=28164
fixes test failures in compiler-rt for a hard-float target "divtc3_test.c, divdc3_test.c, divxc3_test.c"
I'm very new to clang so the way this has been fixed maybe a bit too simplistic. At present none of the builtins that produce calls in clang must use the base PCS. If clang ever needs to make a call to one of the AEABI defined functions that need base AAPCS then we'll need to identify the function when choosing a calling convention.
References:
- GCC list of functions that must be base AAPCS https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/arm/arm.c?view=co&content-type=text%2Fplain
- Runtime ABI for the ARM Architecture http://infocenter.arm.com/help/topic/com.arm.doc.ihi0043d/IHI0043D_rtabi.pdf
Period at the end of a sentence.