[llvm] [GlobalISel] Migrate remaining generic wip_match_opcode combines to MIR-pattern. (PR #222851)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 07:16:29 PDT 2026


================
@@ -1870,16 +2077,68 @@ def combine_fsub_fpext_fneg_fmul_to_fmad_or_fma: GICombineRule<
                                             *${root}, ${info}); }]),
   (apply [{ Helper.applyBuildFn(*${root}, ${info}); }])>;
 
-def combine_minmax_nan_frags : GICombinePatFrag<
-  (outs root:$dst), (ins),
-  !foreach(op, [G_FMINNUM, G_FMAXNUM, G_FMINIMUM, G_FMAXIMUM],
-           (pattern (op $dst, $src0, $src1)))>;
+// Fold minnum/maxnum/minimum/maximum with a NaN operand.
+// G_FMINNUM/G_FMAXNUM discard NaN (keep the other operand).
+// G_FMINIMUM/G_FMAXIMUM return the NaN (IEEE 754-2019).
+// Opcode fan is a patfrag; $lhs/$rhs are ins (uses), not outs (L4).
----------------
yxsamliu wrote:

`L4` and `L7` are hard to understand and may become stale. Could you describe the operands or rules directly instead?

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


More information about the llvm-commits mailing list