r326254 - AMDGPU: Define FP_FAST_FMA{F} macros for amdgcn
Konstantin Zhuravlyov via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 27 13:48:05 PST 2018
Author: kzhuravl
Date: Tue Feb 27 13:48:05 2018
New Revision: 326254
URL: http://llvm.org/viewvc/llvm-project?rev=326254&view=rev
Log:
AMDGPU: Define FP_FAST_FMA{F} macros for amdgcn
- Expand GK_*s (i.e. GFX6 -> GFX600, GFX601, etc.)
- This allows us to choose features correctly in some cases (for example, fast fmaf is available on gfx600, but not gfx601)
- Move HasFMAF, HasFP64, HasLDEXPF to GPUInfo tables
- Add HasFastFMA, HasFastFMAF to GPUInfo tables
- Add missing tests
Modified:
cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
cfe/trunk/lib/Basic/Targets/AMDGPU.h
cfe/trunk/test/Driver/amdgpu-macros.cl
cfe/trunk/test/Misc/target-invalid-cpu-note.c
Modified: cfe/trunk/lib/Basic/Targets/AMDGPU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AMDGPU.cpp?rev=326254&r1=326253&r2=326254&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/AMDGPU.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AMDGPU.cpp Tue Feb 27 13:48:05 2018
@@ -157,49 +157,62 @@ bool AMDGPUTargetInfo::initFeatureMap(
const std::vector<std::string> &FeatureVec) const {
// XXX - What does the member GPU mean if device name string passed here?
- if (getTriple().getArch() == llvm::Triple::amdgcn) {
+ if (isAMDGCN(getTriple())) {
if (CPU.empty())
- CPU = "tahiti";
+ CPU = "gfx600";
switch (parseAMDGCNName(CPU).Kind) {
- case GK_GFX6:
- case GK_GFX7:
- break;
-
- case GK_GFX9:
+ case GK_GFX902:
+ case GK_GFX900:
Features["gfx9-insts"] = true;
LLVM_FALLTHROUGH;
- case GK_GFX8:
- Features["s-memrealtime"] = true;
+ case GK_GFX810:
+ case GK_GFX803:
+ case GK_GFX802:
+ case GK_GFX801:
Features["16-bit-insts"] = true;
Features["dpp"] = true;
+ Features["s-memrealtime"] = true;
+ break;
+ case GK_GFX704:
+ case GK_GFX703:
+ case GK_GFX702:
+ case GK_GFX701:
+ case GK_GFX700:
+ case GK_GFX601:
+ case GK_GFX600:
break;
-
case GK_NONE:
return false;
default:
- llvm_unreachable("unhandled subtarget");
+ llvm_unreachable("Unhandled GPU!");
}
} else {
if (CPU.empty())
CPU = "r600";
switch (parseR600Name(CPU).Kind) {
- case GK_R600:
- case GK_R700:
- case GK_EVERGREEN:
- case GK_NORTHERN_ISLANDS:
- break;
- case GK_R600_DOUBLE_OPS:
- case GK_R700_DOUBLE_OPS:
- case GK_EVERGREEN_DOUBLE_OPS:
case GK_CAYMAN:
+ case GK_CYPRESS:
+ case GK_RV770:
+ case GK_RV670:
// TODO: Add fp64 when implemented.
break;
- case GK_NONE:
- return false;
+ case GK_TURKS:
+ case GK_CAICOS:
+ case GK_BARTS:
+ case GK_SUMO:
+ case GK_REDWOOD:
+ case GK_JUNIPER:
+ case GK_CEDAR:
+ case GK_RV730:
+ case GK_RV710:
+ case GK_RS880:
+ case GK_R630:
+ case GK_R600:
+ break;
default:
- llvm_unreachable("unhandled subtarget");
+ llvm_unreachable("Unhandled GPU!");
}
}
@@ -210,6 +223,7 @@ void AMDGPUTargetInfo::adjustTargetOptio
TargetOptions &TargetOpts) const {
bool hasFP32Denormals = false;
bool hasFP64Denormals = false;
+ GPUInfo CGOptsGPU = parseGPUName(TargetOpts.CPU);
for (auto &I : TargetOpts.FeaturesAsWritten) {
if (I == "+fp32-denormals" || I == "-fp32-denormals")
hasFP32Denormals = true;
@@ -218,46 +232,52 @@ void AMDGPUTargetInfo::adjustTargetOptio
}
if (!hasFP32Denormals)
TargetOpts.Features.push_back(
- (Twine(hasFullSpeedFMAF32(TargetOpts.CPU) && !CGOpts.FlushDenorm
+ (Twine(CGOptsGPU.HasFastFMAF && !CGOpts.FlushDenorm
? '+'
: '-') +
Twine("fp32-denormals"))
.str());
// Always do not flush fp64 or fp16 denorms.
- if (!hasFP64Denormals && hasFP64)
+ if (!hasFP64Denormals && CGOptsGPU.HasFP64)
TargetOpts.Features.push_back("+fp64-fp16-denormals");
}
constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::InvalidGPU;
-constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::R600Names[];
-constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::AMDGCNNames[];
+constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::R600GPUs[];
+constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::AMDGCNGPUs[];
+
AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::parseR600Name(StringRef Name) {
const auto *Result = llvm::find_if(
- R600Names, [Name](const GPUInfo &GPU) { return GPU.Name == Name; });
+ R600GPUs, [Name](const GPUInfo &GPU) { return GPU.Name == Name; });
- if (Result == std::end(R600Names))
+ if (Result == std::end(R600GPUs))
return InvalidGPU;
return *Result;
}
AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::parseAMDGCNName(StringRef Name) {
- const auto *Result =
- llvm::find_if(AMDGCNNames, [Name](const GPUInfo &GPU) {
- return GPU.Name == Name;
- });
+ const auto *Result = llvm::find_if(
+ AMDGCNGPUs, [Name](const GPUInfo &GPU) { return GPU.Name == Name; });
- if (Result == std::end(AMDGCNNames))
+ if (Result == std::end(AMDGCNGPUs))
return InvalidGPU;
return *Result;
}
+AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::parseGPUName(StringRef Name) const {
+ if (isAMDGCN(getTriple()))
+ return parseAMDGCNName(Name);
+ else
+ return parseR600Name(Name);
+}
+
void AMDGPUTargetInfo::fillValidCPUList(
SmallVectorImpl<StringRef> &Values) const {
- if (getTriple().getArch() == llvm::Triple::amdgcn)
- llvm::for_each(AMDGCNNames, [&Values](const GPUInfo &GPU) {
+ if (isAMDGCN(getTriple()))
+ llvm::for_each(AMDGCNGPUs, [&Values](const GPUInfo &GPU) {
Values.emplace_back(GPU.Name);});
else
- llvm::for_each(R600Names, [&Values](const GPUInfo &GPU) {
+ llvm::for_each(R600GPUs, [&Values](const GPUInfo &GPU) {
Values.emplace_back(GPU.Name);});
}
@@ -273,22 +293,10 @@ void AMDGPUTargetInfo::setAddressSpaceMa
AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple,
const TargetOptions &Opts)
- : TargetInfo(Triple),
- GPU(isAMDGCN(Triple) ? AMDGCNNames[0] : parseR600Name(Opts.CPU)),
- hasFP64(false), hasFMAF(false), hasLDEXPF(false),
- AS(isGenericZero(Triple)) {
- if (getTriple().getArch() == llvm::Triple::amdgcn) {
- hasFP64 = true;
- hasFMAF = true;
- hasLDEXPF = true;
- }
- if (getTriple().getArch() == llvm::Triple::r600) {
- if (GPU.Kind == GK_EVERGREEN_DOUBLE_OPS || GPU.Kind == GK_CAYMAN) {
- hasFMAF = true;
- }
- }
+ : TargetInfo(Triple), AS(isGenericZero(Triple)),
+ GPU(isAMDGCN(Triple) ? AMDGCNGPUs[0] : parseR600Name(Opts.CPU)) {
auto IsGenericZero = isGenericZero(Triple);
- resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn
+ resetDataLayout(isAMDGCN(getTriple())
? (IsGenericZero ? DataLayoutStringSIGenericIsZero
: DataLayoutStringSIPrivateIsZero)
: DataLayoutStringR600);
@@ -327,7 +335,7 @@ void AMDGPUTargetInfo::getTargetDefines(
Builder.defineMacro("__AMD__");
Builder.defineMacro("__AMDGPU__");
- if (getTriple().getArch() == llvm::Triple::amdgcn)
+ if (isAMDGCN(getTriple()))
Builder.defineMacro("__AMDGCN__");
else
Builder.defineMacro("__R600__");
@@ -335,10 +343,16 @@ void AMDGPUTargetInfo::getTargetDefines(
if (GPU.Kind != GK_NONE)
Builder.defineMacro(Twine("__") + Twine(GPU.CanonicalName) + Twine("__"));
- if (hasFMAF)
+ // TODO: __HAS_FMAF__, __HAS_LDEXPF__, __HAS_FP64__ are deprecated and will be
+ // removed in the near future.
+ if (GPU.HasFMAF)
Builder.defineMacro("__HAS_FMAF__");
- if (hasLDEXPF)
+ if (GPU.HasFastFMAF)
+ Builder.defineMacro("FP_FAST_FMAF");
+ if (GPU.HasLDEXPF)
Builder.defineMacro("__HAS_LDEXPF__");
- if (hasFP64)
+ if (GPU.HasFP64)
Builder.defineMacro("__HAS_FP64__");
+ if (GPU.HasFastFMA)
+ Builder.defineMacro("FP_FAST_FMA");
}
Modified: cfe/trunk/lib/Basic/Targets/AMDGPU.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AMDGPU.h?rev=326254&r1=326253&r2=326254&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/AMDGPU.h (original)
+++ cfe/trunk/lib/Basic/Targets/AMDGPU.h Tue Feb 27 13:48:05 2018
@@ -47,101 +47,139 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTarg
}
};
- /// \brief The GPU profiles supported by the AMDGPU target.
- enum GPUKind {
- GK_NONE,
+ /// \brief GPU kinds supported by the AMDGPU target.
+ enum GPUKind : uint32_t {
+ // Not specified processor.
+ GK_NONE = 0,
+
+ // R600-based processors.
GK_R600,
- GK_R600_DOUBLE_OPS,
- GK_R700,
- GK_R700_DOUBLE_OPS,
- GK_EVERGREEN,
- GK_EVERGREEN_DOUBLE_OPS,
- GK_NORTHERN_ISLANDS,
+ GK_R630,
+ GK_RS880,
+ GK_RV670,
+ GK_RV710,
+ GK_RV730,
+ GK_RV770,
+ GK_CEDAR,
+ GK_CYPRESS,
+ GK_JUNIPER,
+ GK_REDWOOD,
+ GK_SUMO,
+ GK_BARTS,
+ GK_CAICOS,
GK_CAYMAN,
- GK_GFX6,
- GK_GFX7,
- GK_GFX8,
- GK_GFX9
+ GK_TURKS,
+
+ GK_R600_FIRST = GK_R600,
+ GK_R600_LAST = GK_TURKS,
+
+ // AMDGCN-based processors.
+ GK_GFX600,
+ GK_GFX601,
+ GK_GFX700,
+ GK_GFX701,
+ GK_GFX702,
+ GK_GFX703,
+ GK_GFX704,
+ GK_GFX801,
+ GK_GFX802,
+ GK_GFX803,
+ GK_GFX810,
+ GK_GFX900,
+ GK_GFX902,
+
+ GK_AMDGCN_FIRST = GK_GFX600,
+ GK_AMDGCN_LAST = GK_GFX902,
};
struct GPUInfo {
llvm::StringLiteral Name;
llvm::StringLiteral CanonicalName;
AMDGPUTargetInfo::GPUKind Kind;
+ bool HasFMAF;
+ bool HasFastFMAF;
+ bool HasLDEXPF;
+ bool HasFP64;
+ bool HasFastFMA;
};
- GPUInfo GPU;
-
- static constexpr GPUInfo InvalidGPU = {{""}, {""}, GK_NONE};
- static constexpr GPUInfo R600Names[26] = {
- {{"r600"}, {"r600"}, GK_R600},
- {{"rv630"}, {"r600"}, GK_R600},
- {{"rv635"}, {"r600"}, GK_R600},
- {{"r630"}, {"r630"}, GK_R600},
- {{"rs780"}, {"rs880"}, GK_R600},
- {{"rs880"}, {"rs880"}, GK_R600},
- {{"rv610"}, {"rs880"}, GK_R600},
- {{"rv620"}, {"rs880"}, GK_R600},
- {{"rv670"}, {"rv670"}, GK_R600_DOUBLE_OPS},
- {{"rv710"}, {"rv710"}, GK_R700},
- {{"rv730"}, {"rv730"}, GK_R700},
- {{"rv740"}, {"rv770"}, GK_R700_DOUBLE_OPS},
- {{"rv770"}, {"rv770"}, GK_R700_DOUBLE_OPS},
- {{"cedar"}, {"cedar"}, GK_EVERGREEN},
- {{"palm"}, {"cedar"}, GK_EVERGREEN},
- {{"cypress"}, {"cypress"}, GK_EVERGREEN_DOUBLE_OPS},
- {{"hemlock"}, {"cypress"}, GK_EVERGREEN_DOUBLE_OPS},
- {{"juniper"}, {"juniper"}, GK_EVERGREEN},
- {{"redwood"}, {"redwood"}, GK_EVERGREEN},
- {{"sumo"}, {"sumo"}, GK_EVERGREEN},
- {{"sumo2"}, {"sumo"}, GK_EVERGREEN},
- {{"barts"}, {"barts"}, GK_NORTHERN_ISLANDS},
- {{"caicos"}, {"caicos"}, GK_NORTHERN_ISLANDS},
- {{"turks"}, {"turks"}, GK_NORTHERN_ISLANDS},
- {{"aruba"}, {"cayman"}, GK_CAYMAN},
- {{"cayman"}, {"cayman"}, GK_CAYMAN},
+ static constexpr GPUInfo InvalidGPU =
+ {{""}, {""}, GK_NONE, false, false, false, false, false};
+ static constexpr GPUInfo R600GPUs[26] = {
+ // Name Canonical Kind Has Has Has Has Has
+ // Name FMAF Fast LDEXPF FP64 Fast
+ // FMAF FMA
+ {{"r600"}, {"r600"}, GK_R600, false, false, false, false, false},
+ {{"rv630"}, {"r600"}, GK_R600, false, false, false, false, false},
+ {{"rv635"}, {"r600"}, GK_R600, false, false, false, false, false},
+ {{"r630"}, {"r630"}, GK_R630, false, false, false, false, false},
+ {{"rs780"}, {"rs880"}, GK_RS880, false, false, false, false, false},
+ {{"rs880"}, {"rs880"}, GK_RS880, false, false, false, false, false},
+ {{"rv610"}, {"rs880"}, GK_RS880, false, false, false, false, false},
+ {{"rv620"}, {"rs880"}, GK_RS880, false, false, false, false, false},
+ {{"rv670"}, {"rv670"}, GK_RV670, false, false, false, false, false},
+ {{"rv710"}, {"rv710"}, GK_RV710, false, false, false, false, false},
+ {{"rv730"}, {"rv730"}, GK_RV730, false, false, false, false, false},
+ {{"rv740"}, {"rv770"}, GK_RV770, false, false, false, false, false},
+ {{"rv770"}, {"rv770"}, GK_RV770, false, false, false, false, false},
+ {{"cedar"}, {"cedar"}, GK_CEDAR, false, false, false, false, false},
+ {{"palm"}, {"cedar"}, GK_CEDAR, false, false, false, false, false},
+ {{"cypress"}, {"cypress"}, GK_CYPRESS, true, false, false, false, false},
+ {{"hemlock"}, {"cypress"}, GK_CYPRESS, true, false, false, false, false},
+ {{"juniper"}, {"juniper"}, GK_JUNIPER, false, false, false, false, false},
+ {{"redwood"}, {"redwood"}, GK_REDWOOD, false, false, false, false, false},
+ {{"sumo"}, {"sumo"}, GK_SUMO, false, false, false, false, false},
+ {{"sumo2"}, {"sumo"}, GK_SUMO, false, false, false, false, false},
+ {{"barts"}, {"barts"}, GK_BARTS, false, false, false, false, false},
+ {{"caicos"}, {"caicos"}, GK_BARTS, false, false, false, false, false},
+ {{"aruba"}, {"cayman"}, GK_CAYMAN, true, false, false, false, false},
+ {{"cayman"}, {"cayman"}, GK_CAYMAN, true, false, false, false, false},
+ {{"turks"}, {"turks"}, GK_TURKS, false, false, false, false, false},
};
- static constexpr GPUInfo AMDGCNNames[30] = {
- {{"gfx600"}, {"gfx600"}, GK_GFX6},
- {{"tahiti"}, {"gfx600"}, GK_GFX6},
- {{"gfx601"}, {"gfx601"}, GK_GFX6},
- {{"hainan"}, {"gfx601"}, GK_GFX6},
- {{"oland"}, {"gfx601"}, GK_GFX6},
- {{"pitcairn"}, {"gfx601"}, GK_GFX6},
- {{"verde"}, {"gfx601"}, GK_GFX6},
- {{"gfx700"}, {"gfx700"}, GK_GFX7},
- {{"kaveri"}, {"gfx700"}, GK_GFX7},
- {{"gfx701"}, {"gfx701"}, GK_GFX7},
- {{"hawaii"}, {"gfx701"}, GK_GFX7},
- {{"gfx702"}, {"gfx702"}, GK_GFX7},
- {{"gfx703"}, {"gfx703"}, GK_GFX7},
- {{"kabini"}, {"gfx703"}, GK_GFX7},
- {{"mullins"}, {"gfx703"}, GK_GFX7},
- {{"gfx704"}, {"gfx704"}, GK_GFX7},
- {{"bonaire"}, {"gfx704"}, GK_GFX7},
- {{"gfx801"}, {"gfx801"}, GK_GFX8},
- {{"carrizo"}, {"gfx801"}, GK_GFX8},
- {{"gfx802"}, {"gfx802"}, GK_GFX8},
- {{"iceland"}, {"gfx802"}, GK_GFX8},
- {{"tonga"}, {"gfx802"}, GK_GFX8},
- {{"gfx803"}, {"gfx803"}, GK_GFX8},
- {{"fiji"}, {"gfx803"}, GK_GFX8},
- {{"polaris10"}, {"gfx803"}, GK_GFX8},
- {{"polaris11"}, {"gfx803"}, GK_GFX8},
- {{"gfx810"}, {"gfx810"}, GK_GFX8},
- {{"stoney"}, {"gfx810"}, GK_GFX8},
- {{"gfx900"}, {"gfx900"}, GK_GFX9},
- {{"gfx902"}, {"gfx902"}, GK_GFX9},
+ static constexpr GPUInfo AMDGCNGPUs[30] = {
+ // Name Canonical Kind Has Has Has Has Has
+ // Name FMAF Fast LDEXPF FP64 Fast
+ // FMAF FMA
+ {{"gfx600"}, {"gfx600"}, GK_GFX600, true, true, true, true, true},
+ {{"tahiti"}, {"gfx600"}, GK_GFX600, true, true, true, true, true},
+ {{"gfx601"}, {"gfx601"}, GK_GFX601, true, false, true, true, true},
+ {{"hainan"}, {"gfx601"}, GK_GFX601, true, false, true, true, true},
+ {{"oland"}, {"gfx601"}, GK_GFX601, true, false, true, true, true},
+ {{"pitcairn"}, {"gfx601"}, GK_GFX601, true, false, true, true, true},
+ {{"verde"}, {"gfx601"}, GK_GFX601, true, false, true, true, true},
+ {{"gfx700"}, {"gfx700"}, GK_GFX700, true, false, true, true, true},
+ {{"kaveri"}, {"gfx700"}, GK_GFX700, true, false, true, true, true},
+ {{"gfx701"}, {"gfx701"}, GK_GFX701, true, true, true, true, true},
+ {{"hawaii"}, {"gfx701"}, GK_GFX701, true, true, true, true, true},
+ {{"gfx702"}, {"gfx702"}, GK_GFX702, true, true, true, true, true},
+ {{"gfx703"}, {"gfx703"}, GK_GFX703, true, false, true, true, true},
+ {{"kabini"}, {"gfx703"}, GK_GFX703, true, false, true, true, true},
+ {{"mullins"}, {"gfx703"}, GK_GFX703, true, false, true, true, true},
+ {{"gfx704"}, {"gfx704"}, GK_GFX704, true, false, true, true, true},
+ {{"bonaire"}, {"gfx704"}, GK_GFX704, true, false, true, true, true},
+ {{"gfx801"}, {"gfx801"}, GK_GFX801, true, true, true, true, true},
+ {{"carrizo"}, {"gfx801"}, GK_GFX801, true, true, true, true, true},
+ {{"gfx802"}, {"gfx802"}, GK_GFX802, true, false, true, true, true},
+ {{"iceland"}, {"gfx802"}, GK_GFX802, true, false, true, true, true},
+ {{"tonga"}, {"gfx802"}, GK_GFX802, true, false, true, true, true},
+ {{"gfx803"}, {"gfx803"}, GK_GFX803, true, false, true, true, true},
+ {{"fiji"}, {"gfx803"}, GK_GFX803, true, false, true, true, true},
+ {{"polaris10"}, {"gfx803"}, GK_GFX803, true, false, true, true, true},
+ {{"polaris11"}, {"gfx803"}, GK_GFX803, true, false, true, true, true},
+ {{"gfx810"}, {"gfx810"}, GK_GFX810, true, false, true, true, true},
+ {{"stoney"}, {"gfx810"}, GK_GFX810, true, false, true, true, true},
+ {{"gfx900"}, {"gfx900"}, GK_GFX900, true, true, true, true, true},
+ {{"gfx902"}, {"gfx902"}, GK_GFX900, true, true, true, true, true},
};
- bool hasFP64 : 1;
- bool hasFMAF : 1;
- bool hasLDEXPF : 1;
- const AddrSpace AS;
+ static GPUInfo parseR600Name(StringRef Name);
- static bool hasFullSpeedFMAF32(StringRef GPUName) {
- return parseAMDGCNName(GPUName).Kind >= GK_GFX9;
- }
+ static GPUInfo parseAMDGCNName(StringRef Name);
+
+ GPUInfo parseGPUName(StringRef Name) const;
+
+ const AddrSpace AS;
+ GPUInfo GPU;
static bool isAMDGCN(const llvm::Triple &TT) {
return TT.getArch() == llvm::Triple::amdgcn;
@@ -157,12 +195,10 @@ public:
void adjust(LangOptions &Opts) override;
uint64_t getPointerWidthV(unsigned AddrSpace) const override {
- if (GPU.Kind <= GK_CAYMAN)
+ if (GPU.Kind <= GK_R600_LAST)
return 32;
-
- if (AddrSpace == AS.Private || AddrSpace == AS.Local) {
+ if (AddrSpace == AS.Private || AddrSpace == AS.Local)
return 32;
- }
return 64;
}
@@ -278,10 +314,6 @@ public:
return TargetInfo::CharPtrBuiltinVaList;
}
- static GPUInfo parseR600Name(StringRef Name);
-
- static GPUInfo parseAMDGCNName(StringRef Name);
-
bool isValidCPUName(StringRef Name) const override {
if (getTriple().getArch() == llvm::Triple::amdgcn)
return GK_NONE != parseAMDGCNName(Name).Kind;
@@ -297,7 +329,7 @@ public:
else
GPU = parseR600Name(Name);
- return GPU.Kind != GK_NONE;
+ return GK_NONE != GPU.Kind;
}
void setSupportedOpenCLOpts() override {
@@ -305,16 +337,16 @@ public:
Opts.support("cl_clang_storage_class_specifiers");
Opts.support("cl_khr_icd");
- if (hasFP64)
+ if (GPU.HasFP64)
Opts.support("cl_khr_fp64");
- if (GPU.Kind >= GK_EVERGREEN) {
+ if (GPU.Kind >= GK_CEDAR) {
Opts.support("cl_khr_byte_addressable_store");
Opts.support("cl_khr_global_int32_base_atomics");
Opts.support("cl_khr_global_int32_extended_atomics");
Opts.support("cl_khr_local_int32_base_atomics");
Opts.support("cl_khr_local_int32_extended_atomics");
}
- if (GPU.Kind >= GK_GFX6) {
+ if (GPU.Kind >= GK_AMDGCN_FIRST) {
Opts.support("cl_khr_fp16");
Opts.support("cl_khr_int64_base_atomics");
Opts.support("cl_khr_int64_extended_atomics");
Modified: cfe/trunk/test/Driver/amdgpu-macros.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-macros.cl?rev=326254&r1=326253&r2=326254&view=diff
==============================================================================
--- cfe/trunk/test/Driver/amdgpu-macros.cl (original)
+++ cfe/trunk/test/Driver/amdgpu-macros.cl Tue Feb 27 13:48:05 2018
@@ -28,30 +28,116 @@
// RUN: %clang -E -dM -target r600 -mcpu=sumo2 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,SUMO %s
// RUN: %clang -E -dM -target r600 -mcpu=barts %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,BARTS %s
// RUN: %clang -E -dM -target r600 -mcpu=caicos %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CAICOS %s
-// RUN: %clang -E -dM -target r600 -mcpu=turks %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,TURKS %s
// RUN: %clang -E -dM -target r600 -mcpu=aruba %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CAYMAN %s
// RUN: %clang -E -dM -target r600 -mcpu=cayman %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CAYMAN %s
+// RUN: %clang -E -dM -target r600 -mcpu=turks %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,TURKS %s
+
+// R600-NOT: #define FP_FAST_FMA 1
+// R630-NOT: #define FP_FAST_FMA 1
+// RS880-NOT: #define FP_FAST_FMA 1
+// RV670-NOT: #define FP_FAST_FMA 1
+// RV710-NOT: #define FP_FAST_FMA 1
+// RV730-NOT: #define FP_FAST_FMA 1
+// RV770-NOT: #define FP_FAST_FMA 1
+// CEDAR-NOT: #define FP_FAST_FMA 1
+// CYPRESS-NOT: #define FP_FAST_FMA 1
+// JUNIPER-NOT: #define FP_FAST_FMA 1
+// REDWOOD-NOT: #define FP_FAST_FMA 1
+// SUMO-NOT: #define FP_FAST_FMA 1
+// BARTS-NOT: #define FP_FAST_FMA 1
+// CAICOS-NOT: #define FP_FAST_FMA 1
+// CAYMAN-NOT: #define FP_FAST_FMA 1
+// TURKS-NOT: #define FP_FAST_FMA 1
+
+// R600-NOT: #define FP_FAST_FMAF 1
+// R630-NOT: #define FP_FAST_FMAF 1
+// RS880-NOT: #define FP_FAST_FMAF 1
+// RV670-NOT: #define FP_FAST_FMAF 1
+// RV710-NOT: #define FP_FAST_FMAF 1
+// RV730-NOT: #define FP_FAST_FMAF 1
+// RV770-NOT: #define FP_FAST_FMAF 1
+// CEDAR-NOT: #define FP_FAST_FMAF 1
+// CYPRESS-NOT: #define FP_FAST_FMAF 1
+// JUNIPER-NOT: #define FP_FAST_FMAF 1
+// REDWOOD-NOT: #define FP_FAST_FMAF 1
+// SUMO-NOT: #define FP_FAST_FMAF 1
+// BARTS-NOT: #define FP_FAST_FMAF 1
+// CAICOS-NOT: #define FP_FAST_FMAF 1
+// CAYMAN-NOT: #define FP_FAST_FMAF 1
+// TURKS-NOT: #define FP_FAST_FMAF 1
-// ARCH-R600-DAG: #define __AMD__ 1
// ARCH-R600-DAG: #define __AMDGPU__ 1
+// ARCH-R600-DAG: #define __AMD__ 1
+
+// R600-NOT: #define __HAS_FMAF__ 1
+// R630-NOT: #define __HAS_FMAF__ 1
+// RS880-NOT: #define __HAS_FMAF__ 1
+// RV670-NOT: #define __HAS_FMAF__ 1
+// RV710-NOT: #define __HAS_FMAF__ 1
+// RV730-NOT: #define __HAS_FMAF__ 1
+// RV770-NOT: #define __HAS_FMAF__ 1
+// CEDAR-NOT: #define __HAS_FMAF__ 1
+// CYPRESS-DAG: #define __HAS_FMAF__ 1
+// JUNIPER-NOT: #define __HAS_FMAF__ 1
+// REDWOOD-NOT: #define __HAS_FMAF__ 1
+// SUMO-NOT: #define __HAS_FMAF__ 1
+// BARTS-NOT: #define __HAS_FMAF__ 1
+// CAICOS-NOT: #define __HAS_FMAF__ 1
+// CAYMAN-DAG: #define __HAS_FMAF__ 1
+// TURKS-NOT: #define __HAS_FMAF__ 1
+
+// R600-NOT: #define __HAS_FP64__ 1
+// R630-NOT: #define __HAS_FP64__ 1
+// RS880-NOT: #define __HAS_FP64__ 1
+// RV670-NOT: #define __HAS_FP64__ 1
+// RV710-NOT: #define __HAS_FP64__ 1
+// RV730-NOT: #define __HAS_FP64__ 1
+// RV770-NOT: #define __HAS_FP64__ 1
+// CEDAR-NOT: #define __HAS_FP64__ 1
+// CYPRESS-NOT: #define __HAS_FP64__ 1
+// JUNIPER-NOT: #define __HAS_FP64__ 1
+// REDWOOD-NOT: #define __HAS_FP64__ 1
+// SUMO-NOT: #define __HAS_FP64__ 1
+// BARTS-NOT: #define __HAS_FP64__ 1
+// CAICOS-NOT: #define __HAS_FP64__ 1
+// CAYMAN-NOT: #define __HAS_FP64__ 1
+// TURKS-NOT: #define __HAS_FP64__ 1
+
+// R600-NOT: #define __HAS_LDEXPF__ 1
+// R630-NOT: #define __HAS_LDEXPF__ 1
+// RS880-NOT: #define __HAS_LDEXPF__ 1
+// RV670-NOT: #define __HAS_LDEXPF__ 1
+// RV710-NOT: #define __HAS_LDEXPF__ 1
+// RV730-NOT: #define __HAS_LDEXPF__ 1
+// RV770-NOT: #define __HAS_LDEXPF__ 1
+// CEDAR-NOT: #define __HAS_LDEXPF__ 1
+// CYPRESS-NOT: #define __HAS_LDEXPF__ 1
+// JUNIPER-NOT: #define __HAS_LDEXPF__ 1
+// REDWOOD-NOT: #define __HAS_LDEXPF__ 1
+// SUMO-NOT: #define __HAS_LDEXPF__ 1
+// BARTS-NOT: #define __HAS_LDEXPF__ 1
+// CAICOS-NOT: #define __HAS_LDEXPF__ 1
+// CAYMAN-NOT: #define __HAS_LDEXPF__ 1
+// TURKS-NOT: #define __HAS_LDEXPF__ 1
+
// ARCH-R600-DAG: #define __R600__ 1
-// R600: #define __r600__ 1
-// R630: #define __r630__ 1
-// RS880: #define __rs880__ 1
-// RV670: #define __rv670__ 1
-// RV710: #define __rv710__ 1
-// RV730: #define __rv730__ 1
-// RV770: #define __rv770__ 1
-// CEDAR: #define __cedar__ 1
-// CYPRESS: #define __cypress__ 1
-// JUNIPER: #define __juniper__ 1
-// REDWOOD: #define __redwood__ 1
-// SUMO: #define __sumo__ 1
-// BARTS: #define __barts__ 1
-// CAICOS: #define __caicos__ 1
-// TURKS: #define __turks__ 1
-// CAYMAN: #define __cayman__ 1
+// R600-DAG: #define __r600__ 1
+// R630-DAG: #define __r630__ 1
+// RS880-DAG: #define __rs880__ 1
+// RV670-DAG: #define __rv670__ 1
+// RV710-DAG: #define __rv710__ 1
+// RV730-DAG: #define __rv730__ 1
+// RV770-DAG: #define __rv770__ 1
+// CEDAR-DAG: #define __cedar__ 1
+// CYPRESS-DAG: #define __cypress__ 1
+// JUNIPER-DAG: #define __juniper__ 1
+// REDWOOD-DAG: #define __redwood__ 1
+// SUMO-DAG: #define __sumo__ 1
+// BARTS-DAG: #define __barts__ 1
+// CAICOS-DAG: #define __caicos__ 1
+// CAYMAN-DAG: #define __cayman__ 1
+// TURKS-DAG: #define __turks__ 1
//
// AMDGCN-based processors.
@@ -88,20 +174,90 @@
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx900 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX900 %s
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx902 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX902 %s
-// ARCH-GCN-DAG: #define __AMD__ 1
-// ARCH-GCN-DAG: #define __AMDGPU__ 1
+// GFX600-DAG: #define FP_FAST_FMA 1
+// GFX601-DAG: #define FP_FAST_FMA 1
+// GFX700-DAG: #define FP_FAST_FMA 1
+// GFX701-DAG: #define FP_FAST_FMA 1
+// GFX702-DAG: #define FP_FAST_FMA 1
+// GFX703-DAG: #define FP_FAST_FMA 1
+// GFX704-DAG: #define FP_FAST_FMA 1
+// GFX801-DAG: #define FP_FAST_FMA 1
+// GFX802-DAG: #define FP_FAST_FMA 1
+// GFX803-DAG: #define FP_FAST_FMA 1
+// GFX810-DAG: #define FP_FAST_FMA 1
+// GFX900-DAG: #define FP_FAST_FMA 1
+// GFX902-DAG: #define FP_FAST_FMA 1
+
+// GFX600-DAG: #define FP_FAST_FMAF 1
+// GFX601-NOT: #define FP_FAST_FMAF 1
+// GFX700-NOT: #define FP_FAST_FMAF 1
+// GFX701-DAG: #define FP_FAST_FMAF 1
+// GFX702-DAG: #define FP_FAST_FMAF 1
+// GFX703-NOT: #define FP_FAST_FMAF 1
+// GFX704-NOT: #define FP_FAST_FMAF 1
+// GFX801-DAG: #define FP_FAST_FMAF 1
+// GFX802-NOT: #define FP_FAST_FMAF 1
+// GFX803-NOT: #define FP_FAST_FMAF 1
+// GFX810-NOT: #define FP_FAST_FMAF 1
+// GFX900-DAG: #define FP_FAST_FMAF 1
+// GFX902-DAG: #define FP_FAST_FMAF 1
+
// ARCH-GCN-DAG: #define __AMDGCN__ 1
+// ARCH-GCN-DAG: #define __AMDGPU__ 1
+// ARCH-GCN-DAG: #define __AMD__ 1
-// GFX600: #define __gfx600__ 1
-// GFX601: #define __gfx601__ 1
-// GFX700: #define __gfx700__ 1
-// GFX701: #define __gfx701__ 1
-// GFX702: #define __gfx702__ 1
-// GFX703: #define __gfx703__ 1
-// GFX704: #define __gfx704__ 1
-// GFX801: #define __gfx801__ 1
-// GFX802: #define __gfx802__ 1
-// GFX803: #define __gfx803__ 1
-// GFX810: #define __gfx810__ 1
-// GFX900: #define __gfx900__ 1
-// GFX902: #define __gfx902__ 1
+// GFX600-DAG: #define __HAS_FMAF__ 1
+// GFX601-DAG: #define __HAS_FMAF__ 1
+// GFX700-DAG: #define __HAS_FMAF__ 1
+// GFX701-DAG: #define __HAS_FMAF__ 1
+// GFX702-DAG: #define __HAS_FMAF__ 1
+// GFX703-DAG: #define __HAS_FMAF__ 1
+// GFX704-DAG: #define __HAS_FMAF__ 1
+// GFX801-DAG: #define __HAS_FMAF__ 1
+// GFX802-DAG: #define __HAS_FMAF__ 1
+// GFX803-DAG: #define __HAS_FMAF__ 1
+// GFX810-DAG: #define __HAS_FMAF__ 1
+// GFX900-DAG: #define __HAS_FMAF__ 1
+// GFX902-DAG: #define __HAS_FMAF__ 1
+
+// GFX600-DAG: #define __HAS_FP64__ 1
+// GFX601-DAG: #define __HAS_FP64__ 1
+// GFX700-DAG: #define __HAS_FP64__ 1
+// GFX701-DAG: #define __HAS_FP64__ 1
+// GFX702-DAG: #define __HAS_FP64__ 1
+// GFX703-DAG: #define __HAS_FP64__ 1
+// GFX704-DAG: #define __HAS_FP64__ 1
+// GFX801-DAG: #define __HAS_FP64__ 1
+// GFX802-DAG: #define __HAS_FP64__ 1
+// GFX803-DAG: #define __HAS_FP64__ 1
+// GFX810-DAG: #define __HAS_FP64__ 1
+// GFX900-DAG: #define __HAS_FP64__ 1
+// GFX902-DAG: #define __HAS_FP64__ 1
+
+// GFX600-DAG: #define __HAS_LDEXPF__ 1
+// GFX601-DAG: #define __HAS_LDEXPF__ 1
+// GFX700-DAG: #define __HAS_LDEXPF__ 1
+// GFX701-DAG: #define __HAS_LDEXPF__ 1
+// GFX702-DAG: #define __HAS_LDEXPF__ 1
+// GFX703-DAG: #define __HAS_LDEXPF__ 1
+// GFX704-DAG: #define __HAS_LDEXPF__ 1
+// GFX801-DAG: #define __HAS_LDEXPF__ 1
+// GFX802-DAG: #define __HAS_LDEXPF__ 1
+// GFX803-DAG: #define __HAS_LDEXPF__ 1
+// GFX810-DAG: #define __HAS_LDEXPF__ 1
+// GFX900-DAG: #define __HAS_LDEXPF__ 1
+// GFX902-DAG: #define __HAS_LDEXPF__ 1
+
+// GFX600-DAG: #define __gfx600__ 1
+// GFX601-DAG: #define __gfx601__ 1
+// GFX700-DAG: #define __gfx700__ 1
+// GFX701-DAG: #define __gfx701__ 1
+// GFX702-DAG: #define __gfx702__ 1
+// GFX703-DAG: #define __gfx703__ 1
+// GFX704-DAG: #define __gfx704__ 1
+// GFX801-DAG: #define __gfx801__ 1
+// GFX802-DAG: #define __gfx802__ 1
+// GFX803-DAG: #define __gfx803__ 1
+// GFX810-DAG: #define __gfx810__ 1
+// GFX900-DAG: #define __gfx900__ 1
+// GFX902-DAG: #define __gfx902__ 1
Modified: cfe/trunk/test/Misc/target-invalid-cpu-note.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/target-invalid-cpu-note.c?rev=326254&r1=326253&r2=326254&view=diff
==============================================================================
--- cfe/trunk/test/Misc/target-invalid-cpu-note.c (original)
+++ cfe/trunk/test/Misc/target-invalid-cpu-note.c Tue Feb 27 13:48:05 2018
@@ -42,7 +42,7 @@
// R600: note: valid target CPU values are: r600, rv630, rv635, r630, rs780,
// R600-SAME: rs880, rv610, rv620, rv670, rv710, rv730, rv740, rv770, cedar,
// R600-SAME: palm, cypress, hemlock, juniper, redwood, sumo, sumo2, barts,
-// R600-SAME: caicos, turks, aruba, cayman
+// R600-SAME: caicos, aruba, cayman, turks
// RUN: not %clang_cc1 -triple amdgcn--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix AMDGCN
More information about the cfe-commits
mailing list