public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, MIPS] -mno-float odds and ends
@ 2012-07-30 17:45 Sandra Loosemore
  2012-07-30 19:39 ` Richard Sandiford
  0 siblings, 1 reply; 4+ messages in thread
From: Sandra Loosemore @ 2012-07-30 17:45 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

The MIPS back end has an option -mno-float that is supported by 
bare-metal configs using the SDE library.  However, this option is not 
properly documented in the manual, and MIPS_ARCH_FLOAT_SPEC doesn't know 
about it as one of the explicit floating-point configuration changes 
that should override architecture defaults.  This patch addresses both 
problems.  OK to commit?

-Sandra


2012-07-30  Sandra Loosemore  <sandra@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	gcc/
	* doc/invoke.texi (MIPS Options): Document -mno-float.
	* config/mips/mips.h (MIPS_ARCH_FLOAT_SPEC): Make it know
	about -mno-float.


[-- Attachment #2: no-float.patch --]
[-- Type: text/x-patch, Size: 1707 bytes --]

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 189950)
+++ gcc/doc/invoke.texi	(working copy)
@@ -733,7 +733,8 @@ Objective-C and Objective-C++ Dialects}.
 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
--msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
+-mno-float -msingle-float  -mdouble-float  @gol
+-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
 -mmcu -mmno-mcu @gol
 -mfpu=@var{fpu-type} @gol
 -msmartmips  -mno-smartmips @gol
@@ -15633,6 +15634,11 @@ Use floating-point coprocessor instructi
 Do not use floating-point coprocessor instructions.  Implement
 floating-point calculations using library calls instead.
 
+@item -mno-float
+@opindex mno-float
+Prevents the use of all floating-point operations.  This option is presently 
+supported only by some bare-metal MIPS configurations.
+
 @item -msingle-float
 @opindex msingle-float
 Assume that the floating-point coprocessor only supports single-precision
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(revision 189950)
+++ gcc/config/mips/mips.h	(working copy)
@@ -713,7 +713,7 @@ struct mips_cpu_info {
    link-compatible.  */
 
 #define MIPS_ARCH_FLOAT_SPEC \
-  "%{mhard-float|msoft-float|march=mips*:; \
+  "%{mhard-float|msoft-float|mno-float|march=mips*:; \
      march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
      |march=34kc|march=74kc|march=1004kc|march=5kc \
      |march=octeon|march=xlr: -msoft-float;		  \

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

* Re: [PATCH, MIPS] -mno-float odds and ends
  2012-07-30 17:45 [PATCH, MIPS] -mno-float odds and ends Sandra Loosemore
@ 2012-07-30 19:39 ` Richard Sandiford
  2012-07-30 21:55   ` Sandra Loosemore
  2012-07-30 22:27   ` Sandra Loosemore
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Sandiford @ 2012-07-30 19:39 UTC (permalink / raw)
  To: Sandra Loosemore; +Cc: gcc-patches

Sandra Loosemore <sandra@codesourcery.com> writes:
> The MIPS back end has an option -mno-float that is supported by 
> bare-metal configs using the SDE library.  However, this option is not 
> properly documented in the manual, and MIPS_ARCH_FLOAT_SPEC doesn't know 
> about it as one of the explicit floating-point configuration changes 
> that should override architecture defaults.  This patch addresses both 
> problems.  OK to commit?

OK, you're touching a sore spot here, but...

> +@item -mno-float
> +@opindex mno-float
> +Prevents the use of all floating-point operations.  This option is presently 
> +supported only by some bare-metal MIPS configurations.

...unfortunately, it doesn't prevent the use floating-point operations.
That's why it's such a bad option.  The only difference from the compiler
proper's point of view between -msoft-float and -mno-float is that they
define different preprocessor macros.

The onus is instead on the programmer to avoid writing anything that
might tempt the compiler into using floating-point operations.  If the
user gets it wrong, they get (at best) a link-time error rather than a
compile-time error.

I think we should document it that way.  E.g. something like:

@item -mno-float
@opindex mno-float
Equivalent to @option{-msoft-float}, but asserts that the user is
trying to avoid all floating-point operations.  This option is presently 
supported only by some bare-metal MIPS configurations, where it selects
a special set of libraries that lack all floating-point support
(including, for example, the floating-point @code{printf} formats).
If code compiled with @code{-mno-float} accidentally contains
floating-point operations, it is likely to suffer a link-time
or run-time failure.

but you're better at the wordsmithing than I am.

