diff mbox

RTEMS: Add LEON3/SPARC multilibs

Message ID 1377774243-32474-1-git-send-email-sebastian.huber@embedded-brains.de
State New
Headers show

Commit Message

Sebastian Huber Aug. 29, 2013, 11:04 a.m. UTC
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.huber@embedded-brains.de>

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

Comments

Daniel Hellstrom Aug. 30, 2013, 11:58 a.m. UTC | #1
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.huber@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
Joel Sherrill Sept. 17, 2013, 6:12 p.m. UTC | #2
Committed to the head.

Is this too radical to also go on the 4.8 branch?
We would need to discuss it on the RTEMS side but it
only impacts us if the multilib is there for sparc-elf
on 4.8.

Thanks Sebastian.

On 8/30/2013 6:58 AM, Daniel Hellstrom wrote:
> 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.huber@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
>
Ralf Corsépius Sept. 18, 2013, 5:37 p.m. UTC | #3
On 09/17/2013 08:12 PM, Joel Sherrill wrote:
> Committed to the head.
>
> Is this too radical to also go on the 4.8 branch?
> We would need to discuss it on the RTEMS side but it
> only impacts us if the multilib is there for sparc-elf
> on 4.8.

Not quite. The problem is not GCC-4.8 vs. GCC-4.9, the problems are in 
RTEMS.

Why? sparc-rtems*gccs < 4.8 doesn't support -mcpu=leon3 and thus will 
abort when -mcpu=leon3 will be used.

I.e. you
a) CANNOT use -mcpu=leon3 in RTEMS's bsp_specs and in RTEMS cpukit, 
until the toolchains are guaranteed to support it.
or
b) MUST backport -mcpu=leon3 to GCC-4.8

In other words, if you are sure leon3 works with GCC-4.8, you'd better 
off backporting this to GCC-4.8. If there are known bugs in 
GCC-4.8/leon3, you'd better of not using -mcpu=leon3 in RTEMS.

To my knowledge, GCC up to 4.8.1 doesn't support -mcpu=leon3 at all, but 
I don't know about the status on current gcc-4_8-branch.

Ralf
Sebastian Huber Sept. 19, 2013, 6:59 a.m. UTC | #4
On 2013-09-18 19:37, Ralf Corsépius wrote:
> On 09/17/2013 08:12 PM, Joel Sherrill wrote:
>> Committed to the head.
>>
>> Is this too radical to also go on the 4.8 branch?
>> We would need to discuss it on the RTEMS side but it
>> only impacts us if the multilib is there for sparc-elf
>> on 4.8.
>
> Not quite. The problem is not GCC-4.8 vs. GCC-4.9, the problems are in RTEMS.
>
> Why? sparc-rtems*gccs < 4.8 doesn't support -mcpu=leon3 and thus will abort
> when -mcpu=leon3 will be used.
>
> I.e. you
> a) CANNOT use -mcpu=leon3 in RTEMS's bsp_specs and in RTEMS cpukit, until the
> toolchains are guaranteed to support it.
> or

Yes, exactly.  We have to follow option a).

> b) MUST backport -mcpu=leon3 to GCC-4.8
>
> In other words, if you are sure leon3 works with GCC-4.8, you'd better off
> backporting this to GCC-4.8. If there are known bugs in GCC-4.8/leon3, you'd
> better of not using -mcpu=leon3 in RTEMS.
>
> To my knowledge, GCC up to 4.8.1 doesn't support -mcpu=leon3 at all, but I
> don't know about the status on current gcc-4_8-branch.
>
> Ralf
>

I don't expect that this will be back ported to GCC 4.8.  You also need 
Binutils 2.24 for this.
Eric Botcazou Sept. 19, 2013, 7:23 a.m. UTC | #5
> I don't expect that this will be back ported to GCC 4.8.  You also need
> Binutils 2.24 for this.

From a SPARC maintainership viewpoint, I'd think that this is backportable for 
the upcoming 4.8.2 release, and the patches are essentially SPARC-specific, 
but perhaps the RMs are of a different opinion here.


