[PATCH] AMDGCN: Define cl_khr_fp64 when compiling OpenCL programs

Matt Arsenault arsenm2 at gmail.com
Thu Feb 26 20:49:49 PST 2015


> On Feb 26, 2015, at 5:00 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> 
> ---
> lib/Basic/Targets.cpp    | 2 ++
> test/Preprocessor/init.c | 3 +++
> 2 files changed, 5 insertions(+)
> 
> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
> index 03cd853..e828918 100644
> --- a/lib/Basic/Targets.cpp
> +++ b/lib/Basic/Targets.cpp
> @@ -1645,6 +1645,8 @@ public:
>   void getTargetDefines(const LangOptions &Opts,
>                         MacroBuilder &Builder) const override {
>     Builder.defineMacro("__R600__");
> +    if (GPU >= GK_SOUTHERN_ISLANDS && Opts.OpenCL)
> +      Builder.defineMacro("cl_khr_fp64");
>   }
> 
>   BuiltinVaListKind getBuiltinVaListKind() const override {
> diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
> index e31b3bd..5dc5921 100644
> --- a/test/Preprocessor/init.c
> +++ b/test/Preprocessor/init.c
> @@ -6584,6 +6584,9 @@
> // PPC-DARWIN:#define __powerpc__ 1
> // PPC-DARWIN:#define __ppc__ 1
> //
> +// RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=amdgcn < /dev/null | FileCheck -check-prefix AMDGCN %s
> +// AMDGCN:#define cl_khr_fp64 1
> +
> // RUN: %clang_cc1 -E -dM -ffreestanding -triple=s390x-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix S390X %s
> //
> // S390X:#define __BIGGEST_ALIGNMENT__ 8
> -- 
> 2.0.4
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

LGTM



More information about the cfe-commits mailing list