amd64 arch and sse optimization

Felipe Sateler fsateler at debian.org
Mon Feb 3 15:43:15 UTC 2014


On Mon, Feb 3, 2014 at 12:36 PM, Reinhard Tartler <siretart at gmail.com> wrote:
> On Mon, Feb 3, 2014 at 9:02 AM, Fabian Greffrath <fabian at greffrath.com> wrote:
>> Am Montag, den 03.02.2014, 10:41 -0300 schrieb Felipe Sateler:
>>> I have some packages that also add (on amd64 and i386) -mtune=generic.
>>> This causes the compiler to optimize for the most common cpus, but
>>> still be compatible with older ones.
>>
>> Isn't GCC smart enough to know that it can use SSE optimizations on
>> amd64?
>
> I strongly believe it is, if GCC was not, then it should be fixed.

Indeed, that should be the correct solution.

>
> Please be careful with adding those flags. They instruct gcc to emit
> code that does not work on some machines. The admitedlyonly way to use
> them correctly is to ensure that the emitted code is only used on
> machines that actually supports that.

The mtune flag instructs the compiler to optimize for a certain
instruction set, but still provide a fallback for when the instrucions
are not available. I don't know if this includes the use of SSE or
other coprocessor.

http://stackoverflow.com/questions/10559275/gcc-how-is-march-different-from-mtune

>
> We've been burned with that previously. In Libav, we're installing the
> libraries into special "magic" paths that the dynamic linker only
> includes if the hardware is capable. This works only on libraries, but
> not for programs (and there are still open bugs for that, for instance
> with mplayer/mplayer2 and possibly mpv, all for powerpc, admittedly).
>
> If you are unsure on those flags, better not enable them.

I think sse is required by the amd64 spec, so no point in not using it
(wikipedia agrees).



-- 

Saludos,
Felipe Sateler



More information about the pkg-multimedia-maintainers mailing list