[llvm] [PowerPC] Add support for MSGSNDP instruction (PR #180974)
Tony Varghese via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 11 08:54:37 PST 2026
https://github.com/tonykuttai created https://github.com/llvm/llvm-project/pull/180974
```
Message Send Privileged X-form
msgsndp RB
opcode : 0-5 (5bits) ===> 31
Rst : 6-10 (5bits) ===> 0
RA : 11-15 (5 bits) ===> 0
RB : 16-20 (5 bits)
xo : 21-30 (10 bits) ==> 142
RC : 31 (1 bit) ==> 0
```
>From 3bdc133f94257ae163baa64c797457ba60e3729c Mon Sep 17 00:00:00 2001
From: Tony Varghese <tony.varghese at ibm.com>
Date: Wed, 11 Feb 2026 11:45:50 -0500
Subject: [PATCH] [PowerPC] Add support for MSGSNDP instruction
---
llvm/lib/Target/PowerPC/P10InstrResources.td | 3 ++-
llvm/lib/Target/PowerPC/P9InstrResources.td | 1 +
llvm/lib/Target/PowerPC/PPCInstrInfo.td | 7 ++++++-
llvm/lib/Target/PowerPC/PPCSchedule.td | 1 +
llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt | 3 +++
llvm/test/MC/PowerPC/ppc64-encoding.s | 5 +++++
6 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/PowerPC/P10InstrResources.td b/llvm/lib/Target/PowerPC/P10InstrResources.td
index 4695a6f9940ef..c5928a5b095a7 100644
--- a/llvm/lib/Target/PowerPC/P10InstrResources.td
+++ b/llvm/lib/Target/PowerPC/P10InstrResources.td
@@ -1888,7 +1888,7 @@ def : InstRW<[P10W_ST_3C, P10W_DISP_EVEN, P10W_FX_3C, P10W_DISP_ANY],
)>;
// Expand instructions
-// 3 Cycles Store operations, 3 Cycles ALU operations, 3 Cycles Store operations, 3 Cycles ALU operations, 3 Cycles Store operations, 3 Cycles ALU operations, 6 Cycles Load operations, and 3 Cycles Store operations, 1 input operands
+// 3 Cycles Store operations, 3 Cycles ALU operations, 3 Cycles Store operations, 3 Cycles ALU operations, 3 Cycles Store operations, 3 Cycles ALU operations, 6 Cycles Load operations, and 3 Cycles Store operations, 2 input operands
def : InstRW<[P10W_ST_3C, P10W_DISP_EVEN, P10W_FX_3C, P10W_DISP_ANY, P10W_ST_3C, P10W_DISP_ANY, P10W_FX_3C, P10W_DISP_ANY, P10W_ST_3C, P10W_DISP_ANY, P10W_FX_3C, P10W_DISP_ANY, P10W_LD_6C, P10W_DISP_ANY, P10W_ST_3C, P10W_DISP_ANY],
(instrs
LDAT,
@@ -1992,6 +1992,7 @@ def : InstRW<[P10W_SX_3C, P10W_DISP_EVEN, P10W_DISP_ANY],
// 3 Cycles Simple Fixed-point (SFX) operations, 1 input operands
def : InstRW<[P10W_SX_3C, P10W_DISP_EVEN, P10W_DISP_ANY, P10SX_Read],
(instrs
+ MSGSNDP,
MTMSR,
MTMSRD
)>;
diff --git a/llvm/lib/Target/PowerPC/P9InstrResources.td b/llvm/lib/Target/PowerPC/P9InstrResources.td
index 3f5f7d396555c..d9d1f9823808a 100644
--- a/llvm/lib/Target/PowerPC/P9InstrResources.td
+++ b/llvm/lib/Target/PowerPC/P9InstrResources.td
@@ -754,6 +754,7 @@ def : InstRW<[P9_LS_4C, IP_AGEN_1C, DISP_1C],
EnforceIEIO,
ISYNC,
MSGSYNC,
+ MSGSNDP,
TLBSYNC,
SYNC,
LMW,
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 88dd4df7e4366..7d1ddf97cc9b6 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -4651,6 +4651,12 @@ let Predicates = [IsISA3_0] in {
}
}
+// Processor Control Instructions
+let Predicates = [IsISA2_07], hasSideEffects = 1 in {
+ def MSGSNDP : XForm_16b<31, 142, (outs), (ins gprc:$RB),
+ "msgsndp $RB", IIC_SprMSGSNDP, []>;
+}
+
def TLBSX : XForm_tlb<914, (outs), (ins gprc:$RA, gprc:$RB), "tlbsx $RA, $RB",
IIC_LdStLoad>, Requires<[IsBookE]>;
@@ -5645,4 +5651,3 @@ def : Pat<(int_ppc_dcbtt ForceXForm:$dst),
def : Pat<(int_ppc_stfiw ForceXForm:$dst, f64:$XT),
(STFIWX f64:$XT, ForceXForm:$dst)>;
-
diff --git a/llvm/lib/Target/PowerPC/PPCSchedule.td b/llvm/lib/Target/PowerPC/PPCSchedule.td
index f65dbae16d3a6..81cb64e673628 100644
--- a/llvm/lib/Target/PowerPC/PPCSchedule.td
+++ b/llvm/lib/Target/PowerPC/PPCSchedule.td
@@ -122,6 +122,7 @@ def IIC_SprTLBIEL : InstrItinClass;
def IIC_SprTLBIE : InstrItinClass;
def IIC_SprABORT : InstrItinClass;
def IIC_SprMSGSYNC : InstrItinClass;
+def IIC_SprMSGSNDP : InstrItinClass;
def IIC_SprSTOP : InstrItinClass;
def IIC_SprMFPMR : InstrItinClass;
def IIC_SprMTPMR : InstrItinClass;
diff --git a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
index 567c4fa5bd5ab..c4665e68ce874 100644
--- a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
+++ b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt
@@ -904,6 +904,9 @@
# CHECK: msgsync
0x7c 0x00 0x06 0xec
+# CHECK: msgsndp 3
+0x7c 0x00 0x19 0x1c
+
# CHECK: slbieg 6, 21
0x7c 0xc0 0xab 0xa4
diff --git a/llvm/test/MC/PowerPC/ppc64-encoding.s b/llvm/test/MC/PowerPC/ppc64-encoding.s
index 36bef5e39bd94..593e2f343d0c4 100644
--- a/llvm/test/MC/PowerPC/ppc64-encoding.s
+++ b/llvm/test/MC/PowerPC/ppc64-encoding.s
@@ -1098,6 +1098,11 @@
# CHECK-LE: msgsync # encoding: [0xec,0x06,0x00,0x7c]
msgsync
+# Message Send (Processor Control)
+# CHECK-BE: msgsndp 3 # encoding: [0x7c,0x00,0x19,0x1c]
+# CHECK-LE: msgsndp 3 # encoding: [0x1c,0x19,0x00,0x7c]
+ msgsndp 3
+
# SLB Invalidate Entry Global
# CHECK-BE: slbieg 6, 21 # encoding: [0x7c,0xc0,0xab,0xa4]
# CHECK-LE: slbieg 6, 21 # encoding: [0xa4,0xab,0xc0,0x7c]
More information about the llvm-commits
mailing list