/*
 * Copyright (c) 2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// DEF_MIR_INTRINSIC(STR, NAME, INTRN_CLASS, RETURN_TYPE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5)

DEF_MIR_INTRINSIC(C_strcmp,\
                  "strcmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr)
DEF_MIR_INTRINSIC(C_strncmp,\
                  "strncmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C_strcpy,\
                  "strcpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr)
DEF_MIR_INTRINSIC(C_strncpy,\
                  "strncpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_strlen,\
                  "strlen", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyU64, kArgTyPtr)
DEF_MIR_INTRINSIC(C_strchr,\
                  "strchr", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyPtr, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C_strrchr,\
                  "strrchr", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyPtr, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C_memcmp,\
                  "memcmp", INTRNNOSIDEEFFECT | INTRNISPURE, kArgTyI32, kArgTyPtr, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_memcpy,\
                  "memcpy", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_memmove,\
                  "memmove", 0, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_memset,\
                  "memset", 0, kArgTyVoid, kArgTyPtr, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_acosf,\
                  "acosf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_asinf,\
                  "asinf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_atanf,\
                  "atanf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_cosf,\
                  "cosf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_coshf,\
                  "coshf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_expf,\
                  "expf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_logf,\
                  "logf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_log10f,\
                  "log10f", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_sinf,\
                  "sinf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_sinhf,\
                  "sinhf", INTRNISPURE, kArgTyF32, kArgTyF32)
DEF_MIR_INTRINSIC(C_acos,\
                  "acos", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_asin,\
                  "asin", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_atan,\
                  "atan", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_cos,\
                  "cos", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_cosh,\
                  "cosh", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_exp,\
                  "exp", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_log,\
                  "log", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_log10,\
                  "log10", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_sin,\
                  "sin", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_sinh,\
                  "sinh", INTRNISPURE, kArgTyF64, kArgTyF64)
DEF_MIR_INTRINSIC(C_ffs,\
                  "ffs", INTRNISPURE, kArgTyI32, kArgTyI32)
DEF_MIR_INTRINSIC(C_va_start,\
                  "sinh", INTRNISPURE | INTRNISSPECIAL, kArgTyVoid, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C_constant_p,\
                  "sinh", 0, kArgTyI32, kArgTyDynany)
DEF_MIR_INTRINSIC(C_clz32,\
                  "sinh", INTRNISPURE, kArgTyI32, kArgTyU32)
DEF_MIR_INTRINSIC(C_clz64,\
                  "sinh", INTRNISPURE, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_ctz32,\
                  "sinh", INTRNISPURE, kArgTyI32, kArgTyU32)
DEF_MIR_INTRINSIC(C_ctz64,\
                  "sinh", INTRNISPURE, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_popcount32,\
                  "popcount32", INTRNISPURE, kArgTyI32, kArgTyU32)
DEF_MIR_INTRINSIC(C_popcount64,\
                  "popcount64", INTRNISPURE, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_parity32,\
                  "parity32", INTRNISPURE, kArgTyI32, kArgTyU32)
DEF_MIR_INTRINSIC(C_parity64,\
                  "parity64", INTRNISPURE, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_clrsb32,\
                  "clrsb32", INTRNISPURE, kArgTyI32, kArgTyU32)
DEF_MIR_INTRINSIC(C_clrsb64,\
                  "clrsb64", INTRNISPURE, kArgTyI32, kArgTyU64)
DEF_MIR_INTRINSIC(C_isaligned,\
                  "isaligned", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_alignup,\
                  "alignup", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_aligndown,\
                  "aligndown", INTRNISPURE, kArgTyU1, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C_rev16_2,\
                  "rev16", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI16, kArgTyI16)
DEF_MIR_INTRINSIC(C_rev_4,\
                  "rev", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI32, kArgTyI32)
DEF_MIR_INTRINSIC(C_rev_8,\
                  "rev", INTRNISPURE | INTRNNOSIDEEFFECT, kArgTyI64, kArgTyI64)
DEF_MIR_INTRINSIC(C_stack_save,\
                  "stack_save", INTRNISPURE | INTRNISSPECIAL, kArgTyPtr)
DEF_MIR_INTRINSIC(C_stack_restore,\
                  "stack_restore", INTRNISPURE | INTRNISSPECIAL, kArgTyPtr)
// sync
DEF_MIR_INTRINSIC(C___sync_add_and_fetch_1,\
                  "__sync_add_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_add_and_fetch_2,\
                  "__sync_add_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_add_and_fetch_4,\
                  "__sync_add_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_add_and_fetch_8,\
                  "__sync_add_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_sub_and_fetch_1,\
                  "__sync_sub_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_sub_and_fetch_2,\
                  "__sync_sub_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_sub_and_fetch_4,\
                  "__sync_sub_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_sub_and_fetch_8,\
                  "__sync_sub_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_fetch_and_add_1,\
                  "__sync_fetch_and_add_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_add_2,\
                  "__sync_fetch_and_add_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_add_4,\
                  "__sync_fetch_and_add_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_add_8,\
                  "__sync_fetch_and_add_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_fetch_and_sub_1,\
                  "__sync_fetch_and_sub_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_sub_2,\
                  "__sync_fetch_and_sub_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_sub_4,\
                  "__sync_fetch_and_sub_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_sub_8,\
                  "__sync_fetch_and_sub_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_bool_compare_and_swap_1,\
                  "__sync_bool_compare_and_swap_1", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyU8, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_bool_compare_and_swap_2,\
                  "__sync_bool_compare_and_swap_2", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyU16, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_bool_compare_and_swap_4,\
                  "__sync_bool_compare_and_swap_4", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyU32, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_bool_compare_and_swap_8,\
                  "__sync_bool_compare_and_swap_8", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyU64, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_val_compare_and_swap_1,\
                  "__sync_val_compare_and_swap_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_val_compare_and_swap_2,\
                  "__sync_val_compare_and_swap_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_val_compare_and_swap_4,\
                  "__sync_val_compare_and_swap_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_val_compare_and_swap_8,\
                  "__sync_val_compare_and_swap_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_lock_test_and_set_1,\
                  "__sync_lock_test_and_set_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_lock_test_and_set_2,\
                  "__sync_lock_test_and_set_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_lock_test_and_set_4,\
                  "__sync_lock_test_and_set_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_lock_test_and_set_8,\
                  "__sync_lock_test_and_set_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_lock_release_8,\
                  "__sync_lock_release_8", INTRNATOMIC, kArgTyVoid, kArgTyPtr)
DEF_MIR_INTRINSIC(C___sync_lock_release_4,\
                  "__sync_lock_release_4", INTRNATOMIC, kArgTyVoid, kArgTyPtr)
DEF_MIR_INTRINSIC(C___sync_lock_release_2,\
                  "__sync_lock_release_2", INTRNATOMIC, kArgTyVoid, kArgTyPtr)
DEF_MIR_INTRINSIC(C___sync_lock_release_1,\
                  "__sync_lock_release_1", INTRNATOMIC, kArgTyVoid, kArgTyPtr)
DEF_MIR_INTRINSIC(C___sync_fetch_and_and_1,\
                  "__sync_fetch_and_and_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_and_2,\
                  "__sync_fetch_and_and_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_and_4,\
                  "__sync_fetch_and_and_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_and_8,\
                  "__sync_fetch_and_and_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_fetch_and_or_1,\
                  "__sync_fetch_and_or_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_or_2,\
                  "__sync_fetch_and_or_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_or_4,\
                  "__sync_fetch_and_or_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_or_8,\
                  "__sync_fetch_and_or_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_fetch_and_xor_1,\
                  "__sync_fetch_and_xor_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_xor_2,\
                  "__sync_fetch_and_xor_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_xor_4,\
                  "__sync_fetch_and_xor_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_xor_8,\
                  "__sync_fetch_and_xor_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_fetch_and_nand_1,\
                  "__sync_fetch_and_nand_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_fetch_and_nand_2,\
                  "__sync_fetch_and_nand_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_fetch_and_nand_4,\
                  "__sync_fetch_and_nand_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_fetch_and_nand_8,\
                  "__sync_fetch_and_nand_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_and_and_fetch_1,\
                  "__sync_and_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_and_and_fetch_2,\
                  "__sync_and_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_and_and_fetch_4,\
                  "__sync_and_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_and_and_fetch_8,\
                  "__sync_and_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_or_and_fetch_1,\
                  "__sync_or_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_or_and_fetch_2,\
                  "__sync_or_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_or_and_fetch_4,\
                  "__sync_or_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_or_and_fetch_8,\
                  "__sync_or_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_xor_and_fetch_1,\
                  "__sync_xor_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_xor_and_fetch_2,\
                  "__sync_xor_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_xor_and_fetch_4,\
                  "__sync_xor_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_xor_and_fetch_8,\
                  "__sync_xor_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_nand_and_fetch_1,\
                  "__sync_nand_and_fetch_1", INTRNATOMIC, kArgTyU8, kArgTyPtr, kArgTyU8)
DEF_MIR_INTRINSIC(C___sync_nand_and_fetch_2,\
                  "__sync_nand_and_fetch_2", INTRNATOMIC, kArgTyU16, kArgTyPtr, kArgTyU16)
DEF_MIR_INTRINSIC(C___sync_nand_and_fetch_4,\
                  "__sync_nand_and_fetch_4", INTRNATOMIC, kArgTyU32, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C___sync_nand_and_fetch_8,\
                  "__sync_nand_and_fetch_8", INTRNATOMIC, kArgTyU64, kArgTyPtr, kArgTyU64)
DEF_MIR_INTRINSIC(C___sync_synchronize,\
                  "__sync_synchronize", INTRNATOMIC, kArgTyUndef)

DEF_MIR_INTRINSIC(C__builtin_return_address,\
                  "__builtin_return_address", INTRNISPURE, kArgTyPtr, kArgTyU32)
DEF_MIR_INTRINSIC(C__builtin_extract_return_addr,\
                  "__builtin_extract_return_addr", INTRNISPURE, kArgTyPtr, kArgTyPtr)
DEF_MIR_INTRINSIC(C___builtin_expect,\
                  "__builtin_expect", INTRNISPURE, kArgTyI32, kArgTyI32, kArgTyI32)

// atomic
DEF_MIR_INTRINSIC(C___atomic_load_n,\
                  "__atomic_load_n", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_load,\
                  "__atomic_load", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_store_n,\
                  "__atomic_store_n", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_store,\
                  "__atomic_store", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_exchange_n,\
                  "__atomic_exchange_n", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_exchange,\
                  "__atomic_exchange", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyPtr, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_add_fetch,\
                  "__atomic_add_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_sub_fetch,\
                  "__atomic_sub_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_and_fetch,\
                  "__atomic_and_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_xor_fetch,\
                  "__atomic_xor_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_or_fetch,\
                  "__atomic_or_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_nand_fetch,\
                  "__atomic_nand_fetch", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_add,\
                  "__atomic_fetch_add", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_sub,\
                  "__atomic_fetch_sub", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_and,\
                  "__atomic_fetch_and", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_xor,\
                  "__atomic_fetch_xor", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_or,\
                  "__atomic_fetch_or", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_fetch_nand,\
                  "__atomic_fetch_nand", INTRNATOMIC, kArgTyDynany, kArgTyPtr, kArgTyDynany, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_test_and_set,\
                  "__atomic_test_and_set", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_clear,\
                  "__atomic_clear", INTRNATOMIC, kArgTyVoid, kArgTyPtr, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_thread_fence,\
                  "__atomic_thread_fence", INTRNATOMIC, kArgTyVoid, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_signal_fence,\
                  "__atomic_signal_fence", INTRNATOMIC, kArgTyVoid, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_always_lock_free,\
                  "__atomic_always_lock_free", INTRNATOMIC, kArgTyU1, kArgTyU64, kArgTyPtr)
DEF_MIR_INTRINSIC(C___atomic_is_lock_free,\
                  "__atomic_is_lock_free", INTRNATOMIC, kArgTyU1, kArgTyU64, kArgTyPtr)
DEF_MIR_INTRINSIC(C___atomic_compare_exchange_n,\
                  "__atomic_compare_exchange_n", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyPtr, kArgTyDynany, kArgTyU1, kArgTyI32, kArgTyI32)
DEF_MIR_INTRINSIC(C___atomic_compare_exchange,\
                  "__atomic_compare_exchange", INTRNATOMIC, kArgTyU1, kArgTyPtr, kArgTyPtr, kArgTyPtr, kArgTyU1, kArgTyI32, kArgTyI32)
