[libc-commits] [PATCH] D124204: [libc] Support 32-bit ARM platform tests

Dominic Chen via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Apr 21 15:12:35 PDT 2022


ddcc created this revision.
ddcc added a reviewer: sivachandra.
Herald added subscribers: ecnelises, tschuett, kristof.beyls.
Herald added projects: libc-project, All.
ddcc requested review of this revision.

Set LONG_DOUBLE_IS_DOUBLE, add ifdefs for 128-bit integer types


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124204

Files:
  libc/src/__support/CPP/TypeTraits.h
  libc/src/__support/FPUtil/PlatformDefs.h
  libc/utils/UnitTest/LibcTest.cpp


Index: libc/utils/UnitTest/LibcTest.cpp
===================================================================
--- libc/utils/UnitTest/LibcTest.cpp
+++ libc/utils/UnitTest/LibcTest.cpp
@@ -42,6 +42,7 @@
 
 std::string describeValue(std::string Value) { return std::string(Value); }
 
+#ifdef __SIZEOF_INT128__
 // When the value is __uint128_t, also show its hexadecimal digits.
 // Using template to force exact match, prevent ambiguous promotion.
 std::string describeValue128(__uint128_t Value) {
@@ -61,6 +62,7 @@
 template <> std::string describeValue<__uint128_t>(__uint128_t Value) {
   return describeValue128(Value);
 }
+#endif
 
 template <typename ValType>
 void explainDifference(ValType LHS, ValType RHS, const char *LHSStr,
@@ -218,10 +220,12 @@
                               const char *RHSStr, const char *File,
                               unsigned long Line);
 
+#ifdef __SIZEOF_INT128__
 template bool test<__int128_t>(RunContext *Ctx, TestCondition Cond,
                                __int128_t LHS, __int128_t RHS,
                                const char *LHSStr, const char *RHSStr,
                                const char *File, unsigned long Line);
+#endif
 
 template bool test<unsigned char>(RunContext *Ctx, TestCondition Cond,
                                   unsigned char LHS, unsigned char RHS,
@@ -253,10 +257,12 @@
                                        const char *LHSStr, const char *RHSStr,
                                        const char *File, unsigned long Line);
 
+#ifdef __SIZEOF_INT128__
 template bool test<__uint128_t>(RunContext *Ctx, TestCondition Cond,
                                 __uint128_t LHS, __uint128_t RHS,
                                 const char *LHSStr, const char *RHSStr,
                                 const char *File, unsigned long Line);
+#endif
 
 } // namespace internal
 
Index: libc/src/__support/FPUtil/PlatformDefs.h
===================================================================
--- libc/src/__support/FPUtil/PlatformDefs.h
+++ libc/src/__support/FPUtil/PlatformDefs.h
@@ -15,8 +15,10 @@
 #define X87_FPU
 #endif
 
+// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
 // https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
-#if defined(_WIN32) || (defined(__APPLE__) && defined(__aarch64__))
+#if defined(_WIN32) || defined(__arm__) ||                                     \
+    (defined(__APPLE__) && defined(__aarch64__))
 #define LONG_DOUBLE_IS_DOUBLE
 #endif
 
Index: libc/src/__support/CPP/TypeTraits.h
===================================================================
--- libc/src/__support/CPP/TypeTraits.h
+++ libc/src/__support/CPP/TypeTraits.h
@@ -49,8 +49,11 @@
       IsSameV<unsigned short, TypeNoCV> || IsSameV<int, TypeNoCV> ||
       IsSameV<unsigned int, TypeNoCV> || IsSameV<long, TypeNoCV> ||
       IsSameV<unsigned long, TypeNoCV> || IsSameV<long long, TypeNoCV> ||
-      IsSameV<unsigned long long, TypeNoCV> || IsSameV<bool, TypeNoCV> ||
-      IsSameV<__uint128_t, TypeNoCV> || IsSameV<__int128_t, TypeNoCV>;
+      IsSameV<unsigned long long, TypeNoCV> || IsSameV<bool, TypeNoCV>
+#ifdef __SIZEOF_INT128__
+      || IsSameV<__uint128_t, TypeNoCV> || IsSameV<__int128_t, TypeNoCV>
+#endif
+      ;
 };
 
 template <typename T> struct IsPointerTypeNoCV : public FalseValue {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124204.424306.patch
Type: text/x-patch
Size: 3392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220421/d93b0cc8/attachment.bin>


More information about the libc-commits mailing list