Date: Sat, 11 Jun 2011 06:05:00 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r222976 - in projects/llvm-ia64/contrib/llvm/lib: Support Target/IA64 Message-ID: <201106110605.p5B650SC061014@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sat Jun 11 06:05:00 2011 New Revision: 222976 URL: http://svn.freebsd.org/changeset/base/222976 Log: o Implement sys::getHostCPUName() when ia64 is the host. o Have the Subtarget constructor call sys::getHostCPUName() when running natively to determine the default CPU. o Default to mckinley for cross-compilation. o Define long branch as a feature and list it under mckinley. This should be enough to play with subtargets, features, etc in a minimal form. Modified: projects/llvm-ia64/contrib/llvm/lib/Support/Host.cpp projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.cpp projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.h Modified: projects/llvm-ia64/contrib/llvm/lib/Support/Host.cpp ============================================================================== --- projects/llvm-ia64/contrib/llvm/lib/Support/Host.cpp Sat Jun 11 04:59:01 2011 (r222975) +++ projects/llvm-ia64/contrib/llvm/lib/Support/Host.cpp Sat Jun 11 06:05:00 2011 (r222976) @@ -298,6 +298,44 @@ std::string sys::getHostCPUName() { } return "generic"; } +#elif defined(__ia64__) +std::string sys::getHostCPUName() { + unsigned long id3; + unsigned char family, model; + + __asm __volatile("mov %0 = cpuid[%1]" : "=r"(id3) : "r"(3)); + model = id3 >> 16; + family = id3 >> 24; + + switch (family) { + case 0x07: // Itanium + // There has only been 1 CPU implementation in this family. + return "merced"; + + case 0x1f: // Itanium 2 + // We don't distinguish between Madison and Madison 2 (aka + // Madison 9M). Maybe we should? + switch (model) { + case 0x00: + return "mckinley"; + case 0x01: // Madison & Deerfield + case 0x02: // Madison 2 (aka Madison 9M) + return "madison"; + } + + case 0x20: // Itanium 2 multi-core + switch (model) { + case 0x00: + return "montecito"; + case 0x01: + return "montvale"; + } + } + // XXX where does Tukwila go? + + // Fall back to a generic Itanium 2 implementation. + return "itanium2"; +} #else std::string sys::getHostCPUName() { return "generic"; Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td ============================================================================== --- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td Sat Jun 11 04:59:01 2011 (r222975) +++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64.td Sat Jun 11 06:05:00 2011 (r222976) @@ -6,8 +6,12 @@ include "llvm/Target/Target.td" class IA64Impl<string name, list<SubtargetFeature> features> : Processor<name, NoItineraries, features>; +def FeatureLongBranch : + SubtargetFeature<"lb", "HasLongBranch", "true", + "Enable the long branch instruction">; + def : IA64Impl<"merced", []>; -def : IA64Impl<"mckinley", []>; +def : IA64Impl<"mckinley", [FeatureLongBranch]>; // // Registers Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.cpp ============================================================================== --- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.cpp Sat Jun 11 04:59:01 2011 (r222975) +++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.cpp Sat Jun 11 06:05:00 2011 (r222976) @@ -5,8 +5,13 @@ using namespace llvm; -IA64Subtarget::IA64Subtarget(const std::string &TT, const std::string &FS) { - std::string CPU = "generic"; +IA64Subtarget::IA64Subtarget(const std::string &TT, const std::string &FS) +{ +#if defined(__ia64__) + std::string CPU = sys::getHostCPUName(); +#else + std::string CPU = "mckinley"; +#endif // Parse features string. ParseSubtargetFeatures(FS, CPU); Modified: projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.h ============================================================================== --- projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.h Sat Jun 11 04:59:01 2011 (r222975) +++ projects/llvm-ia64/contrib/llvm/lib/Target/IA64/IA64Subtarget.h Sat Jun 11 06:05:00 2011 (r222976) @@ -8,7 +8,7 @@ namespace llvm { class IA64Subtarget : public TargetSubtarget { - bool ExtendedInsts; + bool HasLongBranch; public: /// This constructor initializes the data members to match that
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106110605.p5B650SC061014>