Re: [PATCH] sparc,rtems: add __FIX_LEON3FT_TN0018 for affected targets

2021-01-19 Thread Daniel Hellstrom
  


On 2021-01-19 10:52, Eric Botcazou wrote:

 * config/sparch/rtemself.h (TARGET_OS_CPP_BUILTINS): Add built-in define 
__FIX_LEON3FT_TN0018.

OK for whichever branch(es) you deem appropriate.


GCC-10, GCC-11 and master.

Thanks,
Daniel



[PATCH] sparc,rtems: add __FIX_LEON3FT_TN0018 for affected targets

2021-01-19 Thread Daniel Hellstrom
Enable a define FIX_LEON3FT_TN0018 for the LEON3FT targets affected
by the GRLIB-TN-0018 errata described here:
  https://www.gaisler.com/notes


gcc/

* config/sparch/rtemself.h (TARGET_OS_CPP_BUILTINS): Add built-in define 
__FIX_LEON3FT_TN0018. 

---
 gcc/config/sparc/rtemself.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/config/sparc/rtemself.h b/gcc/config/sparc/rtemself.h
index 6570590..ddec98c 100644
--- a/gcc/config/sparc/rtemself.h
+++ b/gcc/config/sparc/rtemself.h
@@ -33,6 +33,8 @@
builtin_assert ("system=rtems");\
if (sparc_fix_b2bst)\
  builtin_define ("__FIX_LEON3FT_B2BST"); \
+   if (sparc_fix_gr712rc || sparc_fix_ut700 || sparc_fix_ut699) \
+ builtin_define ("__FIX_LEON3FT_TN0018"); \
 }  \
   while (0)
 
-- 
2.7.4



Re: [wwwdocs] GCC-7.3 changes: Add note about LEON3FT erratum workaround

2018-04-09 Thread Daniel Hellstrom

On 2018-04-07 22:08, Gerald Pfeifer wrote:

On Thu, 1 Feb 2018, Daniel Hellstrom wrote:

I would like to commit the following comment about LEON3-FT errata now
available in GCC-7.3.

Thanks, I have now committed it.

Apparently the ultimate URL is the one below (which I applied for
now)?

Gerald


I received feedback from the webmaster that the preferred link is 
"http://www.gaisler.com/notes; so I updated it just be pushing.


Regards,
Daniel



Index: changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.101
diff -u -r1.101 changes.html
--- changes.html2 Apr 2018 15:22:38 -   1.101
+++ changes.html7 Apr 2018 20:05:52 -
@@ -1324,7 +1324,8 @@
  
  SPARC


-Work arounds for the four http://www.gaisler.com/notes;>
+Work arounds for the four https://www.gaisler.com/index.php/information/app-tech-notes;>
  LEON3FT errata GRLIB-TN-0010..0013 have been added. Relevant 
errata
  are activated by the target specific -mfix-ut699,
  -mfix-ut700 and -mfix-gr712rc switches.




Re: [wwwdocs] GCC-7.3 changes: Add note about LEON3FT erratum workaround

2018-02-01 Thread Daniel Hellstrom

On 2018-01-31 00:27, Eric Botcazou wrote:

I would like to commit the following comment about LEON3-FT errata now
available in GCC-7.3.

Fine with me, thanks.

Thanks, I have now committed it.


Re: [wwwdocs] GCC-7.3 changes: Add note about LEON3FT erratum workaround

2018-01-26 Thread Daniel Hellstrom

Sebastian, thanks for the feedback! I have updated the patch accordingly:

Index: htdocs/gcc-7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.98
diff -u -r1.98 changes.html
--- htdocs/gcc-7/changes.html    23 Jan 2018 06:41:52 -    1.98
+++ htdocs/gcc-7/changes.html    26 Jan 2018 12:24:49 -
@@ -1320,6 +1320,16 @@
 are not listed here).

 

+Target Specific Changes
+
+SPARC
+  
+    Work arounds for the four href="http://www.gaisler.com/index.php/information/app-tech-notes;>
+    LEON3FT errata GRLIB-TN-0010..0013 have been added. 
Relevant errata

+    are activated by the target specific -mfix-ut699,
+    -mfix-ut700 and -mfix-gr712rc 
switches.

+  
+
 Operating Systems

 RTEMS


On 2018-01-26 13:09, Daniel Hellstrom wrote:

Hi,

I would like to commit the following comment about LEON3-FT errata now 
available in GCC-7.3.


Thanks,
Daniel


Index: htdocs/gcc-7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.98
diff -u -r1.98 changes.html
--- htdocs/gcc-7/changes.html    23 Jan 2018 06:41:52 - 1.98
+++ htdocs/gcc-7/changes.html    26 Jan 2018 12:05:33 -
@@ -1327,5 +1327,15 @@
  Support has been added for Epiphany target.
    

+Target Specific Changes
+
+SPARC
+  
+    Work arounds for the four LEON3FT errata
+    GRLIB-TN-0010..0013 have been added. Relevant errata are 
activated

+    by the target specific -mfix-ut699,
+    -mfix-ut700 and -mfix-gr712rc 
switches.

+  
+
 
 




[wwwdocs] GCC-7.3 changes: Add note about LEON3FT erratum workaround

2018-01-26 Thread Daniel Hellstrom

Hi,

