LevyHsu created this revision. LevyHsu added reviewers: craig.topper, jrtc27, Jim, asb, kito-cheng. LevyHsu added projects: clang, LLVM. Herald added subscribers: vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, usaxena95, s.egerton, benna, psnobl, kadircet, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, mgorny. LevyHsu requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang-tools-extra.
RV32/64: bcomress bdecompress RV64 ONLY: bcomressw bdecompressw Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D101144 Files: clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp clang-tools-extra/clangd/index/CanonicalIncludes.cpp clang/lib/Headers/CMakeLists.txt clang/lib/Headers/riscv_zbe_intrin.h clang/lib/Headers/rvintrin.h clang/test/CodeGen/RISCV/rvb-intrinsics/rvintrin.c
Index: clang/test/CodeGen/RISCV/rvb-intrinsics/rvintrin.c =================================================================== --- /dev/null +++ clang/test/CodeGen/RISCV/rvb-intrinsics/rvintrin.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple riscv32 -fsyntax-only \ +// RUN: -target-feature +experimental-zbe %s +// RUN: %clang_cc1 -triple riscv64 -fsyntax-only \ +// RUN: -target-feature +experimental-zbe %s + +#include <rvintrin.h> Index: clang/lib/Headers/rvintrin.h =================================================================== --- /dev/null +++ clang/lib/Headers/rvintrin.h @@ -0,0 +1,26 @@ +/*===-------------------------- rvintrin.h ---------------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __RVINTRIN_H +#define __RVINTRIN_H + +#define int_xlen_t long +#define uint_xlen_t unsigned int_xlen_t + +#define __DEFAULT_FN_ATTRS \ + __attribute__((__always_inline__, __artificial__, __nodebug__)) + +#if defined(__riscv_zbe) +#include "riscv_zbe_intrin.h" +#endif + +#undef __DEFAULT_FN_ATTRS +#undef uint_xlen_t +#undef int_xlen_t +#endif // __RVINTRIN_H \ No newline at end of file Index: clang/lib/Headers/riscv_zbe_intrin.h =================================================================== --- /dev/null +++ clang/lib/Headers/riscv_zbe_intrin.h @@ -0,0 +1,51 @@ +/*===------------------------ riscv_zbe_intrin.h ---------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __RVINTRIN_H +#error "Never use <riscv_zbe_intrin.h> directly; include <rvintrin.h> instead." +#endif + +#ifndef __RISCV_ZBE_INTRIN_H +#define __RISCV_ZBE_INTRIN_H + +#include <stdint.h> + +#if defined(__cplusplus) +extern "C" { +#endif + +// Zbe +static __inline__ int32_t __DEFAULT_FN_ATTRS _rv_bcompress_32(int32_t rs1, + int32_t rs2) { + return __builtin_riscv_bcompress_32(rs1, rs2); +} + +static __inline__ int32_t __DEFAULT_FN_ATTRS _rv_bdecompress_32(int32_t rs1, + int32_t rs2) { + return __builtin_riscv_bdecompress_32(rs1, rs2); +} + +// RV64 ONLY +#if __riscv_xlen == 64 +static __inline__ int64_t __DEFAULT_FN_ATTRS _rv_bcompress_64(int64_t rs1, + int64_t rs2) { + return __builtin_riscv_bcompress_64(rs1, rs2); +} + +static __inline__ int64_t __DEFAULT_FN_ATTRS _rv_bdecompress_64(int64_t rs1, + int64_t rs2) { + return __builtin_riscv_bdecompress_64(rs1, rs2); +} +#endif // if __riscv_xlen == 64 + +#if defined(__cplusplus) +} +#endif // if defined(__cplusplus) + +#endif // __RISCV_ZBE_INTRIN_H \ No newline at end of file Index: clang/lib/Headers/CMakeLists.txt =================================================================== --- clang/lib/Headers/CMakeLists.txt +++ clang/lib/Headers/CMakeLists.txt @@ -97,6 +97,8 @@ ptwriteintrin.h rdseedintrin.h rtmintrin.h + rvintrin.h + riscv_zbe_intrin.h serializeintrin.h sgxintrin.h s390intrin.h Index: clang-tools-extra/clangd/index/CanonicalIncludes.cpp =================================================================== --- clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -152,6 +152,8 @@ {"include/prfchwintrin.h", "<x86intrin.h>"}, {"include/rdseedintrin.h", "<x86intrin.h>"}, {"include/rtmintrin.h", "<immintrin.h>"}, + {"include/rvintrin.h", "<rvintrin.h>"}, + {"include/riscv_zbe_intrin.h", "<riscv_zbe_intrin.h>"}, {"include/shaintrin.h", "<immintrin.h>"}, {"include/smmintrin.h", "<smmintrin.h>"}, {"include/stdalign.h", "<cstdalign>"}, Index: clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp =================================================================== --- clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp +++ clang-tools-extra/clang-include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp @@ -57,6 +57,8 @@ {"include/prfchwintrin.h$", "<x86intrin.h>"}, {"include/rdseedintrin.h$", "<x86intrin.h>"}, {"include/rtmintrin.h$", "<immintrin.h>"}, + {"include/rvintrin.h$", "<rvintrin.h>"}, + {"include/riscv_zbe_intrin.h$", "<riscv_zbe_intrin.h>"}, {"include/shaintrin.h$", "<immintrin.h>"}, {"include/smmintrin.h$", "<smmintrin.h>"}, {"include/stdalign.h$", "<cstdalign>"},
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits