[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
Tue Jan 30 07:23:59 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/3] 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 43502bdcd1abd..05259b217cd1a 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 ff75df51aff07..8a98df32ce6d5 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/3] 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 05259b217cd1a..24fe1f3fe7607 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 8a98df32ce6d5..688860c035728 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;
};
>From c26507f31f3327a8644bc48d24cb5d15a3bcdec5 Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Tue, 30 Jan 2024 10:22:24 -0500
Subject: [PATCH 3/3] Flip bit-fields in 'struct kmp_depend_info' for
big-endian in test include file common.h.
---
.../test/tasking/hidden_helper_task/common.h | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/openmp/runtime/test/tasking/hidden_helper_task/common.h b/openmp/runtime/test/tasking/hidden_helper_task/common.h
index 402ecf3ed553c..ba57656cbac41 100644
--- a/openmp/runtime/test/tasking/hidden_helper_task/common.h
+++ b/openmp/runtime/test/tasking/hidden_helper_task/common.h
@@ -17,9 +17,21 @@ typedef struct kmp_depend_info {
union {
unsigned char flag;
struct {
- bool in : 1;
- bool out : 1;
- bool mtx : 1;
+#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;
More information about the Openmp-commits
mailing list