6 个解决方案
#1
man gcc下
#2
那不用float,用double
#3
用的就是double
#4
`-O'
`-O1'
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
With `-O', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal
of compilation time.
`-O' turns on the following optimization flags:
-fdefer-pop
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-floop-optimize
-fif-conversion
-fif-conversion2
-ftree-ccp
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-ter
-ftree-lrs
-ftree-sra
-ftree-copyrename
-ftree-fre
-ftree-ch
-funit-at-a-time
-fmerge-constants
`-O' also turns on `-fomit-frame-pointer' on machines where doing
so does not interfere with debugging.
`-O' doesn't turn on `-ftree-sra' for the Ada compiler. This
option must be explicitly specified on the command line to be
enabled for the Ada compiler.
`-O2'
Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. The
compiler does not perform loop unrolling or function inlining when
you specify `-O2'. As compared to `-O', this option increases
both compilation time and the performance of the generated code.
`-O2' turns on all optimization flags specified by `-O'. It also
turns on the following optimization flags:
-fthread-jumps
-fcrossjumping
-foptimize-sibling-calls
-fcse-follow-jumps -fcse-skip-blocks
-fgcse -fgcse-lm
-fexpensive-optimizations
-fstrength-reduce
-frerun-cse-after-loop -frerun-loop-opt
-fcaller-saves
-fpeephole2
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fregmove
-fstrict-aliasing
-fdelete-null-pointer-checks
-freorder-blocks -freorder-functions
-falign-functions -falign-jumps
-falign-loops -falign-labels
-ftree-vrp
-ftree-pre
Please note the warning under `-fgcse' about invoking `-O2' on
programs that use computed gotos.
`-O3'
Optimize yet more. `-O3' turns on all optimizations specified by
`-O2' and also turns on the `-finline-functions',
`-funswitch-loops' and `-fgcse-after-reload' options.
`-O0'
Do not optimize. This is the default.
`-O1'
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
With `-O', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal
of compilation time.
`-O' turns on the following optimization flags:
-fdefer-pop
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-floop-optimize
-fif-conversion
-fif-conversion2
-ftree-ccp
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-ter
-ftree-lrs
-ftree-sra
-ftree-copyrename
-ftree-fre
-ftree-ch
-funit-at-a-time
-fmerge-constants
`-O' also turns on `-fomit-frame-pointer' on machines where doing
so does not interfere with debugging.
`-O' doesn't turn on `-ftree-sra' for the Ada compiler. This
option must be explicitly specified on the command line to be
enabled for the Ada compiler.
`-O2'
Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. The
compiler does not perform loop unrolling or function inlining when
you specify `-O2'. As compared to `-O', this option increases
both compilation time and the performance of the generated code.
`-O2' turns on all optimization flags specified by `-O'. It also
turns on the following optimization flags:
-fthread-jumps
-fcrossjumping
-foptimize-sibling-calls
-fcse-follow-jumps -fcse-skip-blocks
-fgcse -fgcse-lm
-fexpensive-optimizations
-fstrength-reduce
-frerun-cse-after-loop -frerun-loop-opt
-fcaller-saves
-fpeephole2
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fregmove
-fstrict-aliasing
-fdelete-null-pointer-checks
-freorder-blocks -freorder-functions
-falign-functions -falign-jumps
-falign-loops -falign-labels
-ftree-vrp
-ftree-pre
Please note the warning under `-fgcse' about invoking `-O2' on
programs that use computed gotos.
`-O3'
Optimize yet more. `-O3' turns on all optimizations specified by
`-O2' and also turns on the `-finline-functions',
`-funswitch-loops' and `-fgcse-after-reload' options.
`-O0'
Do not optimize. This is the default.
#5
下面具体介绍优化选项的东西过长,不贴了。
优化的肯定是目标代码,但有些优化可能是有代价的,再仔细查查看……
优化的肯定是目标代码,但有些优化可能是有代价的,再仔细查查看……
#6
唉~如果我的英文足够好的话,我就man,不用在这里问了。虽然没烦性啃下上边的英文,但还是谢谢milksea
#1
man gcc下
#2
那不用float,用double
#3
用的就是double
#4
`-O'
`-O1'
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
With `-O', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal
of compilation time.
`-O' turns on the following optimization flags:
-fdefer-pop
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-floop-optimize
-fif-conversion
-fif-conversion2
-ftree-ccp
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-ter
-ftree-lrs
-ftree-sra
-ftree-copyrename
-ftree-fre
-ftree-ch
-funit-at-a-time
-fmerge-constants
`-O' also turns on `-fomit-frame-pointer' on machines where doing
so does not interfere with debugging.
`-O' doesn't turn on `-ftree-sra' for the Ada compiler. This
option must be explicitly specified on the command line to be
enabled for the Ada compiler.
`-O2'
Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. The
compiler does not perform loop unrolling or function inlining when
you specify `-O2'. As compared to `-O', this option increases
both compilation time and the performance of the generated code.
`-O2' turns on all optimization flags specified by `-O'. It also
turns on the following optimization flags:
-fthread-jumps
-fcrossjumping
-foptimize-sibling-calls
-fcse-follow-jumps -fcse-skip-blocks
-fgcse -fgcse-lm
-fexpensive-optimizations
-fstrength-reduce
-frerun-cse-after-loop -frerun-loop-opt
-fcaller-saves
-fpeephole2
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fregmove
-fstrict-aliasing
-fdelete-null-pointer-checks
-freorder-blocks -freorder-functions
-falign-functions -falign-jumps
-falign-loops -falign-labels
-ftree-vrp
-ftree-pre
Please note the warning under `-fgcse' about invoking `-O2' on
programs that use computed gotos.
`-O3'
Optimize yet more. `-O3' turns on all optimizations specified by
`-O2' and also turns on the `-finline-functions',
`-funswitch-loops' and `-fgcse-after-reload' options.
`-O0'
Do not optimize. This is the default.
`-O1'
Optimize. Optimizing compilation takes somewhat more time, and a
lot more memory for a large function.
With `-O', the compiler tries to reduce code size and execution
time, without performing any optimizations that take a great deal
of compilation time.
`-O' turns on the following optimization flags:
-fdefer-pop
-fdelayed-branch
-fguess-branch-probability
-fcprop-registers
-floop-optimize
-fif-conversion
-fif-conversion2
-ftree-ccp
-ftree-dce
-ftree-dominator-opts
-ftree-dse
-ftree-ter
-ftree-lrs
-ftree-sra
-ftree-copyrename
-ftree-fre
-ftree-ch
-funit-at-a-time
-fmerge-constants
`-O' also turns on `-fomit-frame-pointer' on machines where doing
so does not interfere with debugging.
`-O' doesn't turn on `-ftree-sra' for the Ada compiler. This
option must be explicitly specified on the command line to be
enabled for the Ada compiler.
`-O2'
Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. The
compiler does not perform loop unrolling or function inlining when
you specify `-O2'. As compared to `-O', this option increases
both compilation time and the performance of the generated code.
`-O2' turns on all optimization flags specified by `-O'. It also
turns on the following optimization flags:
-fthread-jumps
-fcrossjumping
-foptimize-sibling-calls
-fcse-follow-jumps -fcse-skip-blocks
-fgcse -fgcse-lm
-fexpensive-optimizations
-fstrength-reduce
-frerun-cse-after-loop -frerun-loop-opt
-fcaller-saves
-fpeephole2
-fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec
-fregmove
-fstrict-aliasing
-fdelete-null-pointer-checks
-freorder-blocks -freorder-functions
-falign-functions -falign-jumps
-falign-loops -falign-labels
-ftree-vrp
-ftree-pre
Please note the warning under `-fgcse' about invoking `-O2' on
programs that use computed gotos.
`-O3'
Optimize yet more. `-O3' turns on all optimizations specified by
`-O2' and also turns on the `-finline-functions',
`-funswitch-loops' and `-fgcse-after-reload' options.
`-O0'
Do not optimize. This is the default.
#5
下面具体介绍优化选项的东西过长,不贴了。
优化的肯定是目标代码,但有些优化可能是有代价的,再仔细查查看……
优化的肯定是目标代码,但有些优化可能是有代价的,再仔细查查看……
#6
唉~如果我的英文足够好的话,我就man,不用在这里问了。虽然没烦性啃下上边的英文,但还是谢谢milksea