[PATCH] D17042: AMDGPU/SI: move SMRD to flat if UseFlatForGlobal is true

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 11:47:09 PST 2016


tstellarAMD added inline comments.

================
Comment at: lib/Target/AMDGPU/SIInstrInfo.cpp:2379-2397
@@ -2336,1 +2378,21 @@
+
+        if (OffsetOpnd->isReg()) {
+          RegOffset = OffsetOpnd->getReg();
+          HasOffset = true;
+        } else {
+          assert(OffsetOpnd->isImm());
+          ImmOffset = OffsetOpnd->getImm();
+          // SMRD instructions take a dword offsets on SI/CI and byte offset on VI
+          // and FLAT instructions always take a byte offset.
+          if (ST.getGeneration() <= AMDGPUSubtarget::SEA_ISLANDS)
+            ImmOffset <<= 2;
+          HasOffset = (ImmOffset != 0);
+          if (ImmOffset > 64) { // Could not be inlined!
+            RegOffset = MRI.createVirtualRegister(&AMDGPU::SGPR_32RegClass);
+            BuildMI(*MBB, MI, DL, get(AMDGPU::S_MOV_B32),
+                    RegOffset)
+                    .addImm(ImmOffset);
+            ImmOffset = 0;
+          }
+        }
 
----------------
This code is very similar to what we have in the non-FlatForGlobal path.  Can we put this code into its own function so we can share it between the two paths.


http://reviews.llvm.org/D17042





More information about the llvm-commits mailing list