~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to lib/Support/Host.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
#endif
113
113
}
114
114
 
115
 
static bool OSHasAVXSupport() {
116
 
#if defined(__GNUC__)
117
 
  // Check xgetbv; this uses a .byte sequence instead of the instruction 
118
 
  // directly because older assemblers do not include support for xgetbv and 
119
 
  // there is no easy way to conditionally compile based on the assembler used.
120
 
  int rEAX, rEDX;
121
 
  __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
122
 
#elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219
123
 
  unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
124
 
#else
125
 
  int rEAX = 0; // Ensures we return false
126
 
#endif
127
 
  return (rEAX & 6) == 6;
 
115
static bool OSHasAVXSupport() {
 
116
#if defined(__GNUC__)
 
117
  // Check xgetbv; this uses a .byte sequence instead of the instruction
 
118
  // directly because older assemblers do not include support for xgetbv and
 
119
  // there is no easy way to conditionally compile based on the assembler used.
 
120
  int rEAX, rEDX;
 
121
  __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
 
122
#elif defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
 
123
  unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
 
124
#else
 
125
  int rEAX = 0; // Ensures we return false
 
126
#endif
 
127
  return (rEAX & 6) == 6;
128
128
}
129
129
 
130
130
static void DetectX86FamilyModel(unsigned EAX, unsigned &Family,
355
355
      case 20:
356
356
        return "btver1";
357
357
      case 21:
358
 
        if (Model <= 15)
359
 
          return "bdver1";
360
 
        else if (Model <= 31)
 
358
        if (!HasAVX) // If the OS doesn't support AVX provide a sane fallback.
 
359
          return "btver1";
 
360
        if (Model > 15 && Model <= 31)
361
361
          return "bdver2";
 
362
        return "bdver1";
 
363
      case 22:
 
364
        if (!HasAVX) // If the OS doesn't support AVX provide a sane fallback.
 
365
          return "btver1";
 
366
        return "btver2";
362
367
    default:
363
368
      return "generic";
364
369
    }
608
613
#endif
609
614
 
610
615
std::string sys::getProcessTriple() {
611
 
  Triple PT(LLVM_HOSTTRIPLE);
 
616
  Triple PT(LLVM_HOST_TRIPLE);
612
617
 
613
618
  if (sizeof(void *) == 8 && PT.isArch32Bit())
614
619
    PT = PT.get64BitArchVariant();