Perhaps we should document the __mips_no_float preprocessor macro too,
since that's how things like printf() know that they don't need the
floating-point stuff.

The mips.h part is OK though, thanks.  Feel free to apply it separately
if that's more convenient than keeping the patch together.

Richard

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

* Re: [PATCH, MIPS] -mno-float odds and ends
  2012-07-30 19:39 ` Richard Sandiford
@ 2012-07-30 21:55   ` Sandra Loosemore
  2012-07-30 22:27   ` Sandra Loosemore
  1 sibling, 0 replies; 4+ messages in thread
From: Sandra Loosemore @ 2012-07-30 21:55 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

On 07/30/2012 01:38 PM, Richard Sandiford wrote:
>
> ...unfortunately, it doesn't prevent the use floating-point operations.
> That's why it's such a bad option.  The only difference from the compiler
> proper's point of view between -msoft-float and -mno-float is that they
> define different preprocessor macros.
>
> The onus is instead on the programmer to avoid writing anything that
> might tempt the compiler into using floating-point operations.  If the
> user gets it wrong, they get (at best) a link-time error rather than a
> compile-time error.
>
> I think we should document it that way.  E.g. something like:
>
> @item -mno-float
> @opindex mno-float
> Equivalent to @option{-msoft-float}, but asserts that the user is
> trying to avoid all floating-point operations.  This option is presently
> supported only by some bare-metal MIPS configurations, where it selects
> a special set of libraries that lack all floating-point support
> (including, for example, the floating-point @code{printf} formats).
> If code compiled with @code{-mno-float} accidentally contains
> floating-point operations, it is likely to suffer a link-time
> or run-time failure.
>
> but you're better at the wordsmithing than I am.

OK, I've gone with a slightly tweaked version of your wording.

> Perhaps we should document the __mips_no_float preprocessor macro too,
> since that's how things like printf() know that they don't need the
> floating-point stuff.

Hmmm, I don't think that's necessary, at least as part of this patch; we 
don't document the related __mips_hard_float or __mips_soft_float 
preprocessor definitions, either.

> The mips.h part is OK though, thanks.  Feel free to apply it separately
> if that's more convenient than keeping the patch together.

I've checked in the attached version of the patch.  Thanks for the 
speedy review!  :-)

-Sandra


2012-07-30  Sandra Loosemore  <sandra@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	gcc/
	* doc/invoke.texi (MIPS Options): Document -mno-float.
	* config/mips/mips.h (MIPS_ARCH_FLOAT_SPEC): Make it know
	about -mno-float.


[-- Attachment #2: no-float.patch --]
[-- Type: text/x-patch, Size: 2102 bytes --]

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 189950)
+++ gcc/doc/invoke.texi	(working copy)
@@ -733,7 +733,8 @@ Objective-C and Objective-C++ Dialects}.
 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
--msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
+-mno-float -msingle-float  -mdouble-float  @gol
+-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
 -mmcu -mmno-mcu @gol
 -mfpu=@var{fpu-type} @gol
 -msmartmips  -mno-smartmips @gol
@@ -15633,6 +15634,18 @@ Use floating-point coprocessor instructi
 Do not use floating-point coprocessor instructions.  Implement
 floating-point calculations using library calls instead.
 
+@item -mno-float
+@opindex mno-float
+Equivalent to @option{-msoft-float}, but additionally asserts that the
+program being compiled does not perform any floating-point operations.
+This option is presently supported only by some bare-metal MIPS
+configurations, where it may select a special set of libraries
+that lack all floating-point support (including, for example, the
+floating-point @code{printf} formats).  
+If code compiled with @code{-mno-float} accidentally contains
+floating-point operations, it is likely to suffer a link-time
+or run-time failure.
+
 @item -msingle-float
 @opindex msingle-float
 Assume that the floating-point coprocessor only supports single-precision
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(revision 189950)
+++ gcc/config/mips/mips.h	(working copy)
@@ -713,7 +713,7 @@ struct mips_cpu_info {
    link-compatible.  */
 
 #define MIPS_ARCH_FLOAT_SPEC \
-  "%{mhard-float|msoft-float|march=mips*:; \
+  "%{mhard-float|msoft-float|mno-float|march=mips*:; \
      march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
      |march=34kc|march=74kc|march=1004kc|march=5kc \
      |march=octeon|march=xlr: -msoft-float;		  \

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

* Re: [PATCH, MIPS] -mno-float odds and ends
  2012-07-30 19:39 ` Richard Sandiford
  2012-07-30 21:55   ` Sandra Loosemore
@ 2012-07-30 22:27   ` Sandra Loosemore
  1 sibling, 0 replies; 4+ messages in thread
