[PATCH] D18218: AMDGPU: use ComplexPattern for offsets in llvm.amdgcn.buffer.load/store.format

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 14:31:48 PDT 2016


tstellarAMD added inline comments.

================
Comment at: lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1128-1134
@@ +1127,9 @@
+
+  if (isLegalMUBUFImmOffset(C)) {
+    SOffset = CurDAG->getTargetConstant(0, DL, MVT::i32);
+    ImmOffset = CurDAG->getTargetConstant(C->getZExtValue(), DL, MVT::i16);
+  } else {
+    SOffset = Constant;
+    ImmOffset = CurDAG->getTargetConstant(0, DL, MVT::i16);
+  }
+}
----------------
If an offset is too big for the ImmOffset field we should split the offset and store the part in ImmOffset and part in soffset.

If the part in soffset is less than 64, then you save a move instruction since you can encode inline immediates up to 64 in the soffset field, and for cases when the part in soffset is greater than 64 up to 2^16, you can use an s_movk instruction to copy the immediate into register, saving 4 bytes of code size.




http://reviews.llvm.org/D18218





More information about the llvm-commits mailing list