[PATCH] D127511: [RISCV] Refine costs for i1 reductions

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 10:15:39 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:329
+    // cost 2, but we don't have enough info here so we slightly over cost.
+    return 3;
+
----------------
frasercrmck wrote:
> One thing I've noticed is that we do use increasingly more `vmnand` as the vectors become larger and have to be split. Should we be taking this into account? See e.g. an `and` reduce with -riscv-v-vector-bits-min=128:
> 
> <256 x i1>:
>         vmnot.m v8, v0
>         vcpop.m a0, v8
> 
> <512 x i1>:
>         vmand.mm        v8, v8, v10
>         vmand.mm        v9, v0, v9
>         vmnand.mm       v8, v9, v8
>         vcpop.m a0, v8
> 
> <1024 x i1>:
>         vmand.mm        v10, v10, v14
>         vmand.mm        v8, v8, v12
>         vmand.mm        v8, v8, v10
>         vmand.mm        v9, v9, v13
>         vmand.mm        v10, v0, v11
>         vmand.mm        v9, v10, v9
>         vmnand.mm       v8, v9, v8
>         vcpop.m a0, v8
Good catch, thanks!  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127511/new/

https://reviews.llvm.org/D127511



More information about the llvm-commits mailing list