Skip to contentSkip to conversation

Config.in: add -Ofast option

PATCH Superseded Joshua Henderson 3 participants 4 messages Mar 22, 2018 – Mar 26, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Config.in: add -Ofast option

-Ofast (introduced in GCC 4.6) It combines the existing optimization level -O3 with options that can affect standards compliance but result in better optimized code. For example, -Ofast enables -ffast-math.

---
 Config.in           | 9 +++++++++
 package/Makefile.in | 3 +++
 2 files changed, 12 insertions(+)
Config.in +9 -0
index 0002df5..e83ce02 100644
@@ -527,6 +527,15 @@ config BR2_OPTIMIZE_S
 	  -ftree-vect-loop-version
 	  This is the default.
 
+config BR2_OPTIMIZE_FAST
+	bool "optimize for fast"
+	help
+	  Optimize for fast. Disregard strict standards compliance. -Ofast
+	  enables all -O3 optimizations. It also enables optimizations that are
+	  not valid for all standard-compliant programs. It turns on -ffast-math
+	  and the Fortran-specific -fstack-arrays, unless -fmax-stack-var-size
+	  is specified, and -fno-protect-parens.
+
 endchoice
 
 config BR2_GOOGLE_BREAKPAD_ENABLE
package/Makefile.in +3 -0
index e387ce6..828e12e 100644
@@ -128,6 +128,9 @@ endif
 ifeq ($(BR2_OPTIMIZE_S),y)
 TARGET_OPTIMIZATION = -Os
 endif
+ifeq ($(BR2_OPTIMIZE_FAST),y)
+TARGET_OPTIMIZATION = -Ofast
+endif
 ifeq ($(BR2_DEBUG_1),y)
 TARGET_DEBUGGING = -g1
 endif
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Config.in: add -Ofast option

Joshua, All,

On 2018-03-22 09:26 -0700, Joshua Henderson spake thusly:

Quoted 15 lines

-Ofast (introduced in GCC 4.6) It combines the existing optimization level -O3 with options that can affect standards compliance but result in better optimized code. For example, -Ofast enables -ffast-math.

---
 Config.in           | 9 +++++++++
 package/Makefile.in | 3 +++
 2 files changed, 12 insertions(+)
Config.in +0 -0
index 0002df5..e83ce02 100644

Config.in config BR2_OPTIMIZE_S · line 531

Quoted 5 lines
Config.in +2 -0
@@ -527,6 +527,15 @@ config BR2_OPTIMIZE_S
 	  -ftree-vect-loop-version
 	  This is the default.
 
+config BR2_OPTIMIZE_FAST
+	bool "optimize for fast"

-Ofast was introduced in gcc-4.6, so you need a dependency:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6

Otherwise I'm fine with this.

Regards,
Yann E. MORIN.

Quoted 31 lines
Config.in +7 -0
+	help
+	  Optimize for fast. Disregard strict standards compliance. -Ofast
+	  enables all -O3 optimizations. It also enables optimizations that are
+	  not valid for all standard-compliant programs. It turns on -ffast-math
+	  and the Fortran-specific -fstack-arrays, unless -fmax-stack-var-size
+	  is specified, and -fno-protect-parens.
+
 endchoice
 
 config BR2_GOOGLE_BREAKPAD_ENABLE
package/Makefile.in +3 -0
index e387ce6..828e12e 100644
@@ -128,6 +128,9 @@ endif
 ifeq ($(BR2_OPTIMIZE_S),y)
 TARGET_OPTIMIZATION = -Os
 endif
+ifeq ($(BR2_OPTIMIZE_FAST),y)
+TARGET_OPTIMIZATION = -Ofast
+endif
 ifeq ($(BR2_DEBUG_1),y)
 TARGET_DEBUGGING = -g1
 endif
Signature · 6 lines
2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 Config.in: add -Ofast option

Hello,

Quoted 5 lines · Yann E. MORIN

Config.in config BR2_OPTIMIZE_S · line 531

Quoted 2 lines
Config.in +2 -0
+config BR2_OPTIMIZE_FAST
+	bool "optimize for fast"  

-Ofast was introduced in gcc-4.6, so you need a dependency:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6

The "odd" thing being that menuconfig is organized as follows:

Target options --->
Build options --->
Toolchain --->

The optimization level is selected in "Build options" and the compiler version is basically decided in "Toolchain".

So if you select -Ofast in Build options, and then go in Toolchain chose a < 4.6 compiler, your -Ofast selection would disappear.

But there's no good way around this, and using gcc < 4.6 is anyway very rare these days, so I also agree that the "depends on" you suggest is what makes the most sense.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 Config.in: add -Ofast option

Thomas, All,

On 2018-03-25 22:40 +0200, Thomas Petazzoni spake thusly:

Quoted 13 lines · Yann E. MORIN
Quoted 5 lines

Config.in config BR2_OPTIMIZE_S · line 531

Quoted 2 lines
Config.in +2 -0
+config BR2_OPTIMIZE_FAST
+	bool "optimize for fast"  

-Ofast was introduced in gcc-4.6, so you need a dependency:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6

The "odd" thing being that menuconfig is organized as follows:

Target options --->
Build options --->
Toolchain --->

Quoted 5 lines

The optimization level is selected in "Build options" and the compiler version is basically decided in "Toolchain".

So if you select -Ofast in Build options, and then go in Toolchain chose a < 4.6 compiler, your -Ofast selection would disappear.

Yeah, I know. But, as you ssay:

Quoted 1 line

But there's no good way around this, and using gcc < 4.6 is anyway very

... there's no good solution around this issue, and the case for gcc before 4.6 is rare enough that we don't care abot those poor souls anymore... :-/

Quoted 2 lines

rare these days, so I also agree that the "depends on" you suggest is what makes the most sense.

Was that an Acked-by or a Reviewed-by? ;-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'