[Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl...
authorXing Xue <xingxue@outlook.com>
Fri, 18 Nov 2022 16:36:56 +0000 (11:36 -0500)
committerXing Xue <xingxue@outlook.com>
Fri, 18 Nov 2022 16:36:56 +0000 (11:36 -0500)
commitfa7477eb87fd262898e78db983c7b0951b87641c
treed60c676854b7a308f3ac8c66e1b3cf78823eb4db
parenteaa4f041f7864d9612ac2167cbe8925b2ea017d1
[Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

Summary:
AIX library functions frexpl(), ldexpl(), and modfl() are for 128-bit IBM long double, i.e. __ibm128. Other *l() functions, e.g., acosl(), are for 64-bit long double. The AIX Clang compiler currently maps builtin functions __builtin_frexpl(), __builtin_ldexpl(), and __builtin_modfl() to frexpl(), ldexpl(), and modfl() in 64-bit long double mode which results in seg-faults or incorrect return values. This patch changes to map __builtin_frexpl(), __builtin_ldexpl(), and __builtin_modfl() to double version lib functions frexp(), ldexp() and modf() in 64-bit long double mode.

Reviewed by: hubert.reinterpretcast, daltenty

Differential Revision: https://reviews.llvm.org/D137986
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/aix-builtin-mapping.c [new file with mode: 0644]