[1/2] sparc: Revert membar optimization that is not suitable for LEON5

Message ID 20240105071913.593978-2-cederman@gaisler.com
State Accepted
Headers
Series [1/2] sparc: Revert membar optimization that is not suitable for LEON5 |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Daniel Cederman Jan. 5, 2024, 7:19 a.m. UTC
  From: Andreas Larsson <andreas@gaisler.com>

LEON5 has a deeper write-buffer and hence stb is not enough to flush a
write out. For compatibility, use the default V8 approach for both
LEON3 and LEON5.

This reverts commit 49cc765db35a5a21cab2aece27a44983fa70b94b,
"sync.md (*membar_storeload_leon3): New insn."

gcc/ChangeLog:

	* config/sparc/sync.md (*membar_storeload_leon3): Remove
	(*membar_storeload): Enable for LEON
---
 gcc/config/sparc/sync.md | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
  

Comments

Eric Botcazou Jan. 8, 2024, 9:22 a.m. UTC | #1
> LEON5 has a deeper write-buffer and hence stb is not enough to flush a
> write out. For compatibility, use the default V8 approach for both
> LEON3 and LEON5.
> 
> This reverts commit 49cc765db35a5a21cab2aece27a44983fa70b94b,
> "sync.md (*membar_storeload_leon3): New insn."
> 
> gcc/ChangeLog:
> 
> 	* config/sparc/sync.md (*membar_storeload_leon3): Remove
> 	(*membar_storeload): Enable for LEON

OK.
  

Patch

diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 8808ed5bc14e..ac291420b8b9 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -64,19 +64,11 @@ 
   "stbar"
   [(set_attr "type" "multi")])
 
-;; For LEON3, STB has the effect of membar #StoreLoad.
-(define_insn "*membar_storeload_leon3"
-  [(set (match_operand:BLK 0 "" "")
-	(unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
-  "TARGET_LEON3"
-  "stb\t%%g0, [%%sp-1]"
-  [(set_attr "type" "store")])
-
 ;; For V8, LDSTUB has the effect of membar #StoreLoad.
 (define_insn "*membar_storeload"
   [(set (match_operand:BLK 0 "" "")
 	(unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
-  "TARGET_V8 && !TARGET_LEON3"
+  "TARGET_V8"
   "ldstub\t[%%sp-1], %%g0"
   [(set_attr "type" "multi")])