[llvm] [RISCV][ISel] Remove redundant min/max in saturating truncation (PR #75145)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 27 23:52:07 PST 2023


================
@@ -2328,6 +2328,60 @@ defm : VPatBinaryVL_VV_VX_VI<riscv_uaddsat_vl, "PseudoVSADDU">;
 defm : VPatBinaryVL_VV_VX<riscv_ssubsat_vl, "PseudoVSSUB">;
 defm : VPatBinaryVL_VV_VX<riscv_usubsat_vl, "PseudoVSSUBU">;
 
+// 12.5. Vector Narrowing Fixed-Point Clip Instructions
+multiclass VPatTruncSatClipMaxMinBase<string inst, VTypeInfo vti, VTypeInfo wti,
+  SDPatternOperator op1, int op1_value, SDPatternOperator op2, int op2_value> {
+  let Predicates = !listconcat(GetVTypePredicates<vti>.Predicates,
+                               GetVTypePredicates<wti>.Predicates) in
+  def : Pat<(vti.Vector (riscv_trunc_vector_vl
----------------
wangpc-pp wrote:

There is just one `def` in `VPatTruncSatClipMaxMinBase` and `VPatTruncSatClipUMin`, can we use class inheritances here?

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


More information about the llvm-commits mailing list