[Openmp-commits] [openmp] [OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in test cases (PR #79895)

Xing Xue via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 29 12:53:01 PST 2024


https://github.com/xingxue-ibm updated https://github.com/llvm/llvm-project/pull/79895

>From 60e8aa588fb1c335b18300e9eaaae282a4e38dfd Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Mon, 29 Jan 2024 14:58:23 -0500
Subject: [PATCH 1/2] Flip bitfields of "struct flags" for big-endian in test
 cases to match the runtime definition in kmp.h.

---
 openmp/runtime/test/tasking/bug_nested_proxy_task.c      | 9 +++++++++
 openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c
index 43502bdcd1abd10..05259b217cd1a2b 100644
--- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c
+++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c
@@ -50,12 +50,21 @@ typedef struct kmp_depend_info {
      union {
         kmp_uint8 flag; // flag as an unsigned char
         struct { // flag as a set of 8 bits
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+            unsigned all : 1;
+            unsigned unused : 3;
+            unsigned set : 1;
+            unsigned mtx : 1;
+            unsigned out : 1;
+            unsigned in : 1;
+#else
             unsigned in : 1;
             unsigned out : 1;
             unsigned mtx : 1;
             unsigned set : 1;
             unsigned unused : 3;
             unsigned all : 1;
+#endif
         } flags;
      };
 } kmp_depend_info_t;
diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
index ff75df51aff077c..8a98df32ce6d540 100644
--- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
+++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
@@ -47,12 +47,21 @@ typedef struct kmp_depend_info {
      union {
         kmp_uint8 flag; // flag as an unsigned char
         struct { // flag as a set of 8 bits
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+            unsigned all : 1;
+            unsigned unused : 3;
+            unsigned set : 1;
+            unsigned mtx : 1;
+            unsigned out : 1;
+            unsigned in : 1;
+#else
             unsigned in : 1;
             unsigned out : 1;
             unsigned mtx : 1;
             unsigned set : 1;
             unsigned unused : 3;
             unsigned all : 1;
+#endif
         } flags;
     };
 } kmp_depend_info_t;

>From 1053a58793f18deea7e5e66b33a8794a50826668 Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Mon, 29 Jan 2024 15:52:04 -0500
Subject: [PATCH 2/2] git-clang-format changes.

---
 .../test/tasking/bug_nested_proxy_task.c      | 24 +++++++++----------
 .../test/tasking/bug_proxy_task_dep_waiting.c | 24 +++++++++----------
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/openmp/runtime/test/tasking/bug_nested_proxy_task.c b/openmp/runtime/test/tasking/bug_nested_proxy_task.c
index 05259b217cd1a2b..24fe1f3fe7607ca 100644
--- a/openmp/runtime/test/tasking/bug_nested_proxy_task.c
+++ b/openmp/runtime/test/tasking/bug_nested_proxy_task.c
@@ -51,19 +51,19 @@ typedef struct kmp_depend_info {
         kmp_uint8 flag; // flag as an unsigned char
         struct { // flag as a set of 8 bits
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-            unsigned all : 1;
-            unsigned unused : 3;
-            unsigned set : 1;
-            unsigned mtx : 1;
-            unsigned out : 1;
-            unsigned in : 1;
+          unsigned all : 1;
+          unsigned unused : 3;
+          unsigned set : 1;
+          unsigned mtx : 1;
+          unsigned out : 1;
+          unsigned in : 1;
 #else
-            unsigned in : 1;
-            unsigned out : 1;
-            unsigned mtx : 1;
-            unsigned set : 1;
-            unsigned unused : 3;
-            unsigned all : 1;
+          unsigned in : 1;
+          unsigned out : 1;
+          unsigned mtx : 1;
+          unsigned set : 1;
+          unsigned unused : 3;
+          unsigned all : 1;
 #endif
         } flags;
      };
diff --git a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
index 8a98df32ce6d540..688860c035728f7 100644
--- a/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
+++ b/openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
@@ -48,19 +48,19 @@ typedef struct kmp_depend_info {
         kmp_uint8 flag; // flag as an unsigned char
         struct { // flag as a set of 8 bits
 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-            unsigned all : 1;
-            unsigned unused : 3;
-            unsigned set : 1;
-            unsigned mtx : 1;
-            unsigned out : 1;
-            unsigned in : 1;
+          unsigned all : 1;
+          unsigned unused : 3;
+          unsigned set : 1;
+          unsigned mtx : 1;
+          unsigned out : 1;
+          unsigned in : 1;
 #else
-            unsigned in : 1;
-            unsigned out : 1;
-            unsigned mtx : 1;
-            unsigned set : 1;
-            unsigned unused : 3;
-            unsigned all : 1;
+          unsigned in : 1;
+          unsigned out : 1;
+          unsigned mtx : 1;
+          unsigned set : 1;
+          unsigned unused : 3;
+          unsigned all : 1;
 #endif
         } flags;
     };



More information about the Openmp-commits mailing list