I would like to commit the following comment about LEON3-FT errata now 
available in GCC-7.3.


Thanks,
Daniel


Index: htdocs/gcc-7/changes.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-7/changes.html,v
retrieving revision 1.98
diff -u -r1.98 changes.html
--- htdocs/gcc-7/changes.html    23 Jan 2018 06:41:52 -    1.98
+++ htdocs/gcc-7/changes.html    26 Jan 2018 12:05:33 -
@@ -1327,5 +1327,15 @@
  Support has been added for Epiphany target.
    

+Target Specific Changes
+
+SPARC
+  
+    Work arounds for the four LEON3FT errata
+    GRLIB-TN-0010..0013 have been added. Relevant errata are activated
+    by the target specific -mfix-ut699,
+    -mfix-ut700 and -mfix-gr712rc switches.
+  
+
 
 


Re: [PATCH] Update RTEMS multilib for SPARC

2015-09-28 Thread Daniel Hellstrom

On 09/28/2015 03:49 PM, Sebastian Huber wrote:



On 28/09/15 15:39, Daniel Hellstrom wrote:

On 09/28/2015 03:37 PM, Sebastian Huber wrote:



On 28/09/15 15:20, Daniel Hellstrom wrote:

Which multilibs do we have after this change?


.;
soft;@msoft-float
v8;@mcpu=v8
leon3;@mcpu=leon3
leon3v7;@mcpu=leon3v7
leon;@mcpu=leon
leon/ut699;@mcpu=leon@mfix-ut699
leon/at697f;@mcpu=leon@mfix-at697f
soft/v8;@msoft-float@mcpu=v8
soft/leon3;@msoft-float@mcpu=leon3
soft/leon3v7;@msoft-float@mcpu=leon3v7
soft/leon;@msoft-float@mcpu=leon
soft/leon/ut699;@msoft-float@mcpu=leon@mfix-ut699
soft/leon/at697f;@msoft-float@mcpu=leon@mfix-at697f 


Ok, looks good. The change log entry should mention that you add -mcpu=leon 
multilibs as well.


Ooh I forgot to mention that, I will add it to the comment. Otherwise is this okay to commit for 4.9, 5 and master now? 


Since this is a RTEMS only change, I think this is all right. Just make sure 
the change log entry format is all right. The statements end all with a '.' for 
example.


Thanks for the review, updated the comments and committed it.

Daniel



[PATCH] Update RTEMS multilib for SPARC

2015-09-28 Thread Daniel Hellstrom
Now that muser-mode is default the multilib definitions does not require to
specify that switch any more. Add UT699 to multilib after recent patches. Add
AT697F multilib since there are many LEON2 users running RTEMS.

To gcc/ChangeLog:

gcc/
* config/sparc/t-rtems: Remove -muser-mode, add ut699 and at697f
---
 gcc/config/sparc/t-rtems |   25 +++--
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index adb6dcb..6f7cc6f 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,15 +17,20 @@
 # .
 #
 
-MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3/mcpu=leon3v7 muser-mode
-MULTILIB_DIRNAMES = soft v8 leon3 leon3v7 user-mode
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3/mcpu=leon3v7/mcpu=leon \
+  mfix-ut699/mfix-at697f
+MULTILIB_DIRNAMES = soft v8 leon3 leon3v7 leon ut699 at697f
 MULTILIB_MATCHES = msoft-float=mno-fpu
 
-MULTILIB_EXCEPTIONS = muser-mode
-MULTILIB_EXCEPTIONS += mcpu=leon3
-MULTILIB_EXCEPTIONS += mcpu=leon3v7
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3v7
-MULTILIB_EXCEPTIONS += msoft-float/muser-mode
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/muser-mode
-MULTILIB_EXCEPTIONS += mcpu=v8/muser-mode
+MULTILIB_EXCEPTIONS = mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3*/mfix-ut699
+MULTILIB_EXCEPTIONS += mcpu=v8/mfix-ut699
+MULTILIB_EXCEPTIONS += mcpu=leon3*/mfix-ut699
+MULTILIB_EXCEPTIONS += mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3*/mfix-at697f
+MULTILIB_EXCEPTIONS += mcpu=v8/mfix-at697f
+MULTILIB_EXCEPTIONS += mcpu=leon3*/mfix-at697f
-- 
1.7.0.4



Re: [PATCH] Update RTEMS multilib for SPARC

2015-09-28 Thread Daniel Hellstrom

On 09/28/2015 02:36 PM, Sebastian Huber wrote:



On 28/09/15 14:33, Sebastian Huber wrote:

On 28/09/15 14:13, Daniel Hellstrom wrote:

Now that muser-mode is default the multilib definitions does not require to
specify that switch any more. Add UT699 to multilib after recent patches. Add
AT697F multilib since there are many LEON2 users running RTEMS.

To gcc/ChangeLog:

gcc/
* config/sparc/t-rtems: Remove -muser-mode, add ut699 and at697f
---
  gcc/config/sparc/t-rtems |   25 +++--
  1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index adb6dcb..6f7cc6f 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,15 +17,20 @@
  # <http://www.gnu.org/licenses/>.
  #
  -MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3/mcpu=leon3v7 muser-mode
