[PATCH] D154797: [CUDA][HIP] Rename and fix `-fcuda-approx-transcendentals`

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 13:08:02 PDT 2023


yaxunl marked 3 inline comments as done.
yaxunl added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:7221-7223
+    bool UseApproxTranscendentals = false;
+    if (Args.hasFlag(options::OPT_ffast_math, options::OPT_fno_fast_math,
+                     false))
----------------
tra wrote:
> ```
> bool UseApproxTranscendentals = Args.hasFlag(options::OPT_ffast_math, options::OPT_fno_fast_math,  false));
> ```
fixed


================
Comment at: clang/lib/Frontend/InitPreprocessor.cpp:1292-1293
+  if (LangOpts.GPUDeviceApproxTranscendentals) {
+    Builder.defineMacro(Twine("__CLANG_") + (LangOpts.HIP ? "HIP" : "CUDA") +
+                        "_APPROX_TRANSCENDENTALS__");
   }
----------------
tra wrote:
> We may want to rename the macro to `__CLANG_GPU_APPROX_TRANSCENDENTALS__`, too. 
> 
will emit `__CLANG_GPU_APPROX_TRANSCENDENTALS__`


================
Comment at: clang/test/Driver/hip-options.hip:179
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib -fgpu-approx-transcendentals \
+// RUN:   --cuda-gpu-arch=gfx906  %s 2>&1 | FileCheck -check-prefixes=APPROX %s
+
----------------
MaskRay wrote:
> excess spaces before `%s`
> 
> ditto below
> 
> Prefer `--check-prefix=` when there is one single check.
fixed


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154797/new/

https://reviews.llvm.org/D154797



More information about the cfe-commits mailing list