Skip to contentSkip to conversation

Config.in: add -Ofast option

PATCH New Joshua Henderson 2 participants 2 messages Mar 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---

v2:
- Add proper depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6

---
 Config.in           | 10 ++++++++++
 package/Makefile.in |  3 +++
 2 files changed, 13 insertions(+)
Config.in +10 -0
index 0002df5..145f915 100644
@@ -527,6 +527,16 @@ config BR2_OPTIMIZE_S
 	  -ftree-vect-loop-version
 	  This is the default.
 
+config BR2_OPTIMIZE_FAST
+	bool "optimize for fast"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
+	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 v2 1/1 Config.in: add -Ofast option

Hello,

Quoted 7 lines · Joshua Henderson

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

---

Applied to master, thanks.

Thomas

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