diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch')
| -rw-r--r-- | meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch b/meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch new file mode 100644 index 00000000..e554e660 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-13/0008-Fix-atomic-side-effects.-In-atomic_compare_and_swaps.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | From cd3db73d253df229054863e5f920e59e60b84c45 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mahesh Bodapati <mbodapat@xilinx.com> | ||
| 3 | Date: Thu, 12 Jan 2017 16:41:43 +0530 | ||
| 4 | Subject: [PATCH 08/54] Fix atomic side effects. In atomic_compare_and_swapsi, | ||
| 5 | add side effects to prevent incorrect assumptions during optimization. | ||
| 6 | Previously, the outputs were considered unused; this generated assembly code | ||
| 7 | with undefined side effects after invocation of the atomic. | ||
| 8 | |||
| 9 | Signed-off-by: Kirk Meyer <kirk.meyer@sencore.com> | ||
| 10 | Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> | ||
| 11 | |||
| 12 | Conflicts: | ||
| 13 | gcc/config/microblaze/microblaze.md | ||
| 14 | --- | ||
| 15 | gcc/config/microblaze/microblaze.md | 3 +++ | ||
| 16 | gcc/config/microblaze/sync.md | 21 +++++++++++++-------- | ||
| 17 | 2 files changed, 16 insertions(+), 8 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md | ||
| 20 | index 671667b537c..dfd7395432b 100644 | ||
| 21 | --- a/gcc/config/microblaze/microblaze.md | ||
| 22 | +++ b/gcc/config/microblaze/microblaze.md | ||
| 23 | @@ -43,6 +43,9 @@ | ||
| 24 | (UNSPEC_TLS 106) ;; jump table | ||
| 25 | (UNSPEC_SET_TEXT 107) ;; set text start | ||
| 26 | (UNSPEC_TEXT 108) ;; data text relative | ||
| 27 | + (UNSPECV_CAS_BOOL 201) ;; compare and swap (bool) | ||
| 28 | + (UNSPECV_CAS_VAL 202) ;; compare and swap (val) | ||
| 29 | + (UNSPECV_CAS_MEM 203) ;; compare and swap (mem) | ||
| 30 | ]) | ||
| 31 | |||
| 32 | (define_c_enum "unspec" [ | ||
| 33 | diff --git a/gcc/config/microblaze/sync.md b/gcc/config/microblaze/sync.md | ||
| 34 | index c84bac94101..587f852b3a0 100644 | ||
| 35 | --- a/gcc/config/microblaze/sync.md | ||
| 36 | +++ b/gcc/config/microblaze/sync.md | ||
| 37 | @@ -18,14 +18,19 @@ | ||
| 38 | ;; <http://www.gnu.org/licenses/>. | ||
| 39 | |||
| 40 | (define_insn "atomic_compare_and_swapsi" | ||
| 41 | - [(match_operand:SI 0 "register_operand" "=&d") ;; bool output | ||
| 42 | - (match_operand:SI 1 "register_operand" "=&d") ;; val output | ||
| 43 | - (match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory | ||
| 44 | - (match_operand:SI 3 "register_operand" "d") ;; expected value | ||
| 45 | - (match_operand:SI 4 "register_operand" "d") ;; desired value | ||
| 46 | - (match_operand:SI 5 "const_int_operand" "") ;; is_weak | ||
| 47 | - (match_operand:SI 6 "const_int_operand" "") ;; mod_s | ||
| 48 | - (match_operand:SI 7 "const_int_operand" "") ;; mod_f | ||
| 49 | + [(set (match_operand:SI 0 "register_operand" "=&d") ;; bool output | ||
| 50 | + (unspec_volatile:SI | ||
| 51 | + [(match_operand:SI 2 "nonimmediate_operand" "+Q") ;; memory | ||
| 52 | + (match_operand:SI 3 "register_operand" "d") ;; expected value | ||
| 53 | + (match_operand:SI 4 "register_operand" "d")] ;; desired value | ||
| 54 | + UNSPECV_CAS_BOOL)) | ||
| 55 | + (set (match_operand:SI 1 "register_operand" "=&d") ;; val output | ||
| 56 | + (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_VAL)) | ||
| 57 | + (set (match_dup 2) | ||
| 58 | + (unspec_volatile:SI [(const_int 0)] UNSPECV_CAS_MEM)) | ||
| 59 | + (match_operand:SI 5 "const_int_operand" "") ;; is_weak | ||
| 60 | + (match_operand:SI 6 "const_int_operand" "") ;; mod_s | ||
| 61 | + (match_operand:SI 7 "const_int_operand" "") ;; mod_f | ||
| 62 | (clobber (match_scratch:SI 8 "=&d"))] | ||
| 63 | "" | ||
| 64 | { | ||
| 65 | -- | ||
| 66 | 2.34.1 | ||
| 67 | |||
