[llvm] [RISCV][TTI] Implement cost for vp min/max intrinsics (PR #107567)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 04:28:55 PDT 2024


================
@@ -973,23 +973,14 @@ define <vscale x 1 x i64> @xor_nxv1i64_anymask(<vscale x 1 x i64> %x, i64 %y, <v
 }
 
 define <vscale x 1 x i64> @smin_nxv1i64_allonesmask(<vscale x 1 x i64> %x, i64 %y, i32 zeroext %evl) {
-; VEC-COMBINE-LABEL: @smin_nxv1i64_allonesmask(
-; VEC-COMBINE-NEXT:    [[SPLAT:%.*]] = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
-; VEC-COMBINE-NEXT:    [[MASK:%.*]] = shufflevector <vscale x 1 x i1> [[SPLAT]], <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
-; VEC-COMBINE-NEXT:    [[TMP1:%.*]] = call i64 @llvm.smin.i64(i64 [[Y:%.*]], i64 42)
----------------
arcbbb wrote:

Before this patch, the scalar `@llvm.smin.i64` is used because the vector cost is invalid.
After this patch , `@llvm.vp.smin.nxv1i64` is used because the vector cost is lower than scalar cost.

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


More information about the llvm-commits mailing list