-MULTILIB_DIRNAMES = soft v8 leon3 leon3v7 user-mode
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3/mcpu=leon3v7/mcpu=leon \
+   mfix-ut699/mfix-at697f
+MULTILIB_DIRNAMES = soft v8 leon3 leon3v7 leon ut699 at697f
  MULTILIB_MATCHES = msoft-float=mno-fpu
  -MULTILIB_EXCEPTIONS = muser-mode
-MULTILIB_EXCEPTIONS += mcpu=leon3
-MULTILIB_EXCEPTIONS += mcpu=leon3v7
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3v7
-MULTILIB_EXCEPTIONS += msoft-float/muser-mode
-MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/muser-mode
-MULTILIB_EXCEPTIONS += mcpu=v8/muser-mode
+MULTILIB_EXCEPTIONS = mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/mfix-ut699
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3*/mfix-ut699
+MULTILIB_EXCEPTIONS += mcpu=v8/mfix-ut699
+MULTILIB_EXCEPTIONS += mcpu=leon3*/mfix-ut699
+MULTILIB_EXCEPTIONS += mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/mfix-at697f
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3*/mfix-at697f
+MULTILIB_EXCEPTIONS += mcpu=v8/mfix-at697f
+MULTILIB_EXCEPTIONS += mcpu=leon3*/mfix-at697f


Why do we need so many variants with fixes for the UT699 (32-bit Fault-Tolerant LEON3FT SPARC V8 Processor) and the AT697F (LEON2-FT)? Why do we have no leon3 variant without fixes for the UT699 
and AT697F? Which multilib do you suggest now for the NGMP/GR740?


NGMP/GR740 is still the same ("mcpu=leon3" or "mcpu=leon3 msoft-float") but the muser-mode is not longer needed since it is default. This will be easier than having to deal with muser-mode all the 
time and if that is forgotten during link the v7 multilib will be selected wrongly.


Two variants for UT699 (hard-float and soft-float) and for AT697F (hard-float and soft-float). We could remove AT697 soft-float since the mfix-at697f only fixes float instructions at the moment but I 
though it would be easier and MULTILIB_REUSE didn't work I'm guessing since there is a = sign in the target switch.




Sorry, for these stupid questions. Maybe we should change this file to use 
MULTILIB_REQUIRED, like on rs6000 and arm.

Which multilibs do we have after this change?


.;
soft;@msoft-float
v8;@mcpu=v8
leon3;@mcpu=leon3
leon3v7;@mcpu=leon3v7
leon;@mcpu=leon
leon/ut699;@mcpu=leon@mfix-ut699
leon/at697f;@mcpu=leon@mfix-at697f
soft/v8;@msoft-float@mcpu=v8
soft/leon3;@msoft-float@mcpu=leon3
soft/leon3v7;@msoft-float@mcpu=leon3v7
soft/leon;@msoft-float@mcpu=leon
soft/leon/ut699;@msoft-float@mcpu=leon@mfix-ut699
soft/leon/at697f;@msoft-float@mcpu=leon@mfix-at697f


Regards,
Daniel


Re: [PATCH] Update RTEMS multilib for SPARC

2015-09-28 Thread Daniel Hellstrom

On 09/28/2015 03:37 PM, Sebastian Huber wrote:



On 28/09/15 15:20, Daniel Hellstrom wrote:

Which multilibs do we have after this change?


.;
soft;@msoft-float
v8;@mcpu=v8
leon3;@mcpu=leon3
leon3v7;@mcpu=leon3v7
leon;@mcpu=leon
leon/ut699;@mcpu=leon@mfix-ut699
leon/at697f;@mcpu=leon@mfix-at697f
soft/v8;@msoft-float@mcpu=v8
soft/leon3;@msoft-float@mcpu=leon3
soft/leon3v7;@msoft-float@mcpu=leon3v7
soft/leon;@msoft-float@mcpu=leon
soft/leon/ut699;@msoft-float@mcpu=leon@mfix-ut699
soft/leon/at697f;@msoft-float@mcpu=leon@mfix-at697f 


Ok, looks good. The change log entry should mention that you add -mcpu=leon 
multilibs as well.


Ooh I forgot to mention that, I will add it to the comment. Otherwise is this 
okay to commit for 4.9, 5 and master now?



It would be nice if you can update the RTEMS documentation accordingly similar 
to ARM and PowerPC, e.g.

https://docs.rtems.org/doc-current/share/rtems/html/cpu_supplement/ARM-Specific-Information-Multilibs.html#ARM-Specific-Information-Multilibs


I agree. I was just thinking were to document this, thanks!

Daniel



Re: [PATCH] RTEMS: select SPARC multilibs

2014-11-07 Thread Daniel Hellstrom

Hi,

Thanks for review and testing! Then I will apply it.

Thanks for bringing up the sparc-elf. I think we would want the LEON3 in the 
t-elf, however I have to verify the LEON newlib C state and mflat etc. before 
activating that.

DanielH

On 11/07/2014 01:25 PM, Joel Sherrill wrote:


On November 7, 2014 2:40:43 AM CST, Eric Botcazou ebotca...@adacore.com wrote:

I think this would be good for 4.8, 4.9 and trunk.

2014-11-06  Daniel Hellstrom  dan...@gaisler.com

* config.gcc (sparc-*-rtems*): Clean away unused t-elf
* config/sparc/t-rtems: Add leon3v7 and muser-mode multilibs

