[llvm] [AArch64] Add missing sForms to sForm (PR #157552)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 8 13:52:57 PDT 2025
https://github.com/AZero13 created https://github.com/llvm/llvm-project/pull/157552
The goal is to eventually remove the CSEL a, b, cc, SUBS(SUB(x,y), 0) -> CSEL a, b, cc, SUBS(x,y) transform because peephole should have been doing it, but it has not this whole time. midpoint-int has a regression so the transform itself is not removed yet. That will come in another PR.
>From 13bd156a241eb3b271646f6e18633c40b946a420 Mon Sep 17 00:00:00 2001
From: AZero13 <gfunni234 at gmail.com>
Date: Mon, 8 Sep 2025 16:52:32 -0400
Subject: [PATCH] [AArch64] Add missing sForms to sForm
The goal is to eventually remove the CSEL a, b, cc, SUBS(SUB(x,y), 0) -> CSEL a, b, cc, SUBS(x,y) transform because peephole should have been doing it, but it has not this whole time. midpoint-int has a regression so the transform itself is not removed yet. That will come in another PR.
---
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 3ce7829207cb6..0181a70f773f1 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -1718,12 +1718,20 @@ static unsigned sForm(MachineInstr &Instr) {
case AArch64::ADDSWrr:
case AArch64::ADDSWri:
+ case AArch64::ADDSWrx:
case AArch64::ADDSXrr:
case AArch64::ADDSXri:
+ case AArch64::ADDSXrx:
case AArch64::SUBSWrr:
case AArch64::SUBSWri:
+ case AArch64::SUBSWrx:
case AArch64::SUBSXrr:
case AArch64::SUBSXri:
+ case AArch64::SUBSXrx:
+ case AArch64::ADCSWr:
+ case AArch64::ADCSXr:
+ case AArch64::SBCSWr:
+ case AArch64::SBCSXr:
return Instr.getOpcode();
case AArch64::ADDWrr:
@@ -1734,6 +1742,10 @@ static unsigned sForm(MachineInstr &Instr) {
return AArch64::ADDSXrr;
case AArch64::ADDXri:
return AArch64::ADDSXri;
+ case AArch64::ADDWrx:
+ return AArch64::ADDSWrx;
+ case AArch64::ADDXrx:
+ return AArch64::ADDSXrx;
case AArch64::ADCWr:
return AArch64::ADCSWr;
case AArch64::ADCXr:
@@ -1746,6 +1758,10 @@ static unsigned sForm(MachineInstr &Instr) {
return AArch64::SUBSXrr;
case AArch64::SUBXri:
return AArch64::SUBSXri;
+ case AArch64::SUBWrx:
+ return AArch64::SUBSWrx;
+ case AArch64::SUBXrx:
+ return AArch64::SUBSXrx;
case AArch64::SBCWr:
return AArch64::SBCSWr;
case AArch64::SBCXr:
More information about the llvm-commits
mailing list