[llvm] [SystemZ] Use the same PatFrag for all "insert imm" fragments (NFC) (PR #119962)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 14 03:59:45 PST 2024


https://github.com/s-barannikov created https://github.com/llvm/llvm-project/pull/119962

None

>From b1e72f3cc93bc289c64c49374b3508f329feb125 Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Sat, 14 Dec 2024 14:58:52 +0300
Subject: [PATCH] [SystemZ] Use the same PatFrag for all "insert imm" fragments
 (NFC)

---
 llvm/lib/Target/SystemZ/SystemZOperators.td | 29 +++++++++------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZOperators.td b/llvm/lib/Target/SystemZ/SystemZOperators.td
index 6439c82d26ff5c..c084c1ee581a9c 100644
--- a/llvm/lib/Target/SystemZ/SystemZOperators.td
+++ b/llvm/lib/Target/SystemZ/SystemZOperators.td
@@ -757,23 +757,18 @@ defm block_or  : block_op<or>;
 defm block_xor : block_op<xor>;
 
 // Insertions.
-def inserti8 : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, -256), node:$src2)>;
-
-class inserti16<int mask> : PatFrag<(ops node:$src1, node:$src2),
-                                    (or (and node:$src1, mask), node:$src2)>;
-
-def insertll   : inserti16<0xffff0000>;
-def insertlh   : inserti16<0x0000ffff>;
-def insertll64 : inserti16<0xffffffffffff0000>;
-def insertlh64 : inserti16<0xffffffff0000ffff>;
-def inserthl64 : inserti16<0xffff0000ffffffff>;
-def inserthh64 : inserti16<0x0000ffffffffffff>;
-
-def insertlf : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0xffffffff00000000), node:$src2)>;
-def inserthf : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0x00000000ffffffff), node:$src2)>;
+class insert_imm<int mask> : PatFrag<(ops node:$src1, node:$src2),
+                                     (or (and node:$src1, mask), node:$src2)>;
+
+def inserti8   : insert_imm<0xff00>;
+def insertll   : insert_imm<0xffff0000>;
+def insertlh   : insert_imm<0x0000ffff>;
+def insertll64 : insert_imm<0xffffffffffff0000>;
+def insertlh64 : insert_imm<0xffffffff0000ffff>;
+def inserthl64 : insert_imm<0xffff0000ffffffff>;
+def inserthh64 : insert_imm<0x0000ffffffffffff>;
+def insertlf   : insert_imm<0xffffffff00000000>;
+def inserthf   : insert_imm<0x00000000ffffffff>;
 
 // ORs that can be treated as insertions.
 def or_as_inserti8 : PatFrag<(ops node:$src1, node:$src2),



More information about the llvm-commits mailing list