[llvm] [NVPTX] Improve support for rsqrt.approx (PR #89417)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 11:21:52 PDT 2024


================
@@ -30,6 +30,10 @@ using namespace llvm;
 #define DEBUG_TYPE "nvptx-isel"
 #define PASS_NAME "NVPTX DAG->DAG Pattern Instruction Selection"
 
+static cl::opt<bool>
+    DisableRsqrtOpt("nvptx-disable-rsqrt-opt", cl::init(false), cl::Hidden,
----------------
Artem-B wrote:

The patch sets `DisableRsqrtOpt = false` by default, so `doRsqrtOpt()` will return true.
I was looking at tests 3-6 below which optimized `sqrt -> rqsrt.approx`

It was not obvious that it's only in effect when `-nvptx-prec-sqrtf32=0` is in effect. This is probably OK, as we're already promising an approximate result.

https://github.com/llvm/llvm-project/pull/89417


More information about the llvm-commits mailing list