[PATCH] D104786: [AIX] Use less than or equal to for some alignment tests on AIX

Zarko Todorovski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 23 07:59:27 PDT 2021


ZarkoCA created this revision.
ZarkoCA added reviewers: hubert.reinterpretcast, daltenty, PowerPC.
ZarkoCA added a project: PowerPC.
ZarkoCA requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

On AIX the alignment implementation has the storage aligned to the preferred alignment
instead of the alignment of a type. Macro guard these test for AIX and have them pass
when they return less than or equal to the reference alignment.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104786

Files:
  llvm/unittests/Support/AlignOfTest.cpp


Index: llvm/unittests/Support/AlignOfTest.cpp
===================================================================
--- llvm/unittests/Support/AlignOfTest.cpp
+++ llvm/unittests/Support/AlignOfTest.cpp
@@ -131,9 +131,17 @@
   EXPECT_EQ(alignof(T<long>), alignof(AlignedCharArrayUnion<long>));
   EXPECT_EQ(alignof(T<long long>), alignof(AlignedCharArrayUnion<long long>));
   EXPECT_EQ(alignof(T<float>), alignof(AlignedCharArrayUnion<float>));
+#ifdef _AIX
+  EXPECT_LE(alignof(T<double>), alignof(AlignedCharArrayUnion<double>));
+  EXPECT_LE(alignof(T<long double>),
+            alignof(AlignedCharArrayUnion<long double>));
+  EXPECT_LE(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
+#else
   EXPECT_EQ(alignof(T<double>), alignof(AlignedCharArrayUnion<double>));
   EXPECT_EQ(alignof(T<long double>),
             alignof(AlignedCharArrayUnion<long double>));
+  EXPECT_EQ(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
+#endif
   EXPECT_EQ(alignof(T<void *>), alignof(AlignedCharArrayUnion<void *>));
   EXPECT_EQ(alignof(T<int *>), alignof(AlignedCharArrayUnion<int *>));
   EXPECT_EQ(alignof(T<double (*)(double)>),
@@ -143,7 +151,6 @@
   EXPECT_EQ(alignof(S1), alignof(AlignedCharArrayUnion<S1>));
   EXPECT_EQ(alignof(S2), alignof(AlignedCharArrayUnion<S2>));
   EXPECT_EQ(alignof(S3), alignof(AlignedCharArrayUnion<S3>));
-  EXPECT_EQ(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
   EXPECT_EQ(alignof(S5), alignof(AlignedCharArrayUnion<S5>));
   EXPECT_EQ(alignof(S6), alignof(AlignedCharArrayUnion<S6>));
   EXPECT_EQ(alignof(D1), alignof(AlignedCharArrayUnion<D1>));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104786.353977.patch
Type: text/x-patch
Size: 1591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210623/3694c3de/attachment.bin>


More information about the llvm-commits mailing list