- Add Silvermont (--cpu=slm) option for llvm 3.4+.

- Change default Sandybridge isa name to avx1-i32x8 from avx-i32x8,
  to conform with replacement of avx-i32x8 by avx1-i32x8 everywhere else.
- Add "target-cpu" attribute, when using AttrBuilder, to correct a problem
  whereby llvm would switch from the command line cpu setting
  to the native (auto-detected) cpu setting on second and subsequent
  functions. e.g. if I wanted to build for Silvermont on a Sandy Bridge
  machine, ispc/llvm would correctly use Silvermont and turn on the
  Silvermont scheduler. For the second and subsequent functions,
  it would auto-detect Sandy Bridge, but still run the Silvermont
  scheduler.
This commit is contained in:
Preston Gurd
2013-09-20 14:42:46 -04:00
parent 0647c02561
commit 9e0e9dbecc

View File

@@ -126,7 +126,7 @@ lGetSystemISA() {
return "avx1.1-i32x8";
}
// Regular AVX
return "avx-i32x8";
return "avx1-i32x8";
}
else if ((info[2] & (1 << 19)) != 0)
return "sse4-i32x4";
@@ -149,8 +149,11 @@ static const char *supportedCPUs[] = {
#endif
"atom", "penryn", "core2", "corei7", "corei7-avx"
#if !defined(LLVM_3_1)
, "core-avx-i", "core-avx2"
, "core-avx-i", "core-avx2", "slm"
#endif // LLVM 3.2+
#if !defined(LLVM_3_1) && !defined(LLVM_3_2) && !defined(LLVM_3_3)
, "slm"
#endif // LLVM 3.4+
};
Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
@@ -196,9 +199,10 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
isa = "avx1.1-i32x8";
else if (!strcmp(cpu, "sandybridge") ||
!strcmp(cpu, "corei7-avx"))
isa = "avx-i32x8";
isa = "avx1-i32x8";
else if (!strcmp(cpu, "corei7") ||
!strcmp(cpu, "penryn"))
!strcmp(cpu, "penryn") ||
!strcmp(cpu, "slm"))
isa = "sse4-i32x4";
else
isa = "sse2-i32x4";
@@ -660,6 +664,7 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic) :
// Initialize target-specific "target-feature" attribute.
if (!m_attributes.empty()) {
llvm::AttrBuilder attrBuilder;
attrBuilder.addAttribute("target-cpu", this->m_cpu);
attrBuilder.addAttribute("target-features", this->m_attributes);
this->m_tf_attributes = new llvm::AttributeSet(
llvm::AttributeSet::get(