[PATCH] D51933: [AMDGPU] Ensure trig range reduction only used for subtargets that require it

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 13 02:01:05 PDT 2018


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:6655
+    SDValue MulVal = DAG.getNode(ISD::FMUL, DL, VT, Arg,
+                                 DAG.getConstantFP(0.5 / M_PI, DL, VT));
+    TrigVal = DAG.getNode(AMDGPUISD::FRACT, DL, VT, MulVal);
----------------
dstuttard wrote:
> arsenm wrote:
> > Avoid repeating the same constant.
> > 
> > Also we should stop relying on system headers for these constants
> Re system headers - why, are you concerned that M_PI may differ between compilers?
> Can we defer removing reliance on system headers to a separate change that does this globally?
Yes. AFAIK the standard doesn't actually specify the exact rounded value. For other system provided constants, LLVM usually duplicates the definitions and puts them in Support


Repository:
  rL LLVM

https://reviews.llvm.org/D51933





More information about the llvm-commits mailing list