@@ -55,26 +55,26 @@ class Gcc(Compiler):
5555 'lto' : (False , "Enable Link Time Optimization" ),
5656 }
5757 COMPILER_UNIQUE_OPTION_MAP = {
58- 'i8' : 'fdefault-integer-8' ,
59- 'r8' : ['fdefault-real-8' , 'fdefault-double-8' ],
60- 'unroll' : 'funroll-loops' ,
61- 'f2c' : 'ff2c' ,
62- 'loop' : ['ftree-switch-conversion' , 'floop-interchange' , 'floop-strip-mine' , 'floop-block' ],
63- 'lto' : 'flto' ,
64- 'ieee' : ['mieee-fp' , 'fno-trapping-math' ],
65- 'strict' : ['mieee-fp' , 'mno-recip' ],
66- 'precise' : ['mno-recip' ],
67- 'defaultprec' : ['fno-math-errno' ],
68- 'loose' : ['fno-math-errno' , 'mrecip' , 'mno-ieee-fp' ],
69- 'veryloose' : ['fno-math-errno' , 'mrecip=all' , 'mno-ieee-fp' ],
70- 'vectorize' : {False : 'fno-tree-vectorize' , True : 'ftree-vectorize' },
71- DEFAULT_OPT_LEVEL : ['O2' , 'ftree-vectorize' ],
58+ 'i8' : '- fdefault-integer-8' ,
59+ 'r8' : ['- fdefault-real-8' , '- fdefault-double-8' ],
60+ 'unroll' : '- funroll-loops' ,
61+ 'f2c' : '- ff2c' ,
62+ 'loop' : ['- ftree-switch-conversion' , '- floop-interchange' , '- floop-strip-mine' , '- floop-block' ],
63+ 'lto' : '- flto' ,
64+ 'ieee' : ['- mieee-fp' , '- fno-trapping-math' ],
65+ 'strict' : ['- mieee-fp' , '- mno-recip' ],
66+ 'precise' : ['- mno-recip' ],
67+ 'defaultprec' : ['- fno-math-errno' ],
68+ 'loose' : ['- fno-math-errno' , '- mrecip' , '- mno-ieee-fp' ],
69+ 'veryloose' : ['- fno-math-errno' , '- mrecip=all' , '- mno-ieee-fp' ],
70+ 'vectorize' : {False : '- fno-tree-vectorize' , True : '- ftree-vectorize' },
71+ DEFAULT_OPT_LEVEL : ['- O2' , '- ftree-vectorize' ],
7272 }
7373
7474 # gcc on aarch64 does not support -mno-recip, -mieee-fp, -mfno-math-errno...
7575 # https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
7676 if systemtools .get_cpu_architecture () == systemtools .AARCH64 :
77- no_recip_alternative = ['mno-low-precision-recip-sqrt' , 'mno-low-precision-sqrt' , 'mno-low-precision-div' ]
77+ no_recip_alternative = ['- mno-low-precision-recip-sqrt' , '- mno-low-precision-sqrt' , '- mno-low-precision-div' ]
7878 COMPILER_UNIQUE_OPTION_MAP ['strict' ] = no_recip_alternative
7979 COMPILER_UNIQUE_OPTION_MAP ['precise' ] = no_recip_alternative
8080
@@ -84,38 +84,38 @@ class Gcc(Compiler):
8484 if systemtools .get_cpu_family () == systemtools .RISCV :
8585 COMPILER_UNIQUE_OPTION_MAP ['strict' ] = []
8686 COMPILER_UNIQUE_OPTION_MAP ['precise' ] = []
87- COMPILER_UNIQUE_OPTION_MAP ['loose' ] = ['fno-math-errno' ]
88- COMPILER_UNIQUE_OPTION_MAP ['veryloose' ] = ['fno-math-errno' ]
87+ COMPILER_UNIQUE_OPTION_MAP ['loose' ] = ['- fno-math-errno' ]
88+ COMPILER_UNIQUE_OPTION_MAP ['veryloose' ] = ['- fno-math-errno' ]
8989
9090 # used when 'optarch' toolchain option is enabled (and --optarch is not specified)
9191 COMPILER_OPTIMAL_ARCHITECTURE_OPTION = {
92- (systemtools .AARCH32 , systemtools .ARM ): 'mcpu=native' , # implies -march=native and -mtune=native
93- (systemtools .AARCH64 , systemtools .ARM ): 'mcpu=native' , # since GCC 6; implies -march=native and -mtune=native
92+ (systemtools .AARCH32 , systemtools .ARM ): '- mcpu=native' , # implies -march=native and -mtune=native
93+ (systemtools .AARCH64 , systemtools .ARM ): '- mcpu=native' , # since GCC 6; implies -march=native and -mtune=native
9494 # no support for -march on POWER; implies -mtune=native
95- (systemtools .POWER , systemtools .POWER ): 'mcpu=native' ,
96- (systemtools .POWER , systemtools .POWER_LE ): 'mcpu=native' ,
97- (systemtools .X86_64 , systemtools .AMD ): 'march=native' , # implies -mtune=native
98- (systemtools .X86_64 , systemtools .INTEL ): 'march=native' , # implies -mtune=native
95+ (systemtools .POWER , systemtools .POWER ): '- mcpu=native' ,
96+ (systemtools .POWER , systemtools .POWER_LE ): '- mcpu=native' ,
97+ (systemtools .X86_64 , systemtools .AMD ): '- march=native' , # implies -mtune=native
98+ (systemtools .X86_64 , systemtools .INTEL ): '- march=native' , # implies -mtune=native
9999 }
100100 # used with --optarch=GENERIC
101101 COMPILER_GENERIC_OPTION = {
102- (systemtools .AARCH32 , systemtools .ARM ): 'mcpu=generic-armv7' , # implies -march=armv7 and -mtune=generic-armv7
103- (systemtools .AARCH64 , systemtools .ARM ): 'mcpu=generic' , # implies -march=armv8-a and -mtune=generic
104- (systemtools .POWER , systemtools .POWER ): 'mcpu=powerpc64' , # no support for -march on POWER
105- (systemtools .POWER , systemtools .POWER_LE ): 'mcpu=powerpc64le' , # no support for -march on POWER
106- (systemtools .RISCV64 , systemtools .RISCV ): 'march=rv64gc -mabi=lp64d' , # default for -mabi is system-dependent
107- (systemtools .X86_64 , systemtools .AMD ): 'march=x86-64 -mtune=generic' ,
108- (systemtools .X86_64 , systemtools .INTEL ): 'march=x86-64 -mtune=generic' ,
102+ (systemtools .AARCH32 , systemtools .ARM ): '- mcpu=generic-armv7' , # implies -march=armv7 and -mtune=generic-armv7
103+ (systemtools .AARCH64 , systemtools .ARM ): '- mcpu=generic' , # implies -march=armv8-a and -mtune=generic
104+ (systemtools .POWER , systemtools .POWER ): '- mcpu=powerpc64' , # no support for -march on POWER
105+ (systemtools .POWER , systemtools .POWER_LE ): '- mcpu=powerpc64le' , # no support for -march on POWER
106+ (systemtools .RISCV64 , systemtools .RISCV ): '- march=rv64gc -mabi=lp64d' , # default for -mabi is system-dependent
107+ (systemtools .X86_64 , systemtools .AMD ): '- march=x86-64 -mtune=generic' ,
108+ (systemtools .X86_64 , systemtools .INTEL ): '- march=x86-64 -mtune=generic' ,
109109 }
110110
111111 COMPILER_CC = 'gcc'
112112 COMPILER_CXX = 'g++'
113- COMPILER_C_UNIQUE_FLAGS = []
113+ COMPILER_C_UNIQUE_OPTIONS = []
114114
115115 COMPILER_F77 = 'gfortran'
116116 COMPILER_F90 = 'gfortran'
117117 COMPILER_FC = 'gfortran'
118- COMPILER_F_UNIQUE_FLAGS = ['f2c' ]
118+ COMPILER_F_UNIQUE_OPTIONS = ['f2c' ]
119119
120120 LIB_MULTITHREAD = ['pthread' ]
121121 LIB_MATH = ['m' ]
@@ -186,8 +186,8 @@ def _guess_aarch64_default_optarch(self):
186186 break
187187 if core_types :
188188 # On big.LITTLE setups, sort core types to have big core (higher model number) first.
189- # Example: 'mcpu=cortex-a72.cortex-a53' for "ARM Cortex-A53 + Cortex-A72"
190- default_optarch = 'mcpu=%s' % '.' .join ([ct [1 ] for ct in sorted (core_types , reverse = True )])
189+ # Example: '- mcpu=cortex-a72.cortex-a53' for "ARM Cortex-A53 + Cortex-A72"
190+ default_optarch = '- mcpu=%s' % '.' .join ([ct [1 ] for ct in sorted (core_types , reverse = True )])
191191 self .log .debug ("Using architecture-specific compiler optimization flag '%s'" , default_optarch )
192192
193193 return default_optarch
0 commit comments