simd_common.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "simd_common.h"
  6. LLVMValueRef
  7. simd_pop_v128_and_bitcast(const AOTCompContext *comp_ctx,
  8. const AOTFuncContext *func_ctx,
  9. LLVMTypeRef vec_type,
  10. const char *name)
  11. {
  12. LLVMValueRef number;
  13. POP_V128(number);
  14. if (!(number =
  15. LLVMBuildBitCast(comp_ctx->builder, number, vec_type, name))) {
  16. HANDLE_FAILURE("LLVMBuildBitCast");
  17. goto fail;
  18. }
  19. return number;
  20. fail:
  21. return NULL;
  22. }
  23. bool
  24. simd_bitcast_and_push_v128(const AOTCompContext *comp_ctx,
  25. const AOTFuncContext *func_ctx,
  26. LLVMValueRef vector,
  27. const char *name)
  28. {
  29. if (!(vector = LLVMBuildBitCast(comp_ctx->builder, vector, V128_i64x2_TYPE,
  30. name))) {
  31. HANDLE_FAILURE("LLVMBuildBitCast");
  32. goto fail;
  33. }
  34. /* push result into the stack */
  35. PUSH_V128(vector);
  36. return true;
  37. fail:
  38. return false;
  39. }