OK everywhere as far as I'm concerned but the RTEMS folks have the
final say.

Fine with me.

Does spatc-elf need a refresh on its multilibs?

--joel




[PATCH] RTEMS: select SPARC multilibs

2014-11-06 Thread Daniel Hellstrom
Recent support for mcpu=leon3v7 and muser-mode were added
to GCC. Update the RTEMS multilib for sparc to the
following combinations:

v7- ./
leon3 muser-mode  - leon3/user-mode/
leon3v7 muser-mode- leon3v7/user-mode/
v8- v8/
v7 soft-float - soft/
leon3 soft-float muser-mode   - soft/leon3/user-mode/
leon3v7 soft-float muser-mode - soft/leon3v7/user-mode/
v8 soft-float - soft/v8/

I think this would be good for 4.8, 4.9 and trunk.

2014-11-06  Daniel Hellstrom  dan...@gaisler.com

* config.gcc (sparc-*-rtems*): Clean away unused t-elf
* config/sparc/t-rtems: Add leon3v7 and muser-mode multilibs
---
 gcc/config.gcc   |2 +-
 gcc/config/sparc/t-rtems |   13 +++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9d3fa57..39cd227 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2662,7 +2662,7 @@ sparc-*-elf*)
;;
 sparc-*-rtems*)
tm_file=${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h 
sparc/rtemself.h rtems.h newlib-stdint.h
-   tmake_file=${tmake_file} sparc/t-sparc sparc/t-elf sparc/t-rtems
+   tmake_file=${tmake_file} sparc/t-sparc sparc/t-rtems
;;
 sparc-*-linux*)
tm_file=${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h 
glibc-stdint.h sparc/tso.h
diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index 86a2302..ae7a33a 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,6 +17,15 @@
 # http://www.gnu.org/licenses/.
 #
 
-MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3
-MULTILIB_DIRNAMES = soft v8 leon3
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3/mcpu=leon3v7 muser-mode
+MULTILIB_DIRNAMES = soft v8 leon3 leon3v7 user-mode
 MULTILIB_MATCHES = msoft-float=mno-fpu
+
+MULTILIB_EXCEPTIONS = muser-mode
+MULTILIB_EXCEPTIONS += mcpu=leon3
+MULTILIB_EXCEPTIONS += mcpu=leon3v7
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=leon3v7
+MULTILIB_EXCEPTIONS += msoft-float/muser-mode
+MULTILIB_EXCEPTIONS += msoft-float/mcpu=v8/muser-mode
+MULTILIB_EXCEPTIONS += mcpu=v8/muser-mode
-- 
1.7.0.4



[committed] MAINTAINERS: add myself to write-after-approval list.

2014-10-24 Thread Daniel Hellstrom

2014-10-24  Daniel Hellstrom  dan...@gaisler.com

* MAINTAINERS (write-after-approval): Add myself.

Index: MAINTAINERS
===
--- MAINTAINERS(revision 216624)
+++ MAINTAINERS(working copy)
@@ -408,6 +408,7 @@
 Pat Haugenpthau...@us.ibm.com
 Mark Heffernanmeh...@google.com
 George Helffrichgeo...@gcc.gnu.org
+Daniel Hellstromdan...@gaisler.com
 Fergus Hendersonf...@cs.mu.oz.au
 Stuart Hendersonshend...@gcc.gnu.org
 Matthew Hillerhil...@redhat.com



Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-07 Thread Daniel Hellstrom

On 10/06/2014 06:57 PM, Eric Botcazou wrote:

I posted it with v2 in the subject. I have now attached it.

There is a pasto in the v2:

@@ -1764,6 +1772,12 @@ extern int sparc_indent_opcode;
  #define AS_LEON_FLAG -Av8
  #endif
  
+#ifdef HAVE_AS_LEONV7

+#define AS_LEONV7_FLAG -Aleon
+#else
+#define AS_LEONV7_FLAG -Av7
+#endif
+
  /* We use gcc _mcount for profiling.  */
  #define NO_PROFILE_COUNTERS 0
  


I think you would be better off adding a line to the arms of the existing code

#ifdef HAVE_AS_LEON
#define AS_LEON_FLAG -Aleon
#else
#define AS_LEON_FLAG -Av8
#endif

rather than duplicating it.


You're right. I have attached an updated patch. The new code becomes:

 #ifdef HAVE_AS_LEON
 #define AS_LEON_FLAG -Aleon
+#define AS_LEONV7_FLAG -Aleon
 #else
 #define AS_LEON_FLAG -Av8
+#define AS_LEONV7_FLAG -Av7
 #endif

Thanks!
From bfecb09e9402c9bd55373a7eb08ce6e2b244729e Mon Sep 17 00:00:00 2001
From: Daniel Hellstrom dan...@gaisler.com
Date: Wed, 20 Aug 2014 10:53:22 +0100
Subject: [PATCH v3] SPARC: add mcpu=leon3v7 target

The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 -
 gcc/config/sparc/leon.md  |   14 +++---
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 +++
 gcc/config/sparc/sparc.h  |   40 +---
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 +++
 gcc/doc/invoke.texi   |   16 
 8 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
 	*-leon[3-9]*)
 	  with_cpu=leon3
 	  ;;
