From 806b74b0de6e7354033ec36c833d43ca8ff13fa7 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Thu, 9 Mar 2023 15:41:54 -0500 Subject: [PATCH] [HIP] clang should pass `-mno-amdgpu-ieee` to -cc1 Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D145721 --- clang/lib/Driver/ToolChains/Clang.cpp | 2 ++ clang/test/Driver/hip-options.hip | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 1984e13..41fe893 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -7146,6 +7146,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.addOptInFlag(CmdArgs, options::OPT_munsafe_fp_atomics, options::OPT_mno_unsafe_fp_atomics); + Args.addOptOutFlag(CmdArgs, options::OPT_mamdgpu_ieee, + options::OPT_mno_amdgpu_ieee); } // For all the host OpenMP offloading compile jobs we need to pass the targets diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip index 97d0c13..0bce2ac 100644 --- a/clang/test/Driver/hip-options.hip +++ b/clang/test/Driver/hip-options.hip @@ -126,3 +126,15 @@ // RUN: --offload-arch=gfx906 %s 2>&1 \ // RUN: | FileCheck -check-prefix=KANNEG %s // KANNEG-NOT: "-fhip-kernel-arg-name" + +// RUN: %clang -### -nogpuinc -nogpulib -mno-amdgpu-ieee -mamdgpu-ieee \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=IEEE-ON %s +// IEEE-ON-NOT: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-m{{(no-)?}}amdgpu-ieee" + +// RUN: %clang -### -nogpuinc -nogpulib -mamdgpu-ieee -mno-amdgpu-ieee -ffast-math \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefixes=IEEE-OFF %s +// IEEE-OFF: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-mno-amdgpu-ieee" + +// RUN: %clang -### -nogpuinc -nogpulib -mamdgpu-ieee -mno-amdgpu-ieee -ffast-math \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefixes=IEEE-OFF-NEG %s +// IEEE-OFF-NEG-NOT: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-mamdgpu-ieee" -- 2.7.4