Re: issue with clang and CPUTYPE native

2010-12-30 Thread Alexander Best
On Thu Dec 30 10, Roman Divacky wrote:
 On Thu, Dec 30, 2010 at 12:20:33AM +, Alexander Best wrote:
  On Tue Dec 28 10, Roman Divacky wrote:
   -march=native in clang works by detecting CPU name
   and passing it (if found) to llvm. if the CPU is not
   detected nothing is passed.
   
   nocona is supported
   
   ie. leaving the CPUNAME empty or specifying it to nocona should
   be equivalent to setting it to native.
   
   
   can you apply this patch:
   
   Index: Driver/Tools.cpp
   ===
   --- Driver/Tools.cpp  (revision 122591)
   +++ Driver/Tools.cpp  (working copy)
   @@ -684,6 +684,7 @@
  // FIXME: We should also incorporate the detected target features 
   for use
  // with -native.
  std::string CPU = llvm::sys::getHostCPUName();
   +  llvm::outs()  detected CPU =   CPU  \n;
  if (!CPU.empty())
CPUName = Args.MakeArgString(CPU);
} else
  
  thanks a lot for the patch. i've applied it, but am not sure how to only
  compile clang. 'make' in usr.bin/clang fails. do i have to run target
  buildworld  or is there a way to only build clang?
 
 I would guess that cd lib/clang  make  cd ../../usr.bin/clang  make
 should work, if not - full buildworld is necessary I guess

thanks. that worked. this is what clang detects as my cpu:

-march=native

this the dmesg output:

CPU: Intel(R) Pentium(R) Dual  CPU  E2160  @ 1.80GHz (2394.05-MHz K8-class CPU)
  Origin = GenuineIntel  Id = 0x6fd  Family = 6  Model = f  Stepping = 13
  
Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE
  Features2=0xe39dSSE3,DTES64,MON,DS_CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM
  AMD Features=0x20100800SYSCALL,NX,LM
  AMD Features2=0x1LAHF
  TSC: P-state invariant

cheers.
alex

-- 
a13x
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: issue with clang and CPUTYPE native

2010-12-30 Thread Alexander Best
On Thu Dec 30 10, Roman Divacky wrote:
 On Thu, Dec 30, 2010 at 06:40:48PM +, Alexander Best wrote:
  On Thu Dec 30 10, Roman Divacky wrote:
   On Thu, Dec 30, 2010 at 12:20:33AM +, Alexander Best wrote:
On Tue Dec 28 10, Roman Divacky wrote:
 -march=native in clang works by detecting CPU name
 and passing it (if found) to llvm. if the CPU is not
 detected nothing is passed.
 
 nocona is supported
 
 ie. leaving the CPUNAME empty or specifying it to nocona should
 be equivalent to setting it to native.
 
 
 can you apply this patch:
 
 Index: Driver/Tools.cpp
 ===
 --- Driver/Tools.cpp  (revision 122591)
 +++ Driver/Tools.cpp  (working copy)
 @@ -684,6 +684,7 @@
// FIXME: We should also incorporate the detected target 
 features for use
// with -native.
std::string CPU = llvm::sys::getHostCPUName();
 +  llvm::outs()  detected CPU =   CPU  \n;
if (!CPU.empty())
  CPUName = Args.MakeArgString(CPU);
  } else

thanks a lot for the patch. i've applied it, but am not sure how to only
compile clang. 'make' in usr.bin/clang fails. do i have to run target
buildworld  or is there a way to only build clang?
   
   I would guess that cd lib/clang  make  cd ../../usr.bin/clang  make
   should work, if not - full buildworld is necessary I guess
  
  thanks. that worked. this is what clang detects as my cpu:
  
  -march=native
 
 hm? are you sure it wrote -march=native? it should have written

