https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96016
Bug ID: 96016 Summary: AArch64: enable libquadmath Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libquadmath Assignee: unassigned at gcc dot gnu.org Reporter: bule1 at huawei dot com Target Milestone: --- Target: AARCH64 Created attachment 48815 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48815&action=edit patch for enable libquadmath in aarch64 Hi I would like to propose a way to enable libquadmath on aarch64. Currently aarch64 support quad precision float point with type "long double". However the libquadmath won't build even if we specify --enable-quadmath in the configure because it will check whether the target support type __float128 during the build configureation. The build process of libquadmath exit if the answer is no. According to the arm abi(https://c9x.me/compile/bib/abi-arm64.pdf) and some test cases I tried, I found that in aarch64, long double is equivalent to __float128 in x86. I happened need to use a quad-precision math library. So I cancled the hard limitation on detecting __float 128 type. After the change when it found the target is aarch64, a Macro is introduced to redefine long double as __float128. It turns out that the libquadmath can be build and works successfully on aarch64. Test have been conducted with random inputs on aarch64 and x86. The output on aarch64 is agree with the output on x86. One minor question of my solution is that aarch64 don't have __builtin_huge_valq built-in functions to define the HUGE_VALQ. I used the value in the original comment that clearly stated this might cause warning, which did happened during the build. I haven't found where and how does aarch64 define all these built-in const values. Any comment on this issue? The patch is attached. You are welcome to check and comment on the patch. Is it ok for trunk?