3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm
5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Open Source and Linux Lab nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "qemu/osdep.h"
34 #include "exec/exec-all.h"
35 #include "disas/disas.h"
36 #include "tcg/tcg-op.h"
38 #include "qemu/qemu-print.h"
39 #include "exec/cpu_ldst.h"
40 #include "hw/semihosting/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
46 #include "trace-tcg.h"
51 DisasContextBase base
;
52 const XtensaConfig
*config
;
61 bool sar_m32_allocated
;
75 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
76 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i64 cpu_FRD
[16];
83 static TCGv_i32 cpu_MR
[4];
84 static TCGv_i32 cpu_BR
[16];
85 static TCGv_i32 cpu_BR4
[4];
86 static TCGv_i32 cpu_BR8
[2];
87 static TCGv_i32 cpu_SR
[256];
88 static TCGv_i32 cpu_UR
[256];
89 static TCGv_i32 cpu_windowbase_next
;
90 static TCGv_i32 cpu_exclusive_addr
;
91 static TCGv_i32 cpu_exclusive_val
;
93 static GHashTable
*xtensa_regfile_table
;
95 #include "exec/gen-icount.h"
97 static char *sr_name
[256];
98 static char *ur_name
[256];
100 void xtensa_collect_sr_names(const XtensaConfig
*config
)
102 xtensa_isa isa
= config
->isa
;
103 int n
= xtensa_isa_num_sysregs(isa
);
106 for (i
= 0; i
< n
; ++i
) {
107 int sr
= xtensa_sysreg_number(isa
, i
);
109 if (sr
>= 0 && sr
< 256) {
110 const char *name
= xtensa_sysreg_name(isa
, i
);
112 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
115 if (strstr(*pname
, name
) == NULL
) {
117 malloc(strlen(*pname
) + strlen(name
) + 2);
119 strcpy(new_name
, *pname
);
120 strcat(new_name
, "/");
121 strcat(new_name
, name
);
126 *pname
= strdup(name
);
132 void xtensa_translate_init(void)
134 static const char * const regnames
[] = {
135 "ar0", "ar1", "ar2", "ar3",
136 "ar4", "ar5", "ar6", "ar7",
137 "ar8", "ar9", "ar10", "ar11",
138 "ar12", "ar13", "ar14", "ar15",
140 static const char * const fregnames
[] = {
141 "f0", "f1", "f2", "f3",
142 "f4", "f5", "f6", "f7",
143 "f8", "f9", "f10", "f11",
144 "f12", "f13", "f14", "f15",
146 static const char * const mregnames
[] = {
147 "m0", "m1", "m2", "m3",
149 static const char * const bregnames
[] = {
150 "b0", "b1", "b2", "b3",
151 "b4", "b5", "b6", "b7",
152 "b8", "b9", "b10", "b11",
153 "b12", "b13", "b14", "b15",
157 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
158 offsetof(CPUXtensaState
, pc
), "pc");
160 for (i
= 0; i
< 16; i
++) {
161 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
162 offsetof(CPUXtensaState
, regs
[i
]),
166 for (i
= 0; i
< 16; i
++) {
167 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
168 offsetof(CPUXtensaState
,
169 fregs
[i
].f32
[FP_F32_LOW
]),
173 for (i
= 0; i
< 16; i
++) {
174 cpu_FRD
[i
] = tcg_global_mem_new_i64(cpu_env
,
175 offsetof(CPUXtensaState
,
180 for (i
= 0; i
< 4; i
++) {
181 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
182 offsetof(CPUXtensaState
,
187 for (i
= 0; i
< 16; i
++) {
188 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
189 offsetof(CPUXtensaState
,
193 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
194 offsetof(CPUXtensaState
,
199 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
200 offsetof(CPUXtensaState
,
206 for (i
= 0; i
< 256; ++i
) {
208 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
209 offsetof(CPUXtensaState
,
215 for (i
= 0; i
< 256; ++i
) {
217 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
218 offsetof(CPUXtensaState
,
224 cpu_windowbase_next
=
225 tcg_global_mem_new_i32(cpu_env
,
226 offsetof(CPUXtensaState
, windowbase_next
),
229 tcg_global_mem_new_i32(cpu_env
,
230 offsetof(CPUXtensaState
, exclusive_addr
),
233 tcg_global_mem_new_i32(cpu_env
,
234 offsetof(CPUXtensaState
, exclusive_val
),
238 void **xtensa_get_regfile_by_name(const char *name
, int entries
, int bits
)
243 if (xtensa_regfile_table
== NULL
) {
244 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
246 * AR is special. Xtensa translator uses it as a current register
247 * window, but configuration overlays represent it as a complete
248 * physical register file.
250 g_hash_table_insert(xtensa_regfile_table
,
251 (void *)"AR 16x32", (void *)cpu_R
);
252 g_hash_table_insert(xtensa_regfile_table
,
253 (void *)"AR 32x32", (void *)cpu_R
);
254 g_hash_table_insert(xtensa_regfile_table
,
255 (void *)"AR 64x32", (void *)cpu_R
);
257 g_hash_table_insert(xtensa_regfile_table
,
258 (void *)"MR 4x32", (void *)cpu_MR
);
260 g_hash_table_insert(xtensa_regfile_table
,
261 (void *)"FR 16x32", (void *)cpu_FR
);
262 g_hash_table_insert(xtensa_regfile_table
,
263 (void *)"FR 16x64", (void *)cpu_FRD
);
265 g_hash_table_insert(xtensa_regfile_table
,
266 (void *)"BR 16x1", (void *)cpu_BR
);
267 g_hash_table_insert(xtensa_regfile_table
,
268 (void *)"BR4 4x4", (void *)cpu_BR4
);
269 g_hash_table_insert(xtensa_regfile_table
,
270 (void *)"BR8 2x8", (void *)cpu_BR8
);
273 geometry_name
= g_strdup_printf("%s %dx%d", name
, entries
, bits
);
274 res
= (void **)g_hash_table_lookup(xtensa_regfile_table
, geometry_name
);
275 g_free(geometry_name
);
279 static inline bool option_enabled(DisasContext
*dc
, int opt
)
281 return xtensa_option_enabled(dc
->config
, opt
);
284 static void init_sar_tracker(DisasContext
*dc
)
286 dc
->sar_5bit
= false;
287 dc
->sar_m32_5bit
= false;
288 dc
->sar_m32_allocated
= false;
291 static void reset_sar_tracker(DisasContext
*dc
)
293 if (dc
->sar_m32_allocated
) {
294 tcg_temp_free(dc
->sar_m32
);
298 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
300 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
301 if (dc
->sar_m32_5bit
) {
302 tcg_gen_discard_i32(dc
->sar_m32
);
305 dc
->sar_m32_5bit
= false;
308 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
310 TCGv_i32 tmp
= tcg_const_i32(32);
311 if (!dc
->sar_m32_allocated
) {
312 dc
->sar_m32
= tcg_temp_local_new_i32();
313 dc
->sar_m32_allocated
= true;
315 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
316 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
317 dc
->sar_5bit
= false;
318 dc
->sar_m32_5bit
= true;
322 static void gen_exception(DisasContext
*dc
, int excp
)
324 TCGv_i32 tmp
= tcg_const_i32(excp
);
325 gen_helper_exception(cpu_env
, tmp
);
329 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
331 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
332 TCGv_i32 tcause
= tcg_const_i32(cause
);
333 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
335 tcg_temp_free(tcause
);
336 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
337 cause
== SYSCALL_CAUSE
) {
338 dc
->base
.is_jmp
= DISAS_NORETURN
;
342 static void gen_exception_cause_vaddr(DisasContext
*dc
, uint32_t cause
,
345 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
346 TCGv_i32 tcause
= tcg_const_i32(cause
);
347 gen_helper_exception_cause_vaddr(cpu_env
, tpc
, tcause
, vaddr
);
349 tcg_temp_free(tcause
);
352 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
354 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
355 TCGv_i32 tcause
= tcg_const_i32(cause
);
356 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
358 tcg_temp_free(tcause
);
359 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
360 dc
->base
.is_jmp
= DISAS_NORETURN
;
364 static bool gen_check_privilege(DisasContext
*dc
)
366 #ifndef CONFIG_USER_ONLY
371 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
372 dc
->base
.is_jmp
= DISAS_NORETURN
;
376 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
378 cp_mask
&= ~dc
->cpenable
;
380 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
381 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
382 dc
->base
.is_jmp
= DISAS_NORETURN
;
388 static int gen_postprocess(DisasContext
*dc
, int slot
);
390 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
392 tcg_gen_mov_i32(cpu_pc
, dest
);
394 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
396 if (dc
->base
.singlestep_enabled
) {
397 gen_exception(dc
, EXCP_DEBUG
);
399 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
400 slot
= gen_postprocess(dc
, slot
);
403 tcg_gen_goto_tb(slot
);
404 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
406 tcg_gen_exit_tb(NULL
, 0);
409 dc
->base
.is_jmp
= DISAS_NORETURN
;
412 static void gen_jump(DisasContext
*dc
, TCGv dest
)
414 gen_jump_slot(dc
, dest
, -1);
417 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
419 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
426 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
428 TCGv_i32 tmp
= tcg_const_i32(dest
);
429 gen_jump_slot(dc
, tmp
, adjust_jump_slot(dc
, dest
, slot
));
433 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
436 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
438 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
439 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
440 tcg_temp_free(tcallinc
);
441 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
442 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
443 gen_jump_slot(dc
, dest
, slot
);
446 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
448 if (dc
->base
.pc_next
== dc
->lend
) {
449 TCGLabel
*label
= gen_new_label();
451 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
452 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
454 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
456 gen_jump(dc
, cpu_SR
[LBEG
]);
458 gen_set_label(label
);
459 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
465 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
467 if (!gen_check_loop_end(dc
, slot
)) {
468 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
472 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
473 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
475 TCGLabel
*label
= gen_new_label();
477 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
478 gen_jumpi_check_loop_end(dc
, 0);
479 gen_set_label(label
);
480 gen_jumpi(dc
, addr
, 1);
483 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
484 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
486 TCGv_i32 tmp
= tcg_const_i32(t1
);
487 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
491 static uint32_t test_exceptions_sr(DisasContext
*dc
, const OpcodeArg arg
[],
492 const uint32_t par
[])
494 return xtensa_option_enabled(dc
->config
, par
[1]) ? 0 : XTENSA_OP_ILL
;
497 static uint32_t test_exceptions_ccompare(DisasContext
*dc
,
498 const OpcodeArg arg
[],
499 const uint32_t par
[])
501 unsigned n
= par
[0] - CCOMPARE
;
503 if (n
>= dc
->config
->nccompare
) {
504 return XTENSA_OP_ILL
;
506 return test_exceptions_sr(dc
, arg
, par
);
509 static uint32_t test_exceptions_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
510 const uint32_t par
[])
512 unsigned n
= MAX_NDBREAK
;
514 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
515 n
= par
[0] - DBREAKA
;
517 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
518 n
= par
[0] - DBREAKC
;
520 if (n
>= dc
->config
->ndbreak
) {
521 return XTENSA_OP_ILL
;
523 return test_exceptions_sr(dc
, arg
, par
);
526 static uint32_t test_exceptions_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
527 const uint32_t par
[])
529 unsigned n
= par
[0] - IBREAKA
;
531 if (n
>= dc
->config
->nibreak
) {
532 return XTENSA_OP_ILL
;
534 return test_exceptions_sr(dc
, arg
, par
);
537 static uint32_t test_exceptions_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
538 const uint32_t par
[])
540 unsigned n
= MAX_NLEVEL
+ 1;
542 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
543 n
= par
[0] - EXCSAVE1
+ 1;
545 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
546 n
= par
[0] - EPC1
+ 1;
548 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
549 n
= par
[0] - EPS2
+ 2;
551 if (n
> dc
->config
->nlevel
) {
552 return XTENSA_OP_ILL
;
554 return test_exceptions_sr(dc
, arg
, par
);
557 static void gen_load_store_alignment(DisasContext
*dc
, int shift
,
558 TCGv_i32 addr
, bool no_hw_alignment
)
560 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
561 tcg_gen_andi_i32(addr
, addr
, ~0 << shift
);
562 } else if (option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
) &&
564 TCGLabel
*label
= gen_new_label();
565 TCGv_i32 tmp
= tcg_temp_new_i32();
566 tcg_gen_andi_i32(tmp
, addr
, ~(~0 << shift
));
567 tcg_gen_brcondi_i32(TCG_COND_EQ
, tmp
, 0, label
);
568 gen_exception_cause_vaddr(dc
, LOAD_STORE_ALIGNMENT_CAUSE
, addr
);
569 gen_set_label(label
);
574 #ifndef CONFIG_USER_ONLY
575 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
577 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
578 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
580 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
583 gen_helper_waiti(cpu_env
, pc
, intlevel
);
585 tcg_temp_free(intlevel
);
589 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
591 unsigned r
= 31 - clz32(mask
);
593 if (r
/ 4 > dc
->window
) {
594 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
595 TCGv_i32 w
= tcg_const_i32(r
/ 4);
597 gen_helper_window_check(cpu_env
, pc
, w
);
598 dc
->base
.is_jmp
= DISAS_NORETURN
;
604 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
606 TCGv_i32 m
= tcg_temp_new_i32();
609 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
611 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
616 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
618 TCGLabel
*label
= gen_new_label();
620 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
621 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
622 gen_set_label(label
);
625 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
627 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
630 static int gen_postprocess(DisasContext
*dc
, int slot
)
632 uint32_t op_flags
= dc
->op_flags
;
634 #ifndef CONFIG_USER_ONLY
635 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
636 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
639 gen_helper_check_interrupts(cpu_env
);
642 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
643 gen_helper_sync_windowbase(cpu_env
);
645 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
651 struct opcode_arg_copy
{
657 struct opcode_arg_info
{
663 XtensaOpcodeOps
*ops
;
664 OpcodeArg arg
[MAX_OPCODE_ARGS
];
665 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
666 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
678 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
680 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
681 return (r
<< 24) | (g
<< 16) | n
;
684 static enum resource_type
get_resource_type(uint32_t resource
)
686 return resource
>> 24;
690 * a depends on b if b must be executed before a,
691 * because a's side effects will destroy b's inputs.
693 static bool op_depends_on(const struct slot_prop
*a
,
694 const struct slot_prop
*b
)
699 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
702 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
703 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
706 while (i
< a
->n_out
&& j
< b
->n_in
) {
707 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
709 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
719 * Try to break a dependency on b, append temporary register copy records
720 * to the end of copy and update n_copy in case of success.
721 * This is not always possible: e.g. control flow must always be the last,
722 * load/store must be first and state dependencies are not supported yet.
724 static bool break_dependency(struct slot_prop
*a
,
726 struct opcode_arg_copy
*copy
,
731 unsigned n
= *n_copy
;
734 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
737 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
738 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
741 while (i
< a
->n_out
&& j
< b
->n_in
) {
742 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
744 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
747 int index
= b
->in
[j
].index
;
749 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
753 copy
[n
].resource
= b
->in
[j
].resource
;
754 copy
[n
].arg
= b
->arg
+ index
;
765 * Calculate evaluation order for slot opcodes.
766 * Build opcode order graph and output its nodes in topological sort order.
767 * An edge a -> b in the graph means that opcode a must be followed by
770 static bool tsort(struct slot_prop
*slot
,
771 struct slot_prop
*sorted
[],
773 struct opcode_arg_copy
*copy
,
779 unsigned out_edge
[MAX_INSN_SLOTS
];
780 } node
[MAX_INSN_SLOTS
];
782 unsigned in
[MAX_INSN_SLOTS
];
788 unsigned node_idx
= 0;
790 for (i
= 0; i
< n
; ++i
) {
791 node
[i
].n_in_edge
= 0;
792 node
[i
].n_out_edge
= 0;
795 for (i
= 0; i
< n
; ++i
) {
796 unsigned n_out_edge
= 0;
798 for (j
= 0; j
< n
; ++j
) {
799 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
800 node
[i
].out_edge
[n_out_edge
] = j
;
806 node
[i
].n_out_edge
= n_out_edge
;
809 for (i
= 0; i
< n
; ++i
) {
810 if (!node
[i
].n_in_edge
) {
817 for (; in_idx
< n_in
; ++in_idx
) {
819 sorted
[n_out
] = slot
+ i
;
821 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
823 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
824 in
[n_in
] = node
[i
].out_edge
[j
];
830 for (; node_idx
< n
; ++node_idx
) {
831 struct tsnode
*cnode
= node
+ node_idx
;
833 if (cnode
->n_in_edge
) {
834 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
835 unsigned k
= cnode
->out_edge
[j
];
837 if (break_dependency(slot
+ k
, slot
+ node_idx
,
839 --node
[k
].n_in_edge
== 0) {
844 cnode
->out_edge
[cnode
->n_out_edge
- 1];
855 static void opcode_add_resource(struct slot_prop
*op
,
856 uint32_t resource
, char direction
,
862 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
863 op
->in
[op
->n_in
].resource
= resource
;
864 op
->in
[op
->n_in
].index
= index
;
868 if (direction
== 'm' || direction
== 'o') {
869 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
870 op
->out
[op
->n_out
].resource
= resource
;
871 op
->out
[op
->n_out
].index
= index
;
876 g_assert_not_reached();
880 static int resource_compare(const void *a
, const void *b
)
882 const struct opcode_arg_info
*pa
= a
;
883 const struct opcode_arg_info
*pb
= b
;
885 return pa
->resource
< pb
->resource
?
886 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
889 static int arg_copy_compare(const void *a
, const void *b
)
891 const struct opcode_arg_copy
*pa
= a
;
892 const struct opcode_arg_copy
*pb
= b
;
894 return pa
->resource
< pb
->resource
?
895 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
898 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
900 xtensa_isa isa
= dc
->config
->isa
;
901 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, dc
->pc
)};
902 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
906 uint32_t op_flags
= 0;
907 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
908 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
909 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
910 unsigned n_arg_copy
= 0;
911 uint32_t debug_cause
= 0;
912 uint32_t windowed_register
= 0;
913 uint32_t coprocessor
= 0;
915 if (len
== XTENSA_UNDEFINED
) {
916 qemu_log_mask(LOG_GUEST_ERROR
,
917 "unknown instruction length (pc = %08x)\n",
919 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
923 dc
->base
.pc_next
= dc
->pc
+ len
;
924 for (i
= 1; i
< len
; ++i
) {
925 b
[i
] = translator_ldub(env
, dc
->pc
+ i
);
927 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
928 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
929 if (fmt
== XTENSA_UNDEFINED
) {
930 qemu_log_mask(LOG_GUEST_ERROR
,
931 "unrecognized instruction format (pc = %08x)\n",
933 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
936 slots
= xtensa_format_num_slots(isa
, fmt
);
937 for (slot
= 0; slot
< slots
; ++slot
) {
939 int opnd
, vopnd
, opnds
;
940 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
941 XtensaOpcodeOps
*ops
;
943 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
944 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
945 if (opc
== XTENSA_UNDEFINED
) {
946 qemu_log_mask(LOG_GUEST_ERROR
,
947 "unrecognized opcode in slot %d (pc = %08x)\n",
949 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
952 opnds
= xtensa_opcode_num_operands(isa
, opc
);
954 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
955 void **register_file
= NULL
;
958 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
959 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
960 register_file
= dc
->config
->regfile
[rf
];
962 if (rf
== dc
->config
->a_regfile
) {
965 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
967 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
968 windowed_register
|= 1u << v
;
971 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
974 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
976 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
977 arg
[vopnd
].raw_imm
= v
;
978 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
979 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
983 arg
[vopnd
].in
= register_file
[v
];
984 arg
[vopnd
].out
= register_file
[v
];
985 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
987 arg
[vopnd
].num_bits
= 32;
992 ops
= dc
->config
->opcode_ops
[opc
];
993 slot_prop
[slot
].ops
= ops
;
996 op_flags
|= ops
->op_flags
;
997 if (ops
->test_exceptions
) {
998 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
1001 qemu_log_mask(LOG_UNIMP
,
1002 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
1003 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
1004 op_flags
|= XTENSA_OP_ILL
;
1006 if (op_flags
& XTENSA_OP_ILL
) {
1007 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1010 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
1011 debug_cause
|= ops
->par
[0];
1013 if (ops
->test_overflow
) {
1014 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
1016 coprocessor
|= ops
->coprocessor
;
1019 slot_prop
[slot
].n_in
= 0;
1020 slot_prop
[slot
].n_out
= 0;
1021 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
1023 opnds
= xtensa_opcode_num_operands(isa
, opc
);
1025 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
1026 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
1028 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
1029 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
1032 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
1034 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
1035 opcode_add_resource(slot_prop
+ slot
,
1036 encode_resource(RES_REGFILE
, rf
, v
),
1037 xtensa_operand_inout(isa
, opc
, opnd
),
1038 visible
? vopnd
: -1);
1045 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
1047 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
1048 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
1050 opcode_add_resource(slot_prop
+ slot
,
1051 encode_resource(RES_STATE
, 0, state
),
1052 xtensa_stateOperand_inout(isa
, opc
, opnd
),
1055 if (xtensa_opcode_is_branch(isa
, opc
) ||
1056 xtensa_opcode_is_jump(isa
, opc
) ||
1057 xtensa_opcode_is_loop(isa
, opc
) ||
1058 xtensa_opcode_is_call(isa
, opc
)) {
1059 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1062 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1063 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1064 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1065 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1070 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1071 qemu_log_mask(LOG_UNIMP
,
1072 "Circular resource dependencies (pc = %08x)\n",
1074 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1078 ordered
[0] = slot_prop
+ 0;
1081 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1082 !gen_check_privilege(dc
)) {
1086 if (op_flags
& XTENSA_OP_SYSCALL
) {
1087 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1091 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1092 gen_debug_exception(dc
, debug_cause
);
1096 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1100 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1101 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1103 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1107 if (op_flags
& XTENSA_OP_ALLOCA
) {
1108 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1110 gen_helper_movsp(cpu_env
, tmp
);
1114 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1123 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1124 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1125 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1126 resource
= arg_copy
[i
].resource
;
1127 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1128 temp
= tcg_temp_local_new_i32();
1129 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1130 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1131 temp
= tcg_temp_local_new_i64();
1132 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1134 g_assert_not_reached();
1136 arg_copy
[i
].temp
= temp
;
1139 arg_copy
[j
] = arg_copy
[i
];
1143 arg_copy
[i
].arg
->in
= temp
;
1148 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1149 for (slot
= 0; slot
< slots
; ++slot
) {
1150 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1151 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1156 dc
->op_flags
= op_flags
;
1158 for (slot
= 0; slot
< slots
; ++slot
) {
1159 struct slot_prop
*pslot
= ordered
[slot
];
1160 XtensaOpcodeOps
*ops
= pslot
->ops
;
1162 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1165 for (i
= 0; i
< n_arg_copy
; ++i
) {
1166 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1167 tcg_temp_free_i32(arg_copy
[i
].temp
);
1168 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1169 tcg_temp_free_i64(arg_copy
[i
].temp
);
1171 g_assert_not_reached();
1175 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1176 gen_postprocess(dc
, 0);
1178 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1179 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1180 gen_jumpi_check_loop_end(dc
, -1);
1181 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1182 gen_jumpi_check_loop_end(dc
, 0);
1184 gen_check_loop_end(dc
, 0);
1187 dc
->pc
= dc
->base
.pc_next
;
1190 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1192 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1193 return xtensa_op0_insn_len(dc
, b0
);
1196 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1200 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1201 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1202 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1203 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1209 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1212 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1213 CPUXtensaState
*env
= cpu
->env_ptr
;
1214 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1216 dc
->config
= env
->config
;
1217 dc
->pc
= dc
->base
.pc_first
;
1218 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1219 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1220 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1221 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1222 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1223 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1224 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1225 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1226 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1227 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1228 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1229 XTENSA_TBFLAG_WINDOW_SHIFT
);
1230 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1231 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1232 XTENSA_TBFLAG_CALLINC_SHIFT
);
1233 init_sar_tracker(dc
);
1236 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1238 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1241 dc
->next_icount
= tcg_temp_local_new_i32();
1245 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1247 tcg_gen_insn_start(dcbase
->pc_next
);
1250 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1251 const CPUBreakpoint
*bp
)
1253 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1255 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1256 gen_exception(dc
, EXCP_DEBUG
);
1257 dc
->base
.is_jmp
= DISAS_NORETURN
;
1258 /* The address covered by the breakpoint must be included in
1259 [tb->pc, tb->pc + tb->size) in order to for it to be
1260 properly cleared -- thus we increment the PC here so that
1261 the logic setting tb->size below does the right thing. */
1262 dc
->base
.pc_next
+= 2;
1266 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1268 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1269 CPUXtensaState
*env
= cpu
->env_ptr
;
1270 target_ulong page_start
;
1272 /* These two conditions only apply to the first insn in the TB,
1273 but this is the first TranslateOps hook that allows exiting. */
1274 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1275 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1276 gen_exception(dc
, EXCP_YIELD
);
1277 dc
->base
.is_jmp
= DISAS_NORETURN
;
1280 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1281 gen_exception(dc
, EXCP_DEBUG
);
1282 dc
->base
.is_jmp
= DISAS_NORETURN
;
1287 TCGLabel
*label
= gen_new_label();
1289 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1290 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1291 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1293 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1295 gen_set_label(label
);
1299 gen_ibreak_check(env
, dc
);
1302 disas_xtensa_insn(env
, dc
);
1305 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1308 /* End the TB if the next insn will cross into the next page. */
1309 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1310 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1311 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1312 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1313 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1317 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1319 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1321 reset_sar_tracker(dc
);
1323 tcg_temp_free(dc
->next_icount
);
1326 switch (dc
->base
.is_jmp
) {
1327 case DISAS_NORETURN
:
1329 case DISAS_TOO_MANY
:
1330 if (dc
->base
.singlestep_enabled
) {
1331 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1332 gen_exception(dc
, EXCP_DEBUG
);
1334 gen_jumpi(dc
, dc
->pc
, 0);
1338 g_assert_not_reached();
1342 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1344 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1345 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1348 static const TranslatorOps xtensa_translator_ops
= {
1349 .init_disas_context
= xtensa_tr_init_disas_context
,
1350 .tb_start
= xtensa_tr_tb_start
,
1351 .insn_start
= xtensa_tr_insn_start
,
1352 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1353 .translate_insn
= xtensa_tr_translate_insn
,
1354 .tb_stop
= xtensa_tr_tb_stop
,
1355 .disas_log
= xtensa_tr_disas_log
,
1358 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1360 DisasContext dc
= {};
1361 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1364 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1366 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1367 CPUXtensaState
*env
= &cpu
->env
;
1368 xtensa_isa isa
= env
->config
->isa
;
1371 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1373 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1374 const uint32_t *reg
=
1375 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1376 int regno
= xtensa_sysreg_number(isa
, i
);
1379 qemu_fprintf(f
, "%12s=%08x%c",
1380 xtensa_sysreg_name(isa
, i
),
1382 (j
++ % 4) == 3 ? '\n' : ' ');
1386 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1388 for (i
= 0; i
< 16; ++i
) {
1389 qemu_fprintf(f
, " A%02d=%08x%c",
1390 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1393 xtensa_sync_phys_from_window(env
);
1394 qemu_fprintf(f
, "\n");
1396 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1397 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1399 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1400 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1402 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1406 if ((flags
& CPU_DUMP_FPU
) &&
1407 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1408 qemu_fprintf(f
, "\n");
1410 for (i
= 0; i
< 16; ++i
) {
1411 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1412 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1413 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1414 (i
% 2) == 1 ? '\n' : ' ');
1418 if ((flags
& CPU_DUMP_FPU
) &&
1419 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1420 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1421 qemu_fprintf(f
, "\n");
1423 for (i
= 0; i
< 16; ++i
) {
1424 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1425 float64_val(env
->fregs
[i
].f64
),
1426 *(double *)(&env
->fregs
[i
].f64
),
1427 (i
% 2) == 1 ? '\n' : ' ');
1432 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1438 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1439 const uint32_t par
[])
1441 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1444 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1445 const uint32_t par
[])
1447 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1450 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1451 const uint32_t par
[])
1453 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1456 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1457 const uint32_t par
[])
1459 TCGv_i32 tmp
= tcg_temp_new_i32();
1460 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1461 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1465 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1466 const uint32_t par
[])
1468 uint32_t shift
= par
[1];
1469 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1470 TCGv_i32 tmp
= tcg_temp_new_i32();
1472 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1474 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1476 tcg_gen_add_i32(tmp
, tmp
, mask
);
1478 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1479 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1480 tmp
, arg
[0].imm
, 1);
1481 tcg_temp_free(mask
);
1485 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1486 const uint32_t par
[])
1488 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1491 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1492 const uint32_t par
[])
1494 TCGv_i32 tmp
= tcg_temp_new_i32();
1495 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1496 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1500 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1501 const uint32_t par
[])
1503 TCGv_i32 tmp
= tcg_temp_new_i32();
1504 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1505 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1509 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1510 const uint32_t par
[])
1512 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1515 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1516 const uint32_t par
[])
1518 #ifdef TARGET_WORDS_BIGENDIAN
1519 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1521 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1523 TCGv_i32 tmp
= tcg_temp_new_i32();
1524 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1525 #ifdef TARGET_WORDS_BIGENDIAN
1526 tcg_gen_shr_i32(bit
, bit
, tmp
);
1528 tcg_gen_shl_i32(bit
, bit
, tmp
);
1530 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1531 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1536 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1537 const uint32_t par
[])
1539 TCGv_i32 tmp
= tcg_temp_new_i32();
1540 #ifdef TARGET_WORDS_BIGENDIAN
1541 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1543 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1545 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1549 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1550 const uint32_t par
[])
1552 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1555 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1556 const uint32_t par
[])
1558 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1569 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1570 const uint32_t par
[])
1572 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1573 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1574 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1575 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1576 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1577 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1580 TCGv_i32 tmp1
= tcg_temp_new_i32();
1581 TCGv_i32 tmp2
= tcg_temp_new_i32();
1583 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1584 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1585 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1586 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1587 tcg_temp_free(tmp1
);
1588 tcg_temp_free(tmp2
);
1591 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1592 const uint32_t par
[])
1594 TCGv_i32 tmp
= tcg_temp_new_i32();
1596 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1597 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1601 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1602 const uint32_t par
[])
1604 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1605 gen_jumpi(dc
, arg
[0].imm
, 0);
1608 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1609 const uint32_t par
[])
1611 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1612 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1616 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1617 const uint32_t par
[])
1619 TCGv_i32 tmp
= tcg_temp_new_i32();
1620 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1621 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1626 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1627 const uint32_t par
[])
1629 TCGv_i32 tmp
= tcg_temp_new_i32();
1631 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1632 gen_callw_slot(dc
, par
[0], tmp
, -1);
1636 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1637 const uint32_t par
[])
1639 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1640 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1642 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1643 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1644 tcg_temp_free(tmp1
);
1645 tcg_temp_free(tmp2
);
1648 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1649 const uint32_t par
[])
1651 /* TODO: GPIO32 may be a part of coprocessor */
1652 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1655 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1656 const uint32_t par
[])
1658 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1661 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1662 const uint32_t par
[])
1664 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1666 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1670 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1671 const uint32_t par
[])
1673 TCGv_i32 addr
= tcg_temp_new_i32();
1674 TCGv_i32 res
= tcg_temp_new_i32();
1676 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1677 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1678 tcg_temp_free(addr
);
1682 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1683 const uint32_t par
[])
1685 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1686 arg
[2].imm
, arg
[3].imm
);
1689 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1690 const uint32_t par
[])
1692 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1695 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1696 const uint32_t par
[])
1698 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1699 qemu_log_mask(LOG_GUEST_ERROR
,
1700 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1701 return XTENSA_OP_ILL
;
1707 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1708 const uint32_t par
[])
1710 return 1 << (dc
->callinc
* 4);
1713 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1714 const uint32_t par
[])
1716 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1717 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1718 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1719 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1725 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1726 const uint32_t par
[])
1728 int maskimm
= (1 << arg
[3].imm
) - 1;
1730 TCGv_i32 tmp
= tcg_temp_new_i32();
1731 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1732 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1736 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1737 const uint32_t par
[])
1739 TCGv_i32 tmp
= tcg_temp_new_i32();
1741 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1742 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1743 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1747 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1748 const uint32_t par
[])
1750 #ifndef CONFIG_USER_ONLY
1751 TCGv_i32 addr
= tcg_temp_new_i32();
1753 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1754 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1755 gen_helper_itlb_hit_test(cpu_env
, addr
);
1756 tcg_temp_free(addr
);
1760 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1761 const uint32_t par
[])
1763 #ifndef CONFIG_USER_ONLY
1764 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1766 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1767 tcg_temp_free(dtlb
);
1771 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1772 const uint32_t par
[])
1774 gen_jumpi(dc
, arg
[0].imm
, 0);
1777 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1778 const uint32_t par
[])
1780 gen_jump(dc
, arg
[0].in
);
1783 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1784 const uint32_t par
[])
1786 TCGv_i32 addr
= tcg_temp_new_i32();
1788 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1789 gen_load_store_alignment(dc
, 2, addr
, false);
1790 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1791 tcg_temp_free(addr
);
1794 #ifdef CONFIG_USER_ONLY
1795 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1799 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1801 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1802 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1803 TCGv_i32 write
= tcg_const_i32(is_write
);
1805 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1807 tcg_temp_free(write
);
1812 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1813 const uint32_t par
[])
1815 TCGv_i32 addr
= tcg_temp_new_i32();
1817 tcg_gen_mov_i32(addr
, arg
[1].in
);
1818 gen_load_store_alignment(dc
, 2, addr
, true);
1819 gen_check_exclusive(dc
, addr
, false);
1820 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1821 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1822 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1823 tcg_temp_free(addr
);
1826 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1827 const uint32_t par
[])
1829 TCGv_i32 addr
= tcg_temp_new_i32();
1831 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1832 if (par
[0] & MO_SIZE
) {
1833 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1837 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1839 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, par
[0]);
1841 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, par
[0]);
1843 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1846 tcg_temp_free(addr
);
1849 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1850 const uint32_t par
[])
1854 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1855 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1856 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1858 tmp
= tcg_const_i32(arg
[1].imm
);
1860 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1864 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1865 const uint32_t par
[])
1867 uint32_t lend
= arg
[1].imm
;
1869 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1870 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1871 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1873 if (par
[0] != TCG_COND_NEVER
) {
1874 TCGLabel
*label
= gen_new_label();
1875 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1876 gen_jumpi(dc
, lend
, 1);
1877 gen_set_label(label
);
1880 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1901 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1902 const uint32_t par
[])
1905 unsigned half
= par
[1];
1906 uint32_t ld_offset
= par
[2];
1907 unsigned off
= ld_offset
? 2 : 0;
1908 TCGv_i32 vaddr
= tcg_temp_new_i32();
1909 TCGv_i32 mem32
= tcg_temp_new_i32();
1912 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1913 gen_load_store_alignment(dc
, 2, vaddr
, false);
1914 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1916 if (op
!= MAC16_NONE
) {
1917 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1918 half
& MAC16_HX
, op
== MAC16_UMUL
);
1919 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1920 half
& MAC16_XH
, op
== MAC16_UMUL
);
1922 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1923 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1924 if (op
== MAC16_UMUL
) {
1925 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1927 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1930 TCGv_i32 lo
= tcg_temp_new_i32();
1931 TCGv_i32 hi
= tcg_temp_new_i32();
1933 tcg_gen_mul_i32(lo
, m1
, m2
);
1934 tcg_gen_sari_i32(hi
, lo
, 31);
1935 if (op
== MAC16_MULA
) {
1936 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1937 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1940 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1941 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1944 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1946 tcg_temp_free_i32(lo
);
1947 tcg_temp_free_i32(hi
);
1953 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1954 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1956 tcg_temp_free(vaddr
);
1957 tcg_temp_free(mem32
);
1960 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1961 const uint32_t par
[])
1963 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1966 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1967 const uint32_t par
[])
1969 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1972 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1973 const uint32_t par
[])
1975 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1978 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1979 const uint32_t par
[])
1981 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1984 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1985 const uint32_t par
[])
1987 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1990 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1991 const uint32_t par
[])
1993 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1996 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1997 const uint32_t par
[])
1999 TCGv_i32 zero
= tcg_const_i32(0);
2001 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
2002 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
2003 tcg_temp_free(zero
);
2006 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
2007 const uint32_t par
[])
2009 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
2012 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
2013 const uint32_t par
[])
2015 TCGv_i32 zero
= tcg_const_i32(0);
2016 TCGv_i32 tmp
= tcg_temp_new_i32();
2018 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
2019 tcg_gen_movcond_i32(par
[0],
2020 arg
[0].out
, tmp
, zero
,
2021 arg
[1].in
, arg
[0].in
);
2023 tcg_temp_free(zero
);
2026 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
2027 const uint32_t par
[])
2029 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
2032 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
2033 const uint32_t par
[])
2035 TCGv_i32 v1
= tcg_temp_new_i32();
2036 TCGv_i32 v2
= tcg_temp_new_i32();
2039 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
2040 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
2042 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
2043 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
2045 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
2050 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
2051 const uint32_t par
[])
2053 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2056 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
2057 const uint32_t par
[])
2059 TCGv_i32 lo
= tcg_temp_new();
2062 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2064 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2069 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
2070 const uint32_t par
[])
2072 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2075 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2076 const uint32_t par
[])
2080 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2081 const uint32_t par
[])
2083 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2086 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2087 const uint32_t par
[])
2089 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2092 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2093 const uint32_t par
[])
2095 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2098 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2099 const uint32_t par
[])
2101 #ifndef CONFIG_USER_ONLY
2102 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2104 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2105 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2106 tcg_temp_free(dtlb
);
2110 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2111 const uint32_t par
[])
2113 #ifndef CONFIG_USER_ONLY
2114 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2115 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2119 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2120 const uint32_t par
[])
2122 TCGLabel
*label1
= gen_new_label();
2123 TCGLabel
*label2
= gen_new_label();
2125 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2127 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2129 tcg_gen_movi_i32(arg
[0].out
,
2130 par
[0] ? 0x80000000 : 0);
2132 gen_set_label(label1
);
2134 tcg_gen_div_i32(arg
[0].out
,
2135 arg
[1].in
, arg
[2].in
);
2137 tcg_gen_rem_i32(arg
[0].out
,
2138 arg
[1].in
, arg
[2].in
);
2140 gen_set_label(label2
);
2143 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2144 const uint32_t par
[])
2146 tcg_gen_divu_i32(arg
[0].out
,
2147 arg
[1].in
, arg
[2].in
);
2150 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2151 const uint32_t par
[])
2153 /* TODO: GPIO32 may be a part of coprocessor */
2154 tcg_gen_movi_i32(arg
[0].out
, 0);
2157 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2158 const uint32_t par
[])
2160 tcg_gen_remu_i32(arg
[0].out
,
2161 arg
[1].in
, arg
[2].in
);
2164 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2165 const uint32_t par
[])
2167 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2170 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2171 const uint32_t par
[])
2173 gen_jump(dc
, cpu_R
[0]);
2176 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2177 const uint32_t par
[])
2180 qemu_log_mask(LOG_GUEST_ERROR
,
2181 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2182 return XTENSA_OP_ILL
;
2184 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2186 gen_helper_test_ill_retw(cpu_env
, tmp
);
2192 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2193 const uint32_t par
[])
2195 TCGv_i32 tmp
= tcg_const_i32(1);
2196 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2197 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2198 cpu_SR
[WINDOW_START
], tmp
);
2199 tcg_gen_movi_i32(tmp
, dc
->pc
);
2200 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2201 gen_helper_retw(cpu_env
, cpu_R
[0]);
2206 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2207 const uint32_t par
[])
2209 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2212 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2213 const uint32_t par
[])
2215 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2216 gen_jump(dc
, cpu_SR
[EPC1
]);
2219 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2220 const uint32_t par
[])
2222 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2223 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2226 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2227 const uint32_t par
[])
2229 TCGv_i32 tmp
= tcg_const_i32(1);
2231 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2232 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2235 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2236 cpu_SR
[WINDOW_START
], tmp
);
2238 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2239 cpu_SR
[WINDOW_START
], tmp
);
2243 gen_helper_restore_owb(cpu_env
);
2244 gen_jump(dc
, cpu_SR
[EPC1
]);
2247 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2248 const uint32_t par
[])
2250 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2253 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2254 const uint32_t par
[])
2256 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2257 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2258 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2261 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2262 const uint32_t par
[])
2264 if (sr_name
[par
[0]]) {
2265 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2267 tcg_gen_movi_i32(arg
[0].out
, 0);
2271 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2272 const uint32_t par
[])
2274 #ifndef CONFIG_USER_ONLY
2275 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2278 gen_helper_update_ccount(cpu_env
);
2279 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2283 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2284 const uint32_t par
[])
2286 #ifndef CONFIG_USER_ONLY
2287 TCGv_i32 tmp
= tcg_temp_new_i32();
2289 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2290 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2291 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2296 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2297 const uint32_t par
[])
2299 #ifndef CONFIG_USER_ONLY
2300 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2305 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2307 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2308 tcg_temp_free(dtlb
);
2312 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2313 const uint32_t par
[])
2315 #ifndef CONFIG_USER_ONLY
2316 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2320 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2321 const uint32_t par
[])
2323 #ifndef CONFIG_USER_ONLY
2324 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2328 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2329 const uint32_t par
[])
2331 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2334 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2335 const uint32_t par
[])
2337 /* TODO: GPIO32 may be a part of coprocessor */
2338 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2341 #ifdef CONFIG_USER_ONLY
2342 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2346 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2348 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2350 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2355 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2356 const uint32_t par
[])
2358 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2359 TCGv_i32 addr
= tcg_temp_local_new_i32();
2361 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2362 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2363 gen_load_store_alignment(dc
, 2, addr
, true);
2364 gen_check_atomctl(dc
, addr
);
2365 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2366 tmp
, dc
->cring
, MO_TEUL
);
2367 tcg_temp_free(addr
);
2371 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2372 const uint32_t par
[])
2374 TCGv_i32 addr
= tcg_temp_new_i32();
2376 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2377 gen_load_store_alignment(dc
, 2, addr
, false);
2378 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, MO_TEUL
);
2379 tcg_temp_free(addr
);
2382 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2383 const uint32_t par
[])
2385 TCGv_i32 prev
= tcg_temp_new_i32();
2386 TCGv_i32 addr
= tcg_temp_local_new_i32();
2387 TCGv_i32 res
= tcg_temp_local_new_i32();
2388 TCGLabel
*label
= gen_new_label();
2390 tcg_gen_movi_i32(res
, 0);
2391 tcg_gen_mov_i32(addr
, arg
[1].in
);
2392 gen_load_store_alignment(dc
, 2, addr
, true);
2393 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2394 gen_check_exclusive(dc
, addr
, true);
2395 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2396 arg
[0].in
, dc
->cring
, MO_TEUL
);
2397 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2398 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2399 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2400 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2401 gen_set_label(label
);
2402 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2403 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2404 tcg_temp_free(prev
);
2405 tcg_temp_free(addr
);
2409 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2410 const uint32_t par
[])
2412 tcg_gen_setcond_i32(par
[0],
2414 arg
[1].in
, arg
[2].in
);
2417 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2418 const uint32_t par
[])
2420 int shift
= 31 - arg
[2].imm
;
2423 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2424 } else if (shift
== 16) {
2425 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2427 TCGv_i32 tmp
= tcg_temp_new_i32();
2428 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2429 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2434 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2435 const OpcodeArg arg
[],
2436 const uint32_t par
[])
2438 #ifdef CONFIG_USER_ONLY
2441 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2442 bool ill
= dc
->config
->hw_version
<= 250002 && !semihosting_enabled();
2444 if (ill
|| !semihosting_enabled()) {
2445 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2447 return ill
? XTENSA_OP_ILL
: 0;
2450 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2451 const uint32_t par
[])
2453 #ifndef CONFIG_USER_ONLY
2454 if (semihosting_enabled()) {
2455 gen_helper_simcall(cpu_env
);
2461 * Note: 64 bit ops are used here solely because SAR values
2464 #define gen_shift_reg(cmd, reg) do { \
2465 TCGv_i64 tmp = tcg_temp_new_i64(); \
2466 tcg_gen_extu_i32_i64(tmp, reg); \
2467 tcg_gen_##cmd##_i64(v, v, tmp); \
2468 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2469 tcg_temp_free_i64(v); \
2470 tcg_temp_free_i64(tmp); \
2473 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2475 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2476 const uint32_t par
[])
2478 if (dc
->sar_m32_5bit
) {
2479 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2481 TCGv_i64 v
= tcg_temp_new_i64();
2482 TCGv_i32 s
= tcg_const_i32(32);
2483 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2484 tcg_gen_andi_i32(s
, s
, 0x3f);
2485 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2486 gen_shift_reg(shl
, s
);
2491 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2492 const uint32_t par
[])
2494 if (arg
[2].imm
== 32) {
2495 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2496 arg
[0].imm
, arg
[1].imm
);
2498 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2501 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2502 const uint32_t par
[])
2504 if (dc
->sar_m32_5bit
) {
2505 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2507 TCGv_i64 v
= tcg_temp_new_i64();
2508 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2513 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2514 const uint32_t par
[])
2516 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2519 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2520 const uint32_t par
[])
2522 TCGv_i64 v
= tcg_temp_new_i64();
2523 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2527 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2528 const uint32_t par
[])
2530 if (dc
->sar_m32_5bit
) {
2531 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2533 TCGv_i64 v
= tcg_temp_new_i64();
2534 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2540 #undef gen_shift_reg
2542 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2543 const uint32_t par
[])
2545 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2548 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2549 const uint32_t par
[])
2551 TCGv_i32 tmp
= tcg_temp_new_i32();
2552 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2553 gen_left_shift_sar(dc
, tmp
);
2557 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2558 const uint32_t par
[])
2560 TCGv_i32 tmp
= tcg_temp_new_i32();
2561 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2562 gen_right_shift_sar(dc
, tmp
);
2566 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2567 const uint32_t par
[])
2569 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2570 gen_right_shift_sar(dc
, tmp
);
2574 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2575 const uint32_t par
[])
2577 gen_left_shift_sar(dc
, arg
[0].in
);
2580 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2581 const uint32_t par
[])
2583 gen_right_shift_sar(dc
, arg
[0].in
);
2586 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2587 const uint32_t par
[])
2589 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2592 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2593 const uint32_t par
[])
2595 TCGv_i32 tmp
= tcg_temp_new_i32();
2596 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2597 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2601 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2602 const uint32_t par
[])
2604 #ifndef CONFIG_USER_ONLY
2605 gen_waiti(dc
, arg
[0].imm
);
2609 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2610 const uint32_t par
[])
2612 #ifndef CONFIG_USER_ONLY
2613 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2615 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2616 tcg_temp_free(dtlb
);
2620 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2621 const uint32_t par
[])
2623 #ifndef CONFIG_USER_ONLY
2624 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2628 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2629 const uint32_t par
[])
2631 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2634 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2635 const uint32_t par
[])
2637 /* TODO: GPIO32 may be a part of coprocessor */
2638 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2641 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2642 const uint32_t par
[])
2644 if (sr_name
[par
[0]]) {
2645 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2649 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2650 const uint32_t par
[])
2652 if (sr_name
[par
[0]]) {
2653 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2657 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2658 const uint32_t par
[])
2660 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2663 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2664 const uint32_t par
[])
2666 #ifndef CONFIG_USER_ONLY
2667 uint32_t id
= par
[0] - CCOMPARE
;
2668 TCGv_i32 tmp
= tcg_const_i32(id
);
2670 assert(id
< dc
->config
->nccompare
);
2671 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2674 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2675 gen_helper_update_ccompare(cpu_env
, tmp
);
2680 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2681 const uint32_t par
[])
2683 #ifndef CONFIG_USER_ONLY
2684 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2687 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2691 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2692 const uint32_t par
[])
2694 #ifndef CONFIG_USER_ONLY
2695 unsigned id
= par
[0] - DBREAKA
;
2696 TCGv_i32 tmp
= tcg_const_i32(id
);
2698 assert(id
< dc
->config
->ndbreak
);
2699 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2704 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2705 const uint32_t par
[])
2707 #ifndef CONFIG_USER_ONLY
2708 unsigned id
= par
[0] - DBREAKC
;
2709 TCGv_i32 tmp
= tcg_const_i32(id
);
2711 assert(id
< dc
->config
->ndbreak
);
2712 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2717 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2718 const uint32_t par
[])
2720 #ifndef CONFIG_USER_ONLY
2721 unsigned id
= par
[0] - IBREAKA
;
2722 TCGv_i32 tmp
= tcg_const_i32(id
);
2724 assert(id
< dc
->config
->nibreak
);
2725 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2730 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2731 const uint32_t par
[])
2733 #ifndef CONFIG_USER_ONLY
2734 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2738 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2739 const uint32_t par
[])
2741 #ifndef CONFIG_USER_ONLY
2743 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2745 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2750 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2751 const uint32_t par
[])
2753 #ifndef CONFIG_USER_ONLY
2754 gen_helper_intclear(cpu_env
, arg
[0].in
);
2758 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2759 const uint32_t par
[])
2761 #ifndef CONFIG_USER_ONLY
2762 gen_helper_intset(cpu_env
, arg
[0].in
);
2766 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2767 const uint32_t par
[])
2769 #ifndef CONFIG_USER_ONLY
2770 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2774 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2775 const uint32_t par
[])
2777 #ifndef CONFIG_USER_ONLY
2778 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2782 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2783 const uint32_t par
[])
2785 #ifndef CONFIG_USER_ONLY
2786 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2787 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2789 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2790 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2793 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2797 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2798 const uint32_t par
[])
2800 #ifndef CONFIG_USER_ONLY
2801 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2805 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2806 const uint32_t par
[])
2808 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2809 if (dc
->sar_m32_5bit
) {
2810 tcg_gen_discard_i32(dc
->sar_m32
);
2812 dc
->sar_5bit
= false;
2813 dc
->sar_m32_5bit
= false;
2816 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2817 const uint32_t par
[])
2819 #ifndef CONFIG_USER_ONLY
2820 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2824 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2825 const uint32_t par
[])
2827 #ifndef CONFIG_USER_ONLY
2828 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2829 (1 << dc
->config
->nareg
/ 4) - 1);
2833 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2834 const uint32_t par
[])
2836 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2839 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2840 const uint32_t par
[])
2842 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2845 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2846 const uint32_t par
[])
2848 if (sr_name
[par
[0]]) {
2849 TCGv_i32 tmp
= tcg_temp_new_i32();
2851 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2852 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2853 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2856 tcg_gen_movi_i32(arg
[0].out
, 0);
2860 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2861 const uint32_t par
[])
2863 if (sr_name
[par
[0]]) {
2864 TCGv_i32 tmp
= tcg_temp_new_i32();
2866 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2867 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2868 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2871 tcg_gen_movi_i32(arg
[0].out
, 0);
2875 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2876 const uint32_t par
[])
2878 #ifndef CONFIG_USER_ONLY
2879 TCGv_i32 tmp
= tcg_temp_new_i32();
2881 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2885 gen_helper_update_ccount(cpu_env
);
2886 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2887 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2888 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2894 #define gen_translate_xsr(name) \
2895 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2896 const uint32_t par[]) \
2898 TCGv_i32 tmp = tcg_temp_new_i32(); \
2900 if (sr_name[par[0]]) { \
2901 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2903 tcg_gen_movi_i32(tmp, 0); \
2905 translate_wsr_##name(dc, arg, par); \
2906 tcg_gen_mov_i32(arg[0].out, tmp); \
2907 tcg_temp_free(tmp); \
2910 gen_translate_xsr(acchi
)
2911 gen_translate_xsr(ccompare
)
2912 gen_translate_xsr(dbreaka
)
2913 gen_translate_xsr(dbreakc
)
2914 gen_translate_xsr(ibreaka
)
2915 gen_translate_xsr(ibreakenable
)
2916 gen_translate_xsr(icount
)
2917 gen_translate_xsr(memctl
)
2918 gen_translate_xsr(mpuenb
)
2919 gen_translate_xsr(ps
)
2920 gen_translate_xsr(rasid
)
2921 gen_translate_xsr(sar
)
2922 gen_translate_xsr(windowbase
)
2923 gen_translate_xsr(windowstart
)
2925 #undef gen_translate_xsr
2927 static const XtensaOpcodeOps core_ops
[] = {
2930 .translate
= translate_abs
,
2932 .name
= (const char * const[]) {
2933 "add", "add.n", NULL
,
2935 .translate
= translate_add
,
2936 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2938 .name
= (const char * const[]) {
2939 "addi", "addi.n", NULL
,
2941 .translate
= translate_addi
,
2942 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2945 .translate
= translate_addi
,
2948 .translate
= translate_addx
,
2949 .par
= (const uint32_t[]){1},
2952 .translate
= translate_addx
,
2953 .par
= (const uint32_t[]){2},
2956 .translate
= translate_addx
,
2957 .par
= (const uint32_t[]){3},
2960 .translate
= translate_all
,
2961 .par
= (const uint32_t[]){true, 4},
2964 .translate
= translate_all
,
2965 .par
= (const uint32_t[]){true, 8},
2968 .translate
= translate_and
,
2971 .translate
= translate_boolean
,
2972 .par
= (const uint32_t[]){BOOLEAN_AND
},
2975 .translate
= translate_boolean
,
2976 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2979 .translate
= translate_all
,
2980 .par
= (const uint32_t[]){false, 4},
2983 .translate
= translate_all
,
2984 .par
= (const uint32_t[]){false, 8},
2986 .name
= (const char * const[]) {
2987 "ball", "ball.w15", "ball.w18", NULL
,
2989 .translate
= translate_ball
,
2990 .par
= (const uint32_t[]){TCG_COND_EQ
},
2991 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2993 .name
= (const char * const[]) {
2994 "bany", "bany.w15", "bany.w18", NULL
,
2996 .translate
= translate_bany
,
2997 .par
= (const uint32_t[]){TCG_COND_NE
},
2998 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3000 .name
= (const char * const[]) {
3001 "bbc", "bbc.w15", "bbc.w18", NULL
,
3003 .translate
= translate_bb
,
3004 .par
= (const uint32_t[]){TCG_COND_EQ
},
3005 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3007 .name
= (const char * const[]) {
3008 "bbci", "bbci.w15", "bbci.w18", NULL
,
3010 .translate
= translate_bbi
,
3011 .par
= (const uint32_t[]){TCG_COND_EQ
},
3012 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3014 .name
= (const char * const[]) {
3015 "bbs", "bbs.w15", "bbs.w18", NULL
,
3017 .translate
= translate_bb
,
3018 .par
= (const uint32_t[]){TCG_COND_NE
},
3019 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3021 .name
= (const char * const[]) {
3022 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
3024 .translate
= translate_bbi
,
3025 .par
= (const uint32_t[]){TCG_COND_NE
},
3026 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3028 .name
= (const char * const[]) {
3029 "beq", "beq.w15", "beq.w18", NULL
,
3031 .translate
= translate_b
,
3032 .par
= (const uint32_t[]){TCG_COND_EQ
},
3033 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3035 .name
= (const char * const[]) {
3036 "beqi", "beqi.w15", "beqi.w18", NULL
,
3038 .translate
= translate_bi
,
3039 .par
= (const uint32_t[]){TCG_COND_EQ
},
3040 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3042 .name
= (const char * const[]) {
3043 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
3045 .translate
= translate_bz
,
3046 .par
= (const uint32_t[]){TCG_COND_EQ
},
3047 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3050 .translate
= translate_bp
,
3051 .par
= (const uint32_t[]){TCG_COND_EQ
},
3053 .name
= (const char * const[]) {
3054 "bge", "bge.w15", "bge.w18", NULL
,
3056 .translate
= translate_b
,
3057 .par
= (const uint32_t[]){TCG_COND_GE
},
3058 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3060 .name
= (const char * const[]) {
3061 "bgei", "bgei.w15", "bgei.w18", NULL
,
3063 .translate
= translate_bi
,
3064 .par
= (const uint32_t[]){TCG_COND_GE
},
3065 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3067 .name
= (const char * const[]) {
3068 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
3070 .translate
= translate_b
,
3071 .par
= (const uint32_t[]){TCG_COND_GEU
},
3072 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3074 .name
= (const char * const[]) {
3075 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
3077 .translate
= translate_bi
,
3078 .par
= (const uint32_t[]){TCG_COND_GEU
},
3079 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3081 .name
= (const char * const[]) {
3082 "bgez", "bgez.w15", "bgez.w18", NULL
,
3084 .translate
= translate_bz
,
3085 .par
= (const uint32_t[]){TCG_COND_GE
},
3086 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3088 .name
= (const char * const[]) {
3089 "blt", "blt.w15", "blt.w18", NULL
,
3091 .translate
= translate_b
,
3092 .par
= (const uint32_t[]){TCG_COND_LT
},
3093 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3095 .name
= (const char * const[]) {
3096 "blti", "blti.w15", "blti.w18", NULL
,
3098 .translate
= translate_bi
,
3099 .par
= (const uint32_t[]){TCG_COND_LT
},
3100 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3102 .name
= (const char * const[]) {
3103 "bltu", "bltu.w15", "bltu.w18", NULL
,
3105 .translate
= translate_b
,
3106 .par
= (const uint32_t[]){TCG_COND_LTU
},
3107 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3109 .name
= (const char * const[]) {
3110 "bltui", "bltui.w15", "bltui.w18", NULL
,
3112 .translate
= translate_bi
,
3113 .par
= (const uint32_t[]){TCG_COND_LTU
},
3114 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3116 .name
= (const char * const[]) {
3117 "bltz", "bltz.w15", "bltz.w18", NULL
,
3119 .translate
= translate_bz
,
3120 .par
= (const uint32_t[]){TCG_COND_LT
},
3121 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3123 .name
= (const char * const[]) {
3124 "bnall", "bnall.w15", "bnall.w18", NULL
,
3126 .translate
= translate_ball
,
3127 .par
= (const uint32_t[]){TCG_COND_NE
},
3128 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3130 .name
= (const char * const[]) {
3131 "bne", "bne.w15", "bne.w18", NULL
,
3133 .translate
= translate_b
,
3134 .par
= (const uint32_t[]){TCG_COND_NE
},
3135 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3137 .name
= (const char * const[]) {
3138 "bnei", "bnei.w15", "bnei.w18", NULL
,
3140 .translate
= translate_bi
,
3141 .par
= (const uint32_t[]){TCG_COND_NE
},
3142 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3144 .name
= (const char * const[]) {
3145 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3147 .translate
= translate_bz
,
3148 .par
= (const uint32_t[]){TCG_COND_NE
},
3149 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3151 .name
= (const char * const[]) {
3152 "bnone", "bnone.w15", "bnone.w18", NULL
,
3154 .translate
= translate_bany
,
3155 .par
= (const uint32_t[]){TCG_COND_EQ
},
3156 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3159 .translate
= translate_nop
,
3160 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3161 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3164 .translate
= translate_nop
,
3165 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3166 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3169 .translate
= translate_bp
,
3170 .par
= (const uint32_t[]){TCG_COND_NE
},
3173 .translate
= translate_call0
,
3176 .translate
= translate_callw
,
3177 .par
= (const uint32_t[]){3},
3180 .translate
= translate_callw
,
3181 .par
= (const uint32_t[]){1},
3184 .translate
= translate_callw
,
3185 .par
= (const uint32_t[]){2},
3188 .translate
= translate_callx0
,
3191 .translate
= translate_callxw
,
3192 .par
= (const uint32_t[]){3},
3195 .translate
= translate_callxw
,
3196 .par
= (const uint32_t[]){1},
3199 .translate
= translate_callxw
,
3200 .par
= (const uint32_t[]){2},
3203 .translate
= translate_clamps
,
3205 .name
= "clrb_expstate",
3206 .translate
= translate_clrb_expstate
,
3209 .translate
= translate_clrex
,
3212 .translate
= translate_const16
,
3215 .translate
= translate_depbits
,
3218 .translate
= translate_dcache
,
3219 .op_flags
= XTENSA_OP_PRIVILEGED
,
3222 .translate
= translate_nop
,
3225 .translate
= translate_dcache
,
3226 .op_flags
= XTENSA_OP_PRIVILEGED
,
3229 .translate
= translate_dcache
,
3232 .translate
= translate_nop
,
3235 .translate
= translate_dcache
,
3238 .translate
= translate_nop
,
3241 .translate
= translate_nop
,
3242 .op_flags
= XTENSA_OP_PRIVILEGED
,
3245 .translate
= translate_nop
,
3246 .op_flags
= XTENSA_OP_PRIVILEGED
,
3249 .translate
= translate_nop
,
3250 .op_flags
= XTENSA_OP_PRIVILEGED
,
3253 .translate
= translate_nop
,
3254 .op_flags
= XTENSA_OP_PRIVILEGED
,
3257 .translate
= translate_diwbuip
,
3258 .op_flags
= XTENSA_OP_PRIVILEGED
,
3261 .translate
= translate_dcache
,
3262 .op_flags
= XTENSA_OP_PRIVILEGED
,
3265 .translate
= translate_nop
,
3268 .translate
= translate_nop
,
3271 .translate
= translate_nop
,
3274 .translate
= translate_nop
,
3277 .translate
= translate_nop
,
3280 .translate
= translate_nop
,
3283 .translate
= translate_nop
,
3286 .translate
= translate_nop
,
3289 .translate
= translate_nop
,
3292 .translate
= translate_nop
,
3295 .translate
= translate_nop
,
3298 .translate
= translate_entry
,
3299 .test_exceptions
= test_exceptions_entry
,
3300 .test_overflow
= test_overflow_entry
,
3301 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3302 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3305 .translate
= translate_nop
,
3308 .translate
= translate_nop
,
3311 .translate
= translate_extui
,
3314 .translate
= translate_memw
,
3317 .translate
= translate_getex
,
3320 .op_flags
= XTENSA_OP_ILL
,
3323 .op_flags
= XTENSA_OP_ILL
,
3326 .translate
= translate_itlb
,
3327 .par
= (const uint32_t[]){true},
3328 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3331 .translate
= translate_icache
,
3334 .translate
= translate_icache
,
3335 .op_flags
= XTENSA_OP_PRIVILEGED
,
3338 .translate
= translate_nop
,
3339 .op_flags
= XTENSA_OP_PRIVILEGED
,
3342 .translate
= translate_itlb
,
3343 .par
= (const uint32_t[]){false},
3344 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3347 .translate
= translate_nop
,
3348 .op_flags
= XTENSA_OP_PRIVILEGED
,
3350 .name
= (const char * const[]) {
3351 "ill", "ill.n", NULL
,
3353 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3356 .translate
= translate_nop
,
3359 .translate
= translate_icache
,
3360 .op_flags
= XTENSA_OP_PRIVILEGED
,
3363 .translate
= translate_nop
,
3366 .translate
= translate_j
,
3369 .translate
= translate_jx
,
3372 .translate
= translate_ldst
,
3373 .par
= (const uint32_t[]){MO_TESW
, false, false},
3374 .op_flags
= XTENSA_OP_LOAD
,
3377 .translate
= translate_ldst
,
3378 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3379 .op_flags
= XTENSA_OP_LOAD
,
3382 .translate
= translate_ldst
,
3383 .par
= (const uint32_t[]){MO_TEUL
, true, false},
3384 .op_flags
= XTENSA_OP_LOAD
,
3387 .translate
= translate_l32e
,
3388 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3391 .translate
= translate_l32ex
,
3392 .op_flags
= XTENSA_OP_LOAD
,
3394 .name
= (const char * const[]) {
3395 "l32i", "l32i.n", NULL
,
3397 .translate
= translate_ldst
,
3398 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3399 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3402 .translate
= translate_l32r
,
3403 .op_flags
= XTENSA_OP_LOAD
,
3406 .translate
= translate_ldst
,
3407 .par
= (const uint32_t[]){MO_UB
, false, false},
3408 .op_flags
= XTENSA_OP_LOAD
,
3411 .translate
= translate_mac16
,
3412 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3413 .op_flags
= XTENSA_OP_LOAD
,
3416 .translate
= translate_mac16
,
3417 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3418 .op_flags
= XTENSA_OP_LOAD
,
3421 .op_flags
= XTENSA_OP_ILL
,
3423 .name
= (const char * const[]) {
3424 "loop", "loop.w15", NULL
,
3426 .translate
= translate_loop
,
3427 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3428 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3430 .name
= (const char * const[]) {
3431 "loopgtz", "loopgtz.w15", NULL
,
3433 .translate
= translate_loop
,
3434 .par
= (const uint32_t[]){TCG_COND_GT
},
3435 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3437 .name
= (const char * const[]) {
3438 "loopnez", "loopnez.w15", NULL
,
3440 .translate
= translate_loop
,
3441 .par
= (const uint32_t[]){TCG_COND_NE
},
3442 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3445 .translate
= translate_smax
,
3448 .translate
= translate_umax
,
3451 .translate
= translate_memw
,
3454 .translate
= translate_smin
,
3457 .translate
= translate_umin
,
3459 .name
= (const char * const[]) {
3460 "mov", "mov.n", NULL
,
3462 .translate
= translate_mov
,
3463 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3466 .translate
= translate_movcond
,
3467 .par
= (const uint32_t[]){TCG_COND_EQ
},
3470 .translate
= translate_movp
,
3471 .par
= (const uint32_t[]){TCG_COND_EQ
},
3474 .translate
= translate_movcond
,
3475 .par
= (const uint32_t[]){TCG_COND_GE
},
3478 .translate
= translate_movi
,
3481 .translate
= translate_movi
,
3484 .translate
= translate_movcond
,
3485 .par
= (const uint32_t[]){TCG_COND_LT
},
3488 .translate
= translate_movcond
,
3489 .par
= (const uint32_t[]){TCG_COND_NE
},
3492 .translate
= translate_movsp
,
3493 .op_flags
= XTENSA_OP_ALLOCA
,
3496 .translate
= translate_movp
,
3497 .par
= (const uint32_t[]){TCG_COND_NE
},
3499 .name
= "mul.aa.hh",
3500 .translate
= translate_mac16
,
3501 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3503 .name
= "mul.aa.hl",
3504 .translate
= translate_mac16
,
3505 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3507 .name
= "mul.aa.lh",
3508 .translate
= translate_mac16
,
3509 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3511 .name
= "mul.aa.ll",
3512 .translate
= translate_mac16
,
3513 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3515 .name
= "mul.ad.hh",
3516 .translate
= translate_mac16
,
3517 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3519 .name
= "mul.ad.hl",
3520 .translate
= translate_mac16
,
3521 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3523 .name
= "mul.ad.lh",
3524 .translate
= translate_mac16
,
3525 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3527 .name
= "mul.ad.ll",
3528 .translate
= translate_mac16
,
3529 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3531 .name
= "mul.da.hh",
3532 .translate
= translate_mac16
,
3533 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3535 .name
= "mul.da.hl",
3536 .translate
= translate_mac16
,
3537 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3539 .name
= "mul.da.lh",
3540 .translate
= translate_mac16
,
3541 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3543 .name
= "mul.da.ll",
3544 .translate
= translate_mac16
,
3545 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3547 .name
= "mul.dd.hh",
3548 .translate
= translate_mac16
,
3549 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3551 .name
= "mul.dd.hl",
3552 .translate
= translate_mac16
,
3553 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3555 .name
= "mul.dd.lh",
3556 .translate
= translate_mac16
,
3557 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3559 .name
= "mul.dd.ll",
3560 .translate
= translate_mac16
,
3561 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3564 .translate
= translate_mul16
,
3565 .par
= (const uint32_t[]){true},
3568 .translate
= translate_mul16
,
3569 .par
= (const uint32_t[]){false},
3571 .name
= "mula.aa.hh",
3572 .translate
= translate_mac16
,
3573 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3575 .name
= "mula.aa.hl",
3576 .translate
= translate_mac16
,
3577 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3579 .name
= "mula.aa.lh",
3580 .translate
= translate_mac16
,
3581 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3583 .name
= "mula.aa.ll",
3584 .translate
= translate_mac16
,
3585 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3587 .name
= "mula.ad.hh",
3588 .translate
= translate_mac16
,
3589 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3591 .name
= "mula.ad.hl",
3592 .translate
= translate_mac16
,
3593 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3595 .name
= "mula.ad.lh",
3596 .translate
= translate_mac16
,
3597 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3599 .name
= "mula.ad.ll",
3600 .translate
= translate_mac16
,
3601 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3603 .name
= "mula.da.hh",
3604 .translate
= translate_mac16
,
3605 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3607 .name
= "mula.da.hh.lddec",
3608 .translate
= translate_mac16
,
3609 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3611 .name
= "mula.da.hh.ldinc",
3612 .translate
= translate_mac16
,
3613 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3615 .name
= "mula.da.hl",
3616 .translate
= translate_mac16
,
3617 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3619 .name
= "mula.da.hl.lddec",
3620 .translate
= translate_mac16
,
3621 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3623 .name
= "mula.da.hl.ldinc",
3624 .translate
= translate_mac16
,
3625 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3627 .name
= "mula.da.lh",
3628 .translate
= translate_mac16
,
3629 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3631 .name
= "mula.da.lh.lddec",
3632 .translate
= translate_mac16
,
3633 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3635 .name
= "mula.da.lh.ldinc",
3636 .translate
= translate_mac16
,
3637 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3639 .name
= "mula.da.ll",
3640 .translate
= translate_mac16
,
3641 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3643 .name
= "mula.da.ll.lddec",
3644 .translate
= translate_mac16
,
3645 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3647 .name
= "mula.da.ll.ldinc",
3648 .translate
= translate_mac16
,
3649 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3651 .name
= "mula.dd.hh",
3652 .translate
= translate_mac16
,
3653 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3655 .name
= "mula.dd.hh.lddec",
3656 .translate
= translate_mac16
,
3657 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3659 .name
= "mula.dd.hh.ldinc",
3660 .translate
= translate_mac16
,
3661 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3663 .name
= "mula.dd.hl",
3664 .translate
= translate_mac16
,
3665 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3667 .name
= "mula.dd.hl.lddec",
3668 .translate
= translate_mac16
,
3669 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3671 .name
= "mula.dd.hl.ldinc",
3672 .translate
= translate_mac16
,
3673 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3675 .name
= "mula.dd.lh",
3676 .translate
= translate_mac16
,
3677 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3679 .name
= "mula.dd.lh.lddec",
3680 .translate
= translate_mac16
,
3681 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3683 .name
= "mula.dd.lh.ldinc",
3684 .translate
= translate_mac16
,
3685 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3687 .name
= "mula.dd.ll",
3688 .translate
= translate_mac16
,
3689 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3691 .name
= "mula.dd.ll.lddec",
3692 .translate
= translate_mac16
,
3693 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3695 .name
= "mula.dd.ll.ldinc",
3696 .translate
= translate_mac16
,
3697 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3700 .translate
= translate_mull
,
3702 .name
= "muls.aa.hh",
3703 .translate
= translate_mac16
,
3704 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3706 .name
= "muls.aa.hl",
3707 .translate
= translate_mac16
,
3708 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3710 .name
= "muls.aa.lh",
3711 .translate
= translate_mac16
,
3712 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3714 .name
= "muls.aa.ll",
3715 .translate
= translate_mac16
,
3716 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3718 .name
= "muls.ad.hh",
3719 .translate
= translate_mac16
,
3720 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3722 .name
= "muls.ad.hl",
3723 .translate
= translate_mac16
,
3724 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3726 .name
= "muls.ad.lh",
3727 .translate
= translate_mac16
,
3728 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3730 .name
= "muls.ad.ll",
3731 .translate
= translate_mac16
,
3732 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3734 .name
= "muls.da.hh",
3735 .translate
= translate_mac16
,
3736 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3738 .name
= "muls.da.hl",
3739 .translate
= translate_mac16
,
3740 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3742 .name
= "muls.da.lh",
3743 .translate
= translate_mac16
,
3744 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3746 .name
= "muls.da.ll",
3747 .translate
= translate_mac16
,
3748 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3750 .name
= "muls.dd.hh",
3751 .translate
= translate_mac16
,
3752 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3754 .name
= "muls.dd.hl",
3755 .translate
= translate_mac16
,
3756 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3758 .name
= "muls.dd.lh",
3759 .translate
= translate_mac16
,
3760 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3762 .name
= "muls.dd.ll",
3763 .translate
= translate_mac16
,
3764 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3767 .translate
= translate_mulh
,
3768 .par
= (const uint32_t[]){true},
3771 .translate
= translate_mulh
,
3772 .par
= (const uint32_t[]){false},
3775 .translate
= translate_neg
,
3777 .name
= (const char * const[]) {
3778 "nop", "nop.n", NULL
,
3780 .translate
= translate_nop
,
3781 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3784 .translate
= translate_nsa
,
3787 .translate
= translate_nsau
,
3790 .translate
= translate_or
,
3793 .translate
= translate_boolean
,
3794 .par
= (const uint32_t[]){BOOLEAN_OR
},
3797 .translate
= translate_boolean
,
3798 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3801 .translate
= translate_ptlb
,
3802 .par
= (const uint32_t[]){true},
3803 .op_flags
= XTENSA_OP_PRIVILEGED
,
3806 .translate
= translate_nop
,
3809 .translate
= translate_nop
,
3812 .translate
= translate_nop
,
3815 .translate
= translate_nop
,
3818 .translate
= translate_nop
,
3821 .translate
= translate_ptlb
,
3822 .par
= (const uint32_t[]){false},
3823 .op_flags
= XTENSA_OP_PRIVILEGED
,
3826 .translate
= translate_pptlb
,
3827 .op_flags
= XTENSA_OP_PRIVILEGED
,
3830 .translate
= translate_quos
,
3831 .par
= (const uint32_t[]){true},
3832 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3835 .translate
= translate_quou
,
3836 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3839 .translate
= translate_rtlb
,
3840 .par
= (const uint32_t[]){true, 0},
3841 .op_flags
= XTENSA_OP_PRIVILEGED
,
3844 .translate
= translate_rtlb
,
3845 .par
= (const uint32_t[]){true, 1},
3846 .op_flags
= XTENSA_OP_PRIVILEGED
,
3848 .name
= "read_impwire",
3849 .translate
= translate_read_impwire
,
3852 .translate
= translate_quos
,
3853 .par
= (const uint32_t[]){false},
3854 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3857 .translate
= translate_remu
,
3858 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3861 .translate
= translate_rer
,
3862 .op_flags
= XTENSA_OP_PRIVILEGED
,
3864 .name
= (const char * const[]) {
3865 "ret", "ret.n", NULL
,
3867 .translate
= translate_ret
,
3868 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3870 .name
= (const char * const[]) {
3871 "retw", "retw.n", NULL
,
3873 .translate
= translate_retw
,
3874 .test_exceptions
= test_exceptions_retw
,
3875 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3878 .op_flags
= XTENSA_OP_ILL
,
3881 .translate
= translate_rfde
,
3882 .op_flags
= XTENSA_OP_PRIVILEGED
,
3885 .op_flags
= XTENSA_OP_ILL
,
3888 .translate
= translate_rfe
,
3889 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3892 .translate
= translate_rfi
,
3893 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3896 .translate
= translate_rfw
,
3897 .par
= (const uint32_t[]){true},
3898 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3901 .translate
= translate_rfw
,
3902 .par
= (const uint32_t[]){false},
3903 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3906 .translate
= translate_rtlb
,
3907 .par
= (const uint32_t[]){false, 0},
3908 .op_flags
= XTENSA_OP_PRIVILEGED
,
3911 .translate
= translate_rtlb
,
3912 .par
= (const uint32_t[]){false, 1},
3913 .op_flags
= XTENSA_OP_PRIVILEGED
,
3916 .translate
= translate_rptlb0
,
3917 .op_flags
= XTENSA_OP_PRIVILEGED
,
3920 .translate
= translate_rptlb1
,
3921 .op_flags
= XTENSA_OP_PRIVILEGED
,
3924 .translate
= translate_rotw
,
3925 .op_flags
= XTENSA_OP_PRIVILEGED
|
3926 XTENSA_OP_EXIT_TB_M1
|
3927 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3930 .translate
= translate_rsil
,
3932 XTENSA_OP_PRIVILEGED
|
3933 XTENSA_OP_EXIT_TB_0
|
3934 XTENSA_OP_CHECK_INTERRUPTS
,
3937 .translate
= translate_rsr
,
3938 .par
= (const uint32_t[]){176},
3939 .op_flags
= XTENSA_OP_PRIVILEGED
,
3942 .translate
= translate_rsr
,
3943 .par
= (const uint32_t[]){208},
3944 .op_flags
= XTENSA_OP_PRIVILEGED
,
3946 .name
= "rsr.acchi",
3947 .translate
= translate_rsr
,
3948 .test_exceptions
= test_exceptions_sr
,
3949 .par
= (const uint32_t[]){
3951 XTENSA_OPTION_MAC16
,
3954 .name
= "rsr.acclo",
3955 .translate
= translate_rsr
,
3956 .test_exceptions
= test_exceptions_sr
,
3957 .par
= (const uint32_t[]){
3959 XTENSA_OPTION_MAC16
,
3962 .name
= "rsr.atomctl",
3963 .translate
= translate_rsr
,
3964 .test_exceptions
= test_exceptions_sr
,
3965 .par
= (const uint32_t[]){
3967 XTENSA_OPTION_ATOMCTL
,
3969 .op_flags
= XTENSA_OP_PRIVILEGED
,
3972 .translate
= translate_rsr
,
3973 .test_exceptions
= test_exceptions_sr
,
3974 .par
= (const uint32_t[]){
3976 XTENSA_OPTION_BOOLEAN
,
3979 .name
= "rsr.cacheadrdis",
3980 .translate
= translate_rsr
,
3981 .test_exceptions
= test_exceptions_sr
,
3982 .par
= (const uint32_t[]){
3986 .op_flags
= XTENSA_OP_PRIVILEGED
,
3988 .name
= "rsr.cacheattr",
3989 .translate
= translate_rsr
,
3990 .test_exceptions
= test_exceptions_sr
,
3991 .par
= (const uint32_t[]){
3993 XTENSA_OPTION_CACHEATTR
,
3995 .op_flags
= XTENSA_OP_PRIVILEGED
,
3997 .name
= "rsr.ccompare0",
3998 .translate
= translate_rsr
,
3999 .test_exceptions
= test_exceptions_ccompare
,
4000 .par
= (const uint32_t[]){
4002 XTENSA_OPTION_TIMER_INTERRUPT
,
4004 .op_flags
= XTENSA_OP_PRIVILEGED
,
4006 .name
= "rsr.ccompare1",
4007 .translate
= translate_rsr
,
4008 .test_exceptions
= test_exceptions_ccompare
,
4009 .par
= (const uint32_t[]){
4011 XTENSA_OPTION_TIMER_INTERRUPT
,
4013 .op_flags
= XTENSA_OP_PRIVILEGED
,
4015 .name
= "rsr.ccompare2",
4016 .translate
= translate_rsr
,
4017 .test_exceptions
= test_exceptions_ccompare
,
4018 .par
= (const uint32_t[]){
4020 XTENSA_OPTION_TIMER_INTERRUPT
,
4022 .op_flags
= XTENSA_OP_PRIVILEGED
,
4024 .name
= "rsr.ccount",
4025 .translate
= translate_rsr_ccount
,
4026 .test_exceptions
= test_exceptions_sr
,
4027 .par
= (const uint32_t[]){
4029 XTENSA_OPTION_TIMER_INTERRUPT
,
4031 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4033 .name
= "rsr.configid0",
4034 .translate
= translate_rsr
,
4035 .par
= (const uint32_t[]){CONFIGID0
},
4036 .op_flags
= XTENSA_OP_PRIVILEGED
,
4038 .name
= "rsr.configid1",
4039 .translate
= translate_rsr
,
4040 .par
= (const uint32_t[]){CONFIGID1
},
4041 .op_flags
= XTENSA_OP_PRIVILEGED
,
4043 .name
= "rsr.cpenable",
4044 .translate
= translate_rsr
,
4045 .test_exceptions
= test_exceptions_sr
,
4046 .par
= (const uint32_t[]){
4048 XTENSA_OPTION_COPROCESSOR
,
4050 .op_flags
= XTENSA_OP_PRIVILEGED
,
4052 .name
= "rsr.dbreaka0",
4053 .translate
= translate_rsr
,
4054 .test_exceptions
= test_exceptions_dbreak
,
4055 .par
= (const uint32_t[]){
4057 XTENSA_OPTION_DEBUG
,
4059 .op_flags
= XTENSA_OP_PRIVILEGED
,
4061 .name
= "rsr.dbreaka1",
4062 .translate
= translate_rsr
,
4063 .test_exceptions
= test_exceptions_dbreak
,
4064 .par
= (const uint32_t[]){
4066 XTENSA_OPTION_DEBUG
,
4068 .op_flags
= XTENSA_OP_PRIVILEGED
,
4070 .name
= "rsr.dbreakc0",
4071 .translate
= translate_rsr
,
4072 .test_exceptions
= test_exceptions_dbreak
,
4073 .par
= (const uint32_t[]){
4075 XTENSA_OPTION_DEBUG
,
4077 .op_flags
= XTENSA_OP_PRIVILEGED
,
4079 .name
= "rsr.dbreakc1",
4080 .translate
= translate_rsr
,
4081 .test_exceptions
= test_exceptions_dbreak
,
4082 .par
= (const uint32_t[]){
4084 XTENSA_OPTION_DEBUG
,
4086 .op_flags
= XTENSA_OP_PRIVILEGED
,
4089 .translate
= translate_rsr
,
4090 .test_exceptions
= test_exceptions_sr
,
4091 .par
= (const uint32_t[]){
4093 XTENSA_OPTION_DEBUG
,
4095 .op_flags
= XTENSA_OP_PRIVILEGED
,
4097 .name
= "rsr.debugcause",
4098 .translate
= translate_rsr
,
4099 .test_exceptions
= test_exceptions_sr
,
4100 .par
= (const uint32_t[]){
4102 XTENSA_OPTION_DEBUG
,
4104 .op_flags
= XTENSA_OP_PRIVILEGED
,
4107 .translate
= translate_rsr
,
4108 .test_exceptions
= test_exceptions_sr
,
4109 .par
= (const uint32_t[]){
4111 XTENSA_OPTION_EXCEPTION
,
4113 .op_flags
= XTENSA_OP_PRIVILEGED
,
4115 .name
= "rsr.dtlbcfg",
4116 .translate
= translate_rsr
,
4117 .test_exceptions
= test_exceptions_sr
,
4118 .par
= (const uint32_t[]){
4122 .op_flags
= XTENSA_OP_PRIVILEGED
,
4125 .translate
= translate_rsr
,
4126 .test_exceptions
= test_exceptions_sr
,
4127 .par
= (const uint32_t[]){
4129 XTENSA_OPTION_EXCEPTION
,
4131 .op_flags
= XTENSA_OP_PRIVILEGED
,
4134 .translate
= translate_rsr
,
4135 .test_exceptions
= test_exceptions_hpi
,
4136 .par
= (const uint32_t[]){
4138 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4140 .op_flags
= XTENSA_OP_PRIVILEGED
,
4143 .translate
= translate_rsr
,
4144 .test_exceptions
= test_exceptions_hpi
,
4145 .par
= (const uint32_t[]){
4147 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4149 .op_flags
= XTENSA_OP_PRIVILEGED
,
4152 .translate
= translate_rsr
,
4153 .test_exceptions
= test_exceptions_hpi
,
4154 .par
= (const uint32_t[]){
4156 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4158 .op_flags
= XTENSA_OP_PRIVILEGED
,
4161 .translate
= translate_rsr
,
4162 .test_exceptions
= test_exceptions_hpi
,
4163 .par
= (const uint32_t[]){
4165 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4167 .op_flags
= XTENSA_OP_PRIVILEGED
,
4170 .translate
= translate_rsr
,
4171 .test_exceptions
= test_exceptions_hpi
,
4172 .par
= (const uint32_t[]){
4174 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4176 .op_flags
= XTENSA_OP_PRIVILEGED
,
4179 .translate
= translate_rsr
,
4180 .test_exceptions
= test_exceptions_hpi
,
4181 .par
= (const uint32_t[]){
4183 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4185 .op_flags
= XTENSA_OP_PRIVILEGED
,
4188 .translate
= translate_rsr
,
4189 .test_exceptions
= test_exceptions_hpi
,
4190 .par
= (const uint32_t[]){
4192 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4194 .op_flags
= XTENSA_OP_PRIVILEGED
,
4197 .translate
= translate_rsr
,
4198 .test_exceptions
= test_exceptions_hpi
,
4199 .par
= (const uint32_t[]){
4201 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4203 .op_flags
= XTENSA_OP_PRIVILEGED
,
4206 .translate
= translate_rsr
,
4207 .test_exceptions
= test_exceptions_hpi
,
4208 .par
= (const uint32_t[]){
4210 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4212 .op_flags
= XTENSA_OP_PRIVILEGED
,
4215 .translate
= translate_rsr
,
4216 .test_exceptions
= test_exceptions_hpi
,
4217 .par
= (const uint32_t[]){
4219 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4221 .op_flags
= XTENSA_OP_PRIVILEGED
,
4224 .translate
= translate_rsr
,
4225 .test_exceptions
= test_exceptions_hpi
,
4226 .par
= (const uint32_t[]){
4228 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4230 .op_flags
= XTENSA_OP_PRIVILEGED
,
4233 .translate
= translate_rsr
,
4234 .test_exceptions
= test_exceptions_hpi
,
4235 .par
= (const uint32_t[]){
4237 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4239 .op_flags
= XTENSA_OP_PRIVILEGED
,
4241 .name
= "rsr.eraccess",
4242 .translate
= translate_rsr
,
4243 .par
= (const uint32_t[]){ERACCESS
},
4244 .op_flags
= XTENSA_OP_PRIVILEGED
,
4246 .name
= "rsr.exccause",
4247 .translate
= translate_rsr
,
4248 .test_exceptions
= test_exceptions_sr
,
4249 .par
= (const uint32_t[]){
4251 XTENSA_OPTION_EXCEPTION
,
4253 .op_flags
= XTENSA_OP_PRIVILEGED
,
4255 .name
= "rsr.excsave1",
4256 .translate
= translate_rsr
,
4257 .test_exceptions
= test_exceptions_sr
,
4258 .par
= (const uint32_t[]){
4260 XTENSA_OPTION_EXCEPTION
,
4262 .op_flags
= XTENSA_OP_PRIVILEGED
,
4264 .name
= "rsr.excsave2",
4265 .translate
= translate_rsr
,
4266 .test_exceptions
= test_exceptions_hpi
,
4267 .par
= (const uint32_t[]){
4269 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4271 .op_flags
= XTENSA_OP_PRIVILEGED
,
4273 .name
= "rsr.excsave3",
4274 .translate
= translate_rsr
,
4275 .test_exceptions
= test_exceptions_hpi
,
4276 .par
= (const uint32_t[]){
4278 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4280 .op_flags
= XTENSA_OP_PRIVILEGED
,
4282 .name
= "rsr.excsave4",
4283 .translate
= translate_rsr
,
4284 .test_exceptions
= test_exceptions_hpi
,
4285 .par
= (const uint32_t[]){
4287 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4289 .op_flags
= XTENSA_OP_PRIVILEGED
,
4291 .name
= "rsr.excsave5",
4292 .translate
= translate_rsr
,
4293 .test_exceptions
= test_exceptions_hpi
,
4294 .par
= (const uint32_t[]){
4296 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4298 .op_flags
= XTENSA_OP_PRIVILEGED
,
4300 .name
= "rsr.excsave6",
4301 .translate
= translate_rsr
,
4302 .test_exceptions
= test_exceptions_hpi
,
4303 .par
= (const uint32_t[]){
4305 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4307 .op_flags
= XTENSA_OP_PRIVILEGED
,
4309 .name
= "rsr.excsave7",
4310 .translate
= translate_rsr
,
4311 .test_exceptions
= test_exceptions_hpi
,
4312 .par
= (const uint32_t[]){
4314 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4316 .op_flags
= XTENSA_OP_PRIVILEGED
,
4318 .name
= "rsr.excvaddr",
4319 .translate
= translate_rsr
,
4320 .test_exceptions
= test_exceptions_sr
,
4321 .par
= (const uint32_t[]){
4323 XTENSA_OPTION_EXCEPTION
,
4325 .op_flags
= XTENSA_OP_PRIVILEGED
,
4327 .name
= "rsr.ibreaka0",
4328 .translate
= translate_rsr
,
4329 .test_exceptions
= test_exceptions_ibreak
,
4330 .par
= (const uint32_t[]){
4332 XTENSA_OPTION_DEBUG
,
4334 .op_flags
= XTENSA_OP_PRIVILEGED
,
4336 .name
= "rsr.ibreaka1",
4337 .translate
= translate_rsr
,
4338 .test_exceptions
= test_exceptions_ibreak
,
4339 .par
= (const uint32_t[]){
4341 XTENSA_OPTION_DEBUG
,
4343 .op_flags
= XTENSA_OP_PRIVILEGED
,
4345 .name
= "rsr.ibreakenable",
4346 .translate
= translate_rsr
,
4347 .test_exceptions
= test_exceptions_sr
,
4348 .par
= (const uint32_t[]){
4350 XTENSA_OPTION_DEBUG
,
4352 .op_flags
= XTENSA_OP_PRIVILEGED
,
4354 .name
= "rsr.icount",
4355 .translate
= translate_rsr
,
4356 .test_exceptions
= test_exceptions_sr
,
4357 .par
= (const uint32_t[]){
4359 XTENSA_OPTION_DEBUG
,
4361 .op_flags
= XTENSA_OP_PRIVILEGED
,
4363 .name
= "rsr.icountlevel",
4364 .translate
= translate_rsr
,
4365 .test_exceptions
= test_exceptions_sr
,
4366 .par
= (const uint32_t[]){
4368 XTENSA_OPTION_DEBUG
,
4370 .op_flags
= XTENSA_OP_PRIVILEGED
,
4372 .name
= "rsr.intclear",
4373 .translate
= translate_rsr
,
4374 .test_exceptions
= test_exceptions_sr
,
4375 .par
= (const uint32_t[]){
4377 XTENSA_OPTION_INTERRUPT
,
4379 .op_flags
= XTENSA_OP_PRIVILEGED
,
4381 .name
= "rsr.intenable",
4382 .translate
= translate_rsr
,
4383 .test_exceptions
= test_exceptions_sr
,
4384 .par
= (const uint32_t[]){
4386 XTENSA_OPTION_INTERRUPT
,
4388 .op_flags
= XTENSA_OP_PRIVILEGED
,
4390 .name
= "rsr.interrupt",
4391 .translate
= translate_rsr_ccount
,
4392 .test_exceptions
= test_exceptions_sr
,
4393 .par
= (const uint32_t[]){
4395 XTENSA_OPTION_INTERRUPT
,
4397 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4399 .name
= "rsr.intset",
4400 .translate
= translate_rsr_ccount
,
4401 .test_exceptions
= test_exceptions_sr
,
4402 .par
= (const uint32_t[]){
4404 XTENSA_OPTION_INTERRUPT
,
4406 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4408 .name
= "rsr.itlbcfg",
4409 .translate
= translate_rsr
,
4410 .test_exceptions
= test_exceptions_sr
,
4411 .par
= (const uint32_t[]){
4415 .op_flags
= XTENSA_OP_PRIVILEGED
,
4418 .translate
= translate_rsr
,
4419 .test_exceptions
= test_exceptions_sr
,
4420 .par
= (const uint32_t[]){
4425 .name
= "rsr.lcount",
4426 .translate
= translate_rsr
,
4427 .test_exceptions
= test_exceptions_sr
,
4428 .par
= (const uint32_t[]){
4434 .translate
= translate_rsr
,
4435 .test_exceptions
= test_exceptions_sr
,
4436 .par
= (const uint32_t[]){
4441 .name
= "rsr.litbase",
4442 .translate
= translate_rsr
,
4443 .test_exceptions
= test_exceptions_sr
,
4444 .par
= (const uint32_t[]){
4446 XTENSA_OPTION_EXTENDED_L32R
,
4450 .translate
= translate_rsr
,
4451 .test_exceptions
= test_exceptions_sr
,
4452 .par
= (const uint32_t[]){
4454 XTENSA_OPTION_MAC16
,
4458 .translate
= translate_rsr
,
4459 .test_exceptions
= test_exceptions_sr
,
4460 .par
= (const uint32_t[]){
4462 XTENSA_OPTION_MAC16
,
4466 .translate
= translate_rsr
,
4467 .test_exceptions
= test_exceptions_sr
,
4468 .par
= (const uint32_t[]){
4470 XTENSA_OPTION_MAC16
,
4474 .translate
= translate_rsr
,
4475 .test_exceptions
= test_exceptions_sr
,
4476 .par
= (const uint32_t[]){
4478 XTENSA_OPTION_MAC16
,
4481 .name
= "rsr.memctl",
4482 .translate
= translate_rsr
,
4483 .par
= (const uint32_t[]){MEMCTL
},
4484 .op_flags
= XTENSA_OP_PRIVILEGED
,
4487 .translate
= translate_rsr
,
4488 .test_exceptions
= test_exceptions_sr
,
4489 .par
= (const uint32_t[]){
4491 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4493 .op_flags
= XTENSA_OP_PRIVILEGED
,
4496 .translate
= translate_rsr
,
4497 .test_exceptions
= test_exceptions_sr
,
4498 .par
= (const uint32_t[]){
4500 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4502 .op_flags
= XTENSA_OP_PRIVILEGED
,
4505 .translate
= translate_rsr
,
4506 .test_exceptions
= test_exceptions_sr
,
4507 .par
= (const uint32_t[]){
4509 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4511 .op_flags
= XTENSA_OP_PRIVILEGED
,
4513 .name
= "rsr.mesave",
4514 .translate
= translate_rsr
,
4515 .test_exceptions
= test_exceptions_sr
,
4516 .par
= (const uint32_t[]){
4518 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4520 .op_flags
= XTENSA_OP_PRIVILEGED
,
4523 .translate
= translate_rsr
,
4524 .test_exceptions
= test_exceptions_sr
,
4525 .par
= (const uint32_t[]){
4527 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4529 .op_flags
= XTENSA_OP_PRIVILEGED
,
4531 .name
= "rsr.mevaddr",
4532 .translate
= translate_rsr
,
4533 .test_exceptions
= test_exceptions_sr
,
4534 .par
= (const uint32_t[]){
4536 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4538 .op_flags
= XTENSA_OP_PRIVILEGED
,
4540 .name
= "rsr.misc0",
4541 .translate
= translate_rsr
,
4542 .test_exceptions
= test_exceptions_sr
,
4543 .par
= (const uint32_t[]){
4545 XTENSA_OPTION_MISC_SR
,
4547 .op_flags
= XTENSA_OP_PRIVILEGED
,
4549 .name
= "rsr.misc1",
4550 .translate
= translate_rsr
,
4551 .test_exceptions
= test_exceptions_sr
,
4552 .par
= (const uint32_t[]){
4554 XTENSA_OPTION_MISC_SR
,
4556 .op_flags
= XTENSA_OP_PRIVILEGED
,
4558 .name
= "rsr.misc2",
4559 .translate
= translate_rsr
,
4560 .test_exceptions
= test_exceptions_sr
,
4561 .par
= (const uint32_t[]){
4563 XTENSA_OPTION_MISC_SR
,
4565 .op_flags
= XTENSA_OP_PRIVILEGED
,
4567 .name
= "rsr.misc3",
4568 .translate
= translate_rsr
,
4569 .test_exceptions
= test_exceptions_sr
,
4570 .par
= (const uint32_t[]){
4572 XTENSA_OPTION_MISC_SR
,
4574 .op_flags
= XTENSA_OP_PRIVILEGED
,
4576 .name
= "rsr.mpucfg",
4577 .translate
= translate_rsr
,
4578 .test_exceptions
= test_exceptions_sr
,
4579 .par
= (const uint32_t[]){
4583 .op_flags
= XTENSA_OP_PRIVILEGED
,
4585 .name
= "rsr.mpuenb",
4586 .translate
= translate_rsr
,
4587 .test_exceptions
= test_exceptions_sr
,
4588 .par
= (const uint32_t[]){
4592 .op_flags
= XTENSA_OP_PRIVILEGED
,
4594 .name
= "rsr.prefctl",
4595 .translate
= translate_rsr
,
4596 .par
= (const uint32_t[]){PREFCTL
},
4599 .translate
= translate_rsr
,
4600 .test_exceptions
= test_exceptions_sr
,
4601 .par
= (const uint32_t[]){
4603 XTENSA_OPTION_PROCESSOR_ID
,
4605 .op_flags
= XTENSA_OP_PRIVILEGED
,
4608 .translate
= translate_rsr
,
4609 .test_exceptions
= test_exceptions_sr
,
4610 .par
= (const uint32_t[]){
4612 XTENSA_OPTION_EXCEPTION
,
4614 .op_flags
= XTENSA_OP_PRIVILEGED
,
4616 .name
= "rsr.ptevaddr",
4617 .translate
= translate_rsr_ptevaddr
,
4618 .test_exceptions
= test_exceptions_sr
,
4619 .par
= (const uint32_t[]){
4623 .op_flags
= XTENSA_OP_PRIVILEGED
,
4625 .name
= "rsr.rasid",
4626 .translate
= translate_rsr
,
4627 .test_exceptions
= test_exceptions_sr
,
4628 .par
= (const uint32_t[]){
4632 .op_flags
= XTENSA_OP_PRIVILEGED
,
4635 .translate
= translate_rsr
,
4636 .par
= (const uint32_t[]){SAR
},
4638 .name
= "rsr.scompare1",
4639 .translate
= translate_rsr
,
4640 .test_exceptions
= test_exceptions_sr
,
4641 .par
= (const uint32_t[]){
4643 XTENSA_OPTION_CONDITIONAL_STORE
,
4646 .name
= "rsr.vecbase",
4647 .translate
= translate_rsr
,
4648 .test_exceptions
= test_exceptions_sr
,
4649 .par
= (const uint32_t[]){
4651 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4653 .op_flags
= XTENSA_OP_PRIVILEGED
,
4655 .name
= "rsr.windowbase",
4656 .translate
= translate_rsr
,
4657 .test_exceptions
= test_exceptions_sr
,
4658 .par
= (const uint32_t[]){
4660 XTENSA_OPTION_WINDOWED_REGISTER
,
4662 .op_flags
= XTENSA_OP_PRIVILEGED
,
4664 .name
= "rsr.windowstart",
4665 .translate
= translate_rsr
,
4666 .test_exceptions
= test_exceptions_sr
,
4667 .par
= (const uint32_t[]){
4669 XTENSA_OPTION_WINDOWED_REGISTER
,
4671 .op_flags
= XTENSA_OP_PRIVILEGED
,
4674 .translate
= translate_nop
,
4676 .name
= "rur.expstate",
4677 .translate
= translate_rur
,
4678 .par
= (const uint32_t[]){EXPSTATE
},
4680 .name
= "rur.threadptr",
4681 .translate
= translate_rur
,
4682 .par
= (const uint32_t[]){THREADPTR
},
4685 .translate
= translate_ldst
,
4686 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4687 .op_flags
= XTENSA_OP_STORE
,
4690 .translate
= translate_s32c1i
,
4691 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4694 .translate
= translate_s32e
,
4695 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4698 .translate
= translate_s32ex
,
4699 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4701 .name
= (const char * const[]) {
4702 "s32i", "s32i.n", "s32nb", NULL
,
4704 .translate
= translate_ldst
,
4705 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4706 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4709 .translate
= translate_ldst
,
4710 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4711 .op_flags
= XTENSA_OP_STORE
,
4714 .translate
= translate_ldst
,
4715 .par
= (const uint32_t[]){MO_UB
, false, true},
4716 .op_flags
= XTENSA_OP_STORE
,
4719 .translate
= translate_salt
,
4720 .par
= (const uint32_t[]){TCG_COND_LT
},
4723 .translate
= translate_salt
,
4724 .par
= (const uint32_t[]){TCG_COND_LTU
},
4726 .name
= "setb_expstate",
4727 .translate
= translate_setb_expstate
,
4730 .translate
= translate_sext
,
4733 .translate
= translate_simcall
,
4734 .test_exceptions
= test_exceptions_simcall
,
4735 .op_flags
= XTENSA_OP_PRIVILEGED
,
4738 .translate
= translate_sll
,
4741 .translate
= translate_slli
,
4744 .translate
= translate_sra
,
4747 .translate
= translate_srai
,
4750 .translate
= translate_src
,
4753 .translate
= translate_srl
,
4756 .translate
= translate_srli
,
4759 .translate
= translate_ssa8b
,
4762 .translate
= translate_ssa8l
,
4765 .translate
= translate_ssai
,
4768 .translate
= translate_ssl
,
4771 .translate
= translate_ssr
,
4774 .translate
= translate_sub
,
4777 .translate
= translate_subx
,
4778 .par
= (const uint32_t[]){1},
4781 .translate
= translate_subx
,
4782 .par
= (const uint32_t[]){2},
4785 .translate
= translate_subx
,
4786 .par
= (const uint32_t[]){3},
4789 .op_flags
= XTENSA_OP_SYSCALL
,
4791 .name
= "umul.aa.hh",
4792 .translate
= translate_mac16
,
4793 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4795 .name
= "umul.aa.hl",
4796 .translate
= translate_mac16
,
4797 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4799 .name
= "umul.aa.lh",
4800 .translate
= translate_mac16
,
4801 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4803 .name
= "umul.aa.ll",
4804 .translate
= translate_mac16
,
4805 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4808 .translate
= translate_waiti
,
4809 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4812 .translate
= translate_wtlb
,
4813 .par
= (const uint32_t[]){true},
4814 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4817 .translate
= translate_wer
,
4818 .op_flags
= XTENSA_OP_PRIVILEGED
,
4821 .translate
= translate_wtlb
,
4822 .par
= (const uint32_t[]){false},
4823 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4826 .translate
= translate_wptlb
,
4827 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4829 .name
= "wrmsk_expstate",
4830 .translate
= translate_wrmsk_expstate
,
4833 .op_flags
= XTENSA_OP_ILL
,
4836 .op_flags
= XTENSA_OP_ILL
,
4838 .name
= "wsr.acchi",
4839 .translate
= translate_wsr_acchi
,
4840 .test_exceptions
= test_exceptions_sr
,
4841 .par
= (const uint32_t[]){
4843 XTENSA_OPTION_MAC16
,
4846 .name
= "wsr.acclo",
4847 .translate
= translate_wsr
,
4848 .test_exceptions
= test_exceptions_sr
,
4849 .par
= (const uint32_t[]){
4851 XTENSA_OPTION_MAC16
,
4854 .name
= "wsr.atomctl",
4855 .translate
= translate_wsr_mask
,
4856 .test_exceptions
= test_exceptions_sr
,
4857 .par
= (const uint32_t[]){
4859 XTENSA_OPTION_ATOMCTL
,
4862 .op_flags
= XTENSA_OP_PRIVILEGED
,
4865 .translate
= translate_wsr_mask
,
4866 .test_exceptions
= test_exceptions_sr
,
4867 .par
= (const uint32_t[]){
4869 XTENSA_OPTION_BOOLEAN
,
4873 .name
= "wsr.cacheadrdis",
4874 .translate
= translate_wsr_mask
,
4875 .test_exceptions
= test_exceptions_sr
,
4876 .par
= (const uint32_t[]){
4881 .op_flags
= XTENSA_OP_PRIVILEGED
,
4883 .name
= "wsr.cacheattr",
4884 .translate
= translate_wsr
,
4885 .test_exceptions
= test_exceptions_sr
,
4886 .par
= (const uint32_t[]){
4888 XTENSA_OPTION_CACHEATTR
,
4890 .op_flags
= XTENSA_OP_PRIVILEGED
,
4892 .name
= "wsr.ccompare0",
4893 .translate
= translate_wsr_ccompare
,
4894 .test_exceptions
= test_exceptions_ccompare
,
4895 .par
= (const uint32_t[]){
4897 XTENSA_OPTION_TIMER_INTERRUPT
,
4899 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4901 .name
= "wsr.ccompare1",
4902 .translate
= translate_wsr_ccompare
,
4903 .test_exceptions
= test_exceptions_ccompare
,
4904 .par
= (const uint32_t[]){
4906 XTENSA_OPTION_TIMER_INTERRUPT
,
4908 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4910 .name
= "wsr.ccompare2",
4911 .translate
= translate_wsr_ccompare
,
4912 .test_exceptions
= test_exceptions_ccompare
,
4913 .par
= (const uint32_t[]){
4915 XTENSA_OPTION_TIMER_INTERRUPT
,
4917 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4919 .name
= "wsr.ccount",
4920 .translate
= translate_wsr_ccount
,
4921 .test_exceptions
= test_exceptions_sr
,
4922 .par
= (const uint32_t[]){
4924 XTENSA_OPTION_TIMER_INTERRUPT
,
4926 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4928 .name
= "wsr.configid0",
4929 .op_flags
= XTENSA_OP_ILL
,
4931 .name
= "wsr.configid1",
4932 .op_flags
= XTENSA_OP_ILL
,
4934 .name
= "wsr.cpenable",
4935 .translate
= translate_wsr_mask
,
4936 .test_exceptions
= test_exceptions_sr
,
4937 .par
= (const uint32_t[]){
4939 XTENSA_OPTION_COPROCESSOR
,
4942 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4944 .name
= "wsr.dbreaka0",
4945 .translate
= translate_wsr_dbreaka
,
4946 .test_exceptions
= test_exceptions_dbreak
,
4947 .par
= (const uint32_t[]){
4949 XTENSA_OPTION_DEBUG
,
4951 .op_flags
= XTENSA_OP_PRIVILEGED
,
4953 .name
= "wsr.dbreaka1",
4954 .translate
= translate_wsr_dbreaka
,
4955 .test_exceptions
= test_exceptions_dbreak
,
4956 .par
= (const uint32_t[]){
4958 XTENSA_OPTION_DEBUG
,
4960 .op_flags
= XTENSA_OP_PRIVILEGED
,
4962 .name
= "wsr.dbreakc0",
4963 .translate
= translate_wsr_dbreakc
,
4964 .test_exceptions
= test_exceptions_dbreak
,
4965 .par
= (const uint32_t[]){
4967 XTENSA_OPTION_DEBUG
,
4969 .op_flags
= XTENSA_OP_PRIVILEGED
,
4971 .name
= "wsr.dbreakc1",
4972 .translate
= translate_wsr_dbreakc
,
4973 .test_exceptions
= test_exceptions_dbreak
,
4974 .par
= (const uint32_t[]){
4976 XTENSA_OPTION_DEBUG
,
4978 .op_flags
= XTENSA_OP_PRIVILEGED
,
4981 .translate
= translate_wsr
,
4982 .test_exceptions
= test_exceptions_sr
,
4983 .par
= (const uint32_t[]){
4985 XTENSA_OPTION_DEBUG
,
4987 .op_flags
= XTENSA_OP_PRIVILEGED
,
4989 .name
= "wsr.debugcause",
4990 .op_flags
= XTENSA_OP_ILL
,
4993 .translate
= translate_wsr
,
4994 .test_exceptions
= test_exceptions_sr
,
4995 .par
= (const uint32_t[]){
4997 XTENSA_OPTION_EXCEPTION
,
4999 .op_flags
= XTENSA_OP_PRIVILEGED
,
5001 .name
= "wsr.dtlbcfg",
5002 .translate
= translate_wsr_mask
,
5003 .test_exceptions
= test_exceptions_sr
,
5004 .par
= (const uint32_t[]){
5009 .op_flags
= XTENSA_OP_PRIVILEGED
,
5012 .translate
= translate_wsr
,
5013 .test_exceptions
= test_exceptions_sr
,
5014 .par
= (const uint32_t[]){
5016 XTENSA_OPTION_EXCEPTION
,
5018 .op_flags
= XTENSA_OP_PRIVILEGED
,
5021 .translate
= translate_wsr
,
5022 .test_exceptions
= test_exceptions_hpi
,
5023 .par
= (const uint32_t[]){
5025 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5027 .op_flags
= XTENSA_OP_PRIVILEGED
,
5030 .translate
= translate_wsr
,
5031 .test_exceptions
= test_exceptions_hpi
,
5032 .par
= (const uint32_t[]){
5034 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5036 .op_flags
= XTENSA_OP_PRIVILEGED
,
5039 .translate
= translate_wsr
,
5040 .test_exceptions
= test_exceptions_hpi
,
5041 .par
= (const uint32_t[]){
5043 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5045 .op_flags
= XTENSA_OP_PRIVILEGED
,
5048 .translate
= translate_wsr
,
5049 .test_exceptions
= test_exceptions_hpi
,
5050 .par
= (const uint32_t[]){
5052 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5054 .op_flags
= XTENSA_OP_PRIVILEGED
,
5057 .translate
= translate_wsr
,
5058 .test_exceptions
= test_exceptions_hpi
,
5059 .par
= (const uint32_t[]){
5061 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5063 .op_flags
= XTENSA_OP_PRIVILEGED
,
5066 .translate
= translate_wsr
,
5067 .test_exceptions
= test_exceptions_hpi
,
5068 .par
= (const uint32_t[]){
5070 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5072 .op_flags
= XTENSA_OP_PRIVILEGED
,
5075 .translate
= translate_wsr
,
5076 .test_exceptions
= test_exceptions_hpi
,
5077 .par
= (const uint32_t[]){
5079 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5081 .op_flags
= XTENSA_OP_PRIVILEGED
,
5084 .translate
= translate_wsr
,
5085 .test_exceptions
= test_exceptions_hpi
,
5086 .par
= (const uint32_t[]){
5088 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5090 .op_flags
= XTENSA_OP_PRIVILEGED
,
5093 .translate
= translate_wsr
,
5094 .test_exceptions
= test_exceptions_hpi
,
5095 .par
= (const uint32_t[]){
5097 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5099 .op_flags
= XTENSA_OP_PRIVILEGED
,
5102 .translate
= translate_wsr
,
5103 .test_exceptions
= test_exceptions_hpi
,
5104 .par
= (const uint32_t[]){
5106 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5108 .op_flags
= XTENSA_OP_PRIVILEGED
,
5111 .translate
= translate_wsr
,
5112 .test_exceptions
= test_exceptions_hpi
,
5113 .par
= (const uint32_t[]){
5115 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5117 .op_flags
= XTENSA_OP_PRIVILEGED
,
5120 .translate
= translate_wsr
,
5121 .test_exceptions
= test_exceptions_hpi
,
5122 .par
= (const uint32_t[]){
5124 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5126 .op_flags
= XTENSA_OP_PRIVILEGED
,
5128 .name
= "wsr.eraccess",
5129 .translate
= translate_wsr_mask
,
5130 .par
= (const uint32_t[]){
5135 .op_flags
= XTENSA_OP_PRIVILEGED
,
5137 .name
= "wsr.exccause",
5138 .translate
= translate_wsr
,
5139 .test_exceptions
= test_exceptions_sr
,
5140 .par
= (const uint32_t[]){
5142 XTENSA_OPTION_EXCEPTION
,
5144 .op_flags
= XTENSA_OP_PRIVILEGED
,
5146 .name
= "wsr.excsave1",
5147 .translate
= translate_wsr
,
5148 .test_exceptions
= test_exceptions_sr
,
5149 .par
= (const uint32_t[]){
5151 XTENSA_OPTION_EXCEPTION
,
5153 .op_flags
= XTENSA_OP_PRIVILEGED
,
5155 .name
= "wsr.excsave2",
5156 .translate
= translate_wsr
,
5157 .test_exceptions
= test_exceptions_hpi
,
5158 .par
= (const uint32_t[]){
5160 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5162 .op_flags
= XTENSA_OP_PRIVILEGED
,
5164 .name
= "wsr.excsave3",
5165 .translate
= translate_wsr
,
5166 .test_exceptions
= test_exceptions_hpi
,
5167 .par
= (const uint32_t[]){
5169 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5171 .op_flags
= XTENSA_OP_PRIVILEGED
,
5173 .name
= "wsr.excsave4",
5174 .translate
= translate_wsr
,
5175 .test_exceptions
= test_exceptions_hpi
,
5176 .par
= (const uint32_t[]){
5178 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5180 .op_flags
= XTENSA_OP_PRIVILEGED
,
5182 .name
= "wsr.excsave5",
5183 .translate
= translate_wsr
,
5184 .test_exceptions
= test_exceptions_hpi
,
5185 .par
= (const uint32_t[]){
5187 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5189 .op_flags
= XTENSA_OP_PRIVILEGED
,
5191 .name
= "wsr.excsave6",
5192 .translate
= translate_wsr
,
5193 .test_exceptions
= test_exceptions_hpi
,
5194 .par
= (const uint32_t[]){
5196 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5198 .op_flags
= XTENSA_OP_PRIVILEGED
,
5200 .name
= "wsr.excsave7",
5201 .translate
= translate_wsr
,
5202 .test_exceptions
= test_exceptions_hpi
,
5203 .par
= (const uint32_t[]){
5205 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5207 .op_flags
= XTENSA_OP_PRIVILEGED
,
5209 .name
= "wsr.excvaddr",
5210 .translate
= translate_wsr
,
5211 .test_exceptions
= test_exceptions_sr
,
5212 .par
= (const uint32_t[]){
5214 XTENSA_OPTION_EXCEPTION
,
5216 .op_flags
= XTENSA_OP_PRIVILEGED
,
5218 .name
= "wsr.ibreaka0",
5219 .translate
= translate_wsr_ibreaka
,
5220 .test_exceptions
= test_exceptions_ibreak
,
5221 .par
= (const uint32_t[]){
5223 XTENSA_OPTION_DEBUG
,
5225 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5227 .name
= "wsr.ibreaka1",
5228 .translate
= translate_wsr_ibreaka
,
5229 .test_exceptions
= test_exceptions_ibreak
,
5230 .par
= (const uint32_t[]){
5232 XTENSA_OPTION_DEBUG
,
5234 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5236 .name
= "wsr.ibreakenable",
5237 .translate
= translate_wsr_ibreakenable
,
5238 .test_exceptions
= test_exceptions_sr
,
5239 .par
= (const uint32_t[]){
5241 XTENSA_OPTION_DEBUG
,
5243 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5245 .name
= "wsr.icount",
5246 .translate
= translate_wsr_icount
,
5247 .test_exceptions
= test_exceptions_sr
,
5248 .par
= (const uint32_t[]){
5250 XTENSA_OPTION_DEBUG
,
5252 .op_flags
= XTENSA_OP_PRIVILEGED
,
5254 .name
= "wsr.icountlevel",
5255 .translate
= translate_wsr_mask
,
5256 .test_exceptions
= test_exceptions_sr
,
5257 .par
= (const uint32_t[]){
5259 XTENSA_OPTION_DEBUG
,
5262 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5264 .name
= "wsr.intclear",
5265 .translate
= translate_wsr_intclear
,
5266 .test_exceptions
= test_exceptions_sr
,
5267 .par
= (const uint32_t[]){
5269 XTENSA_OPTION_INTERRUPT
,
5272 XTENSA_OP_PRIVILEGED
|
5273 XTENSA_OP_EXIT_TB_0
|
5274 XTENSA_OP_CHECK_INTERRUPTS
,
5276 .name
= "wsr.intenable",
5277 .translate
= translate_wsr
,
5278 .test_exceptions
= test_exceptions_sr
,
5279 .par
= (const uint32_t[]){
5281 XTENSA_OPTION_INTERRUPT
,
5284 XTENSA_OP_PRIVILEGED
|
5285 XTENSA_OP_EXIT_TB_0
|
5286 XTENSA_OP_CHECK_INTERRUPTS
,
5288 .name
= "wsr.interrupt",
5289 .translate
= translate_wsr
,
5290 .test_exceptions
= test_exceptions_sr
,
5291 .par
= (const uint32_t[]){
5293 XTENSA_OPTION_INTERRUPT
,
5296 XTENSA_OP_PRIVILEGED
|
5297 XTENSA_OP_EXIT_TB_0
|
5298 XTENSA_OP_CHECK_INTERRUPTS
,
5300 .name
= "wsr.intset",
5301 .translate
= translate_wsr_intset
,
5302 .test_exceptions
= test_exceptions_sr
,
5303 .par
= (const uint32_t[]){
5305 XTENSA_OPTION_INTERRUPT
,
5308 XTENSA_OP_PRIVILEGED
|
5309 XTENSA_OP_EXIT_TB_0
|
5310 XTENSA_OP_CHECK_INTERRUPTS
,
5312 .name
= "wsr.itlbcfg",
5313 .translate
= translate_wsr_mask
,
5314 .test_exceptions
= test_exceptions_sr
,
5315 .par
= (const uint32_t[]){
5320 .op_flags
= XTENSA_OP_PRIVILEGED
,
5323 .translate
= translate_wsr
,
5324 .test_exceptions
= test_exceptions_sr
,
5325 .par
= (const uint32_t[]){
5329 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5331 .name
= "wsr.lcount",
5332 .translate
= translate_wsr
,
5333 .test_exceptions
= test_exceptions_sr
,
5334 .par
= (const uint32_t[]){
5340 .translate
= translate_wsr
,
5341 .test_exceptions
= test_exceptions_sr
,
5342 .par
= (const uint32_t[]){
5346 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5348 .name
= "wsr.litbase",
5349 .translate
= translate_wsr_mask
,
5350 .test_exceptions
= test_exceptions_sr
,
5351 .par
= (const uint32_t[]){
5353 XTENSA_OPTION_EXTENDED_L32R
,
5356 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5359 .translate
= translate_wsr
,
5360 .test_exceptions
= test_exceptions_sr
,
5361 .par
= (const uint32_t[]){
5363 XTENSA_OPTION_MAC16
,
5367 .translate
= translate_wsr
,
5368 .test_exceptions
= test_exceptions_sr
,
5369 .par
= (const uint32_t[]){
5371 XTENSA_OPTION_MAC16
,
5375 .translate
= translate_wsr
,
5376 .test_exceptions
= test_exceptions_sr
,
5377 .par
= (const uint32_t[]){
5379 XTENSA_OPTION_MAC16
,
5383 .translate
= translate_wsr
,
5384 .test_exceptions
= test_exceptions_sr
,
5385 .par
= (const uint32_t[]){
5387 XTENSA_OPTION_MAC16
,
5390 .name
= "wsr.memctl",
5391 .translate
= translate_wsr_memctl
,
5392 .par
= (const uint32_t[]){MEMCTL
},
5393 .op_flags
= XTENSA_OP_PRIVILEGED
,
5396 .translate
= translate_wsr
,
5397 .test_exceptions
= test_exceptions_sr
,
5398 .par
= (const uint32_t[]){
5400 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5402 .op_flags
= XTENSA_OP_PRIVILEGED
,
5405 .translate
= translate_wsr
,
5406 .test_exceptions
= test_exceptions_sr
,
5407 .par
= (const uint32_t[]){
5409 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5411 .op_flags
= XTENSA_OP_PRIVILEGED
,
5414 .translate
= translate_wsr
,
5415 .test_exceptions
= test_exceptions_sr
,
5416 .par
= (const uint32_t[]){
5418 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5420 .op_flags
= XTENSA_OP_PRIVILEGED
,
5422 .name
= "wsr.mesave",
5423 .translate
= translate_wsr
,
5424 .test_exceptions
= test_exceptions_sr
,
5425 .par
= (const uint32_t[]){
5427 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5429 .op_flags
= XTENSA_OP_PRIVILEGED
,
5432 .translate
= translate_wsr
,
5433 .test_exceptions
= test_exceptions_sr
,
5434 .par
= (const uint32_t[]){
5436 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5438 .op_flags
= XTENSA_OP_PRIVILEGED
,
5440 .name
= "wsr.mevaddr",
5441 .translate
= translate_wsr
,
5442 .test_exceptions
= test_exceptions_sr
,
5443 .par
= (const uint32_t[]){
5445 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5447 .op_flags
= XTENSA_OP_PRIVILEGED
,
5449 .name
= "wsr.misc0",
5450 .translate
= translate_wsr
,
5451 .test_exceptions
= test_exceptions_sr
,
5452 .par
= (const uint32_t[]){
5454 XTENSA_OPTION_MISC_SR
,
5456 .op_flags
= XTENSA_OP_PRIVILEGED
,
5458 .name
= "wsr.misc1",
5459 .translate
= translate_wsr
,
5460 .test_exceptions
= test_exceptions_sr
,
5461 .par
= (const uint32_t[]){
5463 XTENSA_OPTION_MISC_SR
,
5465 .op_flags
= XTENSA_OP_PRIVILEGED
,
5467 .name
= "wsr.misc2",
5468 .translate
= translate_wsr
,
5469 .test_exceptions
= test_exceptions_sr
,
5470 .par
= (const uint32_t[]){
5472 XTENSA_OPTION_MISC_SR
,
5474 .op_flags
= XTENSA_OP_PRIVILEGED
,
5476 .name
= "wsr.misc3",
5477 .translate
= translate_wsr
,
5478 .test_exceptions
= test_exceptions_sr
,
5479 .par
= (const uint32_t[]){
5481 XTENSA_OPTION_MISC_SR
,
5483 .op_flags
= XTENSA_OP_PRIVILEGED
,
5486 .translate
= translate_wsr
,
5487 .test_exceptions
= test_exceptions_sr
,
5488 .par
= (const uint32_t[]){
5490 XTENSA_OPTION_TRACE_PORT
,
5492 .op_flags
= XTENSA_OP_PRIVILEGED
,
5494 .name
= "wsr.mpuenb",
5495 .translate
= translate_wsr_mpuenb
,
5496 .test_exceptions
= test_exceptions_sr
,
5497 .par
= (const uint32_t[]){
5501 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5503 .name
= "wsr.prefctl",
5504 .translate
= translate_wsr
,
5505 .par
= (const uint32_t[]){PREFCTL
},
5508 .op_flags
= XTENSA_OP_ILL
,
5511 .translate
= translate_wsr_ps
,
5512 .test_exceptions
= test_exceptions_sr
,
5513 .par
= (const uint32_t[]){
5515 XTENSA_OPTION_EXCEPTION
,
5518 XTENSA_OP_PRIVILEGED
|
5519 XTENSA_OP_EXIT_TB_M1
|
5520 XTENSA_OP_CHECK_INTERRUPTS
,
5522 .name
= "wsr.ptevaddr",
5523 .translate
= translate_wsr_mask
,
5524 .test_exceptions
= test_exceptions_sr
,
5525 .par
= (const uint32_t[]){
5530 .op_flags
= XTENSA_OP_PRIVILEGED
,
5532 .name
= "wsr.rasid",
5533 .translate
= translate_wsr_rasid
,
5534 .test_exceptions
= test_exceptions_sr
,
5535 .par
= (const uint32_t[]){
5539 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5542 .translate
= translate_wsr_sar
,
5543 .par
= (const uint32_t[]){SAR
},
5545 .name
= "wsr.scompare1",
5546 .translate
= translate_wsr
,
5547 .test_exceptions
= test_exceptions_sr
,
5548 .par
= (const uint32_t[]){
5550 XTENSA_OPTION_CONDITIONAL_STORE
,
5553 .name
= "wsr.vecbase",
5554 .translate
= translate_wsr
,
5555 .test_exceptions
= test_exceptions_sr
,
5556 .par
= (const uint32_t[]){
5558 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5560 .op_flags
= XTENSA_OP_PRIVILEGED
,
5562 .name
= "wsr.windowbase",
5563 .translate
= translate_wsr_windowbase
,
5564 .test_exceptions
= test_exceptions_sr
,
5565 .par
= (const uint32_t[]){
5567 XTENSA_OPTION_WINDOWED_REGISTER
,
5569 .op_flags
= XTENSA_OP_PRIVILEGED
|
5570 XTENSA_OP_EXIT_TB_M1
|
5571 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5573 .name
= "wsr.windowstart",
5574 .translate
= translate_wsr_windowstart
,
5575 .test_exceptions
= test_exceptions_sr
,
5576 .par
= (const uint32_t[]){
5578 XTENSA_OPTION_WINDOWED_REGISTER
,
5580 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5582 .name
= "wur.expstate",
5583 .translate
= translate_wur
,
5584 .par
= (const uint32_t[]){EXPSTATE
},
5586 .name
= "wur.threadptr",
5587 .translate
= translate_wur
,
5588 .par
= (const uint32_t[]){THREADPTR
},
5591 .translate
= translate_xor
,
5594 .translate
= translate_boolean
,
5595 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5598 .op_flags
= XTENSA_OP_ILL
,
5601 .op_flags
= XTENSA_OP_ILL
,
5603 .name
= "xsr.acchi",
5604 .translate
= translate_xsr_acchi
,
5605 .test_exceptions
= test_exceptions_sr
,
5606 .par
= (const uint32_t[]){
5608 XTENSA_OPTION_MAC16
,
5611 .name
= "xsr.acclo",
5612 .translate
= translate_xsr
,
5613 .test_exceptions
= test_exceptions_sr
,
5614 .par
= (const uint32_t[]){
5616 XTENSA_OPTION_MAC16
,
5619 .name
= "xsr.atomctl",
5620 .translate
= translate_xsr_mask
,
5621 .test_exceptions
= test_exceptions_sr
,
5622 .par
= (const uint32_t[]){
5624 XTENSA_OPTION_ATOMCTL
,
5627 .op_flags
= XTENSA_OP_PRIVILEGED
,
5630 .translate
= translate_xsr_mask
,
5631 .test_exceptions
= test_exceptions_sr
,
5632 .par
= (const uint32_t[]){
5634 XTENSA_OPTION_BOOLEAN
,
5638 .name
= "xsr.cacheadrdis",
5639 .translate
= translate_xsr_mask
,
5640 .test_exceptions
= test_exceptions_sr
,
5641 .par
= (const uint32_t[]){
5646 .op_flags
= XTENSA_OP_PRIVILEGED
,
5648 .name
= "xsr.cacheattr",
5649 .translate
= translate_xsr
,
5650 .test_exceptions
= test_exceptions_sr
,
5651 .par
= (const uint32_t[]){
5653 XTENSA_OPTION_CACHEATTR
,
5655 .op_flags
= XTENSA_OP_PRIVILEGED
,
5657 .name
= "xsr.ccompare0",
5658 .translate
= translate_xsr_ccompare
,
5659 .test_exceptions
= test_exceptions_ccompare
,
5660 .par
= (const uint32_t[]){
5662 XTENSA_OPTION_TIMER_INTERRUPT
,
5664 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5666 .name
= "xsr.ccompare1",
5667 .translate
= translate_xsr_ccompare
,
5668 .test_exceptions
= test_exceptions_ccompare
,
5669 .par
= (const uint32_t[]){
5671 XTENSA_OPTION_TIMER_INTERRUPT
,
5673 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5675 .name
= "xsr.ccompare2",
5676 .translate
= translate_xsr_ccompare
,
5677 .test_exceptions
= test_exceptions_ccompare
,
5678 .par
= (const uint32_t[]){
5680 XTENSA_OPTION_TIMER_INTERRUPT
,
5682 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5684 .name
= "xsr.ccount",
5685 .translate
= translate_xsr_ccount
,
5686 .test_exceptions
= test_exceptions_sr
,
5687 .par
= (const uint32_t[]){
5689 XTENSA_OPTION_TIMER_INTERRUPT
,
5691 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5693 .name
= "xsr.configid0",
5694 .op_flags
= XTENSA_OP_ILL
,
5696 .name
= "xsr.configid1",
5697 .op_flags
= XTENSA_OP_ILL
,
5699 .name
= "xsr.cpenable",
5700 .translate
= translate_xsr_mask
,
5701 .test_exceptions
= test_exceptions_sr
,
5702 .par
= (const uint32_t[]){
5704 XTENSA_OPTION_COPROCESSOR
,
5707 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5709 .name
= "xsr.dbreaka0",
5710 .translate
= translate_xsr_dbreaka
,
5711 .test_exceptions
= test_exceptions_dbreak
,
5712 .par
= (const uint32_t[]){
5714 XTENSA_OPTION_DEBUG
,
5716 .op_flags
= XTENSA_OP_PRIVILEGED
,
5718 .name
= "xsr.dbreaka1",
5719 .translate
= translate_xsr_dbreaka
,
5720 .test_exceptions
= test_exceptions_dbreak
,
5721 .par
= (const uint32_t[]){
5723 XTENSA_OPTION_DEBUG
,
5725 .op_flags
= XTENSA_OP_PRIVILEGED
,
5727 .name
= "xsr.dbreakc0",
5728 .translate
= translate_xsr_dbreakc
,
5729 .test_exceptions
= test_exceptions_dbreak
,
5730 .par
= (const uint32_t[]){
5732 XTENSA_OPTION_DEBUG
,
5734 .op_flags
= XTENSA_OP_PRIVILEGED
,
5736 .name
= "xsr.dbreakc1",
5737 .translate
= translate_xsr_dbreakc
,
5738 .test_exceptions
= test_exceptions_dbreak
,
5739 .par
= (const uint32_t[]){
5741 XTENSA_OPTION_DEBUG
,
5743 .op_flags
= XTENSA_OP_PRIVILEGED
,
5746 .translate
= translate_xsr
,
5747 .test_exceptions
= test_exceptions_sr
,
5748 .par
= (const uint32_t[]){
5750 XTENSA_OPTION_DEBUG
,
5752 .op_flags
= XTENSA_OP_PRIVILEGED
,
5754 .name
= "xsr.debugcause",
5755 .op_flags
= XTENSA_OP_ILL
,
5758 .translate
= translate_xsr
,
5759 .test_exceptions
= test_exceptions_sr
,
5760 .par
= (const uint32_t[]){
5762 XTENSA_OPTION_EXCEPTION
,
5764 .op_flags
= XTENSA_OP_PRIVILEGED
,
5766 .name
= "xsr.dtlbcfg",
5767 .translate
= translate_xsr_mask
,
5768 .test_exceptions
= test_exceptions_sr
,
5769 .par
= (const uint32_t[]){
5774 .op_flags
= XTENSA_OP_PRIVILEGED
,
5777 .translate
= translate_xsr
,
5778 .test_exceptions
= test_exceptions_sr
,
5779 .par
= (const uint32_t[]){
5781 XTENSA_OPTION_EXCEPTION
,
5783 .op_flags
= XTENSA_OP_PRIVILEGED
,
5786 .translate
= translate_xsr
,
5787 .test_exceptions
= test_exceptions_hpi
,
5788 .par
= (const uint32_t[]){
5790 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5792 .op_flags
= XTENSA_OP_PRIVILEGED
,
5795 .translate
= translate_xsr
,
5796 .test_exceptions
= test_exceptions_hpi
,
5797 .par
= (const uint32_t[]){
5799 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5801 .op_flags
= XTENSA_OP_PRIVILEGED
,
5804 .translate
= translate_xsr
,
5805 .test_exceptions
= test_exceptions_hpi
,
5806 .par
= (const uint32_t[]){
5808 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5810 .op_flags
= XTENSA_OP_PRIVILEGED
,
5813 .translate
= translate_xsr
,
5814 .test_exceptions
= test_exceptions_hpi
,
5815 .par
= (const uint32_t[]){
5817 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5819 .op_flags
= XTENSA_OP_PRIVILEGED
,
5822 .translate
= translate_xsr
,
5823 .test_exceptions
= test_exceptions_hpi
,
5824 .par
= (const uint32_t[]){
5826 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5828 .op_flags
= XTENSA_OP_PRIVILEGED
,
5831 .translate
= translate_xsr
,
5832 .test_exceptions
= test_exceptions_hpi
,
5833 .par
= (const uint32_t[]){
5835 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5837 .op_flags
= XTENSA_OP_PRIVILEGED
,
5840 .translate
= translate_xsr
,
5841 .test_exceptions
= test_exceptions_hpi
,
5842 .par
= (const uint32_t[]){
5844 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5846 .op_flags
= XTENSA_OP_PRIVILEGED
,
5849 .translate
= translate_xsr
,
5850 .test_exceptions
= test_exceptions_hpi
,
5851 .par
= (const uint32_t[]){
5853 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5855 .op_flags
= XTENSA_OP_PRIVILEGED
,
5858 .translate
= translate_xsr
,
5859 .test_exceptions
= test_exceptions_hpi
,
5860 .par
= (const uint32_t[]){
5862 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5864 .op_flags
= XTENSA_OP_PRIVILEGED
,
5867 .translate
= translate_xsr
,
5868 .test_exceptions
= test_exceptions_hpi
,
5869 .par
= (const uint32_t[]){
5871 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5873 .op_flags
= XTENSA_OP_PRIVILEGED
,
5876 .translate
= translate_xsr
,
5877 .test_exceptions
= test_exceptions_hpi
,
5878 .par
= (const uint32_t[]){
5880 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5882 .op_flags
= XTENSA_OP_PRIVILEGED
,
5885 .translate
= translate_xsr
,
5886 .test_exceptions
= test_exceptions_hpi
,
5887 .par
= (const uint32_t[]){
5889 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5891 .op_flags
= XTENSA_OP_PRIVILEGED
,
5893 .name
= "xsr.eraccess",
5894 .translate
= translate_xsr_mask
,
5895 .par
= (const uint32_t[]){
5900 .op_flags
= XTENSA_OP_PRIVILEGED
,
5902 .name
= "xsr.exccause",
5903 .translate
= translate_xsr
,
5904 .test_exceptions
= test_exceptions_sr
,
5905 .par
= (const uint32_t[]){
5907 XTENSA_OPTION_EXCEPTION
,
5909 .op_flags
= XTENSA_OP_PRIVILEGED
,
5911 .name
= "xsr.excsave1",
5912 .translate
= translate_xsr
,
5913 .test_exceptions
= test_exceptions_sr
,
5914 .par
= (const uint32_t[]){
5916 XTENSA_OPTION_EXCEPTION
,
5918 .op_flags
= XTENSA_OP_PRIVILEGED
,
5920 .name
= "xsr.excsave2",
5921 .translate
= translate_xsr
,
5922 .test_exceptions
= test_exceptions_hpi
,
5923 .par
= (const uint32_t[]){
5925 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5927 .op_flags
= XTENSA_OP_PRIVILEGED
,
5929 .name
= "xsr.excsave3",
5930 .translate
= translate_xsr
,
5931 .test_exceptions
= test_exceptions_hpi
,
5932 .par
= (const uint32_t[]){
5934 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5936 .op_flags
= XTENSA_OP_PRIVILEGED
,
5938 .name
= "xsr.excsave4",
5939 .translate
= translate_xsr
,
5940 .test_exceptions
= test_exceptions_hpi
,
5941 .par
= (const uint32_t[]){
5943 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5945 .op_flags
= XTENSA_OP_PRIVILEGED
,
5947 .name
= "xsr.excsave5",
5948 .translate
= translate_xsr
,
5949 .test_exceptions
= test_exceptions_hpi
,
5950 .par
= (const uint32_t[]){
5952 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5954 .op_flags
= XTENSA_OP_PRIVILEGED
,
5956 .name
= "xsr.excsave6",
5957 .translate
= translate_xsr
,
5958 .test_exceptions
= test_exceptions_hpi
,
5959 .par
= (const uint32_t[]){
5961 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5963 .op_flags
= XTENSA_OP_PRIVILEGED
,
5965 .name
= "xsr.excsave7",
5966 .translate
= translate_xsr
,
5967 .test_exceptions
= test_exceptions_hpi
,
5968 .par
= (const uint32_t[]){
5970 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5972 .op_flags
= XTENSA_OP_PRIVILEGED
,
5974 .name
= "xsr.excvaddr",
5975 .translate
= translate_xsr
,
5976 .test_exceptions
= test_exceptions_sr
,
5977 .par
= (const uint32_t[]){
5979 XTENSA_OPTION_EXCEPTION
,
5981 .op_flags
= XTENSA_OP_PRIVILEGED
,
5983 .name
= "xsr.ibreaka0",
5984 .translate
= translate_xsr_ibreaka
,
5985 .test_exceptions
= test_exceptions_ibreak
,
5986 .par
= (const uint32_t[]){
5988 XTENSA_OPTION_DEBUG
,
5990 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5992 .name
= "xsr.ibreaka1",
5993 .translate
= translate_xsr_ibreaka
,
5994 .test_exceptions
= test_exceptions_ibreak
,
5995 .par
= (const uint32_t[]){
5997 XTENSA_OPTION_DEBUG
,
5999 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
6001 .name
= "xsr.ibreakenable",
6002 .translate
= translate_xsr_ibreakenable
,
6003 .test_exceptions
= test_exceptions_sr
,
6004 .par
= (const uint32_t[]){
6006 XTENSA_OPTION_DEBUG
,
6008 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
6010 .name
= "xsr.icount",
6011 .translate
= translate_xsr_icount
,
6012 .test_exceptions
= test_exceptions_sr
,
6013 .par
= (const uint32_t[]){
6015 XTENSA_OPTION_DEBUG
,
6017 .op_flags
= XTENSA_OP_PRIVILEGED
,
6019 .name
= "xsr.icountlevel",
6020 .translate
= translate_xsr_mask
,
6021 .test_exceptions
= test_exceptions_sr
,
6022 .par
= (const uint32_t[]){
6024 XTENSA_OPTION_DEBUG
,
6027 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6029 .name
= "xsr.intclear",
6030 .op_flags
= XTENSA_OP_ILL
,
6032 .name
= "xsr.intenable",
6033 .translate
= translate_xsr
,
6034 .test_exceptions
= test_exceptions_sr
,
6035 .par
= (const uint32_t[]){
6037 XTENSA_OPTION_INTERRUPT
,
6040 XTENSA_OP_PRIVILEGED
|
6041 XTENSA_OP_EXIT_TB_0
|
6042 XTENSA_OP_CHECK_INTERRUPTS
,
6044 .name
= "xsr.interrupt",
6045 .op_flags
= XTENSA_OP_ILL
,
6047 .name
= "xsr.intset",
6048 .op_flags
= XTENSA_OP_ILL
,
6050 .name
= "xsr.itlbcfg",
6051 .translate
= translate_xsr_mask
,
6052 .test_exceptions
= test_exceptions_sr
,
6053 .par
= (const uint32_t[]){
6058 .op_flags
= XTENSA_OP_PRIVILEGED
,
6061 .translate
= translate_xsr
,
6062 .test_exceptions
= test_exceptions_sr
,
6063 .par
= (const uint32_t[]){
6067 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6069 .name
= "xsr.lcount",
6070 .translate
= translate_xsr
,
6071 .test_exceptions
= test_exceptions_sr
,
6072 .par
= (const uint32_t[]){
6078 .translate
= translate_xsr
,
6079 .test_exceptions
= test_exceptions_sr
,
6080 .par
= (const uint32_t[]){
6084 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6086 .name
= "xsr.litbase",
6087 .translate
= translate_xsr_mask
,
6088 .test_exceptions
= test_exceptions_sr
,
6089 .par
= (const uint32_t[]){
6091 XTENSA_OPTION_EXTENDED_L32R
,
6094 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6097 .translate
= translate_xsr
,
6098 .test_exceptions
= test_exceptions_sr
,
6099 .par
= (const uint32_t[]){
6101 XTENSA_OPTION_MAC16
,
6105 .translate
= translate_xsr
,
6106 .test_exceptions
= test_exceptions_sr
,
6107 .par
= (const uint32_t[]){
6109 XTENSA_OPTION_MAC16
,
6113 .translate
= translate_xsr
,
6114 .test_exceptions
= test_exceptions_sr
,
6115 .par
= (const uint32_t[]){
6117 XTENSA_OPTION_MAC16
,
6121 .translate
= translate_xsr
,
6122 .test_exceptions
= test_exceptions_sr
,
6123 .par
= (const uint32_t[]){
6125 XTENSA_OPTION_MAC16
,
6128 .name
= "xsr.memctl",
6129 .translate
= translate_xsr_memctl
,
6130 .par
= (const uint32_t[]){MEMCTL
},
6131 .op_flags
= XTENSA_OP_PRIVILEGED
,
6134 .translate
= translate_xsr
,
6135 .test_exceptions
= test_exceptions_sr
,
6136 .par
= (const uint32_t[]){
6138 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6140 .op_flags
= XTENSA_OP_PRIVILEGED
,
6143 .translate
= translate_xsr
,
6144 .test_exceptions
= test_exceptions_sr
,
6145 .par
= (const uint32_t[]){
6147 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6149 .op_flags
= XTENSA_OP_PRIVILEGED
,
6152 .translate
= translate_xsr
,
6153 .test_exceptions
= test_exceptions_sr
,
6154 .par
= (const uint32_t[]){
6156 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6158 .op_flags
= XTENSA_OP_PRIVILEGED
,
6160 .name
= "xsr.mesave",
6161 .translate
= translate_xsr
,
6162 .test_exceptions
= test_exceptions_sr
,
6163 .par
= (const uint32_t[]){
6165 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6167 .op_flags
= XTENSA_OP_PRIVILEGED
,
6170 .translate
= translate_xsr
,
6171 .test_exceptions
= test_exceptions_sr
,
6172 .par
= (const uint32_t[]){
6174 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6176 .op_flags
= XTENSA_OP_PRIVILEGED
,
6178 .name
= "xsr.mevaddr",
6179 .translate
= translate_xsr
,
6180 .test_exceptions
= test_exceptions_sr
,
6181 .par
= (const uint32_t[]){
6183 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6185 .op_flags
= XTENSA_OP_PRIVILEGED
,
6187 .name
= "xsr.misc0",
6188 .translate
= translate_xsr
,
6189 .test_exceptions
= test_exceptions_sr
,
6190 .par
= (const uint32_t[]){
6192 XTENSA_OPTION_MISC_SR
,
6194 .op_flags
= XTENSA_OP_PRIVILEGED
,
6196 .name
= "xsr.misc1",
6197 .translate
= translate_xsr
,
6198 .test_exceptions
= test_exceptions_sr
,
6199 .par
= (const uint32_t[]){
6201 XTENSA_OPTION_MISC_SR
,
6203 .op_flags
= XTENSA_OP_PRIVILEGED
,
6205 .name
= "xsr.misc2",
6206 .translate
= translate_xsr
,
6207 .test_exceptions
= test_exceptions_sr
,
6208 .par
= (const uint32_t[]){
6210 XTENSA_OPTION_MISC_SR
,
6212 .op_flags
= XTENSA_OP_PRIVILEGED
,
6214 .name
= "xsr.misc3",
6215 .translate
= translate_xsr
,
6216 .test_exceptions
= test_exceptions_sr
,
6217 .par
= (const uint32_t[]){
6219 XTENSA_OPTION_MISC_SR
,
6221 .op_flags
= XTENSA_OP_PRIVILEGED
,
6223 .name
= "xsr.mpuenb",
6224 .translate
= translate_xsr_mpuenb
,
6225 .test_exceptions
= test_exceptions_sr
,
6226 .par
= (const uint32_t[]){
6230 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6232 .name
= "xsr.prefctl",
6233 .translate
= translate_xsr
,
6234 .par
= (const uint32_t[]){PREFCTL
},
6237 .op_flags
= XTENSA_OP_ILL
,
6240 .translate
= translate_xsr_ps
,
6241 .test_exceptions
= test_exceptions_sr
,
6242 .par
= (const uint32_t[]){
6244 XTENSA_OPTION_EXCEPTION
,
6247 XTENSA_OP_PRIVILEGED
|
6248 XTENSA_OP_EXIT_TB_M1
|
6249 XTENSA_OP_CHECK_INTERRUPTS
,
6251 .name
= "xsr.ptevaddr",
6252 .translate
= translate_xsr_mask
,
6253 .test_exceptions
= test_exceptions_sr
,
6254 .par
= (const uint32_t[]){
6259 .op_flags
= XTENSA_OP_PRIVILEGED
,
6261 .name
= "xsr.rasid",
6262 .translate
= translate_xsr_rasid
,
6263 .test_exceptions
= test_exceptions_sr
,
6264 .par
= (const uint32_t[]){
6268 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6271 .translate
= translate_xsr_sar
,
6272 .par
= (const uint32_t[]){SAR
},
6274 .name
= "xsr.scompare1",
6275 .translate
= translate_xsr
,
6276 .test_exceptions
= test_exceptions_sr
,
6277 .par
= (const uint32_t[]){
6279 XTENSA_OPTION_CONDITIONAL_STORE
,
6282 .name
= "xsr.vecbase",
6283 .translate
= translate_xsr
,
6284 .test_exceptions
= test_exceptions_sr
,
6285 .par
= (const uint32_t[]){
6287 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6289 .op_flags
= XTENSA_OP_PRIVILEGED
,
6291 .name
= "xsr.windowbase",
6292 .translate
= translate_xsr_windowbase
,
6293 .test_exceptions
= test_exceptions_sr
,
6294 .par
= (const uint32_t[]){
6296 XTENSA_OPTION_WINDOWED_REGISTER
,
6298 .op_flags
= XTENSA_OP_PRIVILEGED
|
6299 XTENSA_OP_EXIT_TB_M1
|
6300 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6302 .name
= "xsr.windowstart",
6303 .translate
= translate_xsr_windowstart
,
6304 .test_exceptions
= test_exceptions_sr
,
6305 .par
= (const uint32_t[]){
6307 XTENSA_OPTION_WINDOWED_REGISTER
,
6309 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6313 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6314 .num_opcodes
= ARRAY_SIZE(core_ops
),
6319 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6320 int o0
, int i0
, int i1
, int i2
)
6322 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6323 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6325 arg32
[o0
].out
= tcg_temp_new_i32();
6328 arg32
[i0
].in
= tcg_temp_new_i32();
6329 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6332 arg32
[i1
].in
= tcg_temp_new_i32();
6333 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6336 arg32
[i2
].in
= tcg_temp_new_i32();
6337 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6341 arg32
[o0
].out
= arg
[o0
].out
;
6344 arg32
[i0
].in
= arg
[i0
].in
;
6347 arg32
[i1
].in
= arg
[i1
].in
;
6350 arg32
[i2
].in
= arg
[i2
].in
;
6355 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6356 int o0
, int i0
, int i1
, int i2
)
6358 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6359 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6361 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6362 tcg_temp_free_i32(arg32
[o0
].out
);
6365 tcg_temp_free_i32(arg32
[i0
].in
);
6368 tcg_temp_free_i32(arg32
[i1
].in
);
6371 tcg_temp_free_i32(arg32
[i2
].in
);
6376 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6377 int o0
, int i0
, int i1
)
6379 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6382 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6383 int o0
, int i0
, int i1
)
6385 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6388 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6391 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6394 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6397 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6400 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6403 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6406 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6409 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6412 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6415 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6418 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6421 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6424 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6427 get_f32_i2(arg
, arg32
, i0
, -1);
6430 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6433 put_f32_i2(arg
, arg32
, i0
, -1);
6437 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6438 const uint32_t par
[])
6440 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6443 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6444 const uint32_t par
[])
6448 get_f32_o1_i1(arg
, arg32
, 0, 1);
6449 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6450 put_f32_o1_i1(arg
, arg32
, 0, 1);
6453 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6454 const uint32_t par
[])
6456 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
6457 arg
[1].in
, arg
[2].in
);
6470 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6471 const uint32_t par
[])
6473 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6474 TCGv_i64 s
, TCGv_i64 t
) = {
6475 [COMPARE_UN
] = gen_helper_un_d
,
6476 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6477 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6478 [COMPARE_OLT
] = gen_helper_olt_d
,
6479 [COMPARE_ULT
] = gen_helper_ult_d
,
6480 [COMPARE_OLE
] = gen_helper_ole_d
,
6481 [COMPARE_ULE
] = gen_helper_ule_d
,
6483 TCGv_i32 zero
= tcg_const_i32(0);
6484 TCGv_i32 res
= tcg_temp_new_i32();
6485 TCGv_i32 set_br
= tcg_temp_new_i32();
6486 TCGv_i32 clr_br
= tcg_temp_new_i32();
6488 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6489 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6491 helper
[par
[0]](res
, cpu_env
, arg
[1].in
, arg
[2].in
);
6492 tcg_gen_movcond_i32(TCG_COND_NE
,
6493 arg
[0].out
, res
, zero
,
6495 tcg_temp_free(zero
);
6497 tcg_temp_free(set_br
);
6498 tcg_temp_free(clr_br
);
6501 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6502 const uint32_t par
[])
6504 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6505 TCGv_i32 s
, TCGv_i32 t
) = {
6506 [COMPARE_UN
] = gen_helper_un_s
,
6507 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6508 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6509 [COMPARE_OLT
] = gen_helper_olt_s
,
6510 [COMPARE_ULT
] = gen_helper_ult_s
,
6511 [COMPARE_OLE
] = gen_helper_ole_s
,
6512 [COMPARE_ULE
] = gen_helper_ule_s
,
6515 TCGv_i32 zero
= tcg_const_i32(0);
6516 TCGv_i32 res
= tcg_temp_new_i32();
6517 TCGv_i32 set_br
= tcg_temp_new_i32();
6518 TCGv_i32 clr_br
= tcg_temp_new_i32();
6520 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6521 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6523 get_f32_i2(arg
, arg32
, 1, 2);
6524 helper
[par
[0]](res
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
6525 tcg_gen_movcond_i32(TCG_COND_NE
,
6526 arg
[0].out
, res
, zero
,
6528 put_f32_i2(arg
, arg32
, 1, 2);
6529 tcg_temp_free(zero
);
6531 tcg_temp_free(set_br
);
6532 tcg_temp_free(clr_br
);
6535 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6536 const uint32_t par
[])
6538 static const uint64_t v
[] = {
6539 UINT64_C(0x0000000000000000),
6540 UINT64_C(0x3ff0000000000000),
6541 UINT64_C(0x4000000000000000),
6542 UINT64_C(0x3fe0000000000000),
6545 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6546 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6547 qemu_log_mask(LOG_GUEST_ERROR
,
6548 "const.d f%d, #%d, immediate value is reserved\n",
6549 arg
[0].imm
, arg
[1].imm
);
6553 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6554 const uint32_t par
[])
6556 static const uint32_t v
[] = {
6563 if (arg
[0].num_bits
== 32) {
6564 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6566 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6568 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6569 qemu_log_mask(LOG_GUEST_ERROR
,
6570 "const.s f%d, #%d, immediate value is reserved\n",
6571 arg
[0].imm
, arg
[1].imm
);
6575 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6576 const uint32_t par
[])
6578 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6581 gen_helper_uitof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6583 gen_helper_itof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6585 tcg_temp_free(scale
);
6588 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6589 const uint32_t par
[])
6591 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6594 get_f32_o1(arg
, arg32
, 0);
6596 gen_helper_uitof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6598 gen_helper_itof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6600 put_f32_o1(arg
, arg32
, 0);
6601 tcg_temp_free(scale
);
6604 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6605 const uint32_t par
[])
6607 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6608 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6611 gen_helper_ftoui_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6612 rounding_mode
, scale
);
6614 gen_helper_ftoi_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6615 rounding_mode
, scale
);
6617 tcg_temp_free(rounding_mode
);
6618 tcg_temp_free(scale
);
6621 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6622 const uint32_t par
[])
6624 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6625 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6628 get_f32_i1(arg
, arg32
, 1);
6630 gen_helper_ftoui_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6631 rounding_mode
, scale
);
6633 gen_helper_ftoi_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6634 rounding_mode
, scale
);
6636 put_f32_i1(arg
, arg32
, 1);
6637 tcg_temp_free(rounding_mode
);
6638 tcg_temp_free(scale
);
6641 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6642 const uint32_t par
[])
6644 TCGv_i32 addr
= tcg_temp_new_i32();
6646 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6647 gen_load_store_alignment(dc
, 2, addr
, false);
6649 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6651 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6654 tcg_gen_mov_i32(arg
[1].out
, addr
);
6656 tcg_temp_free(addr
);
6659 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6660 const uint32_t par
[])
6662 TCGv_i32 addr
= tcg_temp_new_i32();
6664 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6665 gen_load_store_alignment(dc
, 2, addr
, false);
6667 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6669 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6672 tcg_gen_mov_i32(arg
[1].out
, addr
);
6674 tcg_temp_free(addr
);
6677 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6678 const uint32_t par
[])
6680 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
6681 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6684 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6685 const uint32_t par
[])
6687 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6690 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6691 const uint32_t par
[])
6693 if (arg
[0].num_bits
== 32) {
6694 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6696 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6700 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6701 const uint32_t par
[])
6703 TCGv_i64 zero
= tcg_const_i64(0);
6704 TCGv_i64 arg2
= tcg_temp_new_i64();
6706 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6707 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6709 arg
[1].in
, arg
[0].in
);
6710 tcg_temp_free_i64(zero
);
6711 tcg_temp_free_i64(arg2
);
6714 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6715 const uint32_t par
[])
6717 if (arg
[0].num_bits
== 32) {
6718 TCGv_i32 zero
= tcg_const_i32(0);
6720 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6722 arg
[1].in
, arg
[0].in
);
6723 tcg_temp_free(zero
);
6725 translate_movcond_d(dc
, arg
, par
);
6729 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6730 const uint32_t par
[])
6732 TCGv_i64 zero
= tcg_const_i64(0);
6733 TCGv_i32 tmp1
= tcg_temp_new_i32();
6734 TCGv_i64 tmp2
= tcg_temp_new_i64();
6736 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6737 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6738 tcg_gen_movcond_i64(par
[0],
6739 arg
[0].out
, tmp2
, zero
,
6740 arg
[1].in
, arg
[0].in
);
6741 tcg_temp_free_i64(zero
);
6742 tcg_temp_free_i32(tmp1
);
6743 tcg_temp_free_i64(tmp2
);
6746 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6747 const uint32_t par
[])
6749 if (arg
[0].num_bits
== 32) {
6750 TCGv_i32 zero
= tcg_const_i32(0);
6751 TCGv_i32 tmp
= tcg_temp_new_i32();
6753 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6754 tcg_gen_movcond_i32(par
[0],
6755 arg
[0].out
, tmp
, zero
,
6756 arg
[1].in
, arg
[0].in
);
6758 tcg_temp_free(zero
);
6760 translate_movp_d(dc
, arg
, par
);
6764 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6765 const uint32_t par
[])
6767 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
6768 arg
[1].in
, arg
[2].in
);
6771 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6772 const uint32_t par
[])
6774 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
6775 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6778 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6779 const uint32_t par
[])
6781 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6784 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6785 const uint32_t par
[])
6789 get_f32_o1_i1(arg
, arg32
, 0, 1);
6790 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6791 put_f32_o1_i1(arg
, arg32
, 0, 1);
6794 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6795 const uint32_t par
[])
6797 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6800 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6801 const uint32_t par
[])
6803 if (arg
[1].num_bits
== 32) {
6804 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6806 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6810 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6811 const uint32_t par
[])
6813 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
6814 arg
[1].in
, arg
[2].in
);
6817 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6818 const uint32_t par
[])
6820 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6823 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6824 const uint32_t par
[])
6826 if (arg
[0].num_bits
== 32) {
6827 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6829 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6833 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6834 const uint32_t par
[])
6836 gen_helper_wur_fpu2k_fcr(cpu_env
, arg
[0].in
);
6839 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6840 const uint32_t par
[])
6842 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6845 static const XtensaOpcodeOps fpu2000_ops
[] = {
6848 .translate
= translate_abs_s
,
6852 .translate
= translate_fpu2k_add_s
,
6856 .translate
= translate_ftoi_s
,
6857 .par
= (const uint32_t[]){float_round_up
, false},
6861 .translate
= translate_float_s
,
6862 .par
= (const uint32_t[]){false},
6866 .translate
= translate_ftoi_s
,
6867 .par
= (const uint32_t[]){float_round_down
, false},
6871 .translate
= translate_ldsti
,
6872 .par
= (const uint32_t[]){false, false},
6873 .op_flags
= XTENSA_OP_LOAD
,
6877 .translate
= translate_ldsti
,
6878 .par
= (const uint32_t[]){false, true},
6879 .op_flags
= XTENSA_OP_LOAD
,
6883 .translate
= translate_ldstx
,
6884 .par
= (const uint32_t[]){false, false},
6885 .op_flags
= XTENSA_OP_LOAD
,
6889 .translate
= translate_ldstx
,
6890 .par
= (const uint32_t[]){false, true},
6891 .op_flags
= XTENSA_OP_LOAD
,
6895 .translate
= translate_fpu2k_madd_s
,
6899 .translate
= translate_mov_s
,
6903 .translate
= translate_movcond_s
,
6904 .par
= (const uint32_t[]){TCG_COND_EQ
},
6908 .translate
= translate_movp_s
,
6909 .par
= (const uint32_t[]){TCG_COND_EQ
},
6913 .translate
= translate_movcond_s
,
6914 .par
= (const uint32_t[]){TCG_COND_GE
},
6918 .translate
= translate_movcond_s
,
6919 .par
= (const uint32_t[]){TCG_COND_LT
},
6923 .translate
= translate_movcond_s
,
6924 .par
= (const uint32_t[]){TCG_COND_NE
},
6928 .translate
= translate_movp_s
,
6929 .par
= (const uint32_t[]){TCG_COND_NE
},
6933 .translate
= translate_fpu2k_msub_s
,
6937 .translate
= translate_fpu2k_mul_s
,
6941 .translate
= translate_neg_s
,
6945 .translate
= translate_compare_s
,
6946 .par
= (const uint32_t[]){COMPARE_OEQ
},
6950 .translate
= translate_compare_s
,
6951 .par
= (const uint32_t[]){COMPARE_OLE
},
6955 .translate
= translate_compare_s
,
6956 .par
= (const uint32_t[]){COMPARE_OLT
},
6960 .translate
= translate_rfr_s
,
6964 .translate
= translate_ftoi_s
,
6965 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6969 .translate
= translate_rur
,
6970 .par
= (const uint32_t[]){FCR
},
6974 .translate
= translate_rur
,
6975 .par
= (const uint32_t[]){FSR
},
6979 .translate
= translate_ldsti
,
6980 .par
= (const uint32_t[]){true, false},
6981 .op_flags
= XTENSA_OP_STORE
,
6985 .translate
= translate_ldsti
,
6986 .par
= (const uint32_t[]){true, true},
6987 .op_flags
= XTENSA_OP_STORE
,
6991 .translate
= translate_ldstx
,
6992 .par
= (const uint32_t[]){true, false},
6993 .op_flags
= XTENSA_OP_STORE
,
6997 .translate
= translate_ldstx
,
6998 .par
= (const uint32_t[]){true, true},
6999 .op_flags
= XTENSA_OP_STORE
,
7003 .translate
= translate_fpu2k_sub_s
,
7007 .translate
= translate_ftoi_s
,
7008 .par
= (const uint32_t[]){float_round_to_zero
, false},
7012 .translate
= translate_compare_s
,
7013 .par
= (const uint32_t[]){COMPARE_UEQ
},
7017 .translate
= translate_float_s
,
7018 .par
= (const uint32_t[]){true},
7022 .translate
= translate_compare_s
,
7023 .par
= (const uint32_t[]){COMPARE_ULE
},
7027 .translate
= translate_compare_s
,
7028 .par
= (const uint32_t[]){COMPARE_ULT
},
7032 .translate
= translate_compare_s
,
7033 .par
= (const uint32_t[]){COMPARE_UN
},
7037 .translate
= translate_ftoi_s
,
7038 .par
= (const uint32_t[]){float_round_to_zero
, true},
7042 .translate
= translate_wfr_s
,
7046 .translate
= translate_wur_fpu2k_fcr
,
7047 .par
= (const uint32_t[]){FCR
},
7051 .translate
= translate_wur_fpu2k_fsr
,
7052 .par
= (const uint32_t[]){FSR
},
7057 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
7058 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
7059 .opcode
= fpu2000_ops
,
7062 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
7063 const uint32_t par
[])
7065 gen_helper_add_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7068 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
7069 const uint32_t par
[])
7071 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7072 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
7073 arg
[1].in
, arg
[2].in
);
7077 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7078 gen_helper_add_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7079 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7083 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7084 const uint32_t par
[])
7086 TCGv_i32 v
= tcg_temp_new_i32();
7088 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
7089 gen_helper_cvtd_s(arg
[0].out
, cpu_env
, v
);
7090 tcg_temp_free_i32(v
);
7093 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
7094 const uint32_t par
[])
7096 TCGv_i32 v
= tcg_temp_new_i32();
7098 gen_helper_cvts_d(v
, cpu_env
, arg
[1].in
);
7099 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
7100 tcg_temp_free_i32(v
);
7103 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
7104 const uint32_t par
[])
7109 addr
= tcg_temp_new_i32();
7110 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7114 gen_load_store_alignment(dc
, 3, addr
, false);
7116 tcg_gen_qemu_st64(arg
[0].in
, addr
, dc
->cring
);
7118 tcg_gen_qemu_ld64(arg
[0].out
, addr
, dc
->cring
);
7122 tcg_gen_mov_i32(arg
[1].out
, addr
);
7124 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7128 tcg_temp_free(addr
);
7132 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
7133 const uint32_t par
[])
7139 addr
= tcg_temp_new_i32();
7140 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7144 gen_load_store_alignment(dc
, 2, addr
, false);
7146 get_f32_i1(arg
, arg32
, 0);
7147 tcg_gen_qemu_st32(arg32
[0].in
, addr
, dc
->cring
);
7148 put_f32_i1(arg
, arg32
, 0);
7150 get_f32_o1(arg
, arg32
, 0);
7151 tcg_gen_qemu_ld32u(arg32
[0].out
, addr
, dc
->cring
);
7152 put_f32_o1(arg
, arg32
, 0);
7156 tcg_gen_mov_i32(arg
[1].out
, addr
);
7158 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7162 tcg_temp_free(addr
);
7166 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
7167 const uint32_t par
[])
7172 addr
= tcg_temp_new_i32();
7173 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7177 gen_load_store_alignment(dc
, 3, addr
, false);
7179 tcg_gen_qemu_st64(arg
[0].in
, addr
, dc
->cring
);
7181 tcg_gen_qemu_ld64(arg
[0].out
, addr
, dc
->cring
);
7185 tcg_gen_mov_i32(arg
[1].out
, addr
);
7187 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7191 tcg_temp_free(addr
);
7195 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
7196 const uint32_t par
[])
7202 addr
= tcg_temp_new_i32();
7203 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7207 gen_load_store_alignment(dc
, 2, addr
, false);
7209 get_f32_i1(arg
, arg32
, 0);
7210 tcg_gen_qemu_st32(arg32
[0].in
, addr
, dc
->cring
);
7211 put_f32_i1(arg
, arg32
, 0);
7213 get_f32_o1(arg
, arg32
, 0);
7214 tcg_gen_qemu_ld32u(arg32
[0].out
, addr
, dc
->cring
);
7215 put_f32_o1(arg
, arg32
, 0);
7219 tcg_gen_mov_i32(arg
[1].out
, addr
);
7221 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7225 tcg_temp_free(addr
);
7229 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7230 const uint32_t par
[])
7232 gen_helper_madd_d(arg
[0].out
, cpu_env
,
7233 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7236 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7237 const uint32_t par
[])
7239 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7240 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
7241 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7245 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7246 gen_helper_madd_s(arg32
[0].out
, cpu_env
,
7247 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7248 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7252 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7253 const uint32_t par
[])
7255 gen_helper_mul_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7258 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7259 const uint32_t par
[])
7261 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7262 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
7263 arg
[1].in
, arg
[2].in
);
7267 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7268 gen_helper_mul_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7269 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7273 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7274 const uint32_t par
[])
7276 gen_helper_msub_d(arg
[0].out
, cpu_env
,
7277 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7280 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7281 const uint32_t par
[])
7283 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7284 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
7285 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7289 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7290 gen_helper_msub_s(arg32
[0].out
, cpu_env
,
7291 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7292 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7296 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7297 const uint32_t par
[])
7299 gen_helper_sub_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7302 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7303 const uint32_t par
[])
7305 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7306 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
7307 arg
[1].in
, arg
[2].in
);
7311 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7312 gen_helper_sub_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7313 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7317 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7318 const uint32_t par
[])
7320 gen_helper_mkdadj_d(arg
[0].out
, cpu_env
, arg
[0].in
, arg
[1].in
);
7323 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7324 const uint32_t par
[])
7328 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7329 gen_helper_mkdadj_s(arg32
[0].out
, cpu_env
, arg32
[0].in
, arg32
[1].in
);
7330 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7333 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7334 const uint32_t par
[])
7336 gen_helper_mksadj_d(arg
[0].out
, cpu_env
, arg
[1].in
);
7339 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7340 const uint32_t par
[])
7344 get_f32_o1_i1(arg
, arg32
, 0, 1);
7345 gen_helper_mksadj_s(arg32
[0].out
, cpu_env
, arg32
[1].in
);
7346 put_f32_o1_i1(arg
, arg32
, 0, 1);
7349 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7350 const uint32_t par
[])
7352 gen_helper_wur_fpu_fcr(cpu_env
, arg
[0].in
);
7355 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7356 const uint32_t par
[])
7358 gen_helper_rur_fpu_fsr(arg
[0].out
, cpu_env
);
7361 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7362 const uint32_t par
[])
7364 gen_helper_wur_fpu_fsr(cpu_env
, arg
[0].in
);
7367 static const XtensaOpcodeOps fpu_ops
[] = {
7370 .translate
= translate_abs_d
,
7374 .translate
= translate_abs_s
,
7378 .translate
= translate_add_d
,
7382 .translate
= translate_add_s
,
7386 .translate
= translate_nop
,
7390 .translate
= translate_nop
,
7393 .name
= "addexpm.d",
7394 .translate
= translate_mov_s
,
7397 .name
= "addexpm.s",
7398 .translate
= translate_mov_s
,
7402 .translate
= translate_ftoi_d
,
7403 .par
= (const uint32_t[]){float_round_up
, false},
7407 .translate
= translate_ftoi_s
,
7408 .par
= (const uint32_t[]){float_round_up
, false},
7412 .translate
= translate_const_d
,
7416 .translate
= translate_const_s
,
7420 .translate
= translate_cvtd_s
,
7424 .translate
= translate_cvts_d
,
7428 .translate
= translate_nop
,
7432 .translate
= translate_nop
,
7436 .translate
= translate_nop
,
7440 .translate
= translate_nop
,
7444 .translate
= translate_float_d
,
7445 .par
= (const uint32_t[]){false},
7449 .translate
= translate_float_s
,
7450 .par
= (const uint32_t[]){false},
7454 .translate
= translate_ftoi_d
,
7455 .par
= (const uint32_t[]){float_round_down
, false},
7459 .translate
= translate_ftoi_s
,
7460 .par
= (const uint32_t[]){float_round_down
, false},
7464 .translate
= translate_ldsti_d
,
7465 .par
= (const uint32_t[]){false, true, false},
7466 .op_flags
= XTENSA_OP_LOAD
,
7470 .translate
= translate_ldsti_d
,
7471 .par
= (const uint32_t[]){false, false, true},
7472 .op_flags
= XTENSA_OP_LOAD
,
7476 .translate
= translate_ldsti_d
,
7477 .par
= (const uint32_t[]){false, true, true},
7478 .op_flags
= XTENSA_OP_LOAD
,
7482 .translate
= translate_ldstx_d
,
7483 .par
= (const uint32_t[]){false, true, false},
7484 .op_flags
= XTENSA_OP_LOAD
,
7488 .translate
= translate_ldstx_d
,
7489 .par
= (const uint32_t[]){false, false, true},
7490 .op_flags
= XTENSA_OP_LOAD
,
7494 .translate
= translate_ldstx_d
,
7495 .par
= (const uint32_t[]){false, true, true},
7496 .op_flags
= XTENSA_OP_LOAD
,
7500 .translate
= translate_ldsti_s
,
7501 .par
= (const uint32_t[]){false, true, false},
7502 .op_flags
= XTENSA_OP_LOAD
,
7506 .translate
= translate_ldsti_s
,
7507 .par
= (const uint32_t[]){false, false, true},
7508 .op_flags
= XTENSA_OP_LOAD
,
7512 .translate
= translate_ldsti_s
,
7513 .par
= (const uint32_t[]){false, true, true},
7514 .op_flags
= XTENSA_OP_LOAD
,
7518 .translate
= translate_ldstx_s
,
7519 .par
= (const uint32_t[]){false, true, false},
7520 .op_flags
= XTENSA_OP_LOAD
,
7524 .translate
= translate_ldstx_s
,
7525 .par
= (const uint32_t[]){false, false, true},
7526 .op_flags
= XTENSA_OP_LOAD
,
7530 .translate
= translate_ldstx_s
,
7531 .par
= (const uint32_t[]){false, true, true},
7532 .op_flags
= XTENSA_OP_LOAD
,
7536 .translate
= translate_madd_d
,
7540 .translate
= translate_madd_s
,
7544 .translate
= translate_nop
,
7548 .translate
= translate_nop
,
7552 .translate
= translate_mkdadj_d
,
7556 .translate
= translate_mkdadj_s
,
7560 .translate
= translate_mksadj_d
,
7564 .translate
= translate_mksadj_s
,
7568 .translate
= translate_mov_d
,
7572 .translate
= translate_mov_s
,
7576 .translate
= translate_movcond_d
,
7577 .par
= (const uint32_t[]){TCG_COND_EQ
},
7581 .translate
= translate_movcond_s
,
7582 .par
= (const uint32_t[]){TCG_COND_EQ
},
7586 .translate
= translate_movp_d
,
7587 .par
= (const uint32_t[]){TCG_COND_EQ
},
7591 .translate
= translate_movp_s
,
7592 .par
= (const uint32_t[]){TCG_COND_EQ
},
7596 .translate
= translate_movcond_d
,
7597 .par
= (const uint32_t[]){TCG_COND_GE
},
7601 .translate
= translate_movcond_s
,
7602 .par
= (const uint32_t[]){TCG_COND_GE
},
7606 .translate
= translate_movcond_d
,
7607 .par
= (const uint32_t[]){TCG_COND_LT
},
7611 .translate
= translate_movcond_s
,
7612 .par
= (const uint32_t[]){TCG_COND_LT
},
7616 .translate
= translate_movcond_d
,
7617 .par
= (const uint32_t[]){TCG_COND_NE
},
7621 .translate
= translate_movcond_s
,
7622 .par
= (const uint32_t[]){TCG_COND_NE
},
7626 .translate
= translate_movp_d
,
7627 .par
= (const uint32_t[]){TCG_COND_NE
},
7631 .translate
= translate_movp_s
,
7632 .par
= (const uint32_t[]){TCG_COND_NE
},
7636 .translate
= translate_msub_d
,
7640 .translate
= translate_msub_s
,
7644 .translate
= translate_mul_d
,
7648 .translate
= translate_mul_s
,
7652 .translate
= translate_neg_d
,
7656 .translate
= translate_neg_s
,
7660 .translate
= translate_nop
,
7664 .translate
= translate_nop
,
7668 .translate
= translate_compare_d
,
7669 .par
= (const uint32_t[]){COMPARE_OEQ
},
7673 .translate
= translate_compare_s
,
7674 .par
= (const uint32_t[]){COMPARE_OEQ
},
7678 .translate
= translate_compare_d
,
7679 .par
= (const uint32_t[]){COMPARE_OLE
},
7683 .translate
= translate_compare_s
,
7684 .par
= (const uint32_t[]){COMPARE_OLE
},
7688 .translate
= translate_compare_d
,
7689 .par
= (const uint32_t[]){COMPARE_OLT
},
7693 .translate
= translate_compare_s
,
7694 .par
= (const uint32_t[]){COMPARE_OLT
},
7698 .translate
= translate_rfr_s
,
7702 .translate
= translate_rfr_d
,
7706 .translate
= translate_ftoi_d
,
7707 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7711 .translate
= translate_ftoi_s
,
7712 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7716 .translate
= translate_rur
,
7717 .par
= (const uint32_t[]){FCR
},
7721 .translate
= translate_rur_fpu_fsr
,
7725 .translate
= translate_ldsti_d
,
7726 .par
= (const uint32_t[]){true, true, false},
7727 .op_flags
= XTENSA_OP_STORE
,
7731 .translate
= translate_ldsti_d
,
7732 .par
= (const uint32_t[]){true, false, true},
7733 .op_flags
= XTENSA_OP_STORE
,
7737 .translate
= translate_ldsti_d
,
7738 .par
= (const uint32_t[]){true, true, true},
7739 .op_flags
= XTENSA_OP_STORE
,
7743 .translate
= translate_ldstx_d
,
7744 .par
= (const uint32_t[]){true, true, false},
7745 .op_flags
= XTENSA_OP_STORE
,
7749 .translate
= translate_ldstx_d
,
7750 .par
= (const uint32_t[]){true, false, true},
7751 .op_flags
= XTENSA_OP_STORE
,
7755 .translate
= translate_ldstx_d
,
7756 .par
= (const uint32_t[]){true, true, true},
7757 .op_flags
= XTENSA_OP_STORE
,
7761 .translate
= translate_nop
,
7765 .translate
= translate_nop
,
7769 .translate
= translate_ldsti_s
,
7770 .par
= (const uint32_t[]){true, true, false},
7771 .op_flags
= XTENSA_OP_STORE
,
7775 .translate
= translate_ldsti_s
,
7776 .par
= (const uint32_t[]){true, false, true},
7777 .op_flags
= XTENSA_OP_STORE
,
7781 .translate
= translate_ldsti_s
,
7782 .par
= (const uint32_t[]){true, true, true},
7783 .op_flags
= XTENSA_OP_STORE
,
7787 .translate
= translate_ldstx_s
,
7788 .par
= (const uint32_t[]){true, true, false},
7789 .op_flags
= XTENSA_OP_STORE
,
7793 .translate
= translate_ldstx_s
,
7794 .par
= (const uint32_t[]){true, false, true},
7795 .op_flags
= XTENSA_OP_STORE
,
7799 .translate
= translate_ldstx_s
,
7800 .par
= (const uint32_t[]){true, true, true},
7801 .op_flags
= XTENSA_OP_STORE
,
7805 .translate
= translate_sub_d
,
7809 .translate
= translate_sub_s
,
7813 .translate
= translate_ftoi_d
,
7814 .par
= (const uint32_t[]){float_round_to_zero
, false},
7818 .translate
= translate_ftoi_s
,
7819 .par
= (const uint32_t[]){float_round_to_zero
, false},
7823 .translate
= translate_compare_d
,
7824 .par
= (const uint32_t[]){COMPARE_UEQ
},
7828 .translate
= translate_compare_s
,
7829 .par
= (const uint32_t[]){COMPARE_UEQ
},
7833 .translate
= translate_float_d
,
7834 .par
= (const uint32_t[]){true},
7838 .translate
= translate_float_s
,
7839 .par
= (const uint32_t[]){true},
7843 .translate
= translate_compare_d
,
7844 .par
= (const uint32_t[]){COMPARE_ULE
},
7848 .translate
= translate_compare_s
,
7849 .par
= (const uint32_t[]){COMPARE_ULE
},
7853 .translate
= translate_compare_d
,
7854 .par
= (const uint32_t[]){COMPARE_ULT
},
7858 .translate
= translate_compare_s
,
7859 .par
= (const uint32_t[]){COMPARE_ULT
},
7863 .translate
= translate_compare_d
,
7864 .par
= (const uint32_t[]){COMPARE_UN
},
7868 .translate
= translate_compare_s
,
7869 .par
= (const uint32_t[]){COMPARE_UN
},
7873 .translate
= translate_ftoi_d
,
7874 .par
= (const uint32_t[]){float_round_to_zero
, true},
7878 .translate
= translate_ftoi_s
,
7879 .par
= (const uint32_t[]){float_round_to_zero
, true},
7883 .translate
= translate_wfr_s
,
7887 .translate
= translate_wfr_d
,
7891 .translate
= translate_wur_fpu_fcr
,
7892 .par
= (const uint32_t[]){FCR
},
7896 .translate
= translate_wur_fpu_fsr
,
7901 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7902 .num_opcodes
= ARRAY_SIZE(fpu_ops
),