public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add mask to specify which LEON3 targets support CASA
@ 2015-06-23 12:22 Daniel Cederman
  2015-06-23 12:22 ` [PATCH 2/2] Add leon3r0 and leon3r0v7 CPU targets Daniel Cederman
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Daniel Cederman @ 2015-06-23 12:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: daniel, cederman, ebotcazou

Not all LEON3 support the CASA instruction. This patch provides a mask
that can be used to specify which LEON3 targets that support CASA.

gcc/ChangeLog:

2015-06-22  Daniel Cederman  <cederman@gaisler.com>

	* config/sparc/sparc.c (sparc_option_override): Mark CPU targets
	  leon3 and leon3v7 as supporting the CASA instruction
	* config/sparc/sparc.opt: Add mask specifying that the LEON3
          supports the CASA instruction (MASK_LEON3_CASA)
	* config/sparc/sync.md: Only generate CASA for V9 and targets
	  with the MASK_LEON3_CASA mask
---
 gcc/config/sparc/sparc.c   | 4 ++--
 gcc/config/sparc/sparc.opt | 3 +++
 gcc/config/sparc/sync.md   | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 995a769..205e3cb 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1280,8 +1280,8 @@ sparc_option_override (void)
     { "supersparc",	MASK_ISA, MASK_V8 },
     { "hypersparc",	MASK_ISA, MASK_V8|MASK_FPU },
     { "leon",		MASK_ISA, MASK_V8|MASK_LEON|MASK_FPU },
-    { "leon3",		MASK_ISA, MASK_V8|MASK_LEON3|MASK_FPU },
-    { "leon3v7",	MASK_ISA, MASK_LEON3|MASK_FPU },
+    { "leon3",		MASK_ISA, MASK_V8|MASK_LEON3|MASK_FPU|MASK_LEON_CASA },
+    { "leon3v7",	MASK_ISA, MASK_LEON3|MASK_FPU|MASK_LEON_CASA },
     { "sparclite",	MASK_ISA, MASK_SPARCLITE },
     /* The Fujitsu MB86930 is the original sparclite chip, with no FPU.  */
     { "f930",		MASK_ISA|MASK_FPU, MASK_SPARCLITE },
diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt
index 5c7f546..e6caa95 100644
--- a/gcc/config/sparc/sparc.opt
+++ b/gcc/config/sparc/sparc.opt
@@ -228,6 +228,9 @@ Mask(LEON)
 Mask(LEON3)
 ;; Generate code for LEON3
 
+Mask(LEON_CASA)
+;; Generate CAS instruction for LEON
+
 Mask(SPARCLITE)
 ;; Generate code for SPARClite
 
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 2fabff5..8e1baee 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -181,7 +181,7 @@
    (match_operand:SI 5 "const_int_operand" "")		;; is_weak
    (match_operand:SI 6 "const_int_operand" "")		;; mod_s
    (match_operand:SI 7 "const_int_operand" "")]		;; mod_f
-  "(TARGET_V9 || TARGET_LEON3)
+  "(TARGET_V9 || TARGET_LEON_CASA)
    && (<MODE>mode != DImode || TARGET_ARCH64 || TARGET_V8PLUS)"
 {
   sparc_expand_compare_and_swap (operands);
@@ -197,7 +197,7 @@
 	     [(match_operand:I48MODE 2 "register_operand" "")
 	      (match_operand:I48MODE 3 "register_operand" "")]
 	     UNSPECV_CAS))])]
-  "TARGET_V9 || TARGET_LEON3"
+  "TARGET_V9 || TARGET_LEON_CASA"
   "")
 
 (define_insn "*atomic_compare_and_swap<mode>_1"
@@ -220,7 +220,7 @@
 	  [(match_operand:SI 2 "register_operand" "r")
 	   (match_operand:SI 3 "register_operand" "0")]
 	  UNSPECV_CAS))]
-  "TARGET_LEON3"
+  "TARGET_LEON_CASA"
 {
   if (TARGET_SV_MODE)
     return "casa\t%1 0xb, %2, %0"; /* ASI for supervisor data space.  */
-- 
2.4.3

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH] Make muser-mode the default for LEON3
@ 2015-06-23 14:29 Daniel Cederman
  2015-06-26  7:59 ` Eric Botcazou
  0 siblings, 1 reply; 21+ messages in thread
