Index: cfe/trunk/lib/Basic/Targets/AMDGPU.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets/AMDGPU.cpp +++ cfe/trunk/lib/Basic/Targets/AMDGPU.cpp @@ -308,7 +308,8 @@ AMDGPUTargetInfo::AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : TargetInfo(Triple), GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), + : TargetInfo(Triple), + GPU(isAMDGCN(Triple) ? GK_GFX6 : parseR600Name(Opts.CPU)), hasFP64(false), hasFMAF(false), hasLDEXPF(false), AS(isGenericZero(Triple)) { if (getTriple().getArch() == llvm::Triple::amdgcn) { @@ -316,6 +317,11 @@ hasFMAF = true; hasLDEXPF = true; } + if (getTriple().getArch() == llvm::Triple::r600) { + if (GPU == GK_EVERGREEN_DOUBLE_OPS || GPU == GK_CAYMAN) { + hasFMAF = true; + } + } auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? (IsGenericZero ? DataLayoutStringSIGenericIsZero Index: cfe/trunk/test/Preprocessor/predefined-arch-macros.c =================================================================== --- cfe/trunk/test/Preprocessor/predefined-arch-macros.c +++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c @@ -2378,6 +2378,9 @@ // RUN: -target amdgcn-unknown-unknown \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_AMDGCN // CHECK_AMDGCN: #define __AMDGCN__ 1 +// CHECK_AMDGCN: #define __HAS_FMAF__ 1 +// CHECK_AMDGCN: #define __HAS_FP64__ 1 +// CHECK_AMDGCN: #define __HAS_LDEXPF__ 1 // Begin r600 tests ---------------- // @@ -2385,3 +2388,10 @@ // RUN: -target r600-unknown-unknown \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_R600 // CHECK_R600: #define __R600__ 1 +// CHECK_R600-NOT: #define __HAS_FMAF__ 1 + +// RUN: %clang -march=amdgcn -mcpu=cypress -E -dM %s -o - 2>&1 \ +// RUN: -target r600-unknown-unknown \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_R600_FP64 +// CHECK_R600_FP64-DAG: #define __R600__ 1 +// CHECK_R600_FP64-DAG: #define __HAS_FMAF__ 1