[Openmp-commits] [openmp] [OpenMP][AIX]Define struct kmp_base_tas_lock with the order of two members swapped for big-endian (PR #79188)

Xing Xue via Openmp-commits openmp-commits at lists.llvm.org
Wed Jan 24 08:05:33 PST 2024


================
@@ -120,8 +120,15 @@ extern void __kmp_validate_locks(void);
 
 struct kmp_base_tas_lock {
   // KMP_LOCK_FREE(tas) => unlocked; locked: (gtid+1) of owning thread
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && KMP_ARCH_PPC64
----------------
xingxue-ibm wrote:

I thought to use `KMP_ARCH_PPC64` to limit the scope. This issue may also affect s390x which I believe is also big-endian. I've changed to guard the order flipping with `#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __LP64__`. @iii-i please let me know if it does not work for s390x. The reason for guarding it with `__LP64__` is the original ordering works as designed in 32-bit mode both little- and big-endian. If these members are flipped for 32-bit big-endian, tags of a direct lock will take the second word while the address of the entry allocated from the indirect lock table will take the first word.

https://github.com/llvm/llvm-project/pull/79188


More information about the Openmp-commits mailing list