[PATCH] D52944: AMDGPU: Add llvm.amdgcn.ds.ordered.add & swap

Marek Olšák via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 08:14:49 PDT 2018


mareko added inline comments.


================
Comment at: include/llvm/IR/IntrinsicsAMDGPU.td:397-399
+  // M0 = {hi16:address, lo16:waveID}. Allow passing M0 as a pointer, so that
+  // the bit packing can be optimized at the IR level.
+  [LLVMQualPointerType<llvm_i32_ty, 2>, // IntToPtr(M0)
----------------
nhaehnle wrote:
> I don't like having this as a pointer. It really isn't, so we're really kidding ourselves here.
> 
> This could just be an i32. Alternatively, and honestly preferably, this should be just the pointer to the honest-to-goodness address, and the waveID a separate operand. It should be possible to add the DAG nodes to build the M0 value in LowerINTRINSIC_W_CHAIN. Unless the DAG combine is unable to optimize that? (Or possibly even then, and we should fix the DAG combines...)
That was what the previous version did and it produced worse code. It selected correct instructions, but we want CSE of the m0 expression across basic blocks and simplifications based on the numbers of known zero bits in the inputs. Doing it in LowerINTRINSIC_W_CHAIN is too late for those.


Repository:
  rL LLVM

https://reviews.llvm.org/D52944





More information about the llvm-commits mailing list