|Posted by David Nadlinger|
in reply to Mikko Ronkainen
Posted in reply to Mikko Ronkainen
On Thursday, 19 December 2013 at 23:28:50 UTC, Mikko Ronkainen wrote:
> Do -m32/m64 just mean -march=x86/x86-64? Or do they something else too?
They generally switch between 32/64 bit subtargets for different processor families, not just x86. But yes, they just set the general target architecture. For the default -mcpu settings this implies on the various operating systems, see: https://github.com/ldc-developers/ldc/blob/master/driver/targetmachine.cpp#L30
> To create a generic 32-bit program, are these sane choices:
> -m32 -mcpu=i686 -mattr=sse2 ?
Depends on what level of backward-compatibility you need. All 64 bit processors support SSE2 (which is why it is enabled by default there).
> And with 64-bit:
> -m64 -mcpu=x86_64 -mattr=avx ?
> Not sure about the avx though, doesn't seem to help my program anymore than sse2.
You definitely can't expect 64 bit machines out in the wild to have AVX yet. For example, the Core i7 in the mid-2010 MacBook Pro I'm typing this message on doesn't support it.
On the other hand, if you want to compile your program only for a few machines with similar processors you control, you could also try using -mcpu=native to let LDC auto-detect the available features.