simd_common.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _SIMD_COMMON_H_
  6. #define _SIMD_COMMON_H_
  7. #include "../aot_compiler.h"
  8. static inline bool
  9. is_target_x86(AOTCompContext *comp_ctx)
  10. {
  11. return !strncmp(comp_ctx->target_arch, "x86_64", 6)
  12. || !strncmp(comp_ctx->target_arch, "i386", 4);
  13. }
  14. LLVMValueRef
  15. simd_pop_v128_and_bitcast(const AOTCompContext *comp_ctx,
  16. const AOTFuncContext *func_ctx, LLVMTypeRef vec_type,
  17. const char *name);
  18. bool
  19. simd_bitcast_and_push_v128(const AOTCompContext *comp_ctx,
  20. const AOTFuncContext *func_ctx, LLVMValueRef vector,
  21. const char *name);
  22. LLVMValueRef
  23. simd_lane_id_to_llvm_value(AOTCompContext *comp_ctx, uint8 lane_id);
  24. LLVMValueRef
  25. simd_build_const_integer_vector(const AOTCompContext *comp_ctx,
  26. const LLVMTypeRef element_type,
  27. const int *element_value, uint32 length);
  28. LLVMValueRef
  29. simd_build_splat_const_integer_vector(const AOTCompContext *comp_ctx,
  30. const LLVMTypeRef element_type,
  31. const int64 element_value, uint32 length);
  32. LLVMValueRef
  33. simd_build_splat_const_float_vector(const AOTCompContext *comp_ctx,
  34. const LLVMTypeRef element_type,
  35. const float element_value, uint32 length);
  36. #endif /* _SIMD_COMMON_H_ */