+	*-leon[3-9]v7*)
+	  with_cpu=leon3v7
+	  ;;
 	*)
 	  with_cpu=`echo ${target} | sed 's/-.*$//'`
 	  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
 			case ${val} in
 			 | sparc | sparcv9 | sparc64 \
 			| v7 | cypress \
-			| v8 | supersparc | hypersparc | leon | leon3 \
+			| v8 | supersparc | hypersparc | leon | leon3 | leon3v7 \
 			| sparclite | f930 | f934 | sparclite86x \
 			| sparclet | tsc701 \
 			| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
   leon_memory*2)
 
 (define_insn_reservation leon_store 2
-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
   leon_memory*2)
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit grfpu_ds grfpu)
 
 (define_insn_reservation leon_fp_alu 4
-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
   grfpu_alu, nothing*3)
 
 (define_insn_reservation leon_fp_divs 16
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
   grfpu_ds*14, nothing*2)
 
 (define_insn_reservation leon_fp_divd 17
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
   grfpu_ds*15, nothing*2)
 
 (define_insn_reservation leon_fp_sqrts 24
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
   grfpu_ds*22, nothing*2)
 
 (define_insn_reservation leon_fp_sqrtd 25
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrtd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrtd))
   grfpu_ds*23, nothing*2)
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc

Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-07 Thread Daniel Hellstrom

On 10/07/2014 09:26 AM, Eric Botcazou wrote:

You're right. I have attached an updated patch. The new code becomes:

   #ifdef HAVE_AS_LEON
   #define AS_LEON_FLAG -Aleon
+#define AS_LEONV7_FLAG -Aleon
   #else
   #define AS_LEON_FLAG -Av8
+#define AS_LEONV7_FLAG -Av7
   #endif

The patch is OK for all active branches (trunk, 4.9 and 4.8), modulo nits in
the ChangeLog entry: capital letter at the beginning and period at the end of
every sentence.

* config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor.
* doc/invoke.texi (SPARC options): Add mcpu=leon3v7 comment.
* config/sparc/leon.md (leon3_load, leon_store, leon_fp_*): Handle
leon3v7 as leon3.
* config/sparc/sparc-opts.h (enum processor_type): Add LEON3V7.
* config/sparc/sparc.c (sparc_option_override): Add leon3v7 support.
* config/sparc/sparc.h (TARGET_CPU_leon3v7): New define.
* config/sparc/sparc.md (cpu): Add leon3v7.
* config/sparc/sparc.opt (enum processor_type): Add leon3v7.


Ok, I will update that. Is there a way of generating the comments automatically?


I assume that you have applied for write access so you'll be able to install
it yourself.  Otherwise let me know if I can lend a hand.


Thanks, I'll let you know. I just applied.

Daniel


Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-07 Thread Daniel Hellstrom

On 10/07/2014 11:07 AM, Eric Botcazou wrote:

Ok, I will update that. Is there a way of generating the comments
automatically?

Do you mean the ChangeLog?  If so, contrib/mklog will generate a skeleton but
you'll still need to write the decription sentences.


Perfect, thanks!


Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-06 Thread Daniel Hellstrom

On 10/06/2014 10:40 AM, Eric Botcazou wrote:

I have sent an updated patch just now. In case -Aleon does not exist it
should select -Av7 instead of -Av8.

No patch was attached to this message though.


I posted it with v2 in the subject. I have now attached it.


Yes, we have. Just verified that with the FSF. It would be a nice for us to
have write access to the sparc parts.

OK, but the granularity is limited so you'll have write access to the entire
SVN repository of GCC.  You'll have Write after approval status so you'll
still need to post patches on gcc-patches@ and wait for someone (usually me
for SPARC) to approve them before installing them.

Everything is explained on http://gcc.gnu.org/svnwrite.html, including how to
request write access (you can mention me as the sponsor).


Thanks, I will check it out.

Daniel
From be3f52f6daaa15aeb52eba1eace3e4f01e8f9f53 Mon Sep 17 00:00:00 2001
From: Daniel Hellstrom dan...@gaisler.com
Date: Wed, 20 Aug 2014 10:53:22 +0100
Subject: [PATCH v2] SPARC: add mcpu=leon3v7 target

The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 +++-
 gcc/config/sparc/leon.md  |   14 ++--
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 ++
 gcc/config/sparc/sparc.h  |   44 +++--
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 ++
 gcc/doc/invoke.texi   |   16 +++---
 8 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
 	*-leon[3-9]*)
 	  with_cpu=leon3
 	  ;;
+	*-leon[3-9]v7*)
+	  with_cpu=leon3v7
+	  ;;
 	*)
 	  with_cpu=`echo ${target} | sed 's/-.*$//'`
 	  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
 			case ${val} in
 			 | sparc | sparcv9 | sparc64 \
 			| v7 | cypress \
-			| v8 | supersparc | hypersparc | leon | leon3 \
+			| v8 | supersparc | hypersparc | leon | leon3 | leon3v7 \
 			| sparclite | f930 | f934 | sparclite86x \
 			| sparclet | tsc701 \
 			| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
   leon_memory*2)
 
 (define_insn_reservation leon_store 2
-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
   leon_memory*2)
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit grfpu_ds grfpu)
 
 (define_insn_reservation leon_fp_alu 4
-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
   grfpu_alu, nothing*3)
 
 (define_insn_reservation leon_fp_divs 16
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
   grfpu_ds*14, nothing*2)
 
 (define_insn_reservation leon_fp_divd 17
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
   grfpu_ds*15, nothing*2)
 
 (define_insn_reservation leon_fp_sqrts 24
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
   grfpu_ds*22, nothing*2)
 
 (define_insn_reservation leon_fp_sqrtd 25
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrtd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrtd))
   grfpu_ds*23, nothing*2)
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc/sparc-opts.h