From: Daniel Cederman @ 2015-06-23 14:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: daniel, cederman, ebotcazou, jakub, sebastian.huber

The muser-mode flag causes the CASA instruction for LEON3 to use the
user mode ASI. This is the correct behavior for almost all LEON3 targets.
For this reason it makes sense to make user mode the default.

gcc/ChangeLog:

2015-06-23  Daniel Cederman  <cederman@gaisler.com>

	* config/sparc/sparc.opt: Rename mask from USER_MODE to SV_MODE
	  and make it inverse to change default
	* config/sparc/sync.md: Only use supervisor ASI for CASA when in
	  supervisor mode
	* doc/invoke.texi: Document change of default
---
 gcc/config/sparc/sparc.opt | 4 ++--
 gcc/config/sparc/sync.md   | 6 +++---
 gcc/doc/invoke.texi        | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt
index 93d24a6..85bf0bd 100644
--- a/gcc/config/sparc/sparc.opt
+++ b/gcc/config/sparc/sparc.opt
@@ -114,8 +114,8 @@ Target
 Optimize tail call instructions in assembler and linker
 
 muser-mode
-Target Report Mask(USER_MODE)
-Do not generate code that can only run in supervisor mode
+Target Report InverseMask(SV_MODE)
+Do not generate code that can only run in supervisor mode (default)
 
 mcpu=
 Target RejectNegative Joined Var(sparc_cpu_and_features) Enum(sparc_processor_type) Init(PROCESSOR_V7)
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 7d00b10..2fabff5 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -222,10 +222,10 @@
 	  UNSPECV_CAS))]
   "TARGET_LEON3"
 {
-  if (TARGET_USER_MODE)
-    return "casa\t%1 0xa, %2, %0"; /* ASI for user data space.  */
-  else
+  if (TARGET_SV_MODE)
     return "casa\t%1 0xb, %2, %0"; /* ASI for supervisor data space.  */
+  else
+    return "casa\t%1 0xa, %2, %0"; /* ASI for user data space.  */
 }
   [(set_attr "type" "multi")])
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index b99ab1c..86b2a73 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -21305,8 +21305,8 @@ in a performance loss, especially for floating-point code.
 @opindex muser-mode
 @opindex mno-user-mode
 Do not generate code that can only run in supervisor mode.  This is relevant
-only for the @code{casa} instruction emitted for the LEON3 processor.  The
-default is @option{-mno-user-mode}.
+only for the @code{casa} instruction emitted for the LEON3 processor.  This
+is the default.
 
 @item -mno-faster-structs
 @itemx -mfaster-structs
-- 
2.4.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-07-03 12:07 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 12:22 [PATCH 1/2] Add mask to specify which LEON3 targets support CASA Daniel Cederman
2015-06-23 12:22 ` [PATCH 2/2] Add leon3r0 and leon3r0v7 CPU targets Daniel Cederman
2015-06-26  7:47   ` Eric Botcazou
2015-06-26 12:07     ` Daniel Cederman
2015-06-30  9:25       ` Eric Botcazou
2015-06-30 11:06         ` Eric Botcazou
2015-06-30 12:46         ` Daniel Cederman
2015-07-03 10:55           ` Eric Botcazou
2015-07-03 12:07             ` Daniel Cederman
2015-06-23 12:22 ` [PATCH] Use leon3 target for native LEON on Linux Daniel Cederman
2015-06-26  7:45   ` Eric Botcazou
2015-06-23 12:22 ` [PATCH] Make muser-mode the default for LEON3 Daniel Cederman
2015-06-23 12:34   ` Sebastian Huber
2015-06-23 12:38   ` Jakub Jelinek
2015-06-23 12:55     ` Daniel Cederman
2015-06-23 13:07       ` Jakub Jelinek
2015-06-23 14:10         ` Daniel Cederman
2015-06-23 14:29 Daniel Cederman
2015-06-26  7:59 ` Eric Botcazou
2015-06-26 12:06   ` Daniel Cederman
2015-06-30  9:50     ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).