[Mesa-dev] [PATCH v2] replace file specific compiler optimization withinline attibute

Marc Dietrich marvin24 at gmx.de
Thu Sep 25 00:56:42 PDT 2014


Am Mittwoch, 24. September 2014, 18:35:24 schrieb Matt Turner:
> On Wed, Sep 24, 2014 at 6:25 AM, Marc Dietrich <marvin24 at gmx.de> wrote:
> > Am Montag, 22. September 2014, 11:48:29 schrieb Matt Turner:
> >> We need a configure check for support for __attribute__((target)). I'm
> >> going to send a series that adds support for this (and does the check
> >> for existing attribute uses, so once that goes in you can rebase this
> >> patch on that).
> > 
> > nice, but won't work with the workaround above. Pragma and attribute does
> > the same so, we could check for the attribute and use the pragma instead.
> 
> I wonder if the best thing to do is to add target("sse4.1") in
> addition to using -msse4.1. That way, we'll retain compatibility with

The idea of this patch was to remove per file optimization flags because this 
breaks LTO. LTO will recompile all files during the final link and apply any
"high-level" compiler flags from a single file (e.g. -msse4.1) to all files 
used in the linking process.

> clang (and gcc-4.3, but who cares?) and we'll mark the function with
> enough information for LTO to work.

A workaround would be to add -msse4.1 only for clang, but that looks a bit 
hackish to me. Also clang can use LTO (with -O4 or -flto) and will likely
break the same way as gcc if enabled.

IMHO, we should just disable vector optimizations for clang until it supports
per function optimization. At least it seems work is ongoing to support this:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-April/061527.html

Marc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140925/87ff6c0b/attachment.sig>


More information about the mesa-dev mailing list