[llvm] [TableGen][SystemZ] Correctly check the range of a leaf immediate (PR #119931)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 17:21:27 PST 2024


================
@@ -759,14 +759,17 @@ defm block_xor : block_op<xor>;
 // Insertions.
 def inserti8 : PatFrag<(ops node:$src1, node:$src2),
                        (or (and node:$src1, -256), node:$src2)>;
-def insertll : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0xffffffffffff0000), node:$src2)>;
-def insertlh : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0xffffffff0000ffff), node:$src2)>;
-def inserthl : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0xffff0000ffffffff), node:$src2)>;
-def inserthh : PatFrag<(ops node:$src1, node:$src2),
-                       (or (and node:$src1, 0x0000ffffffffffff), node:$src2)>;
+
+class inserti16<int mask> : PatFrag<(ops node:$src1, node:$src2),
+                                    (or (and node:$src1, mask), node:$src2)>;
----------------
uweigand wrote:

It seems to me this pattern isn't really restricted to 16 bits, but could be used to implement all the insertion fragments (8-, 16- and 32-bit).  Might be an additional simplification.   Either way, LGTM.  Thanks!

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


More information about the llvm-commits mailing list