Clang/LLVM and /etc/make.conf

nackpere

New Member

Reaction score: 4
Messages: 11

I have a question about Clang/LLVM and the /etc/make.conf file, specifically which CPUTYPE and CFLAGS Clang/LLVM recognize, at least beyond those recognized by the default GCC4.2.1. It is my understanding from doing various searches that Clang does identify the flags in /etc/make.conf. However, I have not been able to find anything on what CPUTYPE or CFLAGS are supported (either in the forums or at the Clang and LLVM websites).

For example, I have a FreeBSD 8.1-RELEASE amd64 machine running on an AMD Athlon II X4 630 processor. I know that in GCC4.4+ the CPUTYPE flag for this processor is 'amdfam10' and that CFLAGS for newer processor features like SSE4A are available. However, I want to know what Clang/LLVM support for my CPU. Thanks in advance for your help.
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,789
Messages: 11,281

Clang/LLVM has not really permeated these forums yet ;) I advise you to take a look at http://wiki.freebsd.org/BuildingFreeBSDWithClang - there are some people and IRC channels mentioned there that may provide access to documentation dealing with specific build flags and targets. And since Clang/LLVM is really only used experimentally in -CURRENT (afaik), @freebsd-current may prove helpful as well -> you will find a lot of Clang activity starting in June.
 
OP
OP
N

nackpere

New Member

Reaction score: 4
Messages: 11

So, after some looking through the LLVM source code (/lib/Target/X86/X86.td), I found the answer to my question. It lists the processors supported as well as the features supported by each.
Code:
//===----------------------------------------------------------------------===//
// X86 processors supported.
//===----------------------------------------------------------------------===//

class Proc<string Name, list<SubtargetFeature> Features>
 : Processor<Name, NoItineraries, Features>;

def : Proc<"generic",         []>;
def : Proc<"i386",            []>;
def : Proc<"i486",            []>;
def : Proc<"i586",            []>;
def : Proc<"pentium",         []>;
def : Proc<"pentium-mmx",     [FeatureMMX]>;
def : Proc<"i686",            []>;
def : Proc<"pentiumpro",      [FeatureCMOV]>;
def : Proc<"pentium2",        [FeatureMMX, FeatureCMOV]>;
def : Proc<"pentium3",        [FeatureSSE1]>;
def : Proc<"pentium-m",       [FeatureSSE2, FeatureSlowBTMem]>;
def : Proc<"pentium4",        [FeatureSSE2]>;
def : Proc<"x86-64",          [FeatureSSE2,   Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"yonah",           [FeatureSSE3, FeatureSlowBTMem]>;
def : Proc<"prescott",        [FeatureSSE3, FeatureSlowBTMem]>;
def : Proc<"nocona",          [FeatureSSE3,   Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"core2",           [FeatureSSSE3,  Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"penryn",          [FeatureSSE41,  Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"atom",            [FeatureSSE3,   Feature64Bit, FeatureSlowBTMem]>;
// "Arrandale" along with corei3 and corei5
def : Proc<"corei7",          [FeatureSSE42,  Feature64Bit, FeatureSlowBTMem,
                               FeatureFastUAMem, FeatureAES]>;
def : Proc<"nehalem",         [FeatureSSE42,  Feature64Bit, FeatureSlowBTMem,
                               FeatureFastUAMem]>;
// Westmere is a similar machine to nehalem with some additional features.
// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
def : Proc<"westmere",         [FeatureSSE42,  Feature64Bit, FeatureSlowBTMem,
                                FeatureFastUAMem, FeatureAES]>;
// Sandy Bridge does not have FMA
// FIXME: Wikipedia says it does... it should have AES as well.
def : Proc<"sandybridge",     [FeatureSSE42,  FeatureAVX,   Feature64Bit]>;

def : Proc<"k6",              [FeatureMMX]>;
def : Proc<"k6-2",            [FeatureMMX,    Feature3DNow]>;
def : Proc<"k6-3",            [FeatureMMX,    Feature3DNow]>;
def : Proc<"athlon",          [FeatureMMX,    Feature3DNowA, FeatureSlowBTMem]>;
def : Proc<"athlon-tbird",    [FeatureMMX,    Feature3DNowA, FeatureSlowBTMem]>;
def : Proc<"athlon-4",        [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
def : Proc<"athlon-xp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
def : Proc<"athlon-mp",       [FeatureSSE1,   Feature3DNowA, FeatureSlowBTMem]>;
def : Proc<"k8",              [FeatureSSE2,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"opteron",         [FeatureSSE2,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"athlon64",        [FeatureSSE2,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"athlon-fx",       [FeatureSSE2,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"k8-sse3",         [FeatureSSE3,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"opteron-sse3",    [FeatureSSE3,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"athlon64-sse3",   [FeatureSSE3,   Feature3DNowA, Feature64Bit,
                               FeatureSlowBTMem]>;
def : Proc<"amdfam10",        [FeatureSSE3,   FeatureSSE4A,
                               Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"barcelona",       [FeatureSSE3,   FeatureSSE4A,
                               Feature3DNowA, Feature64Bit, FeatureSlowBTMem]>;
def : Proc<"istanbul",        [Feature3DNowA, Feature64Bit, FeatureSSE4A,
                               Feature3DNowA]>;
def : Proc<"shanghai",        [Feature3DNowA, Feature64Bit, FeatureSSE4A,
                               Feature3DNowA]>;

def : Proc<"winchip-c6",      [FeatureMMX]>;
def : Proc<"winchip2",        [FeatureMMX, Feature3DNow]>;
def : Proc<"c3",              [FeatureMMX, Feature3DNow]>;
def : Proc<"c3-2",            [FeatureSSE1]>;
 

Ikinoki

Member


Messages: 43

Just a little Follow up
This file though doesn't contain the permitted entries for CPUTYPE...
For example westmere does not work.
But corei7 does.
Check this out, this one works
% cat /usr/src/contrib/llvm/lib/Support/Host.cpp

Also it should show that llvm and clang should autodetect the cpu.
 
Top