[llvm] [GlobalISel] Add G_ABDS and G_ABDU instructions (PR #118122)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 11:15:20 PST 2024


================
@@ -1585,6 +1585,41 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
 
     break;
   }
+  case TargetOpcode::G_ABDS:
+  case TargetOpcode::G_ABDU: {
+    LLT DstTy = MRI->getType(MI->getOperand(0).getReg());
+    LLT SrcTy = MRI->getType(MI->getOperand(1).getReg());
+    LLT SrcTy2 = MRI->getType(MI->getOperand(2).getReg());
+
+    if (SrcTy.isPointerOrPointerVector() || SrcTy2.isPointerOrPointerVector()) {
+      report("Generic abds/abdu does not support pointers as operands", MI);
+      break;
+    }
+
+    if (DstTy.isPointerOrPointerVector()) {
+      report("Generic abds/abdu does not support pointers as a result", MI);
+      break;
+    }
----------------
tschuett wrote:

Good point. It was copy-pasted/inspired by the G_SCMP and G_USCMP nearby.

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


More information about the llvm-commits mailing list