compilation flags

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

compilation flags

Luiz Henrique de Figueiredo
The Makefile in the Lua tarball contains targets for specific
platforms. It also is committed to gcc. Therefore, we could use better
compilation flags, at least for some platforms. In particular, adding
-march=native seems desirable and could boost performance at no cost.
What other compilation flags could be used, especially for linux and
macosx?

Reply | Threaded
Open this post in threaded view
|

Re: compilation flags

Jay Carlson
On 2018-12-11, at 11:58 AM, Luiz Henrique de Figueiredo <[hidden email]> wrote:

> The Makefile in the Lua tarball contains targets for specific
> platforms. It also is committed to gcc. Therefore, we could use better
> compilation flags, at least for some platforms. In particular, adding
> -march=native seems desirable and could boost performance at no cost.
> What other compilation flags could be used, especially for linux and
> macosx?

Only if the person compiling *does not intend to distribute*. I can go hunting for options for non-distributors if you think that's useful.

For people who are going to distribute, I would be very, very reluctant to implicitly tie the results of compilation to the nature of the machine being built on. If my build machine is an i7-4770K:

>      'haswell'
>           Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
>           SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
>           PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
>           set support.

but some of the machines my users have Intel Atom Zs:

>      'bonnell'
>           Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
>           SSE2, SSE3 and SSSE3 instruction set support.

...I could get illegal instruction traps, and tear my hair out...until I think to try doing my builds on those Atom machines.

You could use -mtune=native safely, but in principle you get the same problem: hidden dependency on build machine. This drives build engineers crazy.

--
Jay
Reply | Threaded
Open this post in threaded view
|

Re: compilation flags

eugeny gladkih-2
In reply to this post by Luiz Henrique de Figueiredo
11.12.2018 19:58, Luiz Henrique de Figueiredo пишет:
> The Makefile in the Lua tarball contains targets for specific
> platforms. It also is committed to gcc. Therefore, we could use better
> compilation flags, at least for some platforms. In particular, adding
> -march=native seems desirable and could boost performance at no cost.
> What other compilation flags could be used, especially for linux and
> macosx?
-flto