diff mbox

Fix --with-long-double-128 for sparc32 when defaulting to 64-bit

Message ID 20131204074932.GA29479@volta.rr44.fr
State New
Headers show

Commit Message

Aurelien Jarno Dec. 4, 2013, 7:49 a.m. UTC
On sparc, the --with-long-double-128 option doesn't change anything for
a 64-bit compiler, as it always default to 128-bit long doubles. For
a 32/64-bit compiler defaulting to 32-bit this correctly control the
size of long double of the 32-bit compiler, however for a 32/64-bit
compiler defaulting to 64-bit, the built-in specs force the 
-mlong-double-64 option. This makes the option useless in this case.

The patch below fixes that by removing the -mlong-double-64 from the
built-in spec, using the default instead.

Changelog gcc/

2013-12-04  Aurelien Jarno  <aurelien@aurel32.net>

	* config/sparc/linux64.h (CC1_SPEC): When defaulting to 64-bit,
	don't force -mlong-double-64 when -m32 or -mv8plus is given.

Comments

Jakub Jelinek Dec. 4, 2013, 7:53 a.m. UTC | #1
On Wed, Dec 04, 2013 at 08:49:32AM +0100, Aurelien Jarno wrote:
> On sparc, the --with-long-double-128 option doesn't change anything for
> a 64-bit compiler, as it always default to 128-bit long doubles. For
> a 32/64-bit compiler defaulting to 32-bit this correctly control the
> size of long double of the 32-bit compiler, however for a 32/64-bit
> compiler defaulting to 64-bit, the built-in specs force the 
> -mlong-double-64 option. This makes the option useless in this case.
> 
> The patch below fixes that by removing the -mlong-double-64 from the
> built-in spec, using the default instead.

So how do you configure 64/32-bit compiler defaulting to 64-bit, where
32-bit defaults to -mlong-double-64?

> Changelog gcc/
> 
> 2013-12-04  Aurelien Jarno  <aurelien@aurel32.net>
> 
> 	* config/sparc/linux64.h (CC1_SPEC): When defaulting to 64-bit,
> 	don't force -mlong-double-64 when -m32 or -mv8plus is given.
> 
> Index: gcc/config/sparc/linux64.h
> ===================================================================
> --- gcc/config/sparc/linux64.h	(revision 205647)
> +++ gcc/config/sparc/linux64.h	(working copy)
> @@ -162,9 +162,9 @@
>  #else
>  #define CC1_SPEC "%{profile:-p} \
>  %{m32:%{m64:%emay not use both -m32 and -m64}} \
> -%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
> +%{m32:-mptr32 -mno-stack-bias \
>    %{!mcpu*:-mcpu=cypress}} \
> -%{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
> +%{mv8plus:-mptr32 -mno-stack-bias \
>    %{!mcpu*:-mcpu=v9}} \
>  %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
>  %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \

	Jakub
Aurelien Jarno Dec. 4, 2013, 2:04 p.m. UTC | #2
On Wed, Dec 04, 2013 at 08:53:50AM +0100, Jakub Jelinek wrote:
> On Wed, Dec 04, 2013 at 08:49:32AM +0100, Aurelien Jarno wrote:
> > On sparc, the --with-long-double-128 option doesn't change anything for
> > a 64-bit compiler, as it always default to 128-bit long doubles. For
> > a 32/64-bit compiler defaulting to 32-bit this correctly control the
> > size of long double of the 32-bit compiler, however for a 32/64-bit
> > compiler defaulting to 64-bit, the built-in specs force the 
> > -mlong-double-64 option. This makes the option useless in this case.
> > 
> > The patch below fixes that by removing the -mlong-double-64 from the
> > built-in spec, using the default instead.
> 
> So how do you configure 64/32-bit compiler defaulting to 64-bit, where
> 32-bit defaults to -mlong-double-64?

Naively I would have say by *not* passing --with-long-double-128 to
configure like for a 64/32-bit compiler defaulting to 32-bit, but it
stills defaults to 128-bit long doubles with my patch.

Actually it's also the case for a 64/32-bit compiler defaulting to
32-bit, which make the --with-long-double-128 option completely useless
on sparc64. Whatever the option, the result would always be the same
with the current SVN:

64/32-bit compiler defaulting to 32-bit:
- 128-bit long doubles for -m32
- 128-bit long doubles for -m64

64/32-bit compiler defaulting to 64-bit:
- 64-bit long doubles for -m32
- 128-bit long doubles for -m64

I have to digg a bit more to see how to fix that, but even the current
code is not really consistent.

> > Changelog gcc/
> > 
> > 2013-12-04  Aurelien Jarno  <aurelien@aurel32.net>
> > 
> > 	* config/sparc/linux64.h (CC1_SPEC): When defaulting to 64-bit,
> > 	don't force -mlong-double-64 when -m32 or -mv8plus is given.
> > 
> > Index: gcc/config/sparc/linux64.h
> > ===================================================================
> > --- gcc/config/sparc/linux64.h	(revision 205647)
> > +++ gcc/config/sparc/linux64.h	(working copy)
> > @@ -162,9 +162,9 @@
> >  #else
> >  #define CC1_SPEC "%{profile:-p} \
> >  %{m32:%{m64:%emay not use both -m32 and -m64}} \
> > -%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
> > +%{m32:-mptr32 -mno-stack-bias \
> >    %{!mcpu*:-mcpu=cypress}} \
> > -%{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
> > +%{mv8plus:-mptr32 -mno-stack-bias \
> >    %{!mcpu*:-mcpu=v9}} \
> >  %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
> >  %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \
> 
> 	Jakub
>
diff mbox

Patch

Index: gcc/config/sparc/linux64.h
===================================================================
--- gcc/config/sparc/linux64.h	(revision 205647)
+++ gcc/config/sparc/linux64.h	(working copy)
@@ -162,9 +162,9 @@ 
 #else
 #define CC1_SPEC "%{profile:-p} \
 %{m32:%{m64:%emay not use both -m32 and -m64}} \
-%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
+%{m32:-mptr32 -mno-stack-bias \
   %{!mcpu*:-mcpu=cypress}} \
-%{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
+%{mv8plus:-mptr32 -mno-stack-bias \
   %{!mcpu*:-mcpu=v9}} \
 %{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
 %{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \