[cfe-dev] clang driver defaults to -mcpu=pentium4, why?
Roman Divacky
rdivacky at freebsd.org
Mon May 18 05:33:21 PDT 2009
On Mon, May 18, 2009 at 01:50:12AM -0700, Daniel Dunbar wrote:
> On Mon, May 18, 2009 at 1:35 AM, Roman Divacky <rdivacky at freebsd.org> wrote:
> > hi
> >
> > as $subj says, clang defaults to -mcpu=pentium4 for i386 arch. I wonder why.
> > llvm provides autodetection of the current CPU. wouldnt that be more sane
> > default?
>
> Maybe, maybe not. Chris and I have argued back and forth about this topic... :)
>
> The traditional gcc behavior is to be very conservative in choosing
> the default arch. This has the upside that programs are more portable,
> and the downside that they are slower.
>
> Given the traditional gcc behavior, my personal feeling is that
> changing the default to be the active CPU is risky. Developers may end
> up distributing a binary they think is portable, but isn't, which will
> be very confusing if it only fails in some corner case where a new
> instruction was used.
>
> On the other hand, its probably true that most compiler code is made
> for the machine it is run on, or when it is being built for
> distribution the architecture is already forced.
>
> I'm open to being convinced that -march=native is the correct default...
I am ok with whatever is the default
> > also, how can I enable the "build for my native cpu" now?
>
> It should be with "-march=native", but this is not yet implemented in
> the clang Driver. Patches/bugzillas welcome! :)
ok... I'll file a bugzilla (no energy for patches these days)
thnx!
More information about the cfe-dev
mailing list