oh sorry. i copypasted the wrong line. :(

detected CPU = core2

 
 detected CPU = something

-- 
a13x
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: issue with clang and CPUTYPE native

2010-12-30 Thread Roman Divacky
On Thu, Dec 30, 2010 at 06:46:16PM +, Alexander Best wrote:
 On Thu Dec 30 10, Roman Divacky wrote:
  On Thu, Dec 30, 2010 at 06:40:48PM +, Alexander Best wrote:
   On Thu Dec 30 10, Roman Divacky wrote:
On Thu, Dec 30, 2010 at 12:20:33AM +, Alexander Best wrote:
 On Tue Dec 28 10, Roman Divacky wrote:
  -march=native in clang works by detecting CPU name
  and passing it (if found) to llvm. if the CPU is not
  detected nothing is passed.
  
  nocona is supported
  
  ie. leaving the CPUNAME empty or specifying it to nocona should
  be equivalent to setting it to native.
  
  
  can you apply this patch:
  
  Index: Driver/Tools.cpp
  ===
  --- Driver/Tools.cpp(revision 122591)
  +++ Driver/Tools.cpp(working copy)
  @@ -684,6 +684,7 @@
 // FIXME: We should also incorporate the detected target 
  features for use
 // with -native.
 std::string CPU = llvm::sys::getHostCPUName();
  +  llvm::outs()  detected CPU =   CPU  \n;
 if (!CPU.empty())
   CPUName = Args.MakeArgString(CPU);
   } else
 
 thanks a lot for the patch. i've applied it, but am not sure how to 
 only
 compile clang. 'make' in usr.bin/clang fails. do i have to run target
 buildworld  or is there a way to only build clang?

I would guess that cd lib/clang  make  cd ../../usr.bin/clang  
make
should work, if not - full buildworld is necessary I guess
   
   thanks. that worked. this is what clang detects as my cpu:
   
   -march=native
  
  hm? are you sure it wrote -march=native? it should have written
 
 oh sorry. i copypasted the wrong line. :(
 
 detected CPU = core2

yes, you have core2, maybe thats why using CPU=nocona is causing you problems?
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org


Re: issue with clang and CPUTYPE native

2010-12-30 Thread Alexander Best
On Thu Dec 30 10, Roman Divacky wrote:
 On Thu, Dec 30, 2010 at 06:46:16PM +, Alexander Best wrote:
  On Thu Dec 30 10, Roman Divacky wrote:
   On Thu, Dec 30, 2010 at 06:40:48PM +, Alexander Best wrote:
On Thu Dec 30 10, Roman Divacky wrote:
 On Thu, Dec 30, 2010 at 12:20:33AM +, Alexander Best wrote:
  On Tue Dec 28 10, Roman Divacky wrote:
   -march=native in clang works by detecting CPU name
   and passing it (if found) to llvm. if the CPU is not
   detected nothing is passed.
   
   nocona is supported
   
   ie. leaving the CPUNAME empty or specifying it to nocona should
   be equivalent to setting it to native.
   
   
   can you apply this patch:
   
   Index: Driver/Tools.cpp
   ===
   --- Driver/Tools.cpp  (revision 122591)
   +++ Driver/Tools.cpp  (working copy)
   @@ -684,6 +684,7 @@
  // FIXME: We should also incorporate the detected target 
   features for use
  // with -native.
  std::string CPU = llvm::sys::getHostCPUName();
   +  llvm::outs()  detected CPU =   CPU  \n;
  if (!CPU.empty())
CPUName = Args.MakeArgString(CPU);
} else
  
  thanks a lot for the patch. i've applied it, but am not sure how to 
  only
  compile clang. 'make' in usr.bin/clang fails. do i have to run 
  target
  buildworld  or is there a way to only build clang?
 
 I would guess that cd lib/clang  make  cd ../../usr.bin/clang  
 make
 should work, if not - full buildworld is necessary I guess

thanks. that worked. this is what clang detects as my cpu:

-march=native
   
   hm? are you sure it wrote -march=native? it should have written
  
  oh sorry. i copypasted the wrong line. :(
  
  detected CPU = core2
 
 yes, you have core2, maybe thats why using CPU=nocona is causing you problems?

CPU=nocona *isn't* causing problems. CPU=native is causing the problems.

core2 is wrong imo. have a look at share/mk/bsd.cpu.mk for amd64. it sets core2
to nocona. so clang should detect nocona for CPU=native and *not* core2.

however i'll try to run buildworld again with the patched clang to completely
pinpoint the problem.

cheers.
alex


-- 
a13x
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to freebsd-toolchain-unsubscr...@freebsd.org