[PATCH v2] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom
The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 +++-
 gcc/config/sparc/leon.md  |   14 ++--
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 ++
 gcc/config/sparc/sparc.h  |   44 +++--
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 ++
 gcc/doc/invoke.texi   |   16 +++---
 8 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
*-leon[3-9]*)
  with_cpu=leon3
  ;;
+   *-leon[3-9]v7*)
+ with_cpu=leon3v7
+ ;;
*)
  with_cpu=`echo ${target} | sed 's/-.*$//'`
  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
case ${val} in
 | sparc | sparcv9 | sparc64 \
| v7 | cypress \
-   | v8 | supersparc | hypersparc | leon | leon3 \
+   | v8 | supersparc | hypersparc | leon | leon3 | leon3v7 
\
| sparclite | f930 | f934 | sparclite86x \
| sparclet | tsc701 \
| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
   leon_memory*2)
 
 (define_insn_reservation leon_store 2
-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
   leon_memory*2)
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit grfpu_ds grfpu)
 
 (define_insn_reservation leon_fp_alu 4
-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
   grfpu_alu, nothing*3)
 
 (define_insn_reservation leon_fp_divs 16
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
   grfpu_ds*14, nothing*2)
 
 (define_insn_reservation leon_fp_divd 17
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
   grfpu_ds*15, nothing*2)
 
 (define_insn_reservation leon_fp_sqrts 24
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
   grfpu_ds*22, nothing*2)
 
 (define_insn_reservation leon_fp_sqrtd 25
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrtd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrtd))
   grfpu_ds*23, nothing*2)
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc/sparc-opts.h
+++ b/gcc/config/sparc/sparc-opts.h
@@ -31,6 +31,7 @@ enum processor_type {
   PROCESSOR_HYPERSPARC,
   PROCESSOR_LEON,
   PROCESSOR_LEON3,
+  PROCESSOR_LEON3V7,
   PROCESSOR_SPARCLITE,
   PROCESSOR_F930,
   PROCESSOR_F934,
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e9b2bcf..7f3c43e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1125,6 +1125,7 @@ sparc_option_override (void)
 { TARGET_CPU_hypersparc, PROCESSOR_HYPERSPARC },
 { TARGET_CPU_leon, PROCESSOR_LEON },
 { TARGET_CPU_leon3, PROCESSOR_LEON3 },
+{ TARGET_CPU_leon3v7, PROCESSOR_LEON3V7 },
 { TARGET_CPU_sparclite, PROCESSOR_F930 },
 { TARGET_CPU_sparclite86x, PROCESSOR_SPARCLITE86X },
 { TARGET_CPU_sparclet, PROCESSOR_TSC701 },
@@ -1153,6 +1154,7 @@ sparc_option_override (void)

Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-10-03 Thread Daniel Hellstrom

Hi,


On 10/02/2014 11:22 PM, Eric Botcazou wrote:

[Sorry for the long delay]


The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7 target. This
is also a problem for binaries aiming to be compatible with all LEON3/4
processors.

  * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
  * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
  * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
handle leon3v7 as leon3
  * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
  * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
  * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
  * config/sparc/sparc.md (cpu): add leon3v7
  * config/sparc/sparc.opt (enum processor_type): Add leon3v7

OK for all branches (it should apply everywhere I think).


I have sent an updated patch just now. In case -Aleon does not exist it should 
select -Av7 instead of -Av8.


I don't remember if I already asked... does Aeroflex/Gaisler have a copyright
assignment on file for GCC?  If so, do you also want to have SVN write access?

Yes, we have. Just verified that with the FSF. It would be a nice for us to 
have write access to the sparc parts.

Thanks!
Daniel



Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-09-01 Thread Daniel Hellstrom

Hello,

I have not received any comments on the patch yet.

Eric, do you have any thoughts?

Best Regards,

Daniel Hellstrom
Software Section Head
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
Phone: +46 31 7758657
dan...@gaisler.com
www.Aeroflex.com/Gaisler

On 09/01/2014 08:07 AM, Sebastian Huber wrote:

Hello,

what is the status for this patch?





[PATCH] SPARC: add mcpu=leon3v7 target

2014-08-20 Thread Daniel Hellstrom
The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7 target. This
is also a problem for binaries aiming to be compatible with all LEON3/4
processors.

 * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
 * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
 * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
   handle leon3v7 as leon3
 * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
 * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
 * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
 * config/sparc/sparc.md (cpu): add leon3v7
 * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
 gcc/config.gcc|5 -
 gcc/config/sparc/leon.md  |   14 +++---
 gcc/config/sparc/sparc-opts.h |1 +
 gcc/config/sparc/sparc.c  |3 +++
 gcc/config/sparc/sparc.h  |   38 +++---
 gcc/config/sparc/sparc.md |1 +
 gcc/config/sparc/sparc.opt|3 +++
 gcc/doc/invoke.texi   |   16 
 8 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
*-leon[3-9]*)
  with_cpu=leon3
  ;;
