Introduce predicate for a atomic operations in GMIR
authorYashwant Singh <Yashwant.Singh@amd.com>
Fri, 23 Sep 2022 05:41:39 +0000 (11:11 +0530)
committerYashwant Singh <Yashwant.Singh@amd.com>
Fri, 23 Sep 2022 06:04:36 +0000 (11:34 +0530)
Reviewed By: arsenm, sameerds

Differential Revision: https://reviews.llvm.org/D134266

llvm/include/llvm/CodeGen/TargetInstrInfo.h
llvm/include/llvm/Support/TargetOpcodes.def

index 65fba77..02eaf93 100644 (file)
@@ -110,6 +110,11 @@ public:
     return Opc <= TargetOpcode::GENERIC_OP_END;
   }
 
+  static bool isGenericAtomicRMWOpcode(unsigned Opc) {
+    return Opc >= TargetOpcode::GENERIC_ATOMICRMW_OP_START &&
+           Opc <= TargetOpcode::GENERIC_ATOMICRMW_OP_END;
+  }
+
   /// Given a machine instruction descriptor, returns the register
   /// class constraint for OpNum, or NULL.
   virtual
index 5d6be0f..52da565 100644 (file)
@@ -387,6 +387,12 @@ HANDLE_TARGET_OPCODE(G_ATOMICRMW_FSUB)
 HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAX)
 HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMIN)
 
+// Marker for start of Generic AtomicRMW opcodes
+HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_START, G_ATOMICRMW_XCHG)
+
+// Marker for end of Generic AtomicRMW opcodes
+HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_END, G_ATOMICRMW_FMIN)
+
 // Generic atomic fence
 HANDLE_TARGET_OPCODE(G_FENCE)