[llvm] [AArch64][GlobalISel] Push ADD/SUB through Extend Instructions (PR #90964)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 11:10:49 PDT 2024
================
@@ -52,14 +52,25 @@ def ext_uaddv_to_uaddlv : GICombineRule<
(apply [{ applyExtUaddvToUaddlv(*${root}, MRI, B, Observer, ${matchinfo}); }])
>;
+// Push G_ADD and G_SUB through G_{Z/S}EXT to allow better selection of addl/subl instructions
+// add(ext, ext) => ext(add(ext, ext))
+def push_add_matchinfo :
+ GIDefMatchData<"std::tuple<bool, Register, Register, Register>">;
+def push_add_sub_through_ext : GICombineRule<
+ (defs root:$root, push_add_matchinfo:$matchinfo),
+ (match (wip_match_opcode G_ADD, G_SUB):$root,
----------------
tschuett wrote:
```
(match (G_SEXT $lhs, $s1),
(G_SEXT $rhs, $s2),
(G_ADD $root, $lhs, $rhs),
[[ return mathPushAddSubExt(${root}, ${lhs}, ${rhs}, MRI, ${matchinfo}); }]),
```
https://github.com/llvm/llvm-project/pull/90964
More information about the llvm-commits
mailing list