Index: cfe/trunk/lib/Basic/Targets/AMDGPU.h =================================================================== --- cfe/trunk/lib/Basic/Targets/AMDGPU.h +++ cfe/trunk/lib/Basic/Targets/AMDGPU.h @@ -62,72 +62,76 @@ GK_GFX7, GK_GFX8, GK_GFX9 - } GPU; + }; - struct NameGPUKind { + struct GPUInfo { llvm::StringLiteral Name; + llvm::StringLiteral CanonicalName; AMDGPUTargetInfo::GPUKind Kind; }; - static constexpr NameGPUKind R600Names[26] = { - {{"r600"}, GK_R600}, - {{"rv630"}, GK_R600}, - {{"rv635"}, GK_R600}, - {{"r630"}, GK_R600}, - {{"rs780"}, GK_R600}, - {{"rs880"}, GK_R600}, - {{"rv610"}, GK_R600}, - {{"rv620"}, GK_R600}, - {{"rv670"}, GK_R600_DOUBLE_OPS}, - {{"rv710"}, GK_R700}, - {{"rv730"}, GK_R700}, - {{"rv740"}, GK_R700_DOUBLE_OPS}, - {{"rv770"}, GK_R700_DOUBLE_OPS}, - {{"cedar"}, GK_EVERGREEN}, - {{"palm"}, GK_EVERGREEN}, - {{"cypress"}, GK_EVERGREEN_DOUBLE_OPS}, - {{"hemlock"}, GK_EVERGREEN_DOUBLE_OPS}, - {{"juniper"}, GK_EVERGREEN}, - {{"redwood"}, GK_EVERGREEN}, - {{"sumo"}, GK_EVERGREEN}, - {{"sumo2"}, GK_EVERGREEN}, - {{"barts"}, GK_NORTHERN_ISLANDS}, - {{"caicos"}, GK_NORTHERN_ISLANDS}, - {{"turks"}, GK_NORTHERN_ISLANDS}, - {{"aruba"}, GK_CAYMAN}, - {{"cayman"}, GK_CAYMAN}, + 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 NameGPUKind AMDGCNNames[30] = { - {{"gfx600"}, GK_GFX6}, - {{"tahiti"}, GK_GFX6}, - {{"gfx601"}, GK_GFX6}, - {{"hainan"}, GK_GFX6}, - {{"oland"}, GK_GFX6}, - {{"pitcairn"}, GK_GFX6}, - {{"verde"}, GK_GFX6}, - {{"gfx700"}, GK_GFX7}, - {{"kaveri"}, GK_GFX7}, - {{"gfx701"}, GK_GFX7}, - {{"hawaii"}, GK_GFX7}, - {{"gfx702"}, GK_GFX7}, - {{"gfx703"}, GK_GFX7}, - {{"kabini"}, GK_GFX7}, - {{"mullins"}, GK_GFX7}, - {{"gfx704"}, GK_GFX7}, - {{"bonaire"}, GK_GFX7}, - {{"gfx801"}, GK_GFX8}, - {{"carrizo"}, GK_GFX8}, - {{"gfx802"}, GK_GFX8}, - {{"iceland"}, GK_GFX8}, - {{"tonga"}, GK_GFX8}, - {{"gfx803"}, GK_GFX8}, - {{"fiji"}, GK_GFX8}, - {{"polaris10"}, GK_GFX8}, - {{"polaris11"}, GK_GFX8}, - {{"gfx810"}, GK_GFX8}, - {{"stoney"}, GK_GFX8}, - {{"gfx900"}, GK_GFX9}, - {{"gfx902"}, GK_GFX9}, + 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}, }; bool hasFP64 : 1; @@ -136,7 +140,7 @@ const AddrSpace AS; static bool hasFullSpeedFMAF32(StringRef GPUName) { - return parseAMDGCNName(GPUName) >= GK_GFX9; + return parseAMDGCNName(GPUName).Kind >= GK_GFX9; } static bool isAMDGCN(const llvm::Triple &TT) { @@ -153,7 +157,7 @@ void adjust(LangOptions &Opts) override; uint64_t getPointerWidthV(unsigned AddrSpace) const override { - if (GPU <= GK_CAYMAN) + if (GPU.Kind <= GK_CAYMAN) return 32; if (AddrSpace == AS.Private || AddrSpace == AS.Local) { @@ -274,15 +278,15 @@ return TargetInfo::CharPtrBuiltinVaList; } - static GPUKind parseR600Name(StringRef Name); + static GPUInfo parseR600Name(StringRef Name); - static GPUKind parseAMDGCNName(StringRef Name); + static GPUInfo parseAMDGCNName(StringRef Name); bool isValidCPUName(StringRef Name) const override { if (getTriple().getArch() == llvm::Triple::amdgcn) - return GK_NONE != parseAMDGCNName(Name); + return GK_NONE != parseAMDGCNName(Name).Kind; else - return GK_NONE != parseR600Name(Name); + return GK_NONE != parseR600Name(Name).Kind; } void fillValidCPUList(SmallVectorImpl &Values) const override; @@ -293,7 +297,7 @@ else GPU = parseR600Name(Name); - return GPU != GK_NONE; + return GPU.Kind != GK_NONE; } void setSupportedOpenCLOpts() override { @@ -303,14 +307,14 @@ if (hasFP64) Opts.support("cl_khr_fp64"); - if (GPU >= GK_EVERGREEN) { + if (GPU.Kind >= GK_EVERGREEN) { 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 >= GK_GFX6) { + if (GPU.Kind >= GK_GFX6) { Opts.support("cl_khr_fp16"); Opts.support("cl_khr_int64_base_atomics"); Opts.support("cl_khr_int64_extended_atomics"); Index: cfe/trunk/lib/Basic/Targets/AMDGPU.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets/AMDGPU.cpp +++ cfe/trunk/lib/Basic/Targets/AMDGPU.cpp @@ -161,7 +161,7 @@ if (CPU.empty()) CPU = "tahiti"; - switch (parseAMDGCNName(CPU)) { + switch (parseAMDGCNName(CPU).Kind) { case GK_GFX6: case GK_GFX7: break; @@ -184,7 +184,7 @@ if (CPU.empty()) CPU = "r600"; - switch (parseR600Name(CPU)) { + switch (parseR600Name(CPU).Kind) { case GK_R600: case GK_R700: case GK_EVERGREEN: @@ -229,36 +229,36 @@ } -constexpr AMDGPUTargetInfo::NameGPUKind AMDGPUTargetInfo::R600Names[]; -constexpr AMDGPUTargetInfo::NameGPUKind AMDGPUTargetInfo::AMDGCNNames[]; -AMDGPUTargetInfo::GPUKind AMDGPUTargetInfo::parseR600Name(StringRef Name) { +constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::R600Names[]; +constexpr AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::AMDGCNNames[]; +AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::parseR600Name(StringRef Name) { const auto *Result = llvm::find_if( - R600Names, [Name](const NameGPUKind &Kind) { return Kind.Name == Name; }); + R600Names, [Name](const GPUInfo &GPU) { return GPU.Name == Name; }); if (Result == std::end(R600Names)) - return GK_NONE; - return Result->Kind; + return InvalidGPU; + return *Result; } -AMDGPUTargetInfo::GPUKind AMDGPUTargetInfo::parseAMDGCNName(StringRef Name) { +AMDGPUTargetInfo::GPUInfo AMDGPUTargetInfo::parseAMDGCNName(StringRef Name) { const auto *Result = - llvm::find_if(AMDGCNNames, [Name](const NameGPUKind &Kind) { - return Kind.Name == Name; + llvm::find_if(AMDGCNNames, [Name](const GPUInfo &GPU) { + return GPU.Name == Name; }); if (Result == std::end(AMDGCNNames)) - return GK_NONE; - return Result->Kind; + return InvalidGPU; + return *Result; } void AMDGPUTargetInfo::fillValidCPUList( SmallVectorImpl &Values) const { if (getTriple().getArch() == llvm::Triple::amdgcn) - llvm::for_each(AMDGCNNames, [&Values](const NameGPUKind &Kind) { - Values.emplace_back(Kind.Name);}); + llvm::for_each(AMDGCNNames, [&Values](const GPUInfo &GPU) { + Values.emplace_back(GPU.Name);}); else - llvm::for_each(R600Names, [&Values](const NameGPUKind &Kind) { - Values.emplace_back(Kind.Name);}); + llvm::for_each(R600Names, [&Values](const GPUInfo &GPU) { + Values.emplace_back(GPU.Name);}); } void AMDGPUTargetInfo::setAddressSpaceMap(bool DefaultIsPrivate) { @@ -273,17 +273,17 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : TargetInfo(Triple), - GPU(isAMDGCN(Triple) ? GK_GFX6 : parseR600Name(Opts.CPU)), - hasFP64(false), hasFMAF(false), hasLDEXPF(false), - AS(isGenericZero(Triple)) { + : 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 == GK_EVERGREEN_DOUBLE_OPS || GPU == GK_CAYMAN) { + if (GPU.Kind == GK_EVERGREEN_DOUBLE_OPS || GPU.Kind == GK_CAYMAN) { hasFMAF = true; } } @@ -324,11 +324,17 @@ void AMDGPUTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { + Builder.defineMacro("__AMD__"); + Builder.defineMacro("__AMDGPU__"); + if (getTriple().getArch() == llvm::Triple::amdgcn) Builder.defineMacro("__AMDGCN__"); else Builder.defineMacro("__R600__"); + if (GPU.Kind != GK_NONE) + Builder.defineMacro(Twine("__") + Twine(GPU.CanonicalName) + Twine("__")); + if (hasFMAF) Builder.defineMacro("__HAS_FMAF__"); if (hasLDEXPF) Index: cfe/trunk/test/Driver/amdgpu-macros.cl =================================================================== --- cfe/trunk/test/Driver/amdgpu-macros.cl +++ cfe/trunk/test/Driver/amdgpu-macros.cl @@ -0,0 +1,107 @@ +// Check that appropriate macros are defined for every supported AMDGPU +// "-target" and "-mcpu" options. + +// +// R600-based processors. +// + +// RUN: %clang -E -dM -target r600 -mcpu=r600 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,R600 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv630 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,R600 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv635 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,R600 %s +// RUN: %clang -E -dM -target r600 -mcpu=r630 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,R630 %s +// RUN: %clang -E -dM -target r600 -mcpu=rs780 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RS880 %s +// RUN: %clang -E -dM -target r600 -mcpu=rs880 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RS880 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv610 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RS880 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv620 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RS880 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv670 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RV670 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv710 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RV710 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv730 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RV730 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv740 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RV770 %s +// RUN: %clang -E -dM -target r600 -mcpu=rv770 %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,RV770 %s +// RUN: %clang -E -dM -target r600 -mcpu=cedar %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CEDAR %s +// RUN: %clang -E -dM -target r600 -mcpu=palm %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CEDAR %s +// RUN: %clang -E -dM -target r600 -mcpu=cypress %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CYPRESS %s +// RUN: %clang -E -dM -target r600 -mcpu=hemlock %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,CYPRESS %s +// RUN: %clang -E -dM -target r600 -mcpu=juniper %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,JUNIPER %s +// RUN: %clang -E -dM -target r600 -mcpu=redwood %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,REDWOOD %s +// RUN: %clang -E -dM -target r600 -mcpu=sumo %s 2>&1 | FileCheck --check-prefixes=ARCH-R600,SUMO %s +// 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 + +// ARCH-R600-DAG: #define __AMD__ 1 +// ARCH-R600-DAG: #define __AMDGPU__ 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 + +// +// AMDGCN-based processors. +// + +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx600 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX600 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=tahiti %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX600 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx601 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX601 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=hainan %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX601 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=oland %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX601 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=pitcairn %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX601 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=verde %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX601 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx700 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX700 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=kaveri %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX700 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx701 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX701 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=hawaii %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX701 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx702 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX702 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx703 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX703 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=kabini %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX703 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=mullins %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX703 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx704 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX704 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=bonaire %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX704 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx801 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX801 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=carrizo %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX801 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx802 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX802 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=iceland %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX802 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=tonga %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX802 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx803 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX803 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=fiji %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX803 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=polaris10 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX803 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=polaris11 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX803 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx810 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX810 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=stoney %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX810 %s +// 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 +// ARCH-GCN-DAG: #define __AMDGCN__ 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