Skip to content

Commit

Permalink
[OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in tes…
Browse files Browse the repository at this point in the history
…t cases (llvm#79895)

This patch flips bit-fields in `struct flags` for big-endian in test
cases to be consistent with the definition of the structure in libomp
`kmp.h`.

(cherry picked from commit 7a9b0e4)
  • Loading branch information
xingxue-ibm authored and llvmbot committed Feb 14, 2024
1 parent 831b9a5 commit 3e33697
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 16 deletions.
3 changes: 2 additions & 1 deletion openmp/runtime/src/kmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,8 @@ typedef struct kmp_dephash_entry kmp_dephash_entry_t;
#define KMP_DEP_MTX 0x4
#define KMP_DEP_SET 0x8
#define KMP_DEP_ALL 0x80
// Compiler sends us this info:
// Compiler sends us this info. Note: some test cases contain an explicit copy
// of this struct and should be in sync with any changes here.
typedef struct kmp_depend_info {
kmp_intptr_t base_addr;
size_t len;
Expand Down
21 changes: 15 additions & 6 deletions openmp/runtime/test/tasking/bug_nested_proxy_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
unsigned in : 1;
unsigned out : 1;
unsigned mtx : 1;
unsigned set : 1;
unsigned unused : 3;
unsigned all : 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;
Expand Down
21 changes: 15 additions & 6 deletions openmp/runtime/test/tasking/bug_proxy_task_dep_waiting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
unsigned in : 1;
unsigned out : 1;
unsigned mtx : 1;
unsigned set : 1;
unsigned unused : 3;
unsigned all : 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;
Expand Down
18 changes: 15 additions & 3 deletions openmp/runtime/test/tasking/hidden_helper_task/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3e33697

Please sign in to comment.