2013-08-09  Eric Botcazou  <ebotcazou@adacore.com>

	* configure.ac: Add GAS check for LEON instructions on SPARC.
	* configure: Regenerate.
	* config.in: Likewise.
	* config.gcc (with_cpu): Remove sparc-leon*-* and deal with LEON in the
	sparc*-*-* block.
	* config/sparc/sparc.opt (LEON, LEON3): New masks.
	* config/sparc/sparc.h (ASM_CPU32_DEFAULT_SPEC): Set to AS_LEON_FLAG
	for LEON or LEON3.
	(ASM_CPU_SPEC): Pass AS_LEON_FLAG if -mcpu=leon or -mcpu=leon3.
	(AS_LEON_FLAG): New macro.
	* config/sparc/sparc.c (sparc_option_override): Set MASK_LEON for leon
	and MASK_LEON3 for leon3 and unset them if HAVE_AS_LEON is not defined.
	Deal with LEON and LEON3 for the memory model.
	* config/sparc/sync.md (atomic_compare_and_swap<mode>): Enable if LEON3
	(atomic_compare_and_swap<mode>_1): Likewise.
	(*atomic_compare_and_swap<mode>_1): Likewise.

2013-07-23  Eric Botcazou  <ebotcazou@adacore.com>

	* doc/invoke.texi (SPARC Options): Document new leon3 processor value.

2013-07-22  Eric Botcazou  <ebotcazou@adacore.com>

	* config.gcc (sparc*-*-*): Accept leon3 processor.
	(sparc-leon*-*): Merge with sparc*-*-* and add leon3 support.
	* doc/invoke.texi (SPARC Options): Adjust -mfix-ut699 entry.
	* config/sparc/sparc-opts.h (enum processor_type): Add PROCESSOR_LEON3.
	* config/sparc/sparc.opt (enum processor_type): Add leon3.
	(mfix-ut699): Adjust comment.
	* config/sparc/sparc.h (TARGET_CPU_leon3): New define.
	(CPP_CPU32_DEFAULT_SPEC): Add leon3 support.
	(CPP_CPU_SPEC): Likewise.
	(ASM_CPU_SPEC): Likewise.
	* config/sparc/sparc.c (leon3_cost): New constant.
	(sparc_option_override): Add leon3 support.
	(mem_ref): New function.
	(sparc_gate_work_around_errata): Return true if -mfix-ut699 is enabled.
	(sparc_do_work_around_errata): Look into the instruction in the delay
	slot and adjust accordingly.  Add fix for the data cache nullify issues
	of the UT699.  Change insertion position for the NOP.
	* config/sparc/leon.md (leon_fpalu, leon_fpmds, write_buf): Delete.
	(leon3_load): New reservation.
	(leon_store): Bump latency to 2.
	(grfpu): New automaton.
	(grfpu_alu): New unit.
	(grfpu_ds): Likewise.
	(leon_fp_alu): Adjust.
	(leon_fp_mult): Delete.
	(leon_fp_div): Split into leon_fp_divs and leon_fp_divd.
	(leon_fp_sqrt): Split into leon_fp_sqrts and leon_fp_sqrtd.
	* config/sparc/sparc.md (cpu): Add leon3.
	* config/sparc/sync.md (atomic_exchangesi): Disable if -mfix-ut699.
	(swapsi): Likewise.
	(atomic_test_and_set): Likewise.
	(ldstub): Likewise.

2013-05-28  Eric Botcazou  <ebotcazou@adacore.com>

	* doc/invoke.texi (SPARC Options): Document -mfix-ut699.
	* builtins.c (expand_builtin_mathfn) <BUILT_IN_SQRT>: Try to widen the
	mode if the instruction isn't available in the original mode.
	* config/sparc/sparc.opt (mfix-ut699): New option.
	* config/sparc/sparc.md (muldf3_extend): Disable if -mfix-ut699.
	(divdf3): Turn into expander.
	(divdf3_nofix): New insn.
	(divdf3_fix): Likewise.
	(divsf3): Disable if -mfix-ut699.
	(sqrtdf2): Turn into expander.
	(sqrtdf2_nofix): New insn.
	(sqrtdf2_fix): Likewise.
	(sqrtsf2): Disable if -mfix-ut699.
Sebastian Huber Sept. 19, 2013, 8:45 a.m. UTC | #6
On 2013-09-19 09:23, Eric Botcazou wrote:
>> I don't expect that this will be back ported to GCC 4.8.  You also need
>> >Binutils 2.24 for this.
>>From a SPARC maintainership viewpoint, I'd think that this is backportable for
> the upcoming 4.8.2 release, and the patches are essentially SPARC-specific,
> but perhaps the RMs are of a different opinion here.

A back port would be quite nice for us, since we work currently on SMP support 
for LEON3/4 and C11 atomic operations would be very handy for this.
diff mbox

Patch

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