From: Eitan Adler on
I'd like to add a flag to tell ports that you are building only for
yourself that and optimizations that typically are not enabled could
be turned on.
The first two that come to mind are -mtune=native and -march=native.
Ports would be able to add more flags as needed. This could allow
ports to optimize themselves to the architecture they on without
losing the ability to cross build or have build clusters.

--- old.port.mk 2010-06-27 23:01:04.000000000 -0400
+++ bsd.port.mk 2010-06-27 23:05:16.000000000 -0400
@@ -2282,6 +2282,10 @@
.endif
.endif

+.if defined (ONLY_FOR_SELF)
+CFLAGS += -mtune=native -march=native -mcpu=native
+.endif
+
.if defined(USE_CSTD)
CFLAGS:= ${CFLAGS:N-std=*} -std=${USE_CSTD}
.endif


--
Eitan Adler
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Anonymous on
Eitan Adler <lists(a)eitanadler.com> writes:

> I'd like to add a flag to tell ports that you are building only for
> yourself that and optimizations that typically are not enabled could
> be turned on.

There is already MACHINE_CPU. Depending on CPUTYPE it's set to supported
SIMD instructions. But it doesn't recognize CPUTYPE=native currently.
Until conf/112997 is resolved you can add smth like this to make.conf

CPUTYPE ?= native
MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE} - </dev/null 2>&1 \
| awk '/SSE|MMX/ && !/MATH/ { FS="__"; gsub("_",".",$$2); print tolower($$2) }'

Then you can start adding in your port (ex. for multimedia/mplayer)

.if ${MACHINE_CPU:Mssse3}
CONFIGURE_ARGS += --enable-ssse3
.else
CONFIGURE_ARGS += --disable-ssse3
.endif

> The first two that come to mind are -mtune=native and -march=native.

_CPUCFLAGS are set by CPUTYPE.

$ make -V CPUTYPE
native
$ make -V _CPUCFLAGS
-march=native
$ make -V MACHINE_CPU
amd64 sse4.1 mmx sse2 ssse3 sse sse3 amd64 sse2 sse mmx

Besides, gcc(1) says

-march=cpu-type
Generate instructions for the machine type cpu-type. The choices
for cpu-type are the same as for -mtune. Moreover, specifying
-march=cpu-type implies -mtune=cpu-type.

-mcpu=cpu-type
A deprecated synonym for -mtune.

So, you don't need -mtune and -mcpu.

> Ports would be able to add more flags as needed. This could allow
> ports to optimize themselves to the architecture they on without
> losing the ability to cross build or have build clusters.

Any case where it would be useful besides -march/-mtune/-mmmx/-msse*?
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Eitan Adler on
> Any case where it would be useful besides -march/-mtune/-mmmx/-msse*?
>
Not that I could think of at the moment. I think this solution works better.



--
Eitan Adler
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: RW on
On Sun, 27 Jun 2010 23:09:47 -0400
Eitan Adler <lists(a)eitanadler.com> wrote:

> I'd like to add a flag to tell ports that you are building only for
> yourself that and optimizations that typically are not enabled could
> be turned on.

You can do this yourself. If you add in make.conf something like

..if defined(BUILD_FOR_SELF)
CPUTYPE?= athlon64
..endif




# cd /ports/www/squid

# make -V CFLAGS
-O2 -pipe -fno-strict-aliasing

# setenv BUILD_FOR_SELF yes

# make -V CFLAGS
-O2 -pipe -march=athlon-mp -fno-strict-aliasing
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"