[llvm] [AMDGPU] Use 32-bit SGPR to save/restore of SCC (PR #68367)

Sirish Pande via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 16:31:17 PDT 2023


================
@@ -5094,6 +5094,39 @@ unsigned SIInstrInfo::getVALUOp(const MachineInstr &MI) const {
       "Unexpected scalar opcode without corresponding vector one!");
 }
 
+bool SIInstrInfo::isSCCDefinedBefore(MachineBasicBlock &MBB,
+                                     MachineBasicBlock::iterator Before) const {
+
+  for (MachineBasicBlock::iterator I = Before, B = MBB.begin(); I != B; --I) {
+    MachineInstr &MI = *I;
+    if (!MI.hasImplicitDef())
+      continue;
+    for (MachineOperand &Op : MI.implicit_operands()) {
+      if (Op.getReg() == AMDGPU::SCC && Op.isDef() && !Op.isDead())
+        return true;
+    }
+  }
+  return false;
+}
+
+bool SIInstrInfo::isSCCUsedAfter(MachineBasicBlock &MBB,
+                                 MachineBasicBlock::iterator After) const {
+  for (MachineBasicBlock::iterator I = After, E = MBB.end(); I != E; ++I) {
+    MachineInstr &MI = *I;
+    if (MI.hasRegisterImplicitUseOperand(AMDGPU::SCC))
----------------
srpande wrote:

Not a part of this patch anymore.

https://github.com/llvm/llvm-project/pull/68367


More information about the llvm-commits mailing list