[all-commits] [llvm/llvm-project] e2b7aa: [RISCV] Reduce the number of RISCV vector builtins...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Oct 25 09:04:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2b7aabb57d50a9b16fe71c1f80b983dd61d3fbd
      https://github.com/llvm/llvm-project/commit/e2b7aabb57d50a9b16fe71c1f80b983dd61d3fbd
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-10-25 (Mon, 25 Oct 2021)

  Changed paths:
    M clang/include/clang/Basic/riscv_vector.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/CodeGen/RISCV/riscv-attr-builtin-alias.c
    M clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmerge.c
    M clang/test/CodeGen/RISCV/rvv-intrinsics/vmerge.c
    M clang/utils/TableGen/RISCVVEmitter.cpp
    M llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
    M llvm/test/CodeGen/RISCV/rvv/vmerge-rv32.ll
    M llvm/test/CodeGen/RISCV/rvv/vmerge-rv64.ll

  Log Message:
  -----------
  [RISCV] Reduce the number of RISCV vector builtins by an order of magnitude.

All but 2 of the vector builtins are only used by clang_builtin_alias.
When using clang_builtin_alias, the type string of the builtin is never
checked. Only the types in the function definition used for the alias
are checked.

This patch takes advantage of this to share a single builtin for
many different types. We already used type overloads on the IR intrinsic
so the codegen for the builtins that are being merge were already
the same. This extends the type overloading to the builtins.

I had to make a few tweaks to make this work.
-Floating point vector-vector vmerge now uses the vmerge intrinsic
 instead of the vfmerge intrinsic. New isel patterns and tests are
 added to support this.
-The SemaChecking for the immediate of vset_v/vget_v has been removed.
 Determining the valid range is harder now. I've added masking to
 ManualCodegen to ensure valid IR for invalid input.

This reduces the number of builtins from ~25000 to ~1100.

Reviewed By: HsiangKai

Differential Revision: https://reviews.llvm.org/D112102




More information about the All-commits mailing list