From: Sandra Loosemore @ 2012-07-30 22:27 UTC (permalink / raw)
  To: gcc-patches, rdsandiford

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

On 07/30/2012 01:38 PM, Richard Sandiford wrote:
>
> ...unfortunately, it doesn't prevent the use floating-point operations.
> That's why it's such a bad option.  The only difference from the compiler
> proper's point of view between -msoft-float and -mno-float is that they
> define different preprocessor macros.
>
> The onus is instead on the programmer to avoid writing anything that
> might tempt the compiler into using floating-point operations.  If the
> user gets it wrong, they get (at best) a link-time error rather than a
> compile-time error.
>
> I think we should document it that way.  E.g. something like:
>
> @item -mno-float
> @opindex mno-float
> Equivalent to @option{-msoft-float}, but asserts that the user is
> trying to avoid all floating-point operations.  This option is presently
> supported only by some bare-metal MIPS configurations, where it selects
> a special set of libraries that lack all floating-point support
> (including, for example, the floating-point @code{printf} formats).
> If code compiled with @code{-mno-float} accidentally contains
> floating-point operations, it is likely to suffer a link-time
> or run-time failure.
>
> but you're better at the wordsmithing than I am.

OK, I've gone with a slightly tweaked version of your wording.

> Perhaps we should document the __mips_no_float preprocessor macro too,
> since that's how things like printf() know that they don't need the
> floating-point stuff.

Hmmm, I don't think that's necessary, at least as part of this patch; we 
don't document the related __mips_hard_float or __mips_soft_float 
preprocessor definitions, either.

> The mips.h part is OK though, thanks.  Feel free to apply it separately
> if that's more convenient than keeping the patch together.

I've checked in the attached version of the patch.  Thanks for the 
speedy review!  :-)

-Sandra


2012-07-30  Sandra Loosemore  <sandra@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	gcc/
	* doc/invoke.texi (MIPS Options): Document -mno-float.
	* config/mips/mips.h (MIPS_ARCH_FLOAT_SPEC): Make it know
	about -mno-float.


[-- Attachment #2: no-float.patch --]
[-- Type: text/x-patch, Size: 2102 bytes --]

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 189950)
+++ gcc/doc/invoke.texi	(working copy)
@@ -733,7 +733,8 @@ Objective-C and Objective-C++ Dialects}.
 -mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
 -mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
--msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
+-mno-float -msingle-float  -mdouble-float  @gol
+-mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
 -mmcu -mmno-mcu @gol
 -mfpu=@var{fpu-type} @gol
 -msmartmips  -mno-smartmips @gol
@@ -15633,6 +15634,18 @@ Use floating-point coprocessor instructi
 Do not use floating-point coprocessor instructions.  Implement
 floating-point calculations using library calls instead.
 
+@item -mno-float
+@opindex mno-float
+Equivalent to @option{-msoft-float}, but additionally asserts that the
+program being compiled does not perform any floating-point operations.
+This option is presently supported only by some bare-metal MIPS
+configurations, where it may select a special set of libraries
+that lack all floating-point support (including, for example, the
+floating-point @code{printf} formats).  
+If code compiled with @code{-mno-float} accidentally contains
+floating-point operations, it is likely to suffer a link-time
+or run-time failure.
+
 @item -msingle-float
 @opindex msingle-float
 Assume that the floating-point coprocessor only supports single-precision
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(revision 189950)
+++ gcc/config/mips/mips.h	(working copy)
@@ -713,7 +713,7 @@ struct mips_cpu_info {
    link-compatible.  */
 
 #define MIPS_ARCH_FLOAT_SPEC \
-  "%{mhard-float|msoft-float|march=mips*:; \
+  "%{mhard-float|msoft-float|mno-float|march=mips*:; \
      march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
      |march=34kc|march=74kc|march=1004kc|march=5kc \
      |march=octeon|march=xlr: -msoft-float;		  \

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

end of thread, other threads:[~2012-07-30 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-30 17:45 [PATCH, MIPS] -mno-float odds and ends Sandra Loosemore
2012-07-30 19:39 ` Richard Sandiford
2012-07-30 21:55   ` Sandra Loosemore
2012-07-30 22:27   ` Sandra Loosemore

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).