GCC recommendations and options for fastest code

前端 未结 7 1480
野趣味
野趣味 2020-12-23 18:34

I\'m distributing a C++ program with a makefile for the Unix version, and I\'m wondering what compiler options I should use to get the fastest possible code (it falls into t

7条回答
  •  -上瘾入骨i
    2020-12-23 19:00

    -oFast


    Please try -oFast instead of -o3

    Also here is a list of flags you might want to selectively enable.

    -ffloat-store

    -fexcess-precision=style

    -ffast-math

    -fno-rounding-math

    -fno-signaling-nans

    -fcx-limited-range

    -fno-math-errno

    -funsafe-math-optimizations

    -fassociative-math

    -freciprocal-math

    -ffinite-math-only

    -fno-signed-zeros

    -fno-trapping-math

    -frounding-math

    -fsingle-precision-constant

    -fcx-fortran-rules

    A complete list of the flags and their detailed description is available here

提交回复
热议问题