make.conf CFLAGS

In my make.conf, if I add
Code:
CFLAGS-= -O2
CFLAGS+= -O3
and then I compile a port, I end up with cc -O2 -pipe -O3. How do I get rid of the -O2? and will Clang and/or GCC "pay attention" to the -O2 or the -O3 if they're both there?
 
-O3 includes-O2 and adds more optimizations, so it doesn't matter. That said, you usually shouldn't set any CFLAGS, unless you're prepared for strange errors since that will interfere with a port's own optimizations. You can, however, set CPUTYPE.
 
My issue is I'm trying to get things to compile and utilize my AMD FX's feature set but Clang seems to ignore -mxop, -mpopcnt, even the SSE's and SSE3, unless the SSE and other multimedia features are made up of numerous instructions. However, my CPU type is recognized as HAMMER, if I set that, I definitely won't be getting all of my processor's new features, so I've used, for some time, CFLAGS as an alternative to CPUTYPE manually adding the features shown below

cat /var/run/dmesg.boot | grep Features
Code:
Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x3e98320b<SSE3,PCLMULQDQ,MON,SSSE3,FMA,CX16,SSE4.1,SSE4.2,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x1ebbfff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,XOP,SKINIT,WDT,LWP,FMA4,TCE,NodeId,TBM,Topology,PCXC,PNXC>

I'm well aware of what setting -O3 will do, but I've also thought about clang's link time optimizations (-04), they may be safer and better.

Anyway, objdump -d seems to not show any of these instructions used (except in some sample code another member wrote that was specifically written to require popcnt. Kind of frustrating.
 
Back
Top