[llvm] [LLVM] treat `@llvm.ssub.sat` the same as `@llvm.aarch64.neon.sqsub` (PR #140454)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 15:53:29 PDT 2025


================
@@ -1790,11 +1783,30 @@ bool AArch64LegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
     return LowerBinOp(AArch64::G_UMULL);
   case Intrinsic::aarch64_neon_abs: {
     // Lower the intrinsic to G_ABS.
-    MachineIRBuilder MIB(MI);
     MIB.buildInstr(TargetOpcode::G_ABS, {MI.getOperand(0)}, {MI.getOperand(2)});
     MI.eraseFromParent();
     return true;
   }
+  case Intrinsic::aarch64_neon_sqadd: {
+    if (MIB.getMRI()->getType(MI.getOperand(0).getReg()).isVector())
+      return LowerBinOp(TargetOpcode::G_SADDSAT);
+    break;
+  }
+  case Intrinsic::aarch64_neon_sqsub: {
+    if (MIB.getMRI()->getType(MI.getOperand(0).getReg()).isVector())
----------------
SpencerAbson wrote:

Could we use the `MachineRegisterInfo &MRI = *MIB.getMRI();` you declared up top for these `isVector` expressions?

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


More information about the llvm-commits mailing list