[PATCH] D22826: AMDGPU: fdiv -1, x -> rcp -x

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 06:56:11 PDT 2016


nhaehnle added a subscriber: nhaehnle.

================
Comment at: lib/Target/AMDGPU/SIISelLowering.cpp:2450-2451
@@ +2449,4 @@
+      // Same as for 1.0, but expand the sign out of the constant.
+      if (CLHS->isExactlyValue(-1.0)) {
+        // 1.0 / x -> rcp (fabs x)
+        SDValue FNegRHS = DAG.getNode(ISD::FNEG, SL, VT, RHS);
----------------
Comment: -1.0 / x -> rcp (fneg x)

================
Comment at: test/CodeGen/AMDGPU/rsq.ll:79
@@ +78,3 @@
+; SI-SAFE: v_rcp_f32_e64 [[RSQ:v[0-9]+]], -[[SQRT]]
+; SI-SAF: buffer_store_dword [[RSQ]]
+
----------------
SI-SAFE (E missing)

================
Comment at: test/CodeGen/AMDGPU/rsq.ll:110
@@ +109,3 @@
+; SI-SAFE: v_rcp_f32_e64 [[RSQ:v[0-9]+]], -[[SQRT]]
+; SI-SAF: buffer_store_dword [[RSQ]]
+
----------------
dito


https://reviews.llvm.org/D22826





More information about the llvm-commits mailing list