aot_emit_variable_test.cc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "gtest/gtest.h"
  6. #include "aot_emit_variable.h"
  7. #define DEFAULT_CYCLE_TIMES 0xFFFF
  8. #define DEFAULT_MAX_RAND_NUM 0xFFFFFFFF
  9. class compilation_aot_emit_variable_test : public testing::Test
  10. {
  11. protected:
  12. virtual void SetUp() {}
  13. virtual void TearDown() {}
  14. public:
  15. AOTCompContext comp_ctx = { 0 };
  16. AOTFuncContext func_ctx = { 0 };
  17. };
  18. TEST_F(compilation_aot_emit_variable_test, aot_compile_op_get_local)
  19. {
  20. AOTCompContext *pcomp_ctx = &comp_ctx;
  21. AOTFuncContext *pfunc_ctx = &func_ctx;
  22. uint32 local_idx = 0;
  23. // aot_compile_op_get_local(NULL, pfunc_ctx, local_idx);
  24. // for (uint32_t i = 0; i < DEFAULT_CYCLE_TIMES; i++) {
  25. // local_idx = (1 + (rand() % (DEFAULT_MAX_RAND_NUM - 1 + 1)));
  26. // aot_compile_op_get_local(pcomp_ctx, pfunc_ctx, local_idx);
  27. // }
  28. }
  29. TEST_F(compilation_aot_emit_variable_test, aot_compile_op_set_local)
  30. {
  31. AOTCompContext *pcomp_ctx = &comp_ctx;
  32. AOTFuncContext *pfunc_ctx = &func_ctx;
  33. uint32 local_idx = 0;
  34. // aot_compile_op_set_local(pcomp_ctx, pfunc_ctx, local_idx);
  35. // for (uint32_t i = 0; i < DEFAULT_CYCLE_TIMES; i++) {
  36. // local_idx = (1 + (rand() % (DEFAULT_MAX_RAND_NUM - 1 + 1)));
  37. // aot_compile_op_set_local(pcomp_ctx, pfunc_ctx, local_idx);
  38. // }
  39. }
  40. TEST_F(compilation_aot_emit_variable_test, aot_compile_op_tee_local)
  41. {
  42. AOTCompContext *pcomp_ctx = &comp_ctx;
  43. AOTFuncContext *pfunc_ctx = &func_ctx;
  44. uint32 local_idx = 0;
  45. // aot_compile_op_tee_local(pcomp_ctx, pfunc_ctx, local_idx);
  46. // for (uint32_t i = 0; i < DEFAULT_CYCLE_TIMES; i++) {
  47. // local_idx = (1 + (rand() % (DEFAULT_MAX_RAND_NUM - 1 + 1)));
  48. // aot_compile_op_tee_local(pcomp_ctx, pfunc_ctx, local_idx);
  49. // }
  50. }
  51. TEST_F(compilation_aot_emit_variable_test, aot_compile_op_get_global)
  52. {
  53. AOTCompContext *pcomp_ctx = &comp_ctx;
  54. AOTFuncContext *pfunc_ctx = &func_ctx;
  55. uint32 global_idx = 0;
  56. // aot_compile_op_get_global(pcomp_ctx, pfunc_ctx, global_idx);
  57. // for (uint32_t i = 0; i < DEFAULT_CYCLE_TIMES; i++) {
  58. // local_idx = (1 + (rand() % (DEFAULT_MAX_RAND_NUM - 1 + 1)));
  59. // aot_compile_op_get_global(pcomp_ctx, pfunc_ctx, global_idx);
  60. // }
  61. }
  62. TEST_F(compilation_aot_emit_variable_test, aot_compile_op_set_global)
  63. {
  64. AOTCompContext *pcomp_ctx = &comp_ctx;
  65. AOTFuncContext *pfunc_ctx = &func_ctx;
  66. uint32 global_idx = 0;
  67. bool is_aux_stack = false;
  68. // aot_compile_op_set_global(pcomp_ctx, pfunc_ctx, global_idx,
  69. // is_aux_stack);
  70. // for (uint32_t i = 0; i < DEFAULT_CYCLE_TIMES; i++) {
  71. // is_aux_stack = is_aux_stack ? false : ture;
  72. // local_idx = (1 + (rand() % (DEFAULT_MAX_RAND_NUM - 1 + 1)));
  73. // aot_compile_op_set_global(pcomp_ctx, pfunc_ctx,
  74. // global_idx,is_aux_stack);
  75. // }
  76. }