+   *-leon[3-9]v7*)
+ with_cpu=leon3v7
+ ;;
*)
  with_cpu=`echo ${target} | sed 's/-.*$//'`
  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
case ${val} in
 | sparc | sparcv9 | sparc64 \
| v7 | cypress \
-   | v8 | supersparc | hypersparc | leon | leon3 \
+   | v8 | supersparc | hypersparc | leon | leon3 | leon3v7 
\
| sparclite | f930 | f934 | sparclite86x \
| sparclet | tsc701 \
| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
 
 ;; Use a double reservation to work around the load pipeline hazard on UT699.
 (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
   leon_memory*2)
 
 (define_insn_reservation leon_store 2
-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
   leon_memory*2)
 
 ;; This describes Gaisler Research's FPU
@@ -44,21 +44,21 @@
 (define_cpu_unit grfpu_ds grfpu)
 
 (define_insn_reservation leon_fp_alu 4
-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
   grfpu_alu, nothing*3)
 
 (define_insn_reservation leon_fp_divs 16
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
   grfpu_ds*14, nothing*2)
 
 (define_insn_reservation leon_fp_divd 17
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
   grfpu_ds*15, nothing*2)
 
 (define_insn_reservation leon_fp_sqrts 24
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
   grfpu_ds*22, nothing*2)
 
 (define_insn_reservation leon_fp_sqrtd 25
-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrtd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrtd))
   grfpu_ds*23, nothing*2)
diff --git a/gcc/config/sparc/sparc-opts.h b/gcc/config/sparc/sparc-opts.h
index b5e9761..c35bee4 100644
--- a/gcc/config/sparc/sparc-opts.h
+++ b/gcc/config/sparc/sparc-opts.h
@@ -31,6 +31,7 @@ enum processor_type {
   PROCESSOR_HYPERSPARC,
   PROCESSOR_LEON,
   PROCESSOR_LEON3,
+  PROCESSOR_LEON3V7,
   PROCESSOR_SPARCLITE,
   PROCESSOR_F930,
   PROCESSOR_F934,
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e9b2bcf..7f3c43e 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1125,6 +1125,7 @@ sparc_option_override (void)
 { TARGET_CPU_hypersparc, PROCESSOR_HYPERSPARC },
 { TARGET_CPU_leon, PROCESSOR_LEON },
 { TARGET_CPU_leon3, PROCESSOR_LEON3 },
+{ TARGET_CPU_leon3v7, PROCESSOR_LEON3V7 },
 { TARGET_CPU_sparclite, PROCESSOR_F930 },
 { TARGET_CPU_sparclite86x, PROCESSOR_SPARCLITE86X 

Re: spar-rtems add leon3 multlib to 4.9

2014-08-20 Thread Daniel Hellstrom

Hello,

I would ideally like the mcpu=leon3v7 patch applied first (https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02035.html), so that we can change the multi lib patch to include the leon3v7 target. I believe 
it would be good for the RTEMS LEON3 BSP to include support for all LEON3/4 processors. If switching to mcpu=leon3 in RTEMS BSP, then we no longer support the LEON3 V7 processors.


Best Regards,

Daniel Hellstrom
Software Section Head
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
Phone: +46 31 7758657
dan...@gaisler.com
www.Aeroflex.com/Gaisler

On 08/20/2014 03:51 PM, Joel Sherrill wrote:

I would like to add this patch to the 4.9 branch. It is RTEMS
specific and takes advantage of the leon3 multilib support from
Eric Botcazou.

OK to commit?

--joel

gcc/ChangeLog
2013-08-29  Sebastian Hubersebastian.hu...@embedded-brains.de

* config/sparc/t-rtems: Add leon3 multilibs.
---
   gcc/config/sparc/t-rtems |4 ++--
   1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index 63d0217..f1a3d84 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,6 +17,6 @@
   #http://www.gnu.org/licenses/.
   #

-MULTILIB_OPTIONS = msoft-float mcpu=v8
-MULTILIB_DIRNAMES = soft v8
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3
+MULTILIB_DIRNAMES = soft v8 leon3
   MULTILIB_MATCHES = msoft-float=mno-fpu





Re: [PATCH] SPARC: add mcpu=leon3v7 target

2014-08-20 Thread Daniel Hellstrom

Hi Joel,

Yes an update is required. If/when I get positive comments on the mcpu=leon3v7 
patch I will suggest a new updated multilib patch and a RTEMS LEON3 BSP build 
configuration change.

I have tested the mcpu=leon3v7 patch with RTEMS leon3 BSP generating V7 instructions, and ngmp generating V8 instructions to check that I haven't broken anything. The instructions generated in the 
both cases are good, and the RTEMS single-core test-suite runs on both GR712RC and NGFP hardware successfully (apart from the already known two failures of course).


Regards,
Daniel Hellstrom

On 08/20/2014 05:05 PM, Joel Sherrill wrote:

Daniel,

Does this mean that Sebastian's patch to add a leon3 multilib for
sparc-rtems
needs to be augmented to handled leon3v7? Or does it need to map to a
regular v7 library?

It just seems like the multilibs should have been touched somehow.

--joel
On 8/20/2014 10:01 AM, Daniel Hellstrom wrote:

The LEON3/4 soft-core CPU has support for both SPARCv7 and SPARCv8 that
is configurable at design time. The majority of the LEON3 ASICs are v8
compatible, however when designing an as small LEON3 as possible, v7
without FPU is frequently used.

The current GCC leon3 support implies the SPARCv8 instruction set
which is not compatible with SPARCv7. Relying on the standard SPARCv7
(-mcpu=v7) target for a LEON3-V7 is not feasible since the atomic
instruction (CAS) can not be generated by standard v7 target. This
is also a problem for binaries aiming to be compatible with all LEON3/4
processors.

  * config.gcc (sparc*-*-*): Accept mcpu=leon3v7 processor
  * doc/invoke.texi (SPARC options): add mcpu=leon3v7 comment
  * config/sparc/leon.md (leon3_load, leon_store, leon_fp_*):
handle leon3v7 as leon3
  * config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3V7
  * config/sparc/sparc.c (sparc_option_override): add leon3v7 support
  * config/sparc/sparc.h (TARGET_CPU_leon3v7): new define
  * config/sparc/sparc.md (cpu): add leon3v7
  * config/sparc/sparc.opt (enum processor_type): Add leon3v7
---
  gcc/config.gcc|5 -
  gcc/config/sparc/leon.md  |   14 +++---
  gcc/config/sparc/sparc-opts.h |1 +
  gcc/config/sparc/sparc.c  |3 +++
  gcc/config/sparc/sparc.h  |   38 +++---
  gcc/config/sparc/sparc.md |1 +
  gcc/config/sparc/sparc.opt|3 +++
  gcc/doc/invoke.texi   |   16 
  8 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 605efc0..199e387 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3065,6 +3065,9 @@ if test x$with_cpu = x ; then
*-leon[3-9]*)
  with_cpu=leon3
  ;;
+   *-leon[3-9]v7*)
+ with_cpu=leon3v7
+ ;;
*)
  with_cpu=`echo ${target} | sed 's/-.*$//'`
  ;;
