[PATCH] D95016: [Clang][RISCV] Add custom TableGen backend for riscv-vector intrinsics.
Zakk Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 18:55:16 PST 2021
khchen created this revision.
khchen added reviewers: craig.topper, rogfer01, frasercrmck, HsiangKai, evandro, liaolucy, arcbbb, monkchiang.
Herald added subscribers: dexonsmith, NickHung, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, kristof.beyls, mgorny.
khchen requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.
Demonstrate how to generate vadd/vfadd intrinsic functions
(explicitly api) and tests.
1. add -gen-riscv-vector-builtins for clang builtins.
2. add -gen-riscv-vector-builtin-codegen for clang codegen.
3. add -gen-riscv-vector-header for riscv_vector.h. It also generates
ifdef directives with extension checking, base on D94403 <https://reviews.llvm.org/D94403>.
4. add -gen-riscv-vector-generic-header for riscv_vector_generic.h.
Generate overloading version Header for generic api.
https://github.com/riscv/rvv-intrinsic-doc/blob/master/rvv-intrinsic-rfc.md#c11-generic-interface
5. add -gen-riscv-vector-test and -gen-riscv-vector-generic-test for clang
tests. I think using the same td file to generate tests can avoid duplicate works
but there is no test generator are writen in tablengen backend now. (ArmNeonTest
was deprecated). In order to generate separated test files, I need modify
clang_generate_header function of CMake to support passing more arguments.
6. add gen-riscv-v-tests.sh which generates all clang tests and use
'update_cc_test_checks.py' to update expected result.
7. update tblgen doc for riscv related options.
riscv_vector.td also defines some unused type transformers for vadd,
because I think it could demonstrate how tranfer type work and we need them
for whole intrinsic functions implementation in the future.
Authored-by: Roger Ferrer Ibanez <rofirrim at gmail.com>
Co-Authored-by: Zakk Cehn <zakk.chen at sifive.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95016
Files:
clang/include/clang/Basic/BuiltinsRISCV.def
clang/include/clang/Basic/CMakeLists.txt
clang/include/clang/Basic/riscv_vector.td
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/CMakeLists.txt
clang/test/CodeGen/RISCV/riscv-rvv-intrinsics-generic/vadd.c
clang/test/CodeGen/RISCV/riscv-rvv-intrinsics-generic/vfadd.c
clang/test/CodeGen/RISCV/riscv-rvv-intrinsics/vadd.c
clang/test/CodeGen/RISCV/riscv-rvv-intrinsics/vfadd.c
clang/test/CodeGen/RISCV/vadd.c
clang/test/Headers/riscv-vector-header.c
clang/utils/TableGen/CMakeLists.txt
clang/utils/TableGen/RISCVVEmitter.cpp
clang/utils/TableGen/TableGen.cpp
clang/utils/TableGen/TableGenBackends.h
clang/utils/TestUtils/gen-riscv-v-tests.sh
llvm/docs/CommandGuide/tblgen.rst
More information about the cfe-commits
mailing list