[PATCH] D103322: [AMDGPU] Use s_add_i32 for address additions

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 08:56:46 PDT 2021


foad added a comment.

> This allows to convert the add instruction to s_addk_i32

Nice. (But perhaps we should be able to convert s_add_u32 -> s_addk_i32 if scc is dead?)

> and v_add_nc_u32 instead of needing v_add_co_u32 when converting to a VALU instruction.

None of the tests show this. Why is it better? Just because it does not clobber vcc?



================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:311
+  BuildMI(MBB, I, DL, TII->get(AMDGPU::S_ADD_I32), FlatScrInitLo)
+      .addReg(FlatScrInitLo)
+      .addReg(ScratchWaveOffsetReg);
----------------
Matt usually objects to this extra indentation on the grounds that clang-format is wrong.


================
Comment at: llvm/lib/Target/AMDGPU/SIFrameLowering.cpp:1296
 
-    unsigned Op = IsDestroy ? AMDGPU::S_SUB_U32 : AMDGPU::S_ADD_U32;
-    BuildMI(MBB, I, DL, TII->get(Op), SPReg)
-      .addReg(SPReg)
-      .addImm(Amount * getScratchScaleFactor(ST));
+    Amount = Amount * getScratchScaleFactor(ST);
+    if (IsDestroy)
----------------
`*=`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103322/new/

https://reviews.llvm.org/D103322



More information about the llvm-commits mailing list