[PATCH] D154495: clang: Attach !fpmath metadata to __builtin_sqrt based on language flags

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 04:42:33 PDT 2023


arsenm created this revision.
arsenm added reviewers: yaxunl, Anastasia, jcranmer-intel, tra, jlebar, jhuber6.
Herald added a project: All.
arsenm requested review of this revision.
Herald added subscribers: jplehr, sstefan1, wdng.
Herald added a reviewer: jdoerfert.

OpenCL and HIP have -cl-fp32-correctly-rounded-divide-sqrt and
-fno-hip-correctly-rounded-divide-sqrt. The corresponding fpmath metadata
was only set on fdiv, and not sqrt. The backend is currently underutilizing
sqrt lowering options, and the responsibility is split between the libraries
and backend and this metadata is needed.

      

CUDA/NVCC has -prec-div and -prev-sqrt but clang doesn't appear to be
aiming for compatibility with those. Don't know if OpenMP has a similar
control.


https://reviews.llvm.org/D154495

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGenCUDA/correctly-rounded-div.cu
  clang/test/CodeGenOpenCL/fpmath.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154495.537295.patch
Type: text/x-patch
Size: 5888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230705/7ba964ad/attachment.bin>


More information about the cfe-commits mailing list