Damien George | fcac4b0 | 2016-12-09 16:32:30 +1100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the MicroPython project, http://micropython.org/ |
| 3 | * |
| 4 | * The MIT License (MIT) |
| 5 | * |
| 6 | * Copyright (c) 2016 Damien P. George |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | * of this software and associated documentation files (the "Software"), to deal |
| 10 | * in the Software without restriction, including without limitation the rights |
| 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | * copies of the Software, and to permit persons to whom the Software is |
| 13 | * furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | * THE SOFTWARE. |
| 25 | */ |
| 26 | #ifndef MICROPY_INCLUDED_PY_ASMXTENSA_H |
| 27 | #define MICROPY_INCLUDED_PY_ASMXTENSA_H |
| 28 | |
| 29 | #include "py/asmbase.h" |
| 30 | |
| 31 | // calling conventions: |
| 32 | // up to 6 args in a2-a7 |
| 33 | // return value in a2 |
| 34 | // PC stored in a0 |
| 35 | // stack pointer is a1, stack full descending, is aligned to 16 bytes |
| 36 | // callee save: a1, a12, a13, a14, a15 |
| 37 | // caller save: a3 |
| 38 | |
| 39 | #define ASM_XTENSA_REG_A0 (0) |
| 40 | #define ASM_XTENSA_REG_A1 (1) |
| 41 | #define ASM_XTENSA_REG_A2 (2) |
| 42 | #define ASM_XTENSA_REG_A3 (3) |
| 43 | #define ASM_XTENSA_REG_A4 (4) |
| 44 | #define ASM_XTENSA_REG_A5 (5) |
| 45 | #define ASM_XTENSA_REG_A6 (6) |
| 46 | #define ASM_XTENSA_REG_A7 (7) |
| 47 | #define ASM_XTENSA_REG_A8 (8) |
| 48 | #define ASM_XTENSA_REG_A9 (9) |
| 49 | #define ASM_XTENSA_REG_A10 (10) |
| 50 | #define ASM_XTENSA_REG_A11 (11) |
| 51 | #define ASM_XTENSA_REG_A12 (12) |
| 52 | #define ASM_XTENSA_REG_A13 (13) |
| 53 | #define ASM_XTENSA_REG_A14 (14) |
| 54 | #define ASM_XTENSA_REG_A15 (15) |
| 55 | |
| 56 | // for bccz |
| 57 | #define ASM_XTENSA_CCZ_EQ (0) |
| 58 | #define ASM_XTENSA_CCZ_NE (1) |
| 59 | |
| 60 | // for bcc and setcc |
| 61 | #define ASM_XTENSA_CC_NONE (0) |
| 62 | #define ASM_XTENSA_CC_EQ (1) |
| 63 | #define ASM_XTENSA_CC_LT (2) |
| 64 | #define ASM_XTENSA_CC_LTU (3) |
| 65 | #define ASM_XTENSA_CC_ALL (4) |
| 66 | #define ASM_XTENSA_CC_BC (5) |
| 67 | #define ASM_XTENSA_CC_ANY (8) |
| 68 | #define ASM_XTENSA_CC_NE (9) |
| 69 | #define ASM_XTENSA_CC_GE (10) |
| 70 | #define ASM_XTENSA_CC_GEU (11) |
| 71 | #define ASM_XTENSA_CC_NALL (12) |
| 72 | #define ASM_XTENSA_CC_BS (13) |
| 73 | |
| 74 | // macros for encoding instructions (little endian versions) |
| 75 | #define ASM_XTENSA_ENCODE_RRR(op0, op1, op2, r, s, t) \ |
Damien George | a25aa2b | 2017-02-08 10:48:51 +1100 | [diff] [blame] | 76 | ((((uint32_t)op2) << 20) | (((uint32_t)op1) << 16) | ((r) << 12) | ((s) << 8) | ((t) << 4) | (op0)) |
Damien George | fcac4b0 | 2016-12-09 16:32:30 +1100 | [diff] [blame] | 77 | #define ASM_XTENSA_ENCODE_RRI4(op0, op1, r, s, t, imm4) \ |
| 78 | (((imm4) << 20) | ((op1) << 16) | ((r) << 12) | ((s) << 8) | ((t) << 4) | (op0)) |
| 79 | #define ASM_XTENSA_ENCODE_RRI8(op0, r, s, t, imm8) \ |
Damien George | a25aa2b | 2017-02-08 10:48:51 +1100 | [diff] [blame] | 80 | ((((uint32_t)imm8) << 16) | ((r) << 12) | ((s) << 8) | ((t) << 4) | (op0)) |
Damien George | fcac4b0 | 2016-12-09 16:32:30 +1100 | [diff] [blame] | 81 | #define ASM_XTENSA_ENCODE_RI16(op0, t, imm16) \ |
| 82 | (((imm16) << 8) | ((t) << 4) | (op0)) |
| 83 | #define ASM_XTENSA_ENCODE_RSR(op0, op1, op2, rs, t) \ |
| 84 | (((op2) << 20) | ((op1) << 16) | ((rs) << 8) | ((t) << 4) | (op0)) |
| 85 | #define ASM_XTENSA_ENCODE_CALL(op0, n, offset) \ |
| 86 | (((offset) << 6) | ((n) << 4) | (op0)) |
| 87 | #define ASM_XTENSA_ENCODE_CALLX(op0, op1, op2, r, s, m, n) \ |
Damien George | a25aa2b | 2017-02-08 10:48:51 +1100 | [diff] [blame] | 88 | ((((uint32_t)op2) << 20) | (((uint32_t)op1) << 16) | ((r) << 12) | ((s) << 8) | ((m) << 6) | ((n) << 4) | (op0)) |
Damien George | fcac4b0 | 2016-12-09 16:32:30 +1100 | [diff] [blame] | 89 | #define ASM_XTENSA_ENCODE_BRI8(op0, r, s, m, n, imm8) \ |
| 90 | (((imm8) << 16) | ((r) << 12) | ((s) << 8) | ((m) << 6) | ((n) << 4) | (op0)) |
| 91 | #define ASM_XTENSA_ENCODE_BRI12(op0, s, m, n, imm12) \ |
| 92 | (((imm12) << 12) | ((s) << 8) | ((m) << 6) | ((n) << 4) | (op0)) |
| 93 | #define ASM_XTENSA_ENCODE_RRRN(op0, r, s, t) \ |
| 94 | (((r) << 12) | ((s) << 8) | ((t) << 4) | (op0)) |
| 95 | #define ASM_XTENSA_ENCODE_RI7(op0, s, imm7) \ |
| 96 | ((((imm7) & 0xf) << 12) | ((s) << 8) | ((imm7) & 0x70) | (op0)) |
| 97 | |
| 98 | typedef struct _asm_xtensa_t { |
| 99 | mp_asm_base_t base; |
| 100 | uint32_t cur_const; |
| 101 | uint32_t num_const; |
| 102 | uint32_t *const_table; |
| 103 | uint32_t stack_adjust; |
| 104 | } asm_xtensa_t; |
| 105 | |
| 106 | void asm_xtensa_end_pass(asm_xtensa_t *as); |
| 107 | |
| 108 | void asm_xtensa_entry(asm_xtensa_t *as, int num_locals); |
| 109 | void asm_xtensa_exit(asm_xtensa_t *as); |
| 110 | |
| 111 | void asm_xtensa_op16(asm_xtensa_t *as, uint16_t op); |
| 112 | void asm_xtensa_op24(asm_xtensa_t *as, uint32_t op); |
| 113 | |
| 114 | // raw instructions |
| 115 | |
| 116 | static inline void asm_xtensa_op_add(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 117 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 8, reg_dest, reg_src_a, reg_src_b)); |
| 118 | } |
| 119 | |
| 120 | static inline void asm_xtensa_op_addi(asm_xtensa_t *as, uint reg_dest, uint reg_src, int imm8) { |
| 121 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 12, reg_dest, reg_src, imm8 & 0xff)); |
| 122 | } |
| 123 | |
| 124 | static inline void asm_xtensa_op_and(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 125 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 1, reg_dest, reg_src_a, reg_src_b)); |
| 126 | } |
| 127 | |
| 128 | static inline void asm_xtensa_op_bcc(asm_xtensa_t *as, uint cond, uint reg_src1, uint reg_src2, int32_t rel8) { |
| 129 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(7, cond, reg_src1, reg_src2, rel8 & 0xff)); |
| 130 | } |
| 131 | |
| 132 | static inline void asm_xtensa_op_bccz(asm_xtensa_t *as, uint cond, uint reg_src, int32_t rel12) { |
| 133 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_BRI12(6, reg_src, cond, 1, rel12 & 0xfff)); |
| 134 | } |
| 135 | |
| 136 | static inline void asm_xtensa_op_callx0(asm_xtensa_t *as, uint reg) { |
| 137 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_CALLX(0, 0, 0, 0, reg, 3, 0)); |
| 138 | } |
| 139 | |
| 140 | static inline void asm_xtensa_op_j(asm_xtensa_t *as, int32_t rel18) { |
| 141 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_CALL(6, 0, rel18 & 0x3ffff)); |
| 142 | } |
| 143 | |
| 144 | static inline void asm_xtensa_op_jx(asm_xtensa_t *as, uint reg) { |
| 145 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_CALLX(0, 0, 0, 0, reg, 2, 2)); |
| 146 | } |
| 147 | |
| 148 | static inline void asm_xtensa_op_l8ui(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint byte_offset) { |
| 149 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 0, reg_base, reg_dest, byte_offset & 0xff)); |
| 150 | } |
| 151 | |
| 152 | static inline void asm_xtensa_op_l16ui(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint half_word_offset) { |
| 153 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 1, reg_base, reg_dest, half_word_offset & 0xff)); |
| 154 | } |
| 155 | |
| 156 | static inline void asm_xtensa_op_l32i(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint word_offset) { |
| 157 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 2, reg_base, reg_dest, word_offset & 0xff)); |
| 158 | } |
| 159 | |
| 160 | static inline void asm_xtensa_op_l32i_n(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint word_offset) { |
| 161 | asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RRRN(8, word_offset & 0xf, reg_base, reg_dest)); |
| 162 | } |
| 163 | |
| 164 | static inline void asm_xtensa_op_l32r(asm_xtensa_t *as, uint reg_dest, uint32_t op_off, uint32_t dest_off) { |
| 165 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RI16(1, reg_dest, ((dest_off - ((op_off + 3) & ~3)) >> 2) & 0xffff)); |
| 166 | } |
| 167 | |
| 168 | static inline void asm_xtensa_op_mov_n(asm_xtensa_t *as, uint reg_dest, uint reg_src) { |
| 169 | asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RRRN(13, 0, reg_src, reg_dest)); |
| 170 | } |
| 171 | |
| 172 | static inline void asm_xtensa_op_movi(asm_xtensa_t *as, uint reg_dest, int32_t imm12) { |
| 173 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 10, (imm12 >> 8) & 0xf, reg_dest, imm12 & 0xff)); |
| 174 | } |
| 175 | |
| 176 | static inline void asm_xtensa_op_movi_n(asm_xtensa_t *as, uint reg_dest, int imm4) { |
| 177 | asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RI7(12, reg_dest, imm4)); |
| 178 | } |
| 179 | |
| 180 | static inline void asm_xtensa_op_mull(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 181 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 2, 8, reg_dest, reg_src_a, reg_src_b)); |
| 182 | } |
| 183 | |
| 184 | static inline void asm_xtensa_op_or(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 185 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 2, reg_dest, reg_src_a, reg_src_b)); |
| 186 | } |
| 187 | |
| 188 | static inline void asm_xtensa_op_ret_n(asm_xtensa_t *as) { |
| 189 | asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RRRN(13, 15, 0, 0)); |
| 190 | } |
| 191 | |
| 192 | static inline void asm_xtensa_op_s8i(asm_xtensa_t *as, uint reg_src, uint reg_base, uint byte_offset) { |
| 193 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 4, reg_base, reg_src, byte_offset & 0xff)); |
| 194 | } |
| 195 | |
| 196 | static inline void asm_xtensa_op_s16i(asm_xtensa_t *as, uint reg_src, uint reg_base, uint half_word_offset) { |
| 197 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 5, reg_base, reg_src, half_word_offset & 0xff)); |
| 198 | } |
| 199 | |
| 200 | static inline void asm_xtensa_op_s32i(asm_xtensa_t *as, uint reg_src, uint reg_base, uint word_offset) { |
| 201 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRI8(2, 6, reg_base, reg_src, word_offset & 0xff)); |
| 202 | } |
| 203 | |
| 204 | static inline void asm_xtensa_op_s32i_n(asm_xtensa_t *as, uint reg_src, uint reg_base, uint word_offset) { |
| 205 | asm_xtensa_op16(as, ASM_XTENSA_ENCODE_RRRN(9, word_offset & 0xf, reg_base, reg_src)); |
| 206 | } |
| 207 | |
| 208 | static inline void asm_xtensa_op_sll(asm_xtensa_t *as, uint reg_dest, uint reg_src) { |
| 209 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 1, 10, reg_dest, reg_src, 0)); |
| 210 | } |
| 211 | |
| 212 | static inline void asm_xtensa_op_sra(asm_xtensa_t *as, uint reg_dest, uint reg_src) { |
| 213 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 1, 11, reg_dest, 0, reg_src)); |
| 214 | } |
| 215 | |
| 216 | static inline void asm_xtensa_op_ssl(asm_xtensa_t *as, uint reg_src) { |
| 217 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 4, 1, reg_src, 0)); |
| 218 | } |
| 219 | |
| 220 | static inline void asm_xtensa_op_ssr(asm_xtensa_t *as, uint reg_src) { |
| 221 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 4, 0, reg_src, 0)); |
| 222 | } |
| 223 | |
| 224 | static inline void asm_xtensa_op_sub(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 225 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 12, reg_dest, reg_src_a, reg_src_b)); |
| 226 | } |
| 227 | |
| 228 | static inline void asm_xtensa_op_xor(asm_xtensa_t *as, uint reg_dest, uint reg_src_a, uint reg_src_b) { |
| 229 | asm_xtensa_op24(as, ASM_XTENSA_ENCODE_RRR(0, 0, 3, reg_dest, reg_src_a, reg_src_b)); |
| 230 | } |
| 231 | |
| 232 | // convenience functions |
| 233 | void asm_xtensa_j_label(asm_xtensa_t *as, uint label); |
| 234 | void asm_xtensa_bccz_reg_label(asm_xtensa_t *as, uint cond, uint reg, uint label); |
| 235 | void asm_xtensa_bcc_reg_reg_label(asm_xtensa_t *as, uint cond, uint reg1, uint reg2, uint label); |
| 236 | void asm_xtensa_setcc_reg_reg_reg(asm_xtensa_t *as, uint cond, uint reg_dest, uint reg_src1, uint reg_src2); |
| 237 | void asm_xtensa_mov_reg_i32(asm_xtensa_t *as, uint reg_dest, uint32_t i32); |
| 238 | void asm_xtensa_mov_local_reg(asm_xtensa_t *as, int local_num, uint reg_src); |
| 239 | void asm_xtensa_mov_reg_local(asm_xtensa_t *as, uint reg_dest, int local_num); |
| 240 | void asm_xtensa_mov_reg_local_addr(asm_xtensa_t *as, uint reg_dest, int local_num); |
| 241 | |
| 242 | #if GENERIC_ASM_API |
| 243 | |
| 244 | // The following macros provide a (mostly) arch-independent API to |
| 245 | // generate native code, and are used by the native emitter. |
| 246 | |
| 247 | #define ASM_WORD_SIZE (4) |
| 248 | |
| 249 | #define REG_RET ASM_XTENSA_REG_A2 |
| 250 | #define REG_ARG_1 ASM_XTENSA_REG_A2 |
| 251 | #define REG_ARG_2 ASM_XTENSA_REG_A3 |
| 252 | #define REG_ARG_3 ASM_XTENSA_REG_A4 |
| 253 | #define REG_ARG_4 ASM_XTENSA_REG_A5 |
| 254 | #define REG_ARG_5 ASM_XTENSA_REG_A6 |
| 255 | |
| 256 | #define REG_TEMP0 ASM_XTENSA_REG_A2 |
| 257 | #define REG_TEMP1 ASM_XTENSA_REG_A3 |
| 258 | #define REG_TEMP2 ASM_XTENSA_REG_A4 |
| 259 | |
| 260 | #define REG_LOCAL_1 ASM_XTENSA_REG_A12 |
| 261 | #define REG_LOCAL_2 ASM_XTENSA_REG_A13 |
| 262 | #define REG_LOCAL_3 ASM_XTENSA_REG_A14 |
| 263 | #define REG_LOCAL_NUM (3) |
| 264 | |
| 265 | #define ASM_T asm_xtensa_t |
| 266 | #define ASM_END_PASS asm_xtensa_end_pass |
| 267 | #define ASM_ENTRY asm_xtensa_entry |
| 268 | #define ASM_EXIT asm_xtensa_exit |
| 269 | |
| 270 | #define ASM_JUMP asm_xtensa_j_label |
| 271 | #define ASM_JUMP_IF_REG_ZERO(as, reg, label) \ |
| 272 | asm_xtensa_bccz_reg_label(as, ASM_XTENSA_CCZ_EQ, reg, label) |
| 273 | #define ASM_JUMP_IF_REG_NONZERO(as, reg, label) \ |
| 274 | asm_xtensa_bccz_reg_label(as, ASM_XTENSA_CCZ_NE, reg, label) |
| 275 | #define ASM_JUMP_IF_REG_EQ(as, reg1, reg2, label) \ |
| 276 | asm_xtensa_bcc_reg_reg_label(as, ASM_XTENSA_CC_EQ, reg1, reg2, label) |
| 277 | #define ASM_CALL_IND(as, ptr, idx) \ |
| 278 | do { \ |
| 279 | asm_xtensa_mov_reg_i32(as, ASM_XTENSA_REG_A0, (uint32_t)ptr); \ |
| 280 | asm_xtensa_op_callx0(as, ASM_XTENSA_REG_A0); \ |
| 281 | } while (0) |
| 282 | |
| 283 | #define ASM_MOV_REG_TO_LOCAL(as, reg, local_num) asm_xtensa_mov_local_reg(as, (local_num), (reg)) |
| 284 | #define ASM_MOV_IMM_TO_REG(as, imm, reg) asm_xtensa_mov_reg_i32(as, (reg), (imm)) |
| 285 | #define ASM_MOV_ALIGNED_IMM_TO_REG(as, imm, reg) asm_xtensa_mov_reg_i32(as, (reg), (imm)) |
| 286 | #define ASM_MOV_IMM_TO_LOCAL_USING(as, imm, local_num, reg_temp) \ |
| 287 | do { \ |
| 288 | asm_xtensa_mov_reg_i32(as, (reg_temp), (imm)); \ |
| 289 | asm_xtensa_mov_local_reg(as, (local_num), (reg_temp)); \ |
| 290 | } while (0) |
| 291 | #define ASM_MOV_LOCAL_TO_REG(as, local_num, reg) asm_xtensa_mov_reg_local(as, (reg), (local_num)) |
| 292 | #define ASM_MOV_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_mov_n((as), (reg_dest), (reg_src)) |
| 293 | #define ASM_MOV_LOCAL_ADDR_TO_REG(as, local_num, reg) asm_xtensa_mov_reg_local_addr(as, (reg), (local_num)) |
| 294 | |
| 295 | #define ASM_LSL_REG_REG(as, reg_dest, reg_shift) \ |
| 296 | do { \ |
| 297 | asm_xtensa_op_ssl((as), (reg_shift)); \ |
| 298 | asm_xtensa_op_sll((as), (reg_dest), (reg_dest)); \ |
| 299 | } while (0) |
| 300 | #define ASM_ASR_REG_REG(as, reg_dest, reg_shift) \ |
| 301 | do { \ |
| 302 | asm_xtensa_op_ssr((as), (reg_shift)); \ |
| 303 | asm_xtensa_op_sra((as), (reg_dest), (reg_dest)); \ |
| 304 | } while (0) |
| 305 | #define ASM_OR_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_or((as), (reg_dest), (reg_dest), (reg_src)) |
| 306 | #define ASM_XOR_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_xor((as), (reg_dest), (reg_dest), (reg_src)) |
| 307 | #define ASM_AND_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_and((as), (reg_dest), (reg_dest), (reg_src)) |
| 308 | #define ASM_ADD_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_add((as), (reg_dest), (reg_dest), (reg_src)) |
| 309 | #define ASM_SUB_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_sub((as), (reg_dest), (reg_dest), (reg_src)) |
| 310 | #define ASM_MUL_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_mull((as), (reg_dest), (reg_dest), (reg_src)) |
| 311 | |
| 312 | #define ASM_LOAD_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_op_l32i_n((as), (reg_dest), (reg_base), (word_offset)) |
| 313 | #define ASM_LOAD8_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l8ui((as), (reg_dest), (reg_base), 0) |
| 314 | #define ASM_LOAD16_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l16ui((as), (reg_dest), (reg_base), 0) |
| 315 | #define ASM_LOAD32_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l32i_n((as), (reg_dest), (reg_base), 0) |
| 316 | |
| 317 | #define ASM_STORE_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_op_s32i_n((as), (reg_dest), (reg_base), (word_offset)) |
| 318 | #define ASM_STORE8_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s8i((as), (reg_src), (reg_base), 0) |
| 319 | #define ASM_STORE16_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s16i((as), (reg_src), (reg_base), 0) |
| 320 | #define ASM_STORE32_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s32i_n((as), (reg_src), (reg_base), 0) |
| 321 | |
| 322 | #endif // GENERIC_ASM_API |
| 323 | |
| 324 | #endif // MICROPY_INCLUDED_PY_ASMXTENSA_H |