xiongji90 added a comment.

In D144454#4142253 <https://reviews.llvm.org/D144454#4142253>, @rjmccall wrote:

> New builtins should be documented in the user manual.
>
> There are standard pragmas for changing the rounding mode, right?  What's the 
> interaction between the ability to set this dynamically with a builtin call 
> and those pragmas?

Hi, @rjmccall 
Current status is LLVM has added llvm.get.rounding and llvm.set.rounding 
intrinsic and has also added "__builtin_flt_rounds" for llvm.get.rounding but 
there is no corresponding for llvm.set.rounding intrinisc. According to 
original patch to add llvm.set.rounding: https://reviews.llvm.org/D74729 and 
LLVM document for this intrinsic: https://llvm.org/docs/LangRef.html#id1506
The introduction of llvm.set.rounding intrinsic can provide same functionality 
as C library function "fesetround" and avoid unnecessary dependency on C 
library. Currently, this intrinsic can't benefit C/C++ developers since we 
don't have a corresponding builtin and we even can't add a C/C++ test for this 
intrinsic.
There may be more use scenario other then normal C/C++ program, for example, in 
heterogeneous computing, some other device such as GPU may support rounding 
mode setting in device code,  users can invoke __builtin_flt_rounds_set in 
their source code to use this functionality but they can't use C library 
functions since it unavailable in GPU or other device.

Thanks very much for the review!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144454

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to