riscv_functions.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* riscv_functions.h -- RISCV implementations for arch-specific functions.
  2. *
  3. * Copyright (C) 2023 SiFive, Inc. All rights reserved.
  4. * Contributed by Alex Chiang <alex.chiang@sifive.com>
  5. *
  6. * For conditions of distribution and use, see copyright notice in zlib.h
  7. */
  8. #ifndef RISCV_FUNCTIONS_H_
  9. #define RISCV_FUNCTIONS_H_
  10. #ifdef RISCV_RVV
  11. uint32_t adler32_rvv(uint32_t adler, const uint8_t *buf, size_t len);
  12. uint32_t adler32_fold_copy_rvv(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len);
  13. uint32_t chunksize_rvv(void);
  14. uint8_t* chunkmemset_safe_rvv(uint8_t *out, unsigned dist, unsigned len, unsigned left);
  15. uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1);
  16. uint32_t longest_match_rvv(deflate_state *const s, Pos cur_match);
  17. uint32_t longest_match_slow_rvv(deflate_state *const s, Pos cur_match);
  18. void slide_hash_rvv(deflate_state *s);
  19. void inflate_fast_rvv(PREFIX3(stream) *strm, uint32_t start);
  20. #endif
  21. #ifdef DISABLE_RUNTIME_CPU_DETECTION
  22. // RISCV - RVV
  23. # if defined(RISCV_RVV) && defined(__riscv_v) && defined(__linux__)
  24. # undef native_adler32
  25. # define native_adler32 adler32_rvv
  26. # undef native_adler32_fold_copy
  27. # define native_adler32_fold_copy adler32_fold_copy_rvv
  28. # undef native_chunkmemset_safe
  29. # define native_chunkmemset_safe chunkmemset_safe_rvv
  30. # undef native_chunksize
  31. # define native_chunksize chunksize_rvv
  32. # undef native_compare256
  33. # define native_compare256 compare256_rvv
  34. # undef native_inflate_fast
  35. # define native_inflate_fast inflate_fast_rvv
  36. # undef native_longest_match
  37. # define native_longest_match longest_match_rvv
  38. # undef native_longest_match_slow
  39. # define native_longest_match_slow longest_match_slow_rvv
  40. # undef native_slide_hash
  41. # define native_slide_hash slide_hash_rvv
  42. # endif
  43. #endif
  44. #endif /* RISCV_FUNCTIONS_H_ */