make.conf and AMD FX 8350

What should my CPUTYPE be set to in make.conf? According to example:
AMD64 architecture: amdfam10, opteron-sse3, athlon64-sse3, k8-sse3, opteron, athlon64, k8, core2, nocona

I had all my CFLAGS set manually but the recent ports tree upgrade seems to be ignoring them (new AMD features such as popcnt, lzcnt, maes, xop, mfma, maeb, etc.)

Should I set my CPUTYPE to amdfam10 or what? I can't figure out what flags which CPUTYPES enable anywhere. Please help, I can't rebuild kde so I'm uninstalling all software and re-installing everything and I'd like to get this fixed first.... Also /usr/ports/Mk/bsd.gcc.mk seems to have changed, I had it hacked before so that when clang wasn't being used gcc 4.8 was the default compiler.

Thanks in advance.
 
Ya that wasn't helpful. Im on 10 release. If there were never a good reason to add CFLAGS the OS wouldn't allow it. Mine are harmless and really a replacement for a proper march or CPUTYPE
 
Don't set CFLAGS unless you're a developer that knows exactly what he's doing. Overriding them may have detrimental effects and usually doesn't improve anything as the system is already set to use the most optimal settings for the various components. Setting the CPUTYPE also has very little improvements and only increases the chance of breakage. After 15 years of fiddling I came to the conclusion it's best to forget about those settings and let the system figure it out. It'll perform perfectly without mucking about with it.
 
GCC utilizes, even with -march=native all the new features of my processor... however, with clang, I cannot tell if its using -mxop, -mpopcnt etc. I agree with you, but those clever things are ensuring these are in fact being used.

Also gcc4.6 is garbage when it comes to supporrt/detection of new CPU's. I used to know how to edit bsd.gcc.mk so it always used gcc4.8 except for the ports that wouldn't compile with it (when the port Makefile had "USE_GCC=any") but the new bsd.gcc.mk format is so convoluted I haven't been able to figure that out. Any ideas anyone? And I love clang, but a lot of things don't copile, or compile as well, with it yet.

Also, universal rules are stupid, such as "DON'T SET CFLAGS." I did discover that setting CPUTYPE didn't help in my particular case, but where can I figure out what CPUTYPEs set what flags?
 
Oh, also now that gcc isn't in base, why can't we set a make.conf variable to use our own default GCC. 4.7 and 4.8 are so much better than 4.6! Every knows that!
 
Anyone? It used to be easy to modify bsd.gcc.mk but now it's been changed and I'm not sure how to get ports that have
Code:
USE_GCC=any
set in their Makefile to use 4.8. And the CFLAGS I want set are the ones gcc sets by default (the new instruction sets for my processor). I'm not setting -O3 or -ffast-math or anything like that... just -msse4.1 -msse4.2, -mxop etc.... not so much to ask for to make sure my compiler is using the "best default flags" (based on GCC's relatively consistent cross-platform performance/stability, I'm guessing if it wants to use those settings, it'd be nice if I could make clang/llvm use them by default too, and also to KNOW what flags they're setting "behind the scene" when compiling my software. These CFLAGS have been used on previous versions, compiling nearly everything with GCC 4.8, with a couple ports being forced to stay with 4.2 on FreeBSD 9. I noticed a decent improvement (really, no point in arguing about this), especially with multimedia, which I do a lot of, and my system wasn't buggy. It was quite stable.
 
ikbendeman said:
with clang, I cannot tell if its using -mxop, -mpopcnt

You could write a small test program:
Code:
% cat pctest.c 
#include <stdio.h>
#include <limits.h>

int
main(void)
{
  unsigned n = UINT_MAX;
  int c = __builtin_popcount(n);
  printf("expected: %lu\n", sizeof(n)*8);
  printf("computed: %d\n", c);
  return 0;
}

% clang --version
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd9.2
Thread model: posix

% clang               -Weverything -Werror pctest.c -o pc && objdump -d pc | grep popcnt || echo meh...
meh...
% clang -march=native -Weverything -Werror pctest.c -o pc && objdump -d pc | grep popcnt || echo meh...
  40060b:       f3 0f b8 c0             popcnt %eax,%eax
%

Or build a test kernel with -march=$whatever and check the disassembly:
Code:
% objdump -d kernel | grep popcnt
ffffffffxxxxxxxx:       f3 48 0f b8 4d b8       popcnt -0x48(%rbp),%rcx
ffffffffxxxxxxxx:       f3 48 0f b8 55 b0       popcnt -0x50(%rbp),%rdx
ffffffffxxxxxxxx:       f3 48 0f b8 4d a8       popcnt -0x58(%rbp),%rcx
%
 
Back
Top