@@ -3749,7 +3752,7 @@ case ${target} in
case ${val} in
 | sparc | sparcv9 | sparc64 \
| v7 | cypress \
-   | v8 | supersparc | hypersparc | leon | leon3 \
+   | v8 | supersparc | hypersparc | leon | leon3 | leon3v7 
\
| sparclite | f930 | f934 | sparclite86x \
| sparclet | tsc701 \
| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
diff --git a/gcc/config/sparc/leon.md b/gcc/config/sparc/leon.md
index b511397..e8050fa 100644
--- a/gcc/config/sparc/leon.md
+++ b/gcc/config/sparc/leon.md
@@ -29,11 +29,11 @@
  
  ;; Use a double reservation to work around the load pipeline hazard on UT699.

  (define_insn_reservation leon3_load 1
-  (and (eq_attr cpu leon3) (eq_attr type load,sload))
+  (and (eq_attr cpu leon3,leon3v7) (eq_attr type load,sload))
leon_memory*2)
  
  (define_insn_reservation leon_store 2

-  (and (eq_attr cpu leon,leon3) (eq_attr type store))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type store))
leon_memory*2)
  
  ;; This describes Gaisler Research's FPU

@@ -44,21 +44,21 @@
  (define_cpu_unit grfpu_ds grfpu)
  
  (define_insn_reservation leon_fp_alu 4

-  (and (eq_attr cpu leon,leon3) (eq_attr type fp,fpcmp,fpmul))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fp,fpcmp,fpmul))
grfpu_alu, nothing*3)
  
  (define_insn_reservation leon_fp_divs 16

-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivs))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivs))
grfpu_ds*14, nothing*2)
  
  (define_insn_reservation leon_fp_divd 17

-  (and (eq_attr cpu leon,leon3) (eq_attr type fpdivd))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpdivd))
grfpu_ds*15, nothing*2)
  
  (define_insn_reservation leon_fp_sqrts 24

-  (and (eq_attr cpu leon,leon3) (eq_attr type fpsqrts))
+  (and (eq_attr cpu leon,leon3,leon3v7) (eq_attr type fpsqrts))
grfpu_ds*22, nothing*2)
  
  (define_insn_reservation leon_fp_sqrtd 25

-  (and (eq_attr cpu leon,leon3

Re: [PATCH] RTEMS: Add LEON3/SPARC multilibs

2013-08-30 Thread Daniel Hellstrom

Hello Sebastian,

That seems like a good idea.

Thanks,
Daniel


On 08/29/2013 01:04 PM, Sebastian Huber wrote:

Recently support for LEON3 specific instructions were added to GCC.
Make this support available for RTEMS.

This patch should be committed to GCC 4.9.

gcc/ChangeLog
2013-08-29  Sebastian Huber  sebastian.hu...@embedded-brains.de

* config/sparc/t-rtems: Add leon3 multilibs.
---
  gcc/config/sparc/t-rtems |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index 63d0217..f1a3d84 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,6 +17,6 @@
  # http://www.gnu.org/licenses/.
  #
  
-MULTILIB_OPTIONS = msoft-float mcpu=v8

-MULTILIB_DIRNAMES = soft v8
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3
+MULTILIB_DIRNAMES = soft v8 leon3
  MULTILIB_MATCHES = msoft-float=mno-fpu