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 "semihosting/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
50 DisasContextBase base
;
51 const XtensaConfig
*config
;
60 bool sar_m32_allocated
;
74 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
75 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
78 static TCGv_i32 cpu_pc
;
79 static TCGv_i32 cpu_R
[16];
80 static TCGv_i32 cpu_FR
[16];
81 static TCGv_i64 cpu_FRD
[16];
82 static TCGv_i32 cpu_MR
[4];
83 static TCGv_i32 cpu_BR
[16];
84 static TCGv_i32 cpu_BR4
[4];
85 static TCGv_i32 cpu_BR8
[2];
86 static TCGv_i32 cpu_SR
[256];
87 static TCGv_i32 cpu_UR
[256];
88 static TCGv_i32 cpu_windowbase_next
;
89 static TCGv_i32 cpu_exclusive_addr
;
90 static TCGv_i32 cpu_exclusive_val
;
92 static GHashTable
*xtensa_regfile_table
;
94 #include "exec/gen-icount.h"
96 static char *sr_name
[256];
97 static char *ur_name
[256];
99 void xtensa_collect_sr_names(const XtensaConfig
*config
)
101 xtensa_isa isa
= config
->isa
;
102 int n
= xtensa_isa_num_sysregs(isa
);
105 for (i
= 0; i
< n
; ++i
) {
106 int sr
= xtensa_sysreg_number(isa
, i
);
108 if (sr
>= 0 && sr
< 256) {
109 const char *name
= xtensa_sysreg_name(isa
, i
);
111 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
114 if (strstr(*pname
, name
) == NULL
) {
116 malloc(strlen(*pname
) + strlen(name
) + 2);
118 strcpy(new_name
, *pname
);
119 strcat(new_name
, "/");
120 strcat(new_name
, name
);
125 *pname
= strdup(name
);
131 void xtensa_translate_init(void)
133 static const char * const regnames
[] = {
134 "ar0", "ar1", "ar2", "ar3",
135 "ar4", "ar5", "ar6", "ar7",
136 "ar8", "ar9", "ar10", "ar11",
137 "ar12", "ar13", "ar14", "ar15",
139 static const char * const fregnames
[] = {
140 "f0", "f1", "f2", "f3",
141 "f4", "f5", "f6", "f7",
142 "f8", "f9", "f10", "f11",
143 "f12", "f13", "f14", "f15",
145 static const char * const mregnames
[] = {
146 "m0", "m1", "m2", "m3",
148 static const char * const bregnames
[] = {
149 "b0", "b1", "b2", "b3",
150 "b4", "b5", "b6", "b7",
151 "b8", "b9", "b10", "b11",
152 "b12", "b13", "b14", "b15",
156 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
157 offsetof(CPUXtensaState
, pc
), "pc");
159 for (i
= 0; i
< 16; i
++) {
160 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
161 offsetof(CPUXtensaState
, regs
[i
]),
165 for (i
= 0; i
< 16; i
++) {
166 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
167 offsetof(CPUXtensaState
,
168 fregs
[i
].f32
[FP_F32_LOW
]),
172 for (i
= 0; i
< 16; i
++) {
173 cpu_FRD
[i
] = tcg_global_mem_new_i64(cpu_env
,
174 offsetof(CPUXtensaState
,
179 for (i
= 0; i
< 4; i
++) {
180 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
181 offsetof(CPUXtensaState
,
186 for (i
= 0; i
< 16; i
++) {
187 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
188 offsetof(CPUXtensaState
,
192 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
193 offsetof(CPUXtensaState
,
198 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
199 offsetof(CPUXtensaState
,
205 for (i
= 0; i
< 256; ++i
) {
207 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
208 offsetof(CPUXtensaState
,
214 for (i
= 0; i
< 256; ++i
) {
216 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
217 offsetof(CPUXtensaState
,
223 cpu_windowbase_next
=
224 tcg_global_mem_new_i32(cpu_env
,
225 offsetof(CPUXtensaState
, windowbase_next
),
228 tcg_global_mem_new_i32(cpu_env
,
229 offsetof(CPUXtensaState
, exclusive_addr
),
232 tcg_global_mem_new_i32(cpu_env
,
233 offsetof(CPUXtensaState
, exclusive_val
),
237 void **xtensa_get_regfile_by_name(const char *name
, int entries
, int bits
)
242 if (xtensa_regfile_table
== NULL
) {
243 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
245 * AR is special. Xtensa translator uses it as a current register
246 * window, but configuration overlays represent it as a complete
247 * physical register file.
249 g_hash_table_insert(xtensa_regfile_table
,
250 (void *)"AR 16x32", (void *)cpu_R
);
251 g_hash_table_insert(xtensa_regfile_table
,
252 (void *)"AR 32x32", (void *)cpu_R
);
253 g_hash_table_insert(xtensa_regfile_table
,
254 (void *)"AR 64x32", (void *)cpu_R
);
256 g_hash_table_insert(xtensa_regfile_table
,
257 (void *)"MR 4x32", (void *)cpu_MR
);
259 g_hash_table_insert(xtensa_regfile_table
,
260 (void *)"FR 16x32", (void *)cpu_FR
);
261 g_hash_table_insert(xtensa_regfile_table
,
262 (void *)"FR 16x64", (void *)cpu_FRD
);
264 g_hash_table_insert(xtensa_regfile_table
,
265 (void *)"BR 16x1", (void *)cpu_BR
);
266 g_hash_table_insert(xtensa_regfile_table
,
267 (void *)"BR4 4x4", (void *)cpu_BR4
);
268 g_hash_table_insert(xtensa_regfile_table
,
269 (void *)"BR8 2x8", (void *)cpu_BR8
);
272 geometry_name
= g_strdup_printf("%s %dx%d", name
, entries
, bits
);
273 res
= (void **)g_hash_table_lookup(xtensa_regfile_table
, geometry_name
);
274 g_free(geometry_name
);
278 static inline bool option_enabled(DisasContext
*dc
, int opt
)
280 return xtensa_option_enabled(dc
->config
, opt
);
283 static void init_sar_tracker(DisasContext
*dc
)
285 dc
->sar_5bit
= false;
286 dc
->sar_m32_5bit
= false;
287 dc
->sar_m32_allocated
= false;
290 static void reset_sar_tracker(DisasContext
*dc
)
292 if (dc
->sar_m32_allocated
) {
293 tcg_temp_free(dc
->sar_m32
);
297 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
299 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
300 if (dc
->sar_m32_5bit
) {
301 tcg_gen_discard_i32(dc
->sar_m32
);
304 dc
->sar_m32_5bit
= false;
307 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
309 TCGv_i32 tmp
= tcg_const_i32(32);
310 if (!dc
->sar_m32_allocated
) {
311 dc
->sar_m32
= tcg_temp_local_new_i32();
312 dc
->sar_m32_allocated
= true;
314 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
315 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
316 dc
->sar_5bit
= false;
317 dc
->sar_m32_5bit
= true;
321 static void gen_exception(DisasContext
*dc
, int excp
)
323 TCGv_i32 tmp
= tcg_const_i32(excp
);
324 gen_helper_exception(cpu_env
, tmp
);
328 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
330 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
331 TCGv_i32 tcause
= tcg_const_i32(cause
);
332 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
334 tcg_temp_free(tcause
);
335 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
336 cause
== SYSCALL_CAUSE
) {
337 dc
->base
.is_jmp
= DISAS_NORETURN
;
341 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
343 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
344 TCGv_i32 tcause
= tcg_const_i32(cause
);
345 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
347 tcg_temp_free(tcause
);
348 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
349 dc
->base
.is_jmp
= DISAS_NORETURN
;
353 static bool gen_check_privilege(DisasContext
*dc
)
355 #ifndef CONFIG_USER_ONLY
360 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
361 dc
->base
.is_jmp
= DISAS_NORETURN
;
365 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
367 cp_mask
&= ~dc
->cpenable
;
369 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
370 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
371 dc
->base
.is_jmp
= DISAS_NORETURN
;
377 static int gen_postprocess(DisasContext
*dc
, int slot
);
379 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
381 tcg_gen_mov_i32(cpu_pc
, dest
);
383 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
385 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
386 slot
= gen_postprocess(dc
, slot
);
389 tcg_gen_goto_tb(slot
);
390 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
392 tcg_gen_exit_tb(NULL
, 0);
394 dc
->base
.is_jmp
= DISAS_NORETURN
;
397 static void gen_jump(DisasContext
*dc
, TCGv dest
)
399 gen_jump_slot(dc
, dest
, -1);
402 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
404 return translator_use_goto_tb(&dc
->base
, dest
) ? slot
: -1;
407 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
409 TCGv_i32 tmp
= tcg_const_i32(dest
);
410 gen_jump_slot(dc
, tmp
, adjust_jump_slot(dc
, dest
, slot
));
414 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
417 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
419 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
420 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
421 tcg_temp_free(tcallinc
);
422 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
423 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
424 gen_jump_slot(dc
, dest
, slot
);
427 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
429 if (dc
->base
.pc_next
== dc
->lend
) {
430 TCGLabel
*label
= gen_new_label();
432 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
433 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
435 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
437 gen_jump(dc
, cpu_SR
[LBEG
]);
439 gen_set_label(label
);
440 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
446 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
448 if (!gen_check_loop_end(dc
, slot
)) {
449 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
453 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
454 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
456 TCGLabel
*label
= gen_new_label();
458 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
459 gen_jumpi_check_loop_end(dc
, 0);
460 gen_set_label(label
);
461 gen_jumpi(dc
, addr
, 1);
464 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
465 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
467 TCGv_i32 tmp
= tcg_const_i32(t1
);
468 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
472 static uint32_t test_exceptions_sr(DisasContext
*dc
, const OpcodeArg arg
[],
473 const uint32_t par
[])
475 return xtensa_option_enabled(dc
->config
, par
[1]) ? 0 : XTENSA_OP_ILL
;
478 static uint32_t test_exceptions_ccompare(DisasContext
*dc
,
479 const OpcodeArg arg
[],
480 const uint32_t par
[])
482 unsigned n
= par
[0] - CCOMPARE
;
484 if (n
>= dc
->config
->nccompare
) {
485 return XTENSA_OP_ILL
;
487 return test_exceptions_sr(dc
, arg
, par
);
490 static uint32_t test_exceptions_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
491 const uint32_t par
[])
493 unsigned n
= MAX_NDBREAK
;
495 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
496 n
= par
[0] - DBREAKA
;
498 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
499 n
= par
[0] - DBREAKC
;
501 if (n
>= dc
->config
->ndbreak
) {
502 return XTENSA_OP_ILL
;
504 return test_exceptions_sr(dc
, arg
, par
);
507 static uint32_t test_exceptions_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
508 const uint32_t par
[])
510 unsigned n
= par
[0] - IBREAKA
;
512 if (n
>= dc
->config
->nibreak
) {
513 return XTENSA_OP_ILL
;
515 return test_exceptions_sr(dc
, arg
, par
);
518 static uint32_t test_exceptions_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
519 const uint32_t par
[])
521 unsigned n
= MAX_NLEVEL
+ 1;
523 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
524 n
= par
[0] - EXCSAVE1
+ 1;
526 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
527 n
= par
[0] - EPC1
+ 1;
529 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
530 n
= par
[0] - EPS2
+ 2;
532 if (n
> dc
->config
->nlevel
) {
533 return XTENSA_OP_ILL
;
535 return test_exceptions_sr(dc
, arg
, par
);
538 static MemOp
gen_load_store_alignment(DisasContext
*dc
, MemOp mop
,
541 if ((mop
& MO_SIZE
) == MO_8
) {
544 if ((mop
& MO_AMASK
) == MO_UNALN
&&
545 !option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
)) {
548 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
549 tcg_gen_andi_i32(addr
, addr
, ~0 << get_alignment_bits(mop
));
554 #ifndef CONFIG_USER_ONLY
555 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
557 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
558 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
560 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
563 gen_helper_waiti(cpu_env
, pc
, intlevel
);
565 tcg_temp_free(intlevel
);
569 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
571 unsigned r
= 31 - clz32(mask
);
573 if (r
/ 4 > dc
->window
) {
574 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
575 TCGv_i32 w
= tcg_const_i32(r
/ 4);
577 gen_helper_window_check(cpu_env
, pc
, w
);
578 dc
->base
.is_jmp
= DISAS_NORETURN
;
584 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
586 TCGv_i32 m
= tcg_temp_new_i32();
589 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
591 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
596 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
598 TCGLabel
*label
= gen_new_label();
600 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
601 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
602 gen_set_label(label
);
605 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
607 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
610 static int gen_postprocess(DisasContext
*dc
, int slot
)
612 uint32_t op_flags
= dc
->op_flags
;
614 #ifndef CONFIG_USER_ONLY
615 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
616 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
619 gen_helper_check_interrupts(cpu_env
);
622 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
623 gen_helper_sync_windowbase(cpu_env
);
625 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
631 struct opcode_arg_copy
{
637 struct opcode_arg_info
{
643 XtensaOpcodeOps
*ops
;
644 OpcodeArg arg
[MAX_OPCODE_ARGS
];
645 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
646 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
658 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
660 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
661 return (r
<< 24) | (g
<< 16) | n
;
664 static enum resource_type
get_resource_type(uint32_t resource
)
666 return resource
>> 24;
670 * a depends on b if b must be executed before a,
671 * because a's side effects will destroy b's inputs.
673 static bool op_depends_on(const struct slot_prop
*a
,
674 const struct slot_prop
*b
)
679 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
682 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
683 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
686 while (i
< a
->n_out
&& j
< b
->n_in
) {
687 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
689 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
699 * Try to break a dependency on b, append temporary register copy records
700 * to the end of copy and update n_copy in case of success.
701 * This is not always possible: e.g. control flow must always be the last,
702 * load/store must be first and state dependencies are not supported yet.
704 static bool break_dependency(struct slot_prop
*a
,
706 struct opcode_arg_copy
*copy
,
711 unsigned n
= *n_copy
;
714 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
717 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
718 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
721 while (i
< a
->n_out
&& j
< b
->n_in
) {
722 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
724 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
727 int index
= b
->in
[j
].index
;
729 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
733 copy
[n
].resource
= b
->in
[j
].resource
;
734 copy
[n
].arg
= b
->arg
+ index
;
745 * Calculate evaluation order for slot opcodes.
746 * Build opcode order graph and output its nodes in topological sort order.
747 * An edge a -> b in the graph means that opcode a must be followed by
750 static bool tsort(struct slot_prop
*slot
,
751 struct slot_prop
*sorted
[],
753 struct opcode_arg_copy
*copy
,
759 unsigned out_edge
[MAX_INSN_SLOTS
];
760 } node
[MAX_INSN_SLOTS
];
762 unsigned in
[MAX_INSN_SLOTS
];
768 unsigned node_idx
= 0;
770 for (i
= 0; i
< n
; ++i
) {
771 node
[i
].n_in_edge
= 0;
772 node
[i
].n_out_edge
= 0;
775 for (i
= 0; i
< n
; ++i
) {
776 unsigned n_out_edge
= 0;
778 for (j
= 0; j
< n
; ++j
) {
779 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
780 node
[i
].out_edge
[n_out_edge
] = j
;
786 node
[i
].n_out_edge
= n_out_edge
;
789 for (i
= 0; i
< n
; ++i
) {
790 if (!node
[i
].n_in_edge
) {
797 for (; in_idx
< n_in
; ++in_idx
) {
799 sorted
[n_out
] = slot
+ i
;
801 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
803 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
804 in
[n_in
] = node
[i
].out_edge
[j
];
810 for (; node_idx
< n
; ++node_idx
) {
811 struct tsnode
*cnode
= node
+ node_idx
;
813 if (cnode
->n_in_edge
) {
814 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
815 unsigned k
= cnode
->out_edge
[j
];
817 if (break_dependency(slot
+ k
, slot
+ node_idx
,
819 --node
[k
].n_in_edge
== 0) {
824 cnode
->out_edge
[cnode
->n_out_edge
- 1];
835 static void opcode_add_resource(struct slot_prop
*op
,
836 uint32_t resource
, char direction
,
842 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
843 op
->in
[op
->n_in
].resource
= resource
;
844 op
->in
[op
->n_in
].index
= index
;
848 if (direction
== 'm' || direction
== 'o') {
849 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
850 op
->out
[op
->n_out
].resource
= resource
;
851 op
->out
[op
->n_out
].index
= index
;
856 g_assert_not_reached();
860 static int resource_compare(const void *a
, const void *b
)
862 const struct opcode_arg_info
*pa
= a
;
863 const struct opcode_arg_info
*pb
= b
;
865 return pa
->resource
< pb
->resource
?
866 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
869 static int arg_copy_compare(const void *a
, const void *b
)
871 const struct opcode_arg_copy
*pa
= a
;
872 const struct opcode_arg_copy
*pb
= b
;
874 return pa
->resource
< pb
->resource
?
875 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
878 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
880 xtensa_isa isa
= dc
->config
->isa
;
881 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, &dc
->base
,
883 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
887 uint32_t op_flags
= 0;
888 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
889 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
890 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
891 unsigned n_arg_copy
= 0;
892 uint32_t debug_cause
= 0;
893 uint32_t windowed_register
= 0;
894 uint32_t coprocessor
= 0;
896 if (len
== XTENSA_UNDEFINED
) {
897 qemu_log_mask(LOG_GUEST_ERROR
,
898 "unknown instruction length (pc = %08x)\n",
900 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
901 dc
->base
.pc_next
= dc
->pc
+ 1;
905 dc
->base
.pc_next
= dc
->pc
+ len
;
906 for (i
= 1; i
< len
; ++i
) {
907 b
[i
] = translator_ldub(env
, &dc
->base
, dc
->pc
+ i
);
909 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
910 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
911 if (fmt
== XTENSA_UNDEFINED
) {
912 qemu_log_mask(LOG_GUEST_ERROR
,
913 "unrecognized instruction format (pc = %08x)\n",
915 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
918 slots
= xtensa_format_num_slots(isa
, fmt
);
919 for (slot
= 0; slot
< slots
; ++slot
) {
921 int opnd
, vopnd
, opnds
;
922 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
923 XtensaOpcodeOps
*ops
;
925 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
926 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
927 if (opc
== XTENSA_UNDEFINED
) {
928 qemu_log_mask(LOG_GUEST_ERROR
,
929 "unrecognized opcode in slot %d (pc = %08x)\n",
931 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
934 opnds
= xtensa_opcode_num_operands(isa
, opc
);
936 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
937 void **register_file
= NULL
;
940 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
941 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
942 register_file
= dc
->config
->regfile
[rf
];
944 if (rf
== dc
->config
->a_regfile
) {
947 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
949 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
950 windowed_register
|= 1u << v
;
953 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
956 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
958 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
959 arg
[vopnd
].raw_imm
= v
;
960 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
961 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
965 arg
[vopnd
].in
= register_file
[v
];
966 arg
[vopnd
].out
= register_file
[v
];
967 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
969 arg
[vopnd
].num_bits
= 32;
974 ops
= dc
->config
->opcode_ops
[opc
];
975 slot_prop
[slot
].ops
= ops
;
978 op_flags
|= ops
->op_flags
;
979 if (ops
->test_exceptions
) {
980 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
983 qemu_log_mask(LOG_UNIMP
,
984 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
985 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
986 op_flags
|= XTENSA_OP_ILL
;
988 if (op_flags
& XTENSA_OP_ILL
) {
989 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
992 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
993 debug_cause
|= ops
->par
[0];
995 if (ops
->test_overflow
) {
996 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
998 coprocessor
|= ops
->coprocessor
;
1001 slot_prop
[slot
].n_in
= 0;
1002 slot_prop
[slot
].n_out
= 0;
1003 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
1005 opnds
= xtensa_opcode_num_operands(isa
, opc
);
1007 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
1008 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
1010 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
1011 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
1014 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
1016 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
1017 opcode_add_resource(slot_prop
+ slot
,
1018 encode_resource(RES_REGFILE
, rf
, v
),
1019 xtensa_operand_inout(isa
, opc
, opnd
),
1020 visible
? vopnd
: -1);
1027 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
1029 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
1030 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
1032 opcode_add_resource(slot_prop
+ slot
,
1033 encode_resource(RES_STATE
, 0, state
),
1034 xtensa_stateOperand_inout(isa
, opc
, opnd
),
1037 if (xtensa_opcode_is_branch(isa
, opc
) ||
1038 xtensa_opcode_is_jump(isa
, opc
) ||
1039 xtensa_opcode_is_loop(isa
, opc
) ||
1040 xtensa_opcode_is_call(isa
, opc
)) {
1041 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1044 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1045 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1046 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1047 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1052 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1053 qemu_log_mask(LOG_UNIMP
,
1054 "Circular resource dependencies (pc = %08x)\n",
1056 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1060 ordered
[0] = slot_prop
+ 0;
1063 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1064 !gen_check_privilege(dc
)) {
1068 if (op_flags
& XTENSA_OP_SYSCALL
) {
1069 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1073 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1074 gen_debug_exception(dc
, debug_cause
);
1078 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1082 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1083 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1085 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1089 if (op_flags
& XTENSA_OP_ALLOCA
) {
1090 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1092 gen_helper_movsp(cpu_env
, tmp
);
1096 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1105 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1106 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1107 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1108 resource
= arg_copy
[i
].resource
;
1109 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1110 temp
= tcg_temp_local_new_i32();
1111 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1112 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1113 temp
= tcg_temp_local_new_i64();
1114 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1116 g_assert_not_reached();
1118 arg_copy
[i
].temp
= temp
;
1121 arg_copy
[j
] = arg_copy
[i
];
1125 arg_copy
[i
].arg
->in
= temp
;
1130 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1131 for (slot
= 0; slot
< slots
; ++slot
) {
1132 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1133 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1138 dc
->op_flags
= op_flags
;
1140 for (slot
= 0; slot
< slots
; ++slot
) {
1141 struct slot_prop
*pslot
= ordered
[slot
];
1142 XtensaOpcodeOps
*ops
= pslot
->ops
;
1144 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1147 for (i
= 0; i
< n_arg_copy
; ++i
) {
1148 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1149 tcg_temp_free_i32(arg_copy
[i
].temp
);
1150 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1151 tcg_temp_free_i64(arg_copy
[i
].temp
);
1153 g_assert_not_reached();
1157 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1158 gen_postprocess(dc
, 0);
1160 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1161 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1162 gen_jumpi_check_loop_end(dc
, -1);
1163 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1164 gen_jumpi_check_loop_end(dc
, 0);
1166 gen_check_loop_end(dc
, 0);
1169 dc
->pc
= dc
->base
.pc_next
;
1172 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1174 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1175 return xtensa_op0_insn_len(dc
, b0
);
1178 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1182 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1183 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1184 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1185 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1191 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1194 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1195 CPUXtensaState
*env
= cpu
->env_ptr
;
1196 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1198 dc
->config
= env
->config
;
1199 dc
->pc
= dc
->base
.pc_first
;
1200 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1201 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1202 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1203 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1204 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1205 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1206 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1207 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1208 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1209 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1210 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1211 XTENSA_TBFLAG_WINDOW_SHIFT
);
1212 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1213 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1214 XTENSA_TBFLAG_CALLINC_SHIFT
);
1215 init_sar_tracker(dc
);
1218 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1220 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1223 dc
->next_icount
= tcg_temp_local_new_i32();
1227 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1229 tcg_gen_insn_start(dcbase
->pc_next
);
1232 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1234 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1235 CPUXtensaState
*env
= cpu
->env_ptr
;
1236 target_ulong page_start
;
1238 /* These two conditions only apply to the first insn in the TB,
1239 but this is the first TranslateOps hook that allows exiting. */
1240 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1241 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1242 gen_exception(dc
, EXCP_YIELD
);
1243 dc
->base
.pc_next
= dc
->pc
+ 1;
1244 dc
->base
.is_jmp
= DISAS_NORETURN
;
1249 TCGLabel
*label
= gen_new_label();
1251 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1252 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1253 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1255 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1257 gen_set_label(label
);
1261 gen_ibreak_check(env
, dc
);
1264 disas_xtensa_insn(env
, dc
);
1267 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1270 /* End the TB if the next insn will cross into the next page. */
1271 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1272 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1273 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1274 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1275 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1279 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1281 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1283 reset_sar_tracker(dc
);
1285 tcg_temp_free(dc
->next_icount
);
1288 switch (dc
->base
.is_jmp
) {
1289 case DISAS_NORETURN
:
1291 case DISAS_TOO_MANY
:
1292 gen_jumpi(dc
, dc
->pc
, 0);
1295 g_assert_not_reached();
1299 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1301 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1302 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1305 static const TranslatorOps xtensa_translator_ops
= {
1306 .init_disas_context
= xtensa_tr_init_disas_context
,
1307 .tb_start
= xtensa_tr_tb_start
,
1308 .insn_start
= xtensa_tr_insn_start
,
1309 .translate_insn
= xtensa_tr_translate_insn
,
1310 .tb_stop
= xtensa_tr_tb_stop
,
1311 .disas_log
= xtensa_tr_disas_log
,
1314 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1316 DisasContext dc
= {};
1317 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1320 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1322 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1323 CPUXtensaState
*env
= &cpu
->env
;
1324 xtensa_isa isa
= env
->config
->isa
;
1327 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1329 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1330 const uint32_t *reg
=
1331 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1332 int regno
= xtensa_sysreg_number(isa
, i
);
1335 qemu_fprintf(f
, "%12s=%08x%c",
1336 xtensa_sysreg_name(isa
, i
),
1338 (j
++ % 4) == 3 ? '\n' : ' ');
1342 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1344 for (i
= 0; i
< 16; ++i
) {
1345 qemu_fprintf(f
, " A%02d=%08x%c",
1346 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1349 xtensa_sync_phys_from_window(env
);
1350 qemu_fprintf(f
, "\n");
1352 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1353 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1355 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1356 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1358 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1362 if ((flags
& CPU_DUMP_FPU
) &&
1363 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1364 qemu_fprintf(f
, "\n");
1366 for (i
= 0; i
< 16; ++i
) {
1367 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1368 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1369 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1370 (i
% 2) == 1 ? '\n' : ' ');
1374 if ((flags
& CPU_DUMP_FPU
) &&
1375 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1376 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1377 qemu_fprintf(f
, "\n");
1379 for (i
= 0; i
< 16; ++i
) {
1380 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1381 float64_val(env
->fregs
[i
].f64
),
1382 *(double *)(&env
->fregs
[i
].f64
),
1383 (i
% 2) == 1 ? '\n' : ' ');
1388 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1394 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1395 const uint32_t par
[])
1397 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1400 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1401 const uint32_t par
[])
1403 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1406 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1407 const uint32_t par
[])
1409 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1412 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1413 const uint32_t par
[])
1415 TCGv_i32 tmp
= tcg_temp_new_i32();
1416 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1417 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1421 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1422 const uint32_t par
[])
1424 uint32_t shift
= par
[1];
1425 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1426 TCGv_i32 tmp
= tcg_temp_new_i32();
1428 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1430 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1432 tcg_gen_add_i32(tmp
, tmp
, mask
);
1434 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1435 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1436 tmp
, arg
[0].imm
, 1);
1437 tcg_temp_free(mask
);
1441 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1442 const uint32_t par
[])
1444 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1447 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1448 const uint32_t par
[])
1450 TCGv_i32 tmp
= tcg_temp_new_i32();
1451 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1452 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1456 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1457 const uint32_t par
[])
1459 TCGv_i32 tmp
= tcg_temp_new_i32();
1460 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1461 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1465 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1466 const uint32_t par
[])
1468 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1471 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1472 const uint32_t par
[])
1474 #ifdef TARGET_WORDS_BIGENDIAN
1475 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1477 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1479 TCGv_i32 tmp
= tcg_temp_new_i32();
1480 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1481 #ifdef TARGET_WORDS_BIGENDIAN
1482 tcg_gen_shr_i32(bit
, bit
, tmp
);
1484 tcg_gen_shl_i32(bit
, bit
, tmp
);
1486 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1487 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1492 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1493 const uint32_t par
[])
1495 TCGv_i32 tmp
= tcg_temp_new_i32();
1496 #ifdef TARGET_WORDS_BIGENDIAN
1497 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1499 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1501 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1505 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1506 const uint32_t par
[])
1508 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1511 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1512 const uint32_t par
[])
1514 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1525 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1526 const uint32_t par
[])
1528 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1529 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1530 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1531 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1532 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1533 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1536 TCGv_i32 tmp1
= tcg_temp_new_i32();
1537 TCGv_i32 tmp2
= tcg_temp_new_i32();
1539 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1540 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1541 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1542 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1543 tcg_temp_free(tmp1
);
1544 tcg_temp_free(tmp2
);
1547 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1548 const uint32_t par
[])
1550 TCGv_i32 tmp
= tcg_temp_new_i32();
1552 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1553 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1557 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1558 const uint32_t par
[])
1560 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1561 gen_jumpi(dc
, arg
[0].imm
, 0);
1564 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1565 const uint32_t par
[])
1567 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1568 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1572 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1573 const uint32_t par
[])
1575 TCGv_i32 tmp
= tcg_temp_new_i32();
1576 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1577 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1582 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1583 const uint32_t par
[])
1585 TCGv_i32 tmp
= tcg_temp_new_i32();
1587 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1588 gen_callw_slot(dc
, par
[0], tmp
, -1);
1592 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1593 const uint32_t par
[])
1595 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1596 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1598 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1599 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1600 tcg_temp_free(tmp1
);
1601 tcg_temp_free(tmp2
);
1604 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1605 const uint32_t par
[])
1607 /* TODO: GPIO32 may be a part of coprocessor */
1608 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1611 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1612 const uint32_t par
[])
1614 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1617 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1618 const uint32_t par
[])
1620 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1622 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1626 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1627 const uint32_t par
[])
1629 TCGv_i32 addr
= tcg_temp_new_i32();
1630 TCGv_i32 res
= tcg_temp_new_i32();
1632 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1633 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1634 tcg_temp_free(addr
);
1638 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1639 const uint32_t par
[])
1641 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1642 arg
[2].imm
, arg
[3].imm
);
1645 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1646 const uint32_t par
[])
1648 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1651 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1652 const uint32_t par
[])
1654 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1655 qemu_log_mask(LOG_GUEST_ERROR
,
1656 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1657 return XTENSA_OP_ILL
;
1663 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1664 const uint32_t par
[])
1666 return 1 << (dc
->callinc
* 4);
1669 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1670 const uint32_t par
[])
1672 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1673 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1674 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1675 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1681 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1682 const uint32_t par
[])
1684 int maskimm
= (1 << arg
[3].imm
) - 1;
1686 TCGv_i32 tmp
= tcg_temp_new_i32();
1687 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1688 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1692 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1693 const uint32_t par
[])
1695 TCGv_i32 tmp
= tcg_temp_new_i32();
1697 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1698 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1699 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1703 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1704 const uint32_t par
[])
1706 #ifndef CONFIG_USER_ONLY
1707 TCGv_i32 addr
= tcg_temp_new_i32();
1709 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1710 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1711 gen_helper_itlb_hit_test(cpu_env
, addr
);
1712 tcg_temp_free(addr
);
1716 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1717 const uint32_t par
[])
1719 #ifndef CONFIG_USER_ONLY
1720 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1722 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1723 tcg_temp_free(dtlb
);
1727 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1728 const uint32_t par
[])
1730 gen_jumpi(dc
, arg
[0].imm
, 0);
1733 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1734 const uint32_t par
[])
1736 gen_jump(dc
, arg
[0].in
);
1739 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1740 const uint32_t par
[])
1742 TCGv_i32 addr
= tcg_temp_new_i32();
1745 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1746 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
1747 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, mop
);
1748 tcg_temp_free(addr
);
1751 #ifdef CONFIG_USER_ONLY
1752 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1756 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1758 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1759 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1760 TCGv_i32 write
= tcg_const_i32(is_write
);
1762 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1764 tcg_temp_free(write
);
1769 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1770 const uint32_t par
[])
1772 TCGv_i32 addr
= tcg_temp_new_i32();
1775 tcg_gen_mov_i32(addr
, arg
[1].in
);
1776 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
1777 gen_check_exclusive(dc
, addr
, false);
1778 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->cring
, mop
);
1779 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1780 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1781 tcg_temp_free(addr
);
1784 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1785 const uint32_t par
[])
1787 TCGv_i32 addr
= tcg_temp_new_i32();
1790 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1791 mop
= gen_load_store_alignment(dc
, par
[0], addr
);
1795 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1797 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
1799 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
1801 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1804 tcg_temp_free(addr
);
1807 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1808 const uint32_t par
[])
1812 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1813 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1814 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1816 tmp
= tcg_const_i32(arg
[1].imm
);
1818 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1822 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1823 const uint32_t par
[])
1825 uint32_t lend
= arg
[1].imm
;
1827 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1828 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1829 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1831 if (par
[0] != TCG_COND_NEVER
) {
1832 TCGLabel
*label
= gen_new_label();
1833 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1834 gen_jumpi(dc
, lend
, 1);
1835 gen_set_label(label
);
1838 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1859 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1860 const uint32_t par
[])
1863 unsigned half
= par
[1];
1864 uint32_t ld_offset
= par
[2];
1865 unsigned off
= ld_offset
? 2 : 0;
1866 TCGv_i32 vaddr
= tcg_temp_new_i32();
1867 TCGv_i32 mem32
= tcg_temp_new_i32();
1872 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1873 mop
= gen_load_store_alignment(dc
, MO_TEUL
, vaddr
);
1874 tcg_gen_qemu_ld_tl(mem32
, vaddr
, dc
->cring
, mop
);
1876 if (op
!= MAC16_NONE
) {
1877 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1878 half
& MAC16_HX
, op
== MAC16_UMUL
);
1879 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1880 half
& MAC16_XH
, op
== MAC16_UMUL
);
1882 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1883 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1884 if (op
== MAC16_UMUL
) {
1885 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1887 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1890 TCGv_i32 lo
= tcg_temp_new_i32();
1891 TCGv_i32 hi
= tcg_temp_new_i32();
1893 tcg_gen_mul_i32(lo
, m1
, m2
);
1894 tcg_gen_sari_i32(hi
, lo
, 31);
1895 if (op
== MAC16_MULA
) {
1896 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1897 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1900 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1901 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1904 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1906 tcg_temp_free_i32(lo
);
1907 tcg_temp_free_i32(hi
);
1913 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1914 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1916 tcg_temp_free(vaddr
);
1917 tcg_temp_free(mem32
);
1920 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1921 const uint32_t par
[])
1923 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1926 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1927 const uint32_t par
[])
1929 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1932 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1933 const uint32_t par
[])
1935 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1938 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1939 const uint32_t par
[])
1941 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1944 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1945 const uint32_t par
[])
1947 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1950 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1951 const uint32_t par
[])
1953 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1956 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1957 const uint32_t par
[])
1959 TCGv_i32 zero
= tcg_const_i32(0);
1961 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1962 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1963 tcg_temp_free(zero
);
1966 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1967 const uint32_t par
[])
1969 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1972 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1973 const uint32_t par
[])
1975 TCGv_i32 zero
= tcg_const_i32(0);
1976 TCGv_i32 tmp
= tcg_temp_new_i32();
1978 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1979 tcg_gen_movcond_i32(par
[0],
1980 arg
[0].out
, tmp
, zero
,
1981 arg
[1].in
, arg
[0].in
);
1983 tcg_temp_free(zero
);
1986 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1987 const uint32_t par
[])
1989 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1992 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1993 const uint32_t par
[])
1995 TCGv_i32 v1
= tcg_temp_new_i32();
1996 TCGv_i32 v2
= tcg_temp_new_i32();
1999 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
2000 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
2002 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
2003 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
2005 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
2010 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
2011 const uint32_t par
[])
2013 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2016 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
2017 const uint32_t par
[])
2019 TCGv_i32 lo
= tcg_temp_new();
2022 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2024 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2029 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
2030 const uint32_t par
[])
2032 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2035 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2036 const uint32_t par
[])
2040 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2041 const uint32_t par
[])
2043 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2046 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2047 const uint32_t par
[])
2049 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2052 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2053 const uint32_t par
[])
2055 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2058 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2059 const uint32_t par
[])
2061 #ifndef CONFIG_USER_ONLY
2062 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2064 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2065 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2066 tcg_temp_free(dtlb
);
2070 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2071 const uint32_t par
[])
2073 #ifndef CONFIG_USER_ONLY
2074 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2075 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2079 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2080 const uint32_t par
[])
2082 TCGLabel
*label1
= gen_new_label();
2083 TCGLabel
*label2
= gen_new_label();
2085 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2087 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2089 tcg_gen_movi_i32(arg
[0].out
,
2090 par
[0] ? 0x80000000 : 0);
2092 gen_set_label(label1
);
2094 tcg_gen_div_i32(arg
[0].out
,
2095 arg
[1].in
, arg
[2].in
);
2097 tcg_gen_rem_i32(arg
[0].out
,
2098 arg
[1].in
, arg
[2].in
);
2100 gen_set_label(label2
);
2103 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2104 const uint32_t par
[])
2106 tcg_gen_divu_i32(arg
[0].out
,
2107 arg
[1].in
, arg
[2].in
);
2110 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2111 const uint32_t par
[])
2113 /* TODO: GPIO32 may be a part of coprocessor */
2114 tcg_gen_movi_i32(arg
[0].out
, 0);
2117 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2118 const uint32_t par
[])
2120 tcg_gen_remu_i32(arg
[0].out
,
2121 arg
[1].in
, arg
[2].in
);
2124 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2125 const uint32_t par
[])
2127 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2130 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2131 const uint32_t par
[])
2133 gen_jump(dc
, cpu_R
[0]);
2136 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2137 const uint32_t par
[])
2140 qemu_log_mask(LOG_GUEST_ERROR
,
2141 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2142 return XTENSA_OP_ILL
;
2144 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2146 gen_helper_test_ill_retw(cpu_env
, tmp
);
2152 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2153 const uint32_t par
[])
2155 TCGv_i32 tmp
= tcg_const_i32(1);
2156 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2157 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2158 cpu_SR
[WINDOW_START
], tmp
);
2159 tcg_gen_movi_i32(tmp
, dc
->pc
);
2160 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2161 gen_helper_retw(cpu_env
, cpu_R
[0]);
2166 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2167 const uint32_t par
[])
2169 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2172 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2173 const uint32_t par
[])
2175 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2176 gen_jump(dc
, cpu_SR
[EPC1
]);
2179 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2180 const uint32_t par
[])
2182 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2183 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2186 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2187 const uint32_t par
[])
2189 TCGv_i32 tmp
= tcg_const_i32(1);
2191 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2192 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2195 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2196 cpu_SR
[WINDOW_START
], tmp
);
2198 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2199 cpu_SR
[WINDOW_START
], tmp
);
2203 gen_helper_restore_owb(cpu_env
);
2204 gen_jump(dc
, cpu_SR
[EPC1
]);
2207 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2208 const uint32_t par
[])
2210 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2213 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2214 const uint32_t par
[])
2216 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2217 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2218 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2221 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2222 const uint32_t par
[])
2224 if (sr_name
[par
[0]]) {
2225 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2227 tcg_gen_movi_i32(arg
[0].out
, 0);
2231 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2232 const uint32_t par
[])
2234 #ifndef CONFIG_USER_ONLY
2235 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2238 gen_helper_update_ccount(cpu_env
);
2239 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2243 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2244 const uint32_t par
[])
2246 #ifndef CONFIG_USER_ONLY
2247 TCGv_i32 tmp
= tcg_temp_new_i32();
2249 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2250 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2251 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2256 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2257 const uint32_t par
[])
2259 #ifndef CONFIG_USER_ONLY
2260 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2265 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2267 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2268 tcg_temp_free(dtlb
);
2272 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2273 const uint32_t par
[])
2275 #ifndef CONFIG_USER_ONLY
2276 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2280 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2281 const uint32_t par
[])
2283 #ifndef CONFIG_USER_ONLY
2284 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2288 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2289 const uint32_t par
[])
2291 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2294 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2295 const uint32_t par
[])
2297 /* TODO: GPIO32 may be a part of coprocessor */
2298 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2301 #ifdef CONFIG_USER_ONLY
2302 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2306 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2308 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2310 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2315 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2316 const uint32_t par
[])
2318 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2319 TCGv_i32 addr
= tcg_temp_local_new_i32();
2322 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2323 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2324 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2325 gen_check_atomctl(dc
, addr
);
2326 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2327 tmp
, dc
->cring
, mop
);
2328 tcg_temp_free(addr
);
2332 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2333 const uint32_t par
[])
2335 TCGv_i32 addr
= tcg_temp_new_i32();
2338 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2339 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
2340 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, mop
);
2341 tcg_temp_free(addr
);
2344 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2345 const uint32_t par
[])
2347 TCGv_i32 prev
= tcg_temp_new_i32();
2348 TCGv_i32 addr
= tcg_temp_local_new_i32();
2349 TCGv_i32 res
= tcg_temp_local_new_i32();
2350 TCGLabel
*label
= gen_new_label();
2353 tcg_gen_movi_i32(res
, 0);
2354 tcg_gen_mov_i32(addr
, arg
[1].in
);
2355 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2356 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2357 gen_check_exclusive(dc
, addr
, true);
2358 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2359 arg
[0].in
, dc
->cring
, mop
);
2360 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2361 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2362 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2363 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2364 gen_set_label(label
);
2365 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2366 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2367 tcg_temp_free(prev
);
2368 tcg_temp_free(addr
);
2372 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2373 const uint32_t par
[])
2375 tcg_gen_setcond_i32(par
[0],
2377 arg
[1].in
, arg
[2].in
);
2380 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2381 const uint32_t par
[])
2383 int shift
= 31 - arg
[2].imm
;
2386 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2387 } else if (shift
== 16) {
2388 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2390 TCGv_i32 tmp
= tcg_temp_new_i32();
2391 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2392 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2397 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2398 const OpcodeArg arg
[],
2399 const uint32_t par
[])
2401 #ifdef CONFIG_USER_ONLY
2404 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2405 bool ill
= dc
->config
->hw_version
<= 250002 && !semihosting_enabled();
2407 if (ill
|| !semihosting_enabled()) {
2408 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2410 return ill
? XTENSA_OP_ILL
: 0;
2413 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2414 const uint32_t par
[])
2416 #ifndef CONFIG_USER_ONLY
2417 if (semihosting_enabled()) {
2418 gen_helper_simcall(cpu_env
);
2424 * Note: 64 bit ops are used here solely because SAR values
2427 #define gen_shift_reg(cmd, reg) do { \
2428 TCGv_i64 tmp = tcg_temp_new_i64(); \
2429 tcg_gen_extu_i32_i64(tmp, reg); \
2430 tcg_gen_##cmd##_i64(v, v, tmp); \
2431 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2432 tcg_temp_free_i64(v); \
2433 tcg_temp_free_i64(tmp); \
2436 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2438 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2439 const uint32_t par
[])
2441 if (dc
->sar_m32_5bit
) {
2442 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2444 TCGv_i64 v
= tcg_temp_new_i64();
2445 TCGv_i32 s
= tcg_const_i32(32);
2446 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2447 tcg_gen_andi_i32(s
, s
, 0x3f);
2448 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2449 gen_shift_reg(shl
, s
);
2454 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2455 const uint32_t par
[])
2457 if (arg
[2].imm
== 32) {
2458 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2459 arg
[0].imm
, arg
[1].imm
);
2461 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2464 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2465 const uint32_t par
[])
2467 if (dc
->sar_m32_5bit
) {
2468 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2470 TCGv_i64 v
= tcg_temp_new_i64();
2471 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2476 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2477 const uint32_t par
[])
2479 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2482 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2483 const uint32_t par
[])
2485 TCGv_i64 v
= tcg_temp_new_i64();
2486 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2490 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2491 const uint32_t par
[])
2493 if (dc
->sar_m32_5bit
) {
2494 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2496 TCGv_i64 v
= tcg_temp_new_i64();
2497 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2503 #undef gen_shift_reg
2505 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2506 const uint32_t par
[])
2508 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2511 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2512 const uint32_t par
[])
2514 TCGv_i32 tmp
= tcg_temp_new_i32();
2515 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2516 gen_left_shift_sar(dc
, tmp
);
2520 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2521 const uint32_t par
[])
2523 TCGv_i32 tmp
= tcg_temp_new_i32();
2524 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2525 gen_right_shift_sar(dc
, tmp
);
2529 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2530 const uint32_t par
[])
2532 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2533 gen_right_shift_sar(dc
, tmp
);
2537 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2538 const uint32_t par
[])
2540 gen_left_shift_sar(dc
, arg
[0].in
);
2543 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2544 const uint32_t par
[])
2546 gen_right_shift_sar(dc
, arg
[0].in
);
2549 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2550 const uint32_t par
[])
2552 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2555 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2556 const uint32_t par
[])
2558 TCGv_i32 tmp
= tcg_temp_new_i32();
2559 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2560 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2564 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2565 const uint32_t par
[])
2567 #ifndef CONFIG_USER_ONLY
2568 gen_waiti(dc
, arg
[0].imm
);
2572 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2573 const uint32_t par
[])
2575 #ifndef CONFIG_USER_ONLY
2576 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2578 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2579 tcg_temp_free(dtlb
);
2583 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2584 const uint32_t par
[])
2586 #ifndef CONFIG_USER_ONLY
2587 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2591 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2592 const uint32_t par
[])
2594 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2597 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2598 const uint32_t par
[])
2600 /* TODO: GPIO32 may be a part of coprocessor */
2601 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2604 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2605 const uint32_t par
[])
2607 if (sr_name
[par
[0]]) {
2608 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2612 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2613 const uint32_t par
[])
2615 if (sr_name
[par
[0]]) {
2616 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2620 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2621 const uint32_t par
[])
2623 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2626 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2627 const uint32_t par
[])
2629 #ifndef CONFIG_USER_ONLY
2630 uint32_t id
= par
[0] - CCOMPARE
;
2631 TCGv_i32 tmp
= tcg_const_i32(id
);
2633 assert(id
< dc
->config
->nccompare
);
2634 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2637 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2638 gen_helper_update_ccompare(cpu_env
, tmp
);
2643 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2644 const uint32_t par
[])
2646 #ifndef CONFIG_USER_ONLY
2647 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2650 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2654 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2655 const uint32_t par
[])
2657 #ifndef CONFIG_USER_ONLY
2658 unsigned id
= par
[0] - DBREAKA
;
2659 TCGv_i32 tmp
= tcg_const_i32(id
);
2661 assert(id
< dc
->config
->ndbreak
);
2662 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2667 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2668 const uint32_t par
[])
2670 #ifndef CONFIG_USER_ONLY
2671 unsigned id
= par
[0] - DBREAKC
;
2672 TCGv_i32 tmp
= tcg_const_i32(id
);
2674 assert(id
< dc
->config
->ndbreak
);
2675 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2680 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2681 const uint32_t par
[])
2683 #ifndef CONFIG_USER_ONLY
2684 unsigned id
= par
[0] - IBREAKA
;
2685 TCGv_i32 tmp
= tcg_const_i32(id
);
2687 assert(id
< dc
->config
->nibreak
);
2688 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2693 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2694 const uint32_t par
[])
2696 #ifndef CONFIG_USER_ONLY
2697 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2701 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2702 const uint32_t par
[])
2704 #ifndef CONFIG_USER_ONLY
2706 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2708 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2713 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2714 const uint32_t par
[])
2716 #ifndef CONFIG_USER_ONLY
2717 gen_helper_intclear(cpu_env
, arg
[0].in
);
2721 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2722 const uint32_t par
[])
2724 #ifndef CONFIG_USER_ONLY
2725 gen_helper_intset(cpu_env
, arg
[0].in
);
2729 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2730 const uint32_t par
[])
2732 #ifndef CONFIG_USER_ONLY
2733 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2737 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2738 const uint32_t par
[])
2740 #ifndef CONFIG_USER_ONLY
2741 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2745 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2746 const uint32_t par
[])
2748 #ifndef CONFIG_USER_ONLY
2749 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2750 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2752 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2753 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2756 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2760 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2761 const uint32_t par
[])
2763 #ifndef CONFIG_USER_ONLY
2764 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2768 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2769 const uint32_t par
[])
2771 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2772 if (dc
->sar_m32_5bit
) {
2773 tcg_gen_discard_i32(dc
->sar_m32
);
2775 dc
->sar_5bit
= false;
2776 dc
->sar_m32_5bit
= false;
2779 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2780 const uint32_t par
[])
2782 #ifndef CONFIG_USER_ONLY
2783 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2787 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2788 const uint32_t par
[])
2790 #ifndef CONFIG_USER_ONLY
2791 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2792 (1 << dc
->config
->nareg
/ 4) - 1);
2796 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2797 const uint32_t par
[])
2799 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2802 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2803 const uint32_t par
[])
2805 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2808 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2809 const uint32_t par
[])
2811 if (sr_name
[par
[0]]) {
2812 TCGv_i32 tmp
= tcg_temp_new_i32();
2814 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2815 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2816 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2819 tcg_gen_movi_i32(arg
[0].out
, 0);
2823 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2824 const uint32_t par
[])
2826 if (sr_name
[par
[0]]) {
2827 TCGv_i32 tmp
= tcg_temp_new_i32();
2829 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2830 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2831 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2834 tcg_gen_movi_i32(arg
[0].out
, 0);
2838 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2839 const uint32_t par
[])
2841 #ifndef CONFIG_USER_ONLY
2842 TCGv_i32 tmp
= tcg_temp_new_i32();
2844 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2848 gen_helper_update_ccount(cpu_env
);
2849 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2850 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2851 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2857 #define gen_translate_xsr(name) \
2858 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2859 const uint32_t par[]) \
2861 TCGv_i32 tmp = tcg_temp_new_i32(); \
2863 if (sr_name[par[0]]) { \
2864 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2866 tcg_gen_movi_i32(tmp, 0); \
2868 translate_wsr_##name(dc, arg, par); \
2869 tcg_gen_mov_i32(arg[0].out, tmp); \
2870 tcg_temp_free(tmp); \
2873 gen_translate_xsr(acchi
)
2874 gen_translate_xsr(ccompare
)
2875 gen_translate_xsr(dbreaka
)
2876 gen_translate_xsr(dbreakc
)
2877 gen_translate_xsr(ibreaka
)
2878 gen_translate_xsr(ibreakenable
)
2879 gen_translate_xsr(icount
)
2880 gen_translate_xsr(memctl
)
2881 gen_translate_xsr(mpuenb
)
2882 gen_translate_xsr(ps
)
2883 gen_translate_xsr(rasid
)
2884 gen_translate_xsr(sar
)
2885 gen_translate_xsr(windowbase
)
2886 gen_translate_xsr(windowstart
)
2888 #undef gen_translate_xsr
2890 static const XtensaOpcodeOps core_ops
[] = {
2893 .translate
= translate_abs
,
2895 .name
= (const char * const[]) {
2896 "add", "add.n", NULL
,
2898 .translate
= translate_add
,
2899 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2901 .name
= (const char * const[]) {
2902 "addi", "addi.n", NULL
,
2904 .translate
= translate_addi
,
2905 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2908 .translate
= translate_addi
,
2911 .translate
= translate_addx
,
2912 .par
= (const uint32_t[]){1},
2915 .translate
= translate_addx
,
2916 .par
= (const uint32_t[]){2},
2919 .translate
= translate_addx
,
2920 .par
= (const uint32_t[]){3},
2923 .translate
= translate_all
,
2924 .par
= (const uint32_t[]){true, 4},
2927 .translate
= translate_all
,
2928 .par
= (const uint32_t[]){true, 8},
2931 .translate
= translate_and
,
2934 .translate
= translate_boolean
,
2935 .par
= (const uint32_t[]){BOOLEAN_AND
},
2938 .translate
= translate_boolean
,
2939 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2942 .translate
= translate_all
,
2943 .par
= (const uint32_t[]){false, 4},
2946 .translate
= translate_all
,
2947 .par
= (const uint32_t[]){false, 8},
2949 .name
= (const char * const[]) {
2950 "ball", "ball.w15", "ball.w18", NULL
,
2952 .translate
= translate_ball
,
2953 .par
= (const uint32_t[]){TCG_COND_EQ
},
2954 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2956 .name
= (const char * const[]) {
2957 "bany", "bany.w15", "bany.w18", NULL
,
2959 .translate
= translate_bany
,
2960 .par
= (const uint32_t[]){TCG_COND_NE
},
2961 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2963 .name
= (const char * const[]) {
2964 "bbc", "bbc.w15", "bbc.w18", NULL
,
2966 .translate
= translate_bb
,
2967 .par
= (const uint32_t[]){TCG_COND_EQ
},
2968 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2970 .name
= (const char * const[]) {
2971 "bbci", "bbci.w15", "bbci.w18", NULL
,
2973 .translate
= translate_bbi
,
2974 .par
= (const uint32_t[]){TCG_COND_EQ
},
2975 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2977 .name
= (const char * const[]) {
2978 "bbs", "bbs.w15", "bbs.w18", NULL
,
2980 .translate
= translate_bb
,
2981 .par
= (const uint32_t[]){TCG_COND_NE
},
2982 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2984 .name
= (const char * const[]) {
2985 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2987 .translate
= translate_bbi
,
2988 .par
= (const uint32_t[]){TCG_COND_NE
},
2989 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2991 .name
= (const char * const[]) {
2992 "beq", "beq.w15", "beq.w18", NULL
,
2994 .translate
= translate_b
,
2995 .par
= (const uint32_t[]){TCG_COND_EQ
},
2996 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2998 .name
= (const char * const[]) {
2999 "beqi", "beqi.w15", "beqi.w18", NULL
,
3001 .translate
= translate_bi
,
3002 .par
= (const uint32_t[]){TCG_COND_EQ
},
3003 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3005 .name
= (const char * const[]) {
3006 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
3008 .translate
= translate_bz
,
3009 .par
= (const uint32_t[]){TCG_COND_EQ
},
3010 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3013 .translate
= translate_bp
,
3014 .par
= (const uint32_t[]){TCG_COND_EQ
},
3016 .name
= (const char * const[]) {
3017 "bge", "bge.w15", "bge.w18", NULL
,
3019 .translate
= translate_b
,
3020 .par
= (const uint32_t[]){TCG_COND_GE
},
3021 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3023 .name
= (const char * const[]) {
3024 "bgei", "bgei.w15", "bgei.w18", NULL
,
3026 .translate
= translate_bi
,
3027 .par
= (const uint32_t[]){TCG_COND_GE
},
3028 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3030 .name
= (const char * const[]) {
3031 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
3033 .translate
= translate_b
,
3034 .par
= (const uint32_t[]){TCG_COND_GEU
},
3035 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3037 .name
= (const char * const[]) {
3038 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
3040 .translate
= translate_bi
,
3041 .par
= (const uint32_t[]){TCG_COND_GEU
},
3042 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3044 .name
= (const char * const[]) {
3045 "bgez", "bgez.w15", "bgez.w18", NULL
,
3047 .translate
= translate_bz
,
3048 .par
= (const uint32_t[]){TCG_COND_GE
},
3049 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3051 .name
= (const char * const[]) {
3052 "blt", "blt.w15", "blt.w18", NULL
,
3054 .translate
= translate_b
,
3055 .par
= (const uint32_t[]){TCG_COND_LT
},
3056 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3058 .name
= (const char * const[]) {
3059 "blti", "blti.w15", "blti.w18", NULL
,
3061 .translate
= translate_bi
,
3062 .par
= (const uint32_t[]){TCG_COND_LT
},
3063 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3065 .name
= (const char * const[]) {
3066 "bltu", "bltu.w15", "bltu.w18", NULL
,
3068 .translate
= translate_b
,
3069 .par
= (const uint32_t[]){TCG_COND_LTU
},
3070 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3072 .name
= (const char * const[]) {
3073 "bltui", "bltui.w15", "bltui.w18", NULL
,
3075 .translate
= translate_bi
,
3076 .par
= (const uint32_t[]){TCG_COND_LTU
},
3077 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3079 .name
= (const char * const[]) {
3080 "bltz", "bltz.w15", "bltz.w18", NULL
,
3082 .translate
= translate_bz
,
3083 .par
= (const uint32_t[]){TCG_COND_LT
},
3084 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3086 .name
= (const char * const[]) {
3087 "bnall", "bnall.w15", "bnall.w18", NULL
,
3089 .translate
= translate_ball
,
3090 .par
= (const uint32_t[]){TCG_COND_NE
},
3091 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3093 .name
= (const char * const[]) {
3094 "bne", "bne.w15", "bne.w18", NULL
,
3096 .translate
= translate_b
,
3097 .par
= (const uint32_t[]){TCG_COND_NE
},
3098 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3100 .name
= (const char * const[]) {
3101 "bnei", "bnei.w15", "bnei.w18", NULL
,
3103 .translate
= translate_bi
,
3104 .par
= (const uint32_t[]){TCG_COND_NE
},
3105 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3107 .name
= (const char * const[]) {
3108 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3110 .translate
= translate_bz
,
3111 .par
= (const uint32_t[]){TCG_COND_NE
},
3112 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3114 .name
= (const char * const[]) {
3115 "bnone", "bnone.w15", "bnone.w18", NULL
,
3117 .translate
= translate_bany
,
3118 .par
= (const uint32_t[]){TCG_COND_EQ
},
3119 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3122 .translate
= translate_nop
,
3123 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3124 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3127 .translate
= translate_nop
,
3128 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3129 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3132 .translate
= translate_bp
,
3133 .par
= (const uint32_t[]){TCG_COND_NE
},
3136 .translate
= translate_call0
,
3139 .translate
= translate_callw
,
3140 .par
= (const uint32_t[]){3},
3143 .translate
= translate_callw
,
3144 .par
= (const uint32_t[]){1},
3147 .translate
= translate_callw
,
3148 .par
= (const uint32_t[]){2},
3151 .translate
= translate_callx0
,
3154 .translate
= translate_callxw
,
3155 .par
= (const uint32_t[]){3},
3158 .translate
= translate_callxw
,
3159 .par
= (const uint32_t[]){1},
3162 .translate
= translate_callxw
,
3163 .par
= (const uint32_t[]){2},
3166 .translate
= translate_clamps
,
3168 .name
= "clrb_expstate",
3169 .translate
= translate_clrb_expstate
,
3172 .translate
= translate_clrex
,
3175 .translate
= translate_const16
,
3178 .translate
= translate_depbits
,
3181 .translate
= translate_dcache
,
3182 .op_flags
= XTENSA_OP_PRIVILEGED
,
3185 .translate
= translate_nop
,
3188 .translate
= translate_dcache
,
3189 .op_flags
= XTENSA_OP_PRIVILEGED
,
3192 .translate
= translate_dcache
,
3195 .translate
= translate_nop
,
3198 .translate
= translate_dcache
,
3201 .translate
= translate_nop
,
3204 .translate
= translate_nop
,
3205 .op_flags
= XTENSA_OP_PRIVILEGED
,
3208 .translate
= translate_nop
,
3209 .op_flags
= XTENSA_OP_PRIVILEGED
,
3212 .translate
= translate_nop
,
3213 .op_flags
= XTENSA_OP_PRIVILEGED
,
3216 .translate
= translate_nop
,
3217 .op_flags
= XTENSA_OP_PRIVILEGED
,
3220 .translate
= translate_diwbuip
,
3221 .op_flags
= XTENSA_OP_PRIVILEGED
,
3224 .translate
= translate_dcache
,
3225 .op_flags
= XTENSA_OP_PRIVILEGED
,
3228 .translate
= translate_nop
,
3231 .translate
= translate_nop
,
3234 .translate
= translate_nop
,
3237 .translate
= translate_nop
,
3240 .translate
= translate_nop
,
3243 .translate
= translate_nop
,
3246 .translate
= translate_nop
,
3249 .translate
= translate_nop
,
3252 .translate
= translate_nop
,
3255 .translate
= translate_nop
,
3258 .translate
= translate_nop
,
3261 .translate
= translate_entry
,
3262 .test_exceptions
= test_exceptions_entry
,
3263 .test_overflow
= test_overflow_entry
,
3264 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3265 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3268 .translate
= translate_nop
,
3271 .translate
= translate_nop
,
3274 .translate
= translate_extui
,
3277 .translate
= translate_memw
,
3280 .translate
= translate_getex
,
3283 .op_flags
= XTENSA_OP_ILL
,
3286 .op_flags
= XTENSA_OP_ILL
,
3289 .translate
= translate_itlb
,
3290 .par
= (const uint32_t[]){true},
3291 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3294 .translate
= translate_icache
,
3297 .translate
= translate_icache
,
3298 .op_flags
= XTENSA_OP_PRIVILEGED
,
3301 .translate
= translate_nop
,
3302 .op_flags
= XTENSA_OP_PRIVILEGED
,
3305 .translate
= translate_itlb
,
3306 .par
= (const uint32_t[]){false},
3307 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3310 .translate
= translate_nop
,
3311 .op_flags
= XTENSA_OP_PRIVILEGED
,
3313 .name
= (const char * const[]) {
3314 "ill", "ill.n", NULL
,
3316 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3319 .translate
= translate_nop
,
3322 .translate
= translate_icache
,
3323 .op_flags
= XTENSA_OP_PRIVILEGED
,
3326 .translate
= translate_nop
,
3329 .translate
= translate_j
,
3332 .translate
= translate_jx
,
3335 .translate
= translate_ldst
,
3336 .par
= (const uint32_t[]){MO_TESW
, false, false},
3337 .op_flags
= XTENSA_OP_LOAD
,
3340 .translate
= translate_ldst
,
3341 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3342 .op_flags
= XTENSA_OP_LOAD
,
3345 .translate
= translate_ldst
,
3346 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, false},
3347 .op_flags
= XTENSA_OP_LOAD
,
3350 .translate
= translate_l32e
,
3351 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3354 .translate
= translate_l32ex
,
3355 .op_flags
= XTENSA_OP_LOAD
,
3357 .name
= (const char * const[]) {
3358 "l32i", "l32i.n", NULL
,
3360 .translate
= translate_ldst
,
3361 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3362 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3365 .translate
= translate_l32r
,
3366 .op_flags
= XTENSA_OP_LOAD
,
3369 .translate
= translate_ldst
,
3370 .par
= (const uint32_t[]){MO_UB
, false, false},
3371 .op_flags
= XTENSA_OP_LOAD
,
3374 .translate
= translate_mac16
,
3375 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3376 .op_flags
= XTENSA_OP_LOAD
,
3379 .translate
= translate_mac16
,
3380 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3381 .op_flags
= XTENSA_OP_LOAD
,
3384 .op_flags
= XTENSA_OP_ILL
,
3386 .name
= (const char * const[]) {
3387 "loop", "loop.w15", NULL
,
3389 .translate
= translate_loop
,
3390 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3391 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3393 .name
= (const char * const[]) {
3394 "loopgtz", "loopgtz.w15", NULL
,
3396 .translate
= translate_loop
,
3397 .par
= (const uint32_t[]){TCG_COND_GT
},
3398 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3400 .name
= (const char * const[]) {
3401 "loopnez", "loopnez.w15", NULL
,
3403 .translate
= translate_loop
,
3404 .par
= (const uint32_t[]){TCG_COND_NE
},
3405 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3408 .translate
= translate_smax
,
3411 .translate
= translate_umax
,
3414 .translate
= translate_memw
,
3417 .translate
= translate_smin
,
3420 .translate
= translate_umin
,
3422 .name
= (const char * const[]) {
3423 "mov", "mov.n", NULL
,
3425 .translate
= translate_mov
,
3426 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3429 .translate
= translate_movcond
,
3430 .par
= (const uint32_t[]){TCG_COND_EQ
},
3433 .translate
= translate_movp
,
3434 .par
= (const uint32_t[]){TCG_COND_EQ
},
3437 .translate
= translate_movcond
,
3438 .par
= (const uint32_t[]){TCG_COND_GE
},
3441 .translate
= translate_movi
,
3444 .translate
= translate_movi
,
3447 .translate
= translate_movcond
,
3448 .par
= (const uint32_t[]){TCG_COND_LT
},
3451 .translate
= translate_movcond
,
3452 .par
= (const uint32_t[]){TCG_COND_NE
},
3455 .translate
= translate_movsp
,
3456 .op_flags
= XTENSA_OP_ALLOCA
,
3459 .translate
= translate_movp
,
3460 .par
= (const uint32_t[]){TCG_COND_NE
},
3462 .name
= "mul.aa.hh",
3463 .translate
= translate_mac16
,
3464 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3466 .name
= "mul.aa.hl",
3467 .translate
= translate_mac16
,
3468 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3470 .name
= "mul.aa.lh",
3471 .translate
= translate_mac16
,
3472 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3474 .name
= "mul.aa.ll",
3475 .translate
= translate_mac16
,
3476 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3478 .name
= "mul.ad.hh",
3479 .translate
= translate_mac16
,
3480 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3482 .name
= "mul.ad.hl",
3483 .translate
= translate_mac16
,
3484 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3486 .name
= "mul.ad.lh",
3487 .translate
= translate_mac16
,
3488 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3490 .name
= "mul.ad.ll",
3491 .translate
= translate_mac16
,
3492 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3494 .name
= "mul.da.hh",
3495 .translate
= translate_mac16
,
3496 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3498 .name
= "mul.da.hl",
3499 .translate
= translate_mac16
,
3500 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3502 .name
= "mul.da.lh",
3503 .translate
= translate_mac16
,
3504 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3506 .name
= "mul.da.ll",
3507 .translate
= translate_mac16
,
3508 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3510 .name
= "mul.dd.hh",
3511 .translate
= translate_mac16
,
3512 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3514 .name
= "mul.dd.hl",
3515 .translate
= translate_mac16
,
3516 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3518 .name
= "mul.dd.lh",
3519 .translate
= translate_mac16
,
3520 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3522 .name
= "mul.dd.ll",
3523 .translate
= translate_mac16
,
3524 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3527 .translate
= translate_mul16
,
3528 .par
= (const uint32_t[]){true},
3531 .translate
= translate_mul16
,
3532 .par
= (const uint32_t[]){false},
3534 .name
= "mula.aa.hh",
3535 .translate
= translate_mac16
,
3536 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3538 .name
= "mula.aa.hl",
3539 .translate
= translate_mac16
,
3540 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3542 .name
= "mula.aa.lh",
3543 .translate
= translate_mac16
,
3544 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3546 .name
= "mula.aa.ll",
3547 .translate
= translate_mac16
,
3548 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3550 .name
= "mula.ad.hh",
3551 .translate
= translate_mac16
,
3552 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3554 .name
= "mula.ad.hl",
3555 .translate
= translate_mac16
,
3556 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3558 .name
= "mula.ad.lh",
3559 .translate
= translate_mac16
,
3560 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3562 .name
= "mula.ad.ll",
3563 .translate
= translate_mac16
,
3564 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3566 .name
= "mula.da.hh",
3567 .translate
= translate_mac16
,
3568 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3570 .name
= "mula.da.hh.lddec",
3571 .translate
= translate_mac16
,
3572 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3574 .name
= "mula.da.hh.ldinc",
3575 .translate
= translate_mac16
,
3576 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3578 .name
= "mula.da.hl",
3579 .translate
= translate_mac16
,
3580 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3582 .name
= "mula.da.hl.lddec",
3583 .translate
= translate_mac16
,
3584 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3586 .name
= "mula.da.hl.ldinc",
3587 .translate
= translate_mac16
,
3588 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3590 .name
= "mula.da.lh",
3591 .translate
= translate_mac16
,
3592 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3594 .name
= "mula.da.lh.lddec",
3595 .translate
= translate_mac16
,
3596 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3598 .name
= "mula.da.lh.ldinc",
3599 .translate
= translate_mac16
,
3600 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3602 .name
= "mula.da.ll",
3603 .translate
= translate_mac16
,
3604 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3606 .name
= "mula.da.ll.lddec",
3607 .translate
= translate_mac16
,
3608 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3610 .name
= "mula.da.ll.ldinc",
3611 .translate
= translate_mac16
,
3612 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3614 .name
= "mula.dd.hh",
3615 .translate
= translate_mac16
,
3616 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3618 .name
= "mula.dd.hh.lddec",
3619 .translate
= translate_mac16
,
3620 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3622 .name
= "mula.dd.hh.ldinc",
3623 .translate
= translate_mac16
,
3624 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3626 .name
= "mula.dd.hl",
3627 .translate
= translate_mac16
,
3628 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3630 .name
= "mula.dd.hl.lddec",
3631 .translate
= translate_mac16
,
3632 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3634 .name
= "mula.dd.hl.ldinc",
3635 .translate
= translate_mac16
,
3636 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3638 .name
= "mula.dd.lh",
3639 .translate
= translate_mac16
,
3640 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3642 .name
= "mula.dd.lh.lddec",
3643 .translate
= translate_mac16
,
3644 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3646 .name
= "mula.dd.lh.ldinc",
3647 .translate
= translate_mac16
,
3648 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3650 .name
= "mula.dd.ll",
3651 .translate
= translate_mac16
,
3652 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3654 .name
= "mula.dd.ll.lddec",
3655 .translate
= translate_mac16
,
3656 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3658 .name
= "mula.dd.ll.ldinc",
3659 .translate
= translate_mac16
,
3660 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3663 .translate
= translate_mull
,
3665 .name
= "muls.aa.hh",
3666 .translate
= translate_mac16
,
3667 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3669 .name
= "muls.aa.hl",
3670 .translate
= translate_mac16
,
3671 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3673 .name
= "muls.aa.lh",
3674 .translate
= translate_mac16
,
3675 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3677 .name
= "muls.aa.ll",
3678 .translate
= translate_mac16
,
3679 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3681 .name
= "muls.ad.hh",
3682 .translate
= translate_mac16
,
3683 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3685 .name
= "muls.ad.hl",
3686 .translate
= translate_mac16
,
3687 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3689 .name
= "muls.ad.lh",
3690 .translate
= translate_mac16
,
3691 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3693 .name
= "muls.ad.ll",
3694 .translate
= translate_mac16
,
3695 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3697 .name
= "muls.da.hh",
3698 .translate
= translate_mac16
,
3699 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3701 .name
= "muls.da.hl",
3702 .translate
= translate_mac16
,
3703 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3705 .name
= "muls.da.lh",
3706 .translate
= translate_mac16
,
3707 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3709 .name
= "muls.da.ll",
3710 .translate
= translate_mac16
,
3711 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3713 .name
= "muls.dd.hh",
3714 .translate
= translate_mac16
,
3715 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3717 .name
= "muls.dd.hl",
3718 .translate
= translate_mac16
,
3719 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3721 .name
= "muls.dd.lh",
3722 .translate
= translate_mac16
,
3723 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3725 .name
= "muls.dd.ll",
3726 .translate
= translate_mac16
,
3727 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3730 .translate
= translate_mulh
,
3731 .par
= (const uint32_t[]){true},
3734 .translate
= translate_mulh
,
3735 .par
= (const uint32_t[]){false},
3738 .translate
= translate_neg
,
3740 .name
= (const char * const[]) {
3741 "nop", "nop.n", NULL
,
3743 .translate
= translate_nop
,
3744 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3747 .translate
= translate_nsa
,
3750 .translate
= translate_nsau
,
3753 .translate
= translate_or
,
3756 .translate
= translate_boolean
,
3757 .par
= (const uint32_t[]){BOOLEAN_OR
},
3760 .translate
= translate_boolean
,
3761 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3764 .translate
= translate_ptlb
,
3765 .par
= (const uint32_t[]){true},
3766 .op_flags
= XTENSA_OP_PRIVILEGED
,
3769 .translate
= translate_nop
,
3772 .translate
= translate_nop
,
3775 .translate
= translate_nop
,
3778 .translate
= translate_nop
,
3781 .translate
= translate_nop
,
3784 .translate
= translate_ptlb
,
3785 .par
= (const uint32_t[]){false},
3786 .op_flags
= XTENSA_OP_PRIVILEGED
,
3789 .translate
= translate_pptlb
,
3790 .op_flags
= XTENSA_OP_PRIVILEGED
,
3793 .translate
= translate_quos
,
3794 .par
= (const uint32_t[]){true},
3795 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3798 .translate
= translate_quou
,
3799 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3802 .translate
= translate_rtlb
,
3803 .par
= (const uint32_t[]){true, 0},
3804 .op_flags
= XTENSA_OP_PRIVILEGED
,
3807 .translate
= translate_rtlb
,
3808 .par
= (const uint32_t[]){true, 1},
3809 .op_flags
= XTENSA_OP_PRIVILEGED
,
3811 .name
= "read_impwire",
3812 .translate
= translate_read_impwire
,
3815 .translate
= translate_quos
,
3816 .par
= (const uint32_t[]){false},
3817 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3820 .translate
= translate_remu
,
3821 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3824 .translate
= translate_rer
,
3825 .op_flags
= XTENSA_OP_PRIVILEGED
,
3827 .name
= (const char * const[]) {
3828 "ret", "ret.n", NULL
,
3830 .translate
= translate_ret
,
3831 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3833 .name
= (const char * const[]) {
3834 "retw", "retw.n", NULL
,
3836 .translate
= translate_retw
,
3837 .test_exceptions
= test_exceptions_retw
,
3838 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3841 .op_flags
= XTENSA_OP_ILL
,
3844 .translate
= translate_rfde
,
3845 .op_flags
= XTENSA_OP_PRIVILEGED
,
3848 .op_flags
= XTENSA_OP_ILL
,
3851 .translate
= translate_rfe
,
3852 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3855 .translate
= translate_rfi
,
3856 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3859 .translate
= translate_rfw
,
3860 .par
= (const uint32_t[]){true},
3861 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3864 .translate
= translate_rfw
,
3865 .par
= (const uint32_t[]){false},
3866 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3869 .translate
= translate_rtlb
,
3870 .par
= (const uint32_t[]){false, 0},
3871 .op_flags
= XTENSA_OP_PRIVILEGED
,
3874 .translate
= translate_rtlb
,
3875 .par
= (const uint32_t[]){false, 1},
3876 .op_flags
= XTENSA_OP_PRIVILEGED
,
3879 .translate
= translate_rptlb0
,
3880 .op_flags
= XTENSA_OP_PRIVILEGED
,
3883 .translate
= translate_rptlb1
,
3884 .op_flags
= XTENSA_OP_PRIVILEGED
,
3887 .translate
= translate_rotw
,
3888 .op_flags
= XTENSA_OP_PRIVILEGED
|
3889 XTENSA_OP_EXIT_TB_M1
|
3890 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3893 .translate
= translate_rsil
,
3895 XTENSA_OP_PRIVILEGED
|
3896 XTENSA_OP_EXIT_TB_0
|
3897 XTENSA_OP_CHECK_INTERRUPTS
,
3900 .translate
= translate_rsr
,
3901 .par
= (const uint32_t[]){176},
3902 .op_flags
= XTENSA_OP_PRIVILEGED
,
3905 .translate
= translate_rsr
,
3906 .par
= (const uint32_t[]){208},
3907 .op_flags
= XTENSA_OP_PRIVILEGED
,
3909 .name
= "rsr.acchi",
3910 .translate
= translate_rsr
,
3911 .test_exceptions
= test_exceptions_sr
,
3912 .par
= (const uint32_t[]){
3914 XTENSA_OPTION_MAC16
,
3917 .name
= "rsr.acclo",
3918 .translate
= translate_rsr
,
3919 .test_exceptions
= test_exceptions_sr
,
3920 .par
= (const uint32_t[]){
3922 XTENSA_OPTION_MAC16
,
3925 .name
= "rsr.atomctl",
3926 .translate
= translate_rsr
,
3927 .test_exceptions
= test_exceptions_sr
,
3928 .par
= (const uint32_t[]){
3930 XTENSA_OPTION_ATOMCTL
,
3932 .op_flags
= XTENSA_OP_PRIVILEGED
,
3935 .translate
= translate_rsr
,
3936 .test_exceptions
= test_exceptions_sr
,
3937 .par
= (const uint32_t[]){
3939 XTENSA_OPTION_BOOLEAN
,
3942 .name
= "rsr.cacheadrdis",
3943 .translate
= translate_rsr
,
3944 .test_exceptions
= test_exceptions_sr
,
3945 .par
= (const uint32_t[]){
3949 .op_flags
= XTENSA_OP_PRIVILEGED
,
3951 .name
= "rsr.cacheattr",
3952 .translate
= translate_rsr
,
3953 .test_exceptions
= test_exceptions_sr
,
3954 .par
= (const uint32_t[]){
3956 XTENSA_OPTION_CACHEATTR
,
3958 .op_flags
= XTENSA_OP_PRIVILEGED
,
3960 .name
= "rsr.ccompare0",
3961 .translate
= translate_rsr
,
3962 .test_exceptions
= test_exceptions_ccompare
,
3963 .par
= (const uint32_t[]){
3965 XTENSA_OPTION_TIMER_INTERRUPT
,
3967 .op_flags
= XTENSA_OP_PRIVILEGED
,
3969 .name
= "rsr.ccompare1",
3970 .translate
= translate_rsr
,
3971 .test_exceptions
= test_exceptions_ccompare
,
3972 .par
= (const uint32_t[]){
3974 XTENSA_OPTION_TIMER_INTERRUPT
,
3976 .op_flags
= XTENSA_OP_PRIVILEGED
,
3978 .name
= "rsr.ccompare2",
3979 .translate
= translate_rsr
,
3980 .test_exceptions
= test_exceptions_ccompare
,
3981 .par
= (const uint32_t[]){
3983 XTENSA_OPTION_TIMER_INTERRUPT
,
3985 .op_flags
= XTENSA_OP_PRIVILEGED
,
3987 .name
= "rsr.ccount",
3988 .translate
= translate_rsr_ccount
,
3989 .test_exceptions
= test_exceptions_sr
,
3990 .par
= (const uint32_t[]){
3992 XTENSA_OPTION_TIMER_INTERRUPT
,
3994 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3996 .name
= "rsr.configid0",
3997 .translate
= translate_rsr
,
3998 .par
= (const uint32_t[]){CONFIGID0
},
3999 .op_flags
= XTENSA_OP_PRIVILEGED
,
4001 .name
= "rsr.configid1",
4002 .translate
= translate_rsr
,
4003 .par
= (const uint32_t[]){CONFIGID1
},
4004 .op_flags
= XTENSA_OP_PRIVILEGED
,
4006 .name
= "rsr.cpenable",
4007 .translate
= translate_rsr
,
4008 .test_exceptions
= test_exceptions_sr
,
4009 .par
= (const uint32_t[]){
4011 XTENSA_OPTION_COPROCESSOR
,
4013 .op_flags
= XTENSA_OP_PRIVILEGED
,
4015 .name
= "rsr.dbreaka0",
4016 .translate
= translate_rsr
,
4017 .test_exceptions
= test_exceptions_dbreak
,
4018 .par
= (const uint32_t[]){
4020 XTENSA_OPTION_DEBUG
,
4022 .op_flags
= XTENSA_OP_PRIVILEGED
,
4024 .name
= "rsr.dbreaka1",
4025 .translate
= translate_rsr
,
4026 .test_exceptions
= test_exceptions_dbreak
,
4027 .par
= (const uint32_t[]){
4029 XTENSA_OPTION_DEBUG
,
4031 .op_flags
= XTENSA_OP_PRIVILEGED
,
4033 .name
= "rsr.dbreakc0",
4034 .translate
= translate_rsr
,
4035 .test_exceptions
= test_exceptions_dbreak
,
4036 .par
= (const uint32_t[]){
4038 XTENSA_OPTION_DEBUG
,
4040 .op_flags
= XTENSA_OP_PRIVILEGED
,
4042 .name
= "rsr.dbreakc1",
4043 .translate
= translate_rsr
,
4044 .test_exceptions
= test_exceptions_dbreak
,
4045 .par
= (const uint32_t[]){
4047 XTENSA_OPTION_DEBUG
,
4049 .op_flags
= XTENSA_OP_PRIVILEGED
,
4052 .translate
= translate_rsr
,
4053 .test_exceptions
= test_exceptions_sr
,
4054 .par
= (const uint32_t[]){
4056 XTENSA_OPTION_DEBUG
,
4058 .op_flags
= XTENSA_OP_PRIVILEGED
,
4060 .name
= "rsr.debugcause",
4061 .translate
= translate_rsr
,
4062 .test_exceptions
= test_exceptions_sr
,
4063 .par
= (const uint32_t[]){
4065 XTENSA_OPTION_DEBUG
,
4067 .op_flags
= XTENSA_OP_PRIVILEGED
,
4070 .translate
= translate_rsr
,
4071 .test_exceptions
= test_exceptions_sr
,
4072 .par
= (const uint32_t[]){
4074 XTENSA_OPTION_EXCEPTION
,
4076 .op_flags
= XTENSA_OP_PRIVILEGED
,
4078 .name
= "rsr.dtlbcfg",
4079 .translate
= translate_rsr
,
4080 .test_exceptions
= test_exceptions_sr
,
4081 .par
= (const uint32_t[]){
4085 .op_flags
= XTENSA_OP_PRIVILEGED
,
4088 .translate
= translate_rsr
,
4089 .test_exceptions
= test_exceptions_sr
,
4090 .par
= (const uint32_t[]){
4092 XTENSA_OPTION_EXCEPTION
,
4094 .op_flags
= XTENSA_OP_PRIVILEGED
,
4097 .translate
= translate_rsr
,
4098 .test_exceptions
= test_exceptions_hpi
,
4099 .par
= (const uint32_t[]){
4101 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4103 .op_flags
= XTENSA_OP_PRIVILEGED
,
4106 .translate
= translate_rsr
,
4107 .test_exceptions
= test_exceptions_hpi
,
4108 .par
= (const uint32_t[]){
4110 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4112 .op_flags
= XTENSA_OP_PRIVILEGED
,
4115 .translate
= translate_rsr
,
4116 .test_exceptions
= test_exceptions_hpi
,
4117 .par
= (const uint32_t[]){
4119 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4121 .op_flags
= XTENSA_OP_PRIVILEGED
,
4124 .translate
= translate_rsr
,
4125 .test_exceptions
= test_exceptions_hpi
,
4126 .par
= (const uint32_t[]){
4128 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4130 .op_flags
= XTENSA_OP_PRIVILEGED
,
4133 .translate
= translate_rsr
,
4134 .test_exceptions
= test_exceptions_hpi
,
4135 .par
= (const uint32_t[]){
4137 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4139 .op_flags
= XTENSA_OP_PRIVILEGED
,
4142 .translate
= translate_rsr
,
4143 .test_exceptions
= test_exceptions_hpi
,
4144 .par
= (const uint32_t[]){
4146 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4148 .op_flags
= XTENSA_OP_PRIVILEGED
,
4151 .translate
= translate_rsr
,
4152 .test_exceptions
= test_exceptions_hpi
,
4153 .par
= (const uint32_t[]){
4155 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4157 .op_flags
= XTENSA_OP_PRIVILEGED
,
4160 .translate
= translate_rsr
,
4161 .test_exceptions
= test_exceptions_hpi
,
4162 .par
= (const uint32_t[]){
4164 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4166 .op_flags
= XTENSA_OP_PRIVILEGED
,
4169 .translate
= translate_rsr
,
4170 .test_exceptions
= test_exceptions_hpi
,
4171 .par
= (const uint32_t[]){
4173 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4175 .op_flags
= XTENSA_OP_PRIVILEGED
,
4178 .translate
= translate_rsr
,
4179 .test_exceptions
= test_exceptions_hpi
,
4180 .par
= (const uint32_t[]){
4182 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4184 .op_flags
= XTENSA_OP_PRIVILEGED
,
4187 .translate
= translate_rsr
,
4188 .test_exceptions
= test_exceptions_hpi
,
4189 .par
= (const uint32_t[]){
4191 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4193 .op_flags
= XTENSA_OP_PRIVILEGED
,
4196 .translate
= translate_rsr
,
4197 .test_exceptions
= test_exceptions_hpi
,
4198 .par
= (const uint32_t[]){
4200 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4202 .op_flags
= XTENSA_OP_PRIVILEGED
,
4204 .name
= "rsr.eraccess",
4205 .translate
= translate_rsr
,
4206 .par
= (const uint32_t[]){ERACCESS
},
4207 .op_flags
= XTENSA_OP_PRIVILEGED
,
4209 .name
= "rsr.exccause",
4210 .translate
= translate_rsr
,
4211 .test_exceptions
= test_exceptions_sr
,
4212 .par
= (const uint32_t[]){
4214 XTENSA_OPTION_EXCEPTION
,
4216 .op_flags
= XTENSA_OP_PRIVILEGED
,
4218 .name
= "rsr.excsave1",
4219 .translate
= translate_rsr
,
4220 .test_exceptions
= test_exceptions_sr
,
4221 .par
= (const uint32_t[]){
4223 XTENSA_OPTION_EXCEPTION
,
4225 .op_flags
= XTENSA_OP_PRIVILEGED
,
4227 .name
= "rsr.excsave2",
4228 .translate
= translate_rsr
,
4229 .test_exceptions
= test_exceptions_hpi
,
4230 .par
= (const uint32_t[]){
4232 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4234 .op_flags
= XTENSA_OP_PRIVILEGED
,
4236 .name
= "rsr.excsave3",
4237 .translate
= translate_rsr
,
4238 .test_exceptions
= test_exceptions_hpi
,
4239 .par
= (const uint32_t[]){
4241 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4243 .op_flags
= XTENSA_OP_PRIVILEGED
,
4245 .name
= "rsr.excsave4",
4246 .translate
= translate_rsr
,
4247 .test_exceptions
= test_exceptions_hpi
,
4248 .par
= (const uint32_t[]){
4250 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4252 .op_flags
= XTENSA_OP_PRIVILEGED
,
4254 .name
= "rsr.excsave5",
4255 .translate
= translate_rsr
,
4256 .test_exceptions
= test_exceptions_hpi
,
4257 .par
= (const uint32_t[]){
4259 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4261 .op_flags
= XTENSA_OP_PRIVILEGED
,
4263 .name
= "rsr.excsave6",
4264 .translate
= translate_rsr
,
4265 .test_exceptions
= test_exceptions_hpi
,
4266 .par
= (const uint32_t[]){
4268 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4270 .op_flags
= XTENSA_OP_PRIVILEGED
,
4272 .name
= "rsr.excsave7",
4273 .translate
= translate_rsr
,
4274 .test_exceptions
= test_exceptions_hpi
,
4275 .par
= (const uint32_t[]){
4277 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4279 .op_flags
= XTENSA_OP_PRIVILEGED
,
4281 .name
= "rsr.excvaddr",
4282 .translate
= translate_rsr
,
4283 .test_exceptions
= test_exceptions_sr
,
4284 .par
= (const uint32_t[]){
4286 XTENSA_OPTION_EXCEPTION
,
4288 .op_flags
= XTENSA_OP_PRIVILEGED
,
4290 .name
= "rsr.ibreaka0",
4291 .translate
= translate_rsr
,
4292 .test_exceptions
= test_exceptions_ibreak
,
4293 .par
= (const uint32_t[]){
4295 XTENSA_OPTION_DEBUG
,
4297 .op_flags
= XTENSA_OP_PRIVILEGED
,
4299 .name
= "rsr.ibreaka1",
4300 .translate
= translate_rsr
,
4301 .test_exceptions
= test_exceptions_ibreak
,
4302 .par
= (const uint32_t[]){
4304 XTENSA_OPTION_DEBUG
,
4306 .op_flags
= XTENSA_OP_PRIVILEGED
,
4308 .name
= "rsr.ibreakenable",
4309 .translate
= translate_rsr
,
4310 .test_exceptions
= test_exceptions_sr
,
4311 .par
= (const uint32_t[]){
4313 XTENSA_OPTION_DEBUG
,
4315 .op_flags
= XTENSA_OP_PRIVILEGED
,
4317 .name
= "rsr.icount",
4318 .translate
= translate_rsr
,
4319 .test_exceptions
= test_exceptions_sr
,
4320 .par
= (const uint32_t[]){
4322 XTENSA_OPTION_DEBUG
,
4324 .op_flags
= XTENSA_OP_PRIVILEGED
,
4326 .name
= "rsr.icountlevel",
4327 .translate
= translate_rsr
,
4328 .test_exceptions
= test_exceptions_sr
,
4329 .par
= (const uint32_t[]){
4331 XTENSA_OPTION_DEBUG
,
4333 .op_flags
= XTENSA_OP_PRIVILEGED
,
4335 .name
= "rsr.intclear",
4336 .translate
= translate_rsr
,
4337 .test_exceptions
= test_exceptions_sr
,
4338 .par
= (const uint32_t[]){
4340 XTENSA_OPTION_INTERRUPT
,
4342 .op_flags
= XTENSA_OP_PRIVILEGED
,
4344 .name
= "rsr.intenable",
4345 .translate
= translate_rsr
,
4346 .test_exceptions
= test_exceptions_sr
,
4347 .par
= (const uint32_t[]){
4349 XTENSA_OPTION_INTERRUPT
,
4351 .op_flags
= XTENSA_OP_PRIVILEGED
,
4353 .name
= "rsr.interrupt",
4354 .translate
= translate_rsr_ccount
,
4355 .test_exceptions
= test_exceptions_sr
,
4356 .par
= (const uint32_t[]){
4358 XTENSA_OPTION_INTERRUPT
,
4360 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4362 .name
= "rsr.intset",
4363 .translate
= translate_rsr_ccount
,
4364 .test_exceptions
= test_exceptions_sr
,
4365 .par
= (const uint32_t[]){
4367 XTENSA_OPTION_INTERRUPT
,
4369 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4371 .name
= "rsr.itlbcfg",
4372 .translate
= translate_rsr
,
4373 .test_exceptions
= test_exceptions_sr
,
4374 .par
= (const uint32_t[]){
4378 .op_flags
= XTENSA_OP_PRIVILEGED
,
4381 .translate
= translate_rsr
,
4382 .test_exceptions
= test_exceptions_sr
,
4383 .par
= (const uint32_t[]){
4388 .name
= "rsr.lcount",
4389 .translate
= translate_rsr
,
4390 .test_exceptions
= test_exceptions_sr
,
4391 .par
= (const uint32_t[]){
4397 .translate
= translate_rsr
,
4398 .test_exceptions
= test_exceptions_sr
,
4399 .par
= (const uint32_t[]){
4404 .name
= "rsr.litbase",
4405 .translate
= translate_rsr
,
4406 .test_exceptions
= test_exceptions_sr
,
4407 .par
= (const uint32_t[]){
4409 XTENSA_OPTION_EXTENDED_L32R
,
4413 .translate
= translate_rsr
,
4414 .test_exceptions
= test_exceptions_sr
,
4415 .par
= (const uint32_t[]){
4417 XTENSA_OPTION_MAC16
,
4421 .translate
= translate_rsr
,
4422 .test_exceptions
= test_exceptions_sr
,
4423 .par
= (const uint32_t[]){
4425 XTENSA_OPTION_MAC16
,
4429 .translate
= translate_rsr
,
4430 .test_exceptions
= test_exceptions_sr
,
4431 .par
= (const uint32_t[]){
4433 XTENSA_OPTION_MAC16
,
4437 .translate
= translate_rsr
,
4438 .test_exceptions
= test_exceptions_sr
,
4439 .par
= (const uint32_t[]){
4441 XTENSA_OPTION_MAC16
,
4444 .name
= "rsr.memctl",
4445 .translate
= translate_rsr
,
4446 .par
= (const uint32_t[]){MEMCTL
},
4447 .op_flags
= XTENSA_OP_PRIVILEGED
,
4450 .translate
= translate_rsr
,
4451 .test_exceptions
= test_exceptions_sr
,
4452 .par
= (const uint32_t[]){
4454 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4456 .op_flags
= XTENSA_OP_PRIVILEGED
,
4459 .translate
= translate_rsr
,
4460 .test_exceptions
= test_exceptions_sr
,
4461 .par
= (const uint32_t[]){
4463 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4465 .op_flags
= XTENSA_OP_PRIVILEGED
,
4468 .translate
= translate_rsr
,
4469 .test_exceptions
= test_exceptions_sr
,
4470 .par
= (const uint32_t[]){
4472 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4474 .op_flags
= XTENSA_OP_PRIVILEGED
,
4476 .name
= "rsr.mesave",
4477 .translate
= translate_rsr
,
4478 .test_exceptions
= test_exceptions_sr
,
4479 .par
= (const uint32_t[]){
4481 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4483 .op_flags
= XTENSA_OP_PRIVILEGED
,
4486 .translate
= translate_rsr
,
4487 .test_exceptions
= test_exceptions_sr
,
4488 .par
= (const uint32_t[]){
4490 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4492 .op_flags
= XTENSA_OP_PRIVILEGED
,
4494 .name
= "rsr.mevaddr",
4495 .translate
= translate_rsr
,
4496 .test_exceptions
= test_exceptions_sr
,
4497 .par
= (const uint32_t[]){
4499 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4501 .op_flags
= XTENSA_OP_PRIVILEGED
,
4503 .name
= "rsr.misc0",
4504 .translate
= translate_rsr
,
4505 .test_exceptions
= test_exceptions_sr
,
4506 .par
= (const uint32_t[]){
4508 XTENSA_OPTION_MISC_SR
,
4510 .op_flags
= XTENSA_OP_PRIVILEGED
,
4512 .name
= "rsr.misc1",
4513 .translate
= translate_rsr
,
4514 .test_exceptions
= test_exceptions_sr
,
4515 .par
= (const uint32_t[]){
4517 XTENSA_OPTION_MISC_SR
,
4519 .op_flags
= XTENSA_OP_PRIVILEGED
,
4521 .name
= "rsr.misc2",
4522 .translate
= translate_rsr
,
4523 .test_exceptions
= test_exceptions_sr
,
4524 .par
= (const uint32_t[]){
4526 XTENSA_OPTION_MISC_SR
,
4528 .op_flags
= XTENSA_OP_PRIVILEGED
,
4530 .name
= "rsr.misc3",
4531 .translate
= translate_rsr
,
4532 .test_exceptions
= test_exceptions_sr
,
4533 .par
= (const uint32_t[]){
4535 XTENSA_OPTION_MISC_SR
,
4537 .op_flags
= XTENSA_OP_PRIVILEGED
,
4539 .name
= "rsr.mpucfg",
4540 .translate
= translate_rsr
,
4541 .test_exceptions
= test_exceptions_sr
,
4542 .par
= (const uint32_t[]){
4546 .op_flags
= XTENSA_OP_PRIVILEGED
,
4548 .name
= "rsr.mpuenb",
4549 .translate
= translate_rsr
,
4550 .test_exceptions
= test_exceptions_sr
,
4551 .par
= (const uint32_t[]){
4555 .op_flags
= XTENSA_OP_PRIVILEGED
,
4557 .name
= "rsr.prefctl",
4558 .translate
= translate_rsr
,
4559 .par
= (const uint32_t[]){PREFCTL
},
4562 .translate
= translate_rsr
,
4563 .test_exceptions
= test_exceptions_sr
,
4564 .par
= (const uint32_t[]){
4566 XTENSA_OPTION_PROCESSOR_ID
,
4568 .op_flags
= XTENSA_OP_PRIVILEGED
,
4571 .translate
= translate_rsr
,
4572 .test_exceptions
= test_exceptions_sr
,
4573 .par
= (const uint32_t[]){
4575 XTENSA_OPTION_EXCEPTION
,
4577 .op_flags
= XTENSA_OP_PRIVILEGED
,
4579 .name
= "rsr.ptevaddr",
4580 .translate
= translate_rsr_ptevaddr
,
4581 .test_exceptions
= test_exceptions_sr
,
4582 .par
= (const uint32_t[]){
4586 .op_flags
= XTENSA_OP_PRIVILEGED
,
4588 .name
= "rsr.rasid",
4589 .translate
= translate_rsr
,
4590 .test_exceptions
= test_exceptions_sr
,
4591 .par
= (const uint32_t[]){
4595 .op_flags
= XTENSA_OP_PRIVILEGED
,
4598 .translate
= translate_rsr
,
4599 .par
= (const uint32_t[]){SAR
},
4601 .name
= "rsr.scompare1",
4602 .translate
= translate_rsr
,
4603 .test_exceptions
= test_exceptions_sr
,
4604 .par
= (const uint32_t[]){
4606 XTENSA_OPTION_CONDITIONAL_STORE
,
4609 .name
= "rsr.vecbase",
4610 .translate
= translate_rsr
,
4611 .test_exceptions
= test_exceptions_sr
,
4612 .par
= (const uint32_t[]){
4614 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4616 .op_flags
= XTENSA_OP_PRIVILEGED
,
4618 .name
= "rsr.windowbase",
4619 .translate
= translate_rsr
,
4620 .test_exceptions
= test_exceptions_sr
,
4621 .par
= (const uint32_t[]){
4623 XTENSA_OPTION_WINDOWED_REGISTER
,
4625 .op_flags
= XTENSA_OP_PRIVILEGED
,
4627 .name
= "rsr.windowstart",
4628 .translate
= translate_rsr
,
4629 .test_exceptions
= test_exceptions_sr
,
4630 .par
= (const uint32_t[]){
4632 XTENSA_OPTION_WINDOWED_REGISTER
,
4634 .op_flags
= XTENSA_OP_PRIVILEGED
,
4637 .translate
= translate_nop
,
4639 .name
= "rur.expstate",
4640 .translate
= translate_rur
,
4641 .par
= (const uint32_t[]){EXPSTATE
},
4643 .name
= "rur.threadptr",
4644 .translate
= translate_rur
,
4645 .par
= (const uint32_t[]){THREADPTR
},
4648 .translate
= translate_ldst
,
4649 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4650 .op_flags
= XTENSA_OP_STORE
,
4653 .translate
= translate_s32c1i
,
4654 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4657 .translate
= translate_s32e
,
4658 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4661 .translate
= translate_s32ex
,
4662 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4664 .name
= (const char * const[]) {
4665 "s32i", "s32i.n", "s32nb", NULL
,
4667 .translate
= translate_ldst
,
4668 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4669 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4672 .translate
= translate_ldst
,
4673 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, true},
4674 .op_flags
= XTENSA_OP_STORE
,
4677 .translate
= translate_ldst
,
4678 .par
= (const uint32_t[]){MO_UB
, false, true},
4679 .op_flags
= XTENSA_OP_STORE
,
4682 .translate
= translate_salt
,
4683 .par
= (const uint32_t[]){TCG_COND_LT
},
4686 .translate
= translate_salt
,
4687 .par
= (const uint32_t[]){TCG_COND_LTU
},
4689 .name
= "setb_expstate",
4690 .translate
= translate_setb_expstate
,
4693 .translate
= translate_sext
,
4696 .translate
= translate_simcall
,
4697 .test_exceptions
= test_exceptions_simcall
,
4698 .op_flags
= XTENSA_OP_PRIVILEGED
,
4701 .translate
= translate_sll
,
4704 .translate
= translate_slli
,
4707 .translate
= translate_sra
,
4710 .translate
= translate_srai
,
4713 .translate
= translate_src
,
4716 .translate
= translate_srl
,
4719 .translate
= translate_srli
,
4722 .translate
= translate_ssa8b
,
4725 .translate
= translate_ssa8l
,
4728 .translate
= translate_ssai
,
4731 .translate
= translate_ssl
,
4734 .translate
= translate_ssr
,
4737 .translate
= translate_sub
,
4740 .translate
= translate_subx
,
4741 .par
= (const uint32_t[]){1},
4744 .translate
= translate_subx
,
4745 .par
= (const uint32_t[]){2},
4748 .translate
= translate_subx
,
4749 .par
= (const uint32_t[]){3},
4752 .op_flags
= XTENSA_OP_SYSCALL
,
4754 .name
= "umul.aa.hh",
4755 .translate
= translate_mac16
,
4756 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4758 .name
= "umul.aa.hl",
4759 .translate
= translate_mac16
,
4760 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4762 .name
= "umul.aa.lh",
4763 .translate
= translate_mac16
,
4764 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4766 .name
= "umul.aa.ll",
4767 .translate
= translate_mac16
,
4768 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4771 .translate
= translate_waiti
,
4772 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4775 .translate
= translate_wtlb
,
4776 .par
= (const uint32_t[]){true},
4777 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4780 .translate
= translate_wer
,
4781 .op_flags
= XTENSA_OP_PRIVILEGED
,
4784 .translate
= translate_wtlb
,
4785 .par
= (const uint32_t[]){false},
4786 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4789 .translate
= translate_wptlb
,
4790 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4792 .name
= "wrmsk_expstate",
4793 .translate
= translate_wrmsk_expstate
,
4796 .op_flags
= XTENSA_OP_ILL
,
4799 .op_flags
= XTENSA_OP_ILL
,
4801 .name
= "wsr.acchi",
4802 .translate
= translate_wsr_acchi
,
4803 .test_exceptions
= test_exceptions_sr
,
4804 .par
= (const uint32_t[]){
4806 XTENSA_OPTION_MAC16
,
4809 .name
= "wsr.acclo",
4810 .translate
= translate_wsr
,
4811 .test_exceptions
= test_exceptions_sr
,
4812 .par
= (const uint32_t[]){
4814 XTENSA_OPTION_MAC16
,
4817 .name
= "wsr.atomctl",
4818 .translate
= translate_wsr_mask
,
4819 .test_exceptions
= test_exceptions_sr
,
4820 .par
= (const uint32_t[]){
4822 XTENSA_OPTION_ATOMCTL
,
4825 .op_flags
= XTENSA_OP_PRIVILEGED
,
4828 .translate
= translate_wsr_mask
,
4829 .test_exceptions
= test_exceptions_sr
,
4830 .par
= (const uint32_t[]){
4832 XTENSA_OPTION_BOOLEAN
,
4836 .name
= "wsr.cacheadrdis",
4837 .translate
= translate_wsr_mask
,
4838 .test_exceptions
= test_exceptions_sr
,
4839 .par
= (const uint32_t[]){
4844 .op_flags
= XTENSA_OP_PRIVILEGED
,
4846 .name
= "wsr.cacheattr",
4847 .translate
= translate_wsr
,
4848 .test_exceptions
= test_exceptions_sr
,
4849 .par
= (const uint32_t[]){
4851 XTENSA_OPTION_CACHEATTR
,
4853 .op_flags
= XTENSA_OP_PRIVILEGED
,
4855 .name
= "wsr.ccompare0",
4856 .translate
= translate_wsr_ccompare
,
4857 .test_exceptions
= test_exceptions_ccompare
,
4858 .par
= (const uint32_t[]){
4860 XTENSA_OPTION_TIMER_INTERRUPT
,
4862 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4864 .name
= "wsr.ccompare1",
4865 .translate
= translate_wsr_ccompare
,
4866 .test_exceptions
= test_exceptions_ccompare
,
4867 .par
= (const uint32_t[]){
4869 XTENSA_OPTION_TIMER_INTERRUPT
,
4871 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4873 .name
= "wsr.ccompare2",
4874 .translate
= translate_wsr_ccompare
,
4875 .test_exceptions
= test_exceptions_ccompare
,
4876 .par
= (const uint32_t[]){
4878 XTENSA_OPTION_TIMER_INTERRUPT
,
4880 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4882 .name
= "wsr.ccount",
4883 .translate
= translate_wsr_ccount
,
4884 .test_exceptions
= test_exceptions_sr
,
4885 .par
= (const uint32_t[]){
4887 XTENSA_OPTION_TIMER_INTERRUPT
,
4889 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4891 .name
= "wsr.configid0",
4892 .op_flags
= XTENSA_OP_ILL
,
4894 .name
= "wsr.configid1",
4895 .op_flags
= XTENSA_OP_ILL
,
4897 .name
= "wsr.cpenable",
4898 .translate
= translate_wsr_mask
,
4899 .test_exceptions
= test_exceptions_sr
,
4900 .par
= (const uint32_t[]){
4902 XTENSA_OPTION_COPROCESSOR
,
4905 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4907 .name
= "wsr.dbreaka0",
4908 .translate
= translate_wsr_dbreaka
,
4909 .test_exceptions
= test_exceptions_dbreak
,
4910 .par
= (const uint32_t[]){
4912 XTENSA_OPTION_DEBUG
,
4914 .op_flags
= XTENSA_OP_PRIVILEGED
,
4916 .name
= "wsr.dbreaka1",
4917 .translate
= translate_wsr_dbreaka
,
4918 .test_exceptions
= test_exceptions_dbreak
,
4919 .par
= (const uint32_t[]){
4921 XTENSA_OPTION_DEBUG
,
4923 .op_flags
= XTENSA_OP_PRIVILEGED
,
4925 .name
= "wsr.dbreakc0",
4926 .translate
= translate_wsr_dbreakc
,
4927 .test_exceptions
= test_exceptions_dbreak
,
4928 .par
= (const uint32_t[]){
4930 XTENSA_OPTION_DEBUG
,
4932 .op_flags
= XTENSA_OP_PRIVILEGED
,
4934 .name
= "wsr.dbreakc1",
4935 .translate
= translate_wsr_dbreakc
,
4936 .test_exceptions
= test_exceptions_dbreak
,
4937 .par
= (const uint32_t[]){
4939 XTENSA_OPTION_DEBUG
,
4941 .op_flags
= XTENSA_OP_PRIVILEGED
,
4944 .translate
= translate_wsr
,
4945 .test_exceptions
= test_exceptions_sr
,
4946 .par
= (const uint32_t[]){
4948 XTENSA_OPTION_DEBUG
,
4950 .op_flags
= XTENSA_OP_PRIVILEGED
,
4952 .name
= "wsr.debugcause",
4953 .op_flags
= XTENSA_OP_ILL
,
4956 .translate
= translate_wsr
,
4957 .test_exceptions
= test_exceptions_sr
,
4958 .par
= (const uint32_t[]){
4960 XTENSA_OPTION_EXCEPTION
,
4962 .op_flags
= XTENSA_OP_PRIVILEGED
,
4964 .name
= "wsr.dtlbcfg",
4965 .translate
= translate_wsr_mask
,
4966 .test_exceptions
= test_exceptions_sr
,
4967 .par
= (const uint32_t[]){
4972 .op_flags
= XTENSA_OP_PRIVILEGED
,
4975 .translate
= translate_wsr
,
4976 .test_exceptions
= test_exceptions_sr
,
4977 .par
= (const uint32_t[]){
4979 XTENSA_OPTION_EXCEPTION
,
4981 .op_flags
= XTENSA_OP_PRIVILEGED
,
4984 .translate
= translate_wsr
,
4985 .test_exceptions
= test_exceptions_hpi
,
4986 .par
= (const uint32_t[]){
4988 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4990 .op_flags
= XTENSA_OP_PRIVILEGED
,
4993 .translate
= translate_wsr
,
4994 .test_exceptions
= test_exceptions_hpi
,
4995 .par
= (const uint32_t[]){
4997 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4999 .op_flags
= XTENSA_OP_PRIVILEGED
,
5002 .translate
= translate_wsr
,
5003 .test_exceptions
= test_exceptions_hpi
,
5004 .par
= (const uint32_t[]){
5006 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5008 .op_flags
= XTENSA_OP_PRIVILEGED
,
5011 .translate
= translate_wsr
,
5012 .test_exceptions
= test_exceptions_hpi
,
5013 .par
= (const uint32_t[]){
5015 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5017 .op_flags
= XTENSA_OP_PRIVILEGED
,
5020 .translate
= translate_wsr
,
5021 .test_exceptions
= test_exceptions_hpi
,
5022 .par
= (const uint32_t[]){
5024 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5026 .op_flags
= XTENSA_OP_PRIVILEGED
,
5029 .translate
= translate_wsr
,
5030 .test_exceptions
= test_exceptions_hpi
,
5031 .par
= (const uint32_t[]){
5033 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5035 .op_flags
= XTENSA_OP_PRIVILEGED
,
5038 .translate
= translate_wsr
,
5039 .test_exceptions
= test_exceptions_hpi
,
5040 .par
= (const uint32_t[]){
5042 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5044 .op_flags
= XTENSA_OP_PRIVILEGED
,
5047 .translate
= translate_wsr
,
5048 .test_exceptions
= test_exceptions_hpi
,
5049 .par
= (const uint32_t[]){
5051 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5053 .op_flags
= XTENSA_OP_PRIVILEGED
,
5056 .translate
= translate_wsr
,
5057 .test_exceptions
= test_exceptions_hpi
,
5058 .par
= (const uint32_t[]){
5060 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5062 .op_flags
= XTENSA_OP_PRIVILEGED
,
5065 .translate
= translate_wsr
,
5066 .test_exceptions
= test_exceptions_hpi
,
5067 .par
= (const uint32_t[]){
5069 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5071 .op_flags
= XTENSA_OP_PRIVILEGED
,
5074 .translate
= translate_wsr
,
5075 .test_exceptions
= test_exceptions_hpi
,
5076 .par
= (const uint32_t[]){
5078 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5080 .op_flags
= XTENSA_OP_PRIVILEGED
,
5083 .translate
= translate_wsr
,
5084 .test_exceptions
= test_exceptions_hpi
,
5085 .par
= (const uint32_t[]){
5087 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5089 .op_flags
= XTENSA_OP_PRIVILEGED
,
5091 .name
= "wsr.eraccess",
5092 .translate
= translate_wsr_mask
,
5093 .par
= (const uint32_t[]){
5098 .op_flags
= XTENSA_OP_PRIVILEGED
,
5100 .name
= "wsr.exccause",
5101 .translate
= translate_wsr
,
5102 .test_exceptions
= test_exceptions_sr
,
5103 .par
= (const uint32_t[]){
5105 XTENSA_OPTION_EXCEPTION
,
5107 .op_flags
= XTENSA_OP_PRIVILEGED
,
5109 .name
= "wsr.excsave1",
5110 .translate
= translate_wsr
,
5111 .test_exceptions
= test_exceptions_sr
,
5112 .par
= (const uint32_t[]){
5114 XTENSA_OPTION_EXCEPTION
,
5116 .op_flags
= XTENSA_OP_PRIVILEGED
,
5118 .name
= "wsr.excsave2",
5119 .translate
= translate_wsr
,
5120 .test_exceptions
= test_exceptions_hpi
,
5121 .par
= (const uint32_t[]){
5123 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5125 .op_flags
= XTENSA_OP_PRIVILEGED
,
5127 .name
= "wsr.excsave3",
5128 .translate
= translate_wsr
,
5129 .test_exceptions
= test_exceptions_hpi
,
5130 .par
= (const uint32_t[]){
5132 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5134 .op_flags
= XTENSA_OP_PRIVILEGED
,
5136 .name
= "wsr.excsave4",
5137 .translate
= translate_wsr
,
5138 .test_exceptions
= test_exceptions_hpi
,
5139 .par
= (const uint32_t[]){
5141 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5143 .op_flags
= XTENSA_OP_PRIVILEGED
,
5145 .name
= "wsr.excsave5",
5146 .translate
= translate_wsr
,
5147 .test_exceptions
= test_exceptions_hpi
,
5148 .par
= (const uint32_t[]){
5150 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5152 .op_flags
= XTENSA_OP_PRIVILEGED
,
5154 .name
= "wsr.excsave6",
5155 .translate
= translate_wsr
,
5156 .test_exceptions
= test_exceptions_hpi
,
5157 .par
= (const uint32_t[]){
5159 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5161 .op_flags
= XTENSA_OP_PRIVILEGED
,
5163 .name
= "wsr.excsave7",
5164 .translate
= translate_wsr
,
5165 .test_exceptions
= test_exceptions_hpi
,
5166 .par
= (const uint32_t[]){
5168 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5170 .op_flags
= XTENSA_OP_PRIVILEGED
,
5172 .name
= "wsr.excvaddr",
5173 .translate
= translate_wsr
,
5174 .test_exceptions
= test_exceptions_sr
,
5175 .par
= (const uint32_t[]){
5177 XTENSA_OPTION_EXCEPTION
,
5179 .op_flags
= XTENSA_OP_PRIVILEGED
,
5181 .name
= "wsr.ibreaka0",
5182 .translate
= translate_wsr_ibreaka
,
5183 .test_exceptions
= test_exceptions_ibreak
,
5184 .par
= (const uint32_t[]){
5186 XTENSA_OPTION_DEBUG
,
5188 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5190 .name
= "wsr.ibreaka1",
5191 .translate
= translate_wsr_ibreaka
,
5192 .test_exceptions
= test_exceptions_ibreak
,
5193 .par
= (const uint32_t[]){
5195 XTENSA_OPTION_DEBUG
,
5197 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5199 .name
= "wsr.ibreakenable",
5200 .translate
= translate_wsr_ibreakenable
,
5201 .test_exceptions
= test_exceptions_sr
,
5202 .par
= (const uint32_t[]){
5204 XTENSA_OPTION_DEBUG
,
5206 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5208 .name
= "wsr.icount",
5209 .translate
= translate_wsr_icount
,
5210 .test_exceptions
= test_exceptions_sr
,
5211 .par
= (const uint32_t[]){
5213 XTENSA_OPTION_DEBUG
,
5215 .op_flags
= XTENSA_OP_PRIVILEGED
,
5217 .name
= "wsr.icountlevel",
5218 .translate
= translate_wsr_mask
,
5219 .test_exceptions
= test_exceptions_sr
,
5220 .par
= (const uint32_t[]){
5222 XTENSA_OPTION_DEBUG
,
5225 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5227 .name
= "wsr.intclear",
5228 .translate
= translate_wsr_intclear
,
5229 .test_exceptions
= test_exceptions_sr
,
5230 .par
= (const uint32_t[]){
5232 XTENSA_OPTION_INTERRUPT
,
5235 XTENSA_OP_PRIVILEGED
|
5236 XTENSA_OP_EXIT_TB_0
|
5237 XTENSA_OP_CHECK_INTERRUPTS
,
5239 .name
= "wsr.intenable",
5240 .translate
= translate_wsr
,
5241 .test_exceptions
= test_exceptions_sr
,
5242 .par
= (const uint32_t[]){
5244 XTENSA_OPTION_INTERRUPT
,
5247 XTENSA_OP_PRIVILEGED
|
5248 XTENSA_OP_EXIT_TB_0
|
5249 XTENSA_OP_CHECK_INTERRUPTS
,
5251 .name
= "wsr.interrupt",
5252 .translate
= translate_wsr
,
5253 .test_exceptions
= test_exceptions_sr
,
5254 .par
= (const uint32_t[]){
5256 XTENSA_OPTION_INTERRUPT
,
5259 XTENSA_OP_PRIVILEGED
|
5260 XTENSA_OP_EXIT_TB_0
|
5261 XTENSA_OP_CHECK_INTERRUPTS
,
5263 .name
= "wsr.intset",
5264 .translate
= translate_wsr_intset
,
5265 .test_exceptions
= test_exceptions_sr
,
5266 .par
= (const uint32_t[]){
5268 XTENSA_OPTION_INTERRUPT
,
5271 XTENSA_OP_PRIVILEGED
|
5272 XTENSA_OP_EXIT_TB_0
|
5273 XTENSA_OP_CHECK_INTERRUPTS
,
5275 .name
= "wsr.itlbcfg",
5276 .translate
= translate_wsr_mask
,
5277 .test_exceptions
= test_exceptions_sr
,
5278 .par
= (const uint32_t[]){
5283 .op_flags
= XTENSA_OP_PRIVILEGED
,
5286 .translate
= translate_wsr
,
5287 .test_exceptions
= test_exceptions_sr
,
5288 .par
= (const uint32_t[]){
5292 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5294 .name
= "wsr.lcount",
5295 .translate
= translate_wsr
,
5296 .test_exceptions
= test_exceptions_sr
,
5297 .par
= (const uint32_t[]){
5303 .translate
= translate_wsr
,
5304 .test_exceptions
= test_exceptions_sr
,
5305 .par
= (const uint32_t[]){
5309 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5311 .name
= "wsr.litbase",
5312 .translate
= translate_wsr_mask
,
5313 .test_exceptions
= test_exceptions_sr
,
5314 .par
= (const uint32_t[]){
5316 XTENSA_OPTION_EXTENDED_L32R
,
5319 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5322 .translate
= translate_wsr
,
5323 .test_exceptions
= test_exceptions_sr
,
5324 .par
= (const uint32_t[]){
5326 XTENSA_OPTION_MAC16
,
5330 .translate
= translate_wsr
,
5331 .test_exceptions
= test_exceptions_sr
,
5332 .par
= (const uint32_t[]){
5334 XTENSA_OPTION_MAC16
,
5338 .translate
= translate_wsr
,
5339 .test_exceptions
= test_exceptions_sr
,
5340 .par
= (const uint32_t[]){
5342 XTENSA_OPTION_MAC16
,
5346 .translate
= translate_wsr
,
5347 .test_exceptions
= test_exceptions_sr
,
5348 .par
= (const uint32_t[]){
5350 XTENSA_OPTION_MAC16
,
5353 .name
= "wsr.memctl",
5354 .translate
= translate_wsr_memctl
,
5355 .par
= (const uint32_t[]){MEMCTL
},
5356 .op_flags
= XTENSA_OP_PRIVILEGED
,
5359 .translate
= translate_wsr
,
5360 .test_exceptions
= test_exceptions_sr
,
5361 .par
= (const uint32_t[]){
5363 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5365 .op_flags
= XTENSA_OP_PRIVILEGED
,
5368 .translate
= translate_wsr
,
5369 .test_exceptions
= test_exceptions_sr
,
5370 .par
= (const uint32_t[]){
5372 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5374 .op_flags
= XTENSA_OP_PRIVILEGED
,
5377 .translate
= translate_wsr
,
5378 .test_exceptions
= test_exceptions_sr
,
5379 .par
= (const uint32_t[]){
5381 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5383 .op_flags
= XTENSA_OP_PRIVILEGED
,
5385 .name
= "wsr.mesave",
5386 .translate
= translate_wsr
,
5387 .test_exceptions
= test_exceptions_sr
,
5388 .par
= (const uint32_t[]){
5390 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5392 .op_flags
= XTENSA_OP_PRIVILEGED
,
5395 .translate
= translate_wsr
,
5396 .test_exceptions
= test_exceptions_sr
,
5397 .par
= (const uint32_t[]){
5399 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5401 .op_flags
= XTENSA_OP_PRIVILEGED
,
5403 .name
= "wsr.mevaddr",
5404 .translate
= translate_wsr
,
5405 .test_exceptions
= test_exceptions_sr
,
5406 .par
= (const uint32_t[]){
5408 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5410 .op_flags
= XTENSA_OP_PRIVILEGED
,
5412 .name
= "wsr.misc0",
5413 .translate
= translate_wsr
,
5414 .test_exceptions
= test_exceptions_sr
,
5415 .par
= (const uint32_t[]){
5417 XTENSA_OPTION_MISC_SR
,
5419 .op_flags
= XTENSA_OP_PRIVILEGED
,
5421 .name
= "wsr.misc1",
5422 .translate
= translate_wsr
,
5423 .test_exceptions
= test_exceptions_sr
,
5424 .par
= (const uint32_t[]){
5426 XTENSA_OPTION_MISC_SR
,
5428 .op_flags
= XTENSA_OP_PRIVILEGED
,
5430 .name
= "wsr.misc2",
5431 .translate
= translate_wsr
,
5432 .test_exceptions
= test_exceptions_sr
,
5433 .par
= (const uint32_t[]){
5435 XTENSA_OPTION_MISC_SR
,
5437 .op_flags
= XTENSA_OP_PRIVILEGED
,
5439 .name
= "wsr.misc3",
5440 .translate
= translate_wsr
,
5441 .test_exceptions
= test_exceptions_sr
,
5442 .par
= (const uint32_t[]){
5444 XTENSA_OPTION_MISC_SR
,
5446 .op_flags
= XTENSA_OP_PRIVILEGED
,
5449 .translate
= translate_wsr
,
5450 .test_exceptions
= test_exceptions_sr
,
5451 .par
= (const uint32_t[]){
5453 XTENSA_OPTION_TRACE_PORT
,
5455 .op_flags
= XTENSA_OP_PRIVILEGED
,
5457 .name
= "wsr.mpuenb",
5458 .translate
= translate_wsr_mpuenb
,
5459 .test_exceptions
= test_exceptions_sr
,
5460 .par
= (const uint32_t[]){
5464 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5466 .name
= "wsr.prefctl",
5467 .translate
= translate_wsr
,
5468 .par
= (const uint32_t[]){PREFCTL
},
5471 .op_flags
= XTENSA_OP_ILL
,
5474 .translate
= translate_wsr_ps
,
5475 .test_exceptions
= test_exceptions_sr
,
5476 .par
= (const uint32_t[]){
5478 XTENSA_OPTION_EXCEPTION
,
5481 XTENSA_OP_PRIVILEGED
|
5482 XTENSA_OP_EXIT_TB_M1
|
5483 XTENSA_OP_CHECK_INTERRUPTS
,
5485 .name
= "wsr.ptevaddr",
5486 .translate
= translate_wsr_mask
,
5487 .test_exceptions
= test_exceptions_sr
,
5488 .par
= (const uint32_t[]){
5493 .op_flags
= XTENSA_OP_PRIVILEGED
,
5495 .name
= "wsr.rasid",
5496 .translate
= translate_wsr_rasid
,
5497 .test_exceptions
= test_exceptions_sr
,
5498 .par
= (const uint32_t[]){
5502 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5505 .translate
= translate_wsr_sar
,
5506 .par
= (const uint32_t[]){SAR
},
5508 .name
= "wsr.scompare1",
5509 .translate
= translate_wsr
,
5510 .test_exceptions
= test_exceptions_sr
,
5511 .par
= (const uint32_t[]){
5513 XTENSA_OPTION_CONDITIONAL_STORE
,
5516 .name
= "wsr.vecbase",
5517 .translate
= translate_wsr
,
5518 .test_exceptions
= test_exceptions_sr
,
5519 .par
= (const uint32_t[]){
5521 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5523 .op_flags
= XTENSA_OP_PRIVILEGED
,
5525 .name
= "wsr.windowbase",
5526 .translate
= translate_wsr_windowbase
,
5527 .test_exceptions
= test_exceptions_sr
,
5528 .par
= (const uint32_t[]){
5530 XTENSA_OPTION_WINDOWED_REGISTER
,
5532 .op_flags
= XTENSA_OP_PRIVILEGED
|
5533 XTENSA_OP_EXIT_TB_M1
|
5534 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5536 .name
= "wsr.windowstart",
5537 .translate
= translate_wsr_windowstart
,
5538 .test_exceptions
= test_exceptions_sr
,
5539 .par
= (const uint32_t[]){
5541 XTENSA_OPTION_WINDOWED_REGISTER
,
5543 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5545 .name
= "wur.expstate",
5546 .translate
= translate_wur
,
5547 .par
= (const uint32_t[]){EXPSTATE
},
5549 .name
= "wur.threadptr",
5550 .translate
= translate_wur
,
5551 .par
= (const uint32_t[]){THREADPTR
},
5554 .translate
= translate_xor
,
5557 .translate
= translate_boolean
,
5558 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5561 .op_flags
= XTENSA_OP_ILL
,
5564 .op_flags
= XTENSA_OP_ILL
,
5566 .name
= "xsr.acchi",
5567 .translate
= translate_xsr_acchi
,
5568 .test_exceptions
= test_exceptions_sr
,
5569 .par
= (const uint32_t[]){
5571 XTENSA_OPTION_MAC16
,
5574 .name
= "xsr.acclo",
5575 .translate
= translate_xsr
,
5576 .test_exceptions
= test_exceptions_sr
,
5577 .par
= (const uint32_t[]){
5579 XTENSA_OPTION_MAC16
,
5582 .name
= "xsr.atomctl",
5583 .translate
= translate_xsr_mask
,
5584 .test_exceptions
= test_exceptions_sr
,
5585 .par
= (const uint32_t[]){
5587 XTENSA_OPTION_ATOMCTL
,
5590 .op_flags
= XTENSA_OP_PRIVILEGED
,
5593 .translate
= translate_xsr_mask
,
5594 .test_exceptions
= test_exceptions_sr
,
5595 .par
= (const uint32_t[]){
5597 XTENSA_OPTION_BOOLEAN
,
5601 .name
= "xsr.cacheadrdis",
5602 .translate
= translate_xsr_mask
,
5603 .test_exceptions
= test_exceptions_sr
,
5604 .par
= (const uint32_t[]){
5609 .op_flags
= XTENSA_OP_PRIVILEGED
,
5611 .name
= "xsr.cacheattr",
5612 .translate
= translate_xsr
,
5613 .test_exceptions
= test_exceptions_sr
,
5614 .par
= (const uint32_t[]){
5616 XTENSA_OPTION_CACHEATTR
,
5618 .op_flags
= XTENSA_OP_PRIVILEGED
,
5620 .name
= "xsr.ccompare0",
5621 .translate
= translate_xsr_ccompare
,
5622 .test_exceptions
= test_exceptions_ccompare
,
5623 .par
= (const uint32_t[]){
5625 XTENSA_OPTION_TIMER_INTERRUPT
,
5627 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5629 .name
= "xsr.ccompare1",
5630 .translate
= translate_xsr_ccompare
,
5631 .test_exceptions
= test_exceptions_ccompare
,
5632 .par
= (const uint32_t[]){
5634 XTENSA_OPTION_TIMER_INTERRUPT
,
5636 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5638 .name
= "xsr.ccompare2",
5639 .translate
= translate_xsr_ccompare
,
5640 .test_exceptions
= test_exceptions_ccompare
,
5641 .par
= (const uint32_t[]){
5643 XTENSA_OPTION_TIMER_INTERRUPT
,
5645 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5647 .name
= "xsr.ccount",
5648 .translate
= translate_xsr_ccount
,
5649 .test_exceptions
= test_exceptions_sr
,
5650 .par
= (const uint32_t[]){
5652 XTENSA_OPTION_TIMER_INTERRUPT
,
5654 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5656 .name
= "xsr.configid0",
5657 .op_flags
= XTENSA_OP_ILL
,
5659 .name
= "xsr.configid1",
5660 .op_flags
= XTENSA_OP_ILL
,
5662 .name
= "xsr.cpenable",
5663 .translate
= translate_xsr_mask
,
5664 .test_exceptions
= test_exceptions_sr
,
5665 .par
= (const uint32_t[]){
5667 XTENSA_OPTION_COPROCESSOR
,
5670 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5672 .name
= "xsr.dbreaka0",
5673 .translate
= translate_xsr_dbreaka
,
5674 .test_exceptions
= test_exceptions_dbreak
,
5675 .par
= (const uint32_t[]){
5677 XTENSA_OPTION_DEBUG
,
5679 .op_flags
= XTENSA_OP_PRIVILEGED
,
5681 .name
= "xsr.dbreaka1",
5682 .translate
= translate_xsr_dbreaka
,
5683 .test_exceptions
= test_exceptions_dbreak
,
5684 .par
= (const uint32_t[]){
5686 XTENSA_OPTION_DEBUG
,
5688 .op_flags
= XTENSA_OP_PRIVILEGED
,
5690 .name
= "xsr.dbreakc0",
5691 .translate
= translate_xsr_dbreakc
,
5692 .test_exceptions
= test_exceptions_dbreak
,
5693 .par
= (const uint32_t[]){
5695 XTENSA_OPTION_DEBUG
,
5697 .op_flags
= XTENSA_OP_PRIVILEGED
,
5699 .name
= "xsr.dbreakc1",
5700 .translate
= translate_xsr_dbreakc
,
5701 .test_exceptions
= test_exceptions_dbreak
,
5702 .par
= (const uint32_t[]){
5704 XTENSA_OPTION_DEBUG
,
5706 .op_flags
= XTENSA_OP_PRIVILEGED
,
5709 .translate
= translate_xsr
,
5710 .test_exceptions
= test_exceptions_sr
,
5711 .par
= (const uint32_t[]){
5713 XTENSA_OPTION_DEBUG
,
5715 .op_flags
= XTENSA_OP_PRIVILEGED
,
5717 .name
= "xsr.debugcause",
5718 .op_flags
= XTENSA_OP_ILL
,
5721 .translate
= translate_xsr
,
5722 .test_exceptions
= test_exceptions_sr
,
5723 .par
= (const uint32_t[]){
5725 XTENSA_OPTION_EXCEPTION
,
5727 .op_flags
= XTENSA_OP_PRIVILEGED
,
5729 .name
= "xsr.dtlbcfg",
5730 .translate
= translate_xsr_mask
,
5731 .test_exceptions
= test_exceptions_sr
,
5732 .par
= (const uint32_t[]){
5737 .op_flags
= XTENSA_OP_PRIVILEGED
,
5740 .translate
= translate_xsr
,
5741 .test_exceptions
= test_exceptions_sr
,
5742 .par
= (const uint32_t[]){
5744 XTENSA_OPTION_EXCEPTION
,
5746 .op_flags
= XTENSA_OP_PRIVILEGED
,
5749 .translate
= translate_xsr
,
5750 .test_exceptions
= test_exceptions_hpi
,
5751 .par
= (const uint32_t[]){
5753 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5755 .op_flags
= XTENSA_OP_PRIVILEGED
,
5758 .translate
= translate_xsr
,
5759 .test_exceptions
= test_exceptions_hpi
,
5760 .par
= (const uint32_t[]){
5762 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5764 .op_flags
= XTENSA_OP_PRIVILEGED
,
5767 .translate
= translate_xsr
,
5768 .test_exceptions
= test_exceptions_hpi
,
5769 .par
= (const uint32_t[]){
5771 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5773 .op_flags
= XTENSA_OP_PRIVILEGED
,
5776 .translate
= translate_xsr
,
5777 .test_exceptions
= test_exceptions_hpi
,
5778 .par
= (const uint32_t[]){
5780 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5782 .op_flags
= XTENSA_OP_PRIVILEGED
,
5785 .translate
= translate_xsr
,
5786 .test_exceptions
= test_exceptions_hpi
,
5787 .par
= (const uint32_t[]){
5789 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5791 .op_flags
= XTENSA_OP_PRIVILEGED
,
5794 .translate
= translate_xsr
,
5795 .test_exceptions
= test_exceptions_hpi
,
5796 .par
= (const uint32_t[]){
5798 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5800 .op_flags
= XTENSA_OP_PRIVILEGED
,
5803 .translate
= translate_xsr
,
5804 .test_exceptions
= test_exceptions_hpi
,
5805 .par
= (const uint32_t[]){
5807 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5809 .op_flags
= XTENSA_OP_PRIVILEGED
,
5812 .translate
= translate_xsr
,
5813 .test_exceptions
= test_exceptions_hpi
,
5814 .par
= (const uint32_t[]){
5816 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5818 .op_flags
= XTENSA_OP_PRIVILEGED
,
5821 .translate
= translate_xsr
,
5822 .test_exceptions
= test_exceptions_hpi
,
5823 .par
= (const uint32_t[]){
5825 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5827 .op_flags
= XTENSA_OP_PRIVILEGED
,
5830 .translate
= translate_xsr
,
5831 .test_exceptions
= test_exceptions_hpi
,
5832 .par
= (const uint32_t[]){
5834 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5836 .op_flags
= XTENSA_OP_PRIVILEGED
,
5839 .translate
= translate_xsr
,
5840 .test_exceptions
= test_exceptions_hpi
,
5841 .par
= (const uint32_t[]){
5843 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5845 .op_flags
= XTENSA_OP_PRIVILEGED
,
5848 .translate
= translate_xsr
,
5849 .test_exceptions
= test_exceptions_hpi
,
5850 .par
= (const uint32_t[]){
5852 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5854 .op_flags
= XTENSA_OP_PRIVILEGED
,
5856 .name
= "xsr.eraccess",
5857 .translate
= translate_xsr_mask
,
5858 .par
= (const uint32_t[]){
5863 .op_flags
= XTENSA_OP_PRIVILEGED
,
5865 .name
= "xsr.exccause",
5866 .translate
= translate_xsr
,
5867 .test_exceptions
= test_exceptions_sr
,
5868 .par
= (const uint32_t[]){
5870 XTENSA_OPTION_EXCEPTION
,
5872 .op_flags
= XTENSA_OP_PRIVILEGED
,
5874 .name
= "xsr.excsave1",
5875 .translate
= translate_xsr
,
5876 .test_exceptions
= test_exceptions_sr
,
5877 .par
= (const uint32_t[]){
5879 XTENSA_OPTION_EXCEPTION
,
5881 .op_flags
= XTENSA_OP_PRIVILEGED
,
5883 .name
= "xsr.excsave2",
5884 .translate
= translate_xsr
,
5885 .test_exceptions
= test_exceptions_hpi
,
5886 .par
= (const uint32_t[]){
5888 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5890 .op_flags
= XTENSA_OP_PRIVILEGED
,
5892 .name
= "xsr.excsave3",
5893 .translate
= translate_xsr
,
5894 .test_exceptions
= test_exceptions_hpi
,
5895 .par
= (const uint32_t[]){
5897 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5899 .op_flags
= XTENSA_OP_PRIVILEGED
,
5901 .name
= "xsr.excsave4",
5902 .translate
= translate_xsr
,
5903 .test_exceptions
= test_exceptions_hpi
,
5904 .par
= (const uint32_t[]){
5906 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5908 .op_flags
= XTENSA_OP_PRIVILEGED
,
5910 .name
= "xsr.excsave5",
5911 .translate
= translate_xsr
,
5912 .test_exceptions
= test_exceptions_hpi
,
5913 .par
= (const uint32_t[]){
5915 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5917 .op_flags
= XTENSA_OP_PRIVILEGED
,
5919 .name
= "xsr.excsave6",
5920 .translate
= translate_xsr
,
5921 .test_exceptions
= test_exceptions_hpi
,
5922 .par
= (const uint32_t[]){
5924 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5926 .op_flags
= XTENSA_OP_PRIVILEGED
,
5928 .name
= "xsr.excsave7",
5929 .translate
= translate_xsr
,
5930 .test_exceptions
= test_exceptions_hpi
,
5931 .par
= (const uint32_t[]){
5933 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5935 .op_flags
= XTENSA_OP_PRIVILEGED
,
5937 .name
= "xsr.excvaddr",
5938 .translate
= translate_xsr
,
5939 .test_exceptions
= test_exceptions_sr
,
5940 .par
= (const uint32_t[]){
5942 XTENSA_OPTION_EXCEPTION
,
5944 .op_flags
= XTENSA_OP_PRIVILEGED
,
5946 .name
= "xsr.ibreaka0",
5947 .translate
= translate_xsr_ibreaka
,
5948 .test_exceptions
= test_exceptions_ibreak
,
5949 .par
= (const uint32_t[]){
5951 XTENSA_OPTION_DEBUG
,
5953 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5955 .name
= "xsr.ibreaka1",
5956 .translate
= translate_xsr_ibreaka
,
5957 .test_exceptions
= test_exceptions_ibreak
,
5958 .par
= (const uint32_t[]){
5960 XTENSA_OPTION_DEBUG
,
5962 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5964 .name
= "xsr.ibreakenable",
5965 .translate
= translate_xsr_ibreakenable
,
5966 .test_exceptions
= test_exceptions_sr
,
5967 .par
= (const uint32_t[]){
5969 XTENSA_OPTION_DEBUG
,
5971 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5973 .name
= "xsr.icount",
5974 .translate
= translate_xsr_icount
,
5975 .test_exceptions
= test_exceptions_sr
,
5976 .par
= (const uint32_t[]){
5978 XTENSA_OPTION_DEBUG
,
5980 .op_flags
= XTENSA_OP_PRIVILEGED
,
5982 .name
= "xsr.icountlevel",
5983 .translate
= translate_xsr_mask
,
5984 .test_exceptions
= test_exceptions_sr
,
5985 .par
= (const uint32_t[]){
5987 XTENSA_OPTION_DEBUG
,
5990 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5992 .name
= "xsr.intclear",
5993 .op_flags
= XTENSA_OP_ILL
,
5995 .name
= "xsr.intenable",
5996 .translate
= translate_xsr
,
5997 .test_exceptions
= test_exceptions_sr
,
5998 .par
= (const uint32_t[]){
6000 XTENSA_OPTION_INTERRUPT
,
6003 XTENSA_OP_PRIVILEGED
|
6004 XTENSA_OP_EXIT_TB_0
|
6005 XTENSA_OP_CHECK_INTERRUPTS
,
6007 .name
= "xsr.interrupt",
6008 .op_flags
= XTENSA_OP_ILL
,
6010 .name
= "xsr.intset",
6011 .op_flags
= XTENSA_OP_ILL
,
6013 .name
= "xsr.itlbcfg",
6014 .translate
= translate_xsr_mask
,
6015 .test_exceptions
= test_exceptions_sr
,
6016 .par
= (const uint32_t[]){
6021 .op_flags
= XTENSA_OP_PRIVILEGED
,
6024 .translate
= translate_xsr
,
6025 .test_exceptions
= test_exceptions_sr
,
6026 .par
= (const uint32_t[]){
6030 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6032 .name
= "xsr.lcount",
6033 .translate
= translate_xsr
,
6034 .test_exceptions
= test_exceptions_sr
,
6035 .par
= (const uint32_t[]){
6041 .translate
= translate_xsr
,
6042 .test_exceptions
= test_exceptions_sr
,
6043 .par
= (const uint32_t[]){
6047 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6049 .name
= "xsr.litbase",
6050 .translate
= translate_xsr_mask
,
6051 .test_exceptions
= test_exceptions_sr
,
6052 .par
= (const uint32_t[]){
6054 XTENSA_OPTION_EXTENDED_L32R
,
6057 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6060 .translate
= translate_xsr
,
6061 .test_exceptions
= test_exceptions_sr
,
6062 .par
= (const uint32_t[]){
6064 XTENSA_OPTION_MAC16
,
6068 .translate
= translate_xsr
,
6069 .test_exceptions
= test_exceptions_sr
,
6070 .par
= (const uint32_t[]){
6072 XTENSA_OPTION_MAC16
,
6076 .translate
= translate_xsr
,
6077 .test_exceptions
= test_exceptions_sr
,
6078 .par
= (const uint32_t[]){
6080 XTENSA_OPTION_MAC16
,
6084 .translate
= translate_xsr
,
6085 .test_exceptions
= test_exceptions_sr
,
6086 .par
= (const uint32_t[]){
6088 XTENSA_OPTION_MAC16
,
6091 .name
= "xsr.memctl",
6092 .translate
= translate_xsr_memctl
,
6093 .par
= (const uint32_t[]){MEMCTL
},
6094 .op_flags
= XTENSA_OP_PRIVILEGED
,
6097 .translate
= translate_xsr
,
6098 .test_exceptions
= test_exceptions_sr
,
6099 .par
= (const uint32_t[]){
6101 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6103 .op_flags
= XTENSA_OP_PRIVILEGED
,
6106 .translate
= translate_xsr
,
6107 .test_exceptions
= test_exceptions_sr
,
6108 .par
= (const uint32_t[]){
6110 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6112 .op_flags
= XTENSA_OP_PRIVILEGED
,
6115 .translate
= translate_xsr
,
6116 .test_exceptions
= test_exceptions_sr
,
6117 .par
= (const uint32_t[]){
6119 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6121 .op_flags
= XTENSA_OP_PRIVILEGED
,
6123 .name
= "xsr.mesave",
6124 .translate
= translate_xsr
,
6125 .test_exceptions
= test_exceptions_sr
,
6126 .par
= (const uint32_t[]){
6128 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6130 .op_flags
= XTENSA_OP_PRIVILEGED
,
6133 .translate
= translate_xsr
,
6134 .test_exceptions
= test_exceptions_sr
,
6135 .par
= (const uint32_t[]){
6137 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6139 .op_flags
= XTENSA_OP_PRIVILEGED
,
6141 .name
= "xsr.mevaddr",
6142 .translate
= translate_xsr
,
6143 .test_exceptions
= test_exceptions_sr
,
6144 .par
= (const uint32_t[]){
6146 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6148 .op_flags
= XTENSA_OP_PRIVILEGED
,
6150 .name
= "xsr.misc0",
6151 .translate
= translate_xsr
,
6152 .test_exceptions
= test_exceptions_sr
,
6153 .par
= (const uint32_t[]){
6155 XTENSA_OPTION_MISC_SR
,
6157 .op_flags
= XTENSA_OP_PRIVILEGED
,
6159 .name
= "xsr.misc1",
6160 .translate
= translate_xsr
,
6161 .test_exceptions
= test_exceptions_sr
,
6162 .par
= (const uint32_t[]){
6164 XTENSA_OPTION_MISC_SR
,
6166 .op_flags
= XTENSA_OP_PRIVILEGED
,
6168 .name
= "xsr.misc2",
6169 .translate
= translate_xsr
,
6170 .test_exceptions
= test_exceptions_sr
,
6171 .par
= (const uint32_t[]){
6173 XTENSA_OPTION_MISC_SR
,
6175 .op_flags
= XTENSA_OP_PRIVILEGED
,
6177 .name
= "xsr.misc3",
6178 .translate
= translate_xsr
,
6179 .test_exceptions
= test_exceptions_sr
,
6180 .par
= (const uint32_t[]){
6182 XTENSA_OPTION_MISC_SR
,
6184 .op_flags
= XTENSA_OP_PRIVILEGED
,
6186 .name
= "xsr.mpuenb",
6187 .translate
= translate_xsr_mpuenb
,
6188 .test_exceptions
= test_exceptions_sr
,
6189 .par
= (const uint32_t[]){
6193 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6195 .name
= "xsr.prefctl",
6196 .translate
= translate_xsr
,
6197 .par
= (const uint32_t[]){PREFCTL
},
6200 .op_flags
= XTENSA_OP_ILL
,
6203 .translate
= translate_xsr_ps
,
6204 .test_exceptions
= test_exceptions_sr
,
6205 .par
= (const uint32_t[]){
6207 XTENSA_OPTION_EXCEPTION
,
6210 XTENSA_OP_PRIVILEGED
|
6211 XTENSA_OP_EXIT_TB_M1
|
6212 XTENSA_OP_CHECK_INTERRUPTS
,
6214 .name
= "xsr.ptevaddr",
6215 .translate
= translate_xsr_mask
,
6216 .test_exceptions
= test_exceptions_sr
,
6217 .par
= (const uint32_t[]){
6222 .op_flags
= XTENSA_OP_PRIVILEGED
,
6224 .name
= "xsr.rasid",
6225 .translate
= translate_xsr_rasid
,
6226 .test_exceptions
= test_exceptions_sr
,
6227 .par
= (const uint32_t[]){
6231 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6234 .translate
= translate_xsr_sar
,
6235 .par
= (const uint32_t[]){SAR
},
6237 .name
= "xsr.scompare1",
6238 .translate
= translate_xsr
,
6239 .test_exceptions
= test_exceptions_sr
,
6240 .par
= (const uint32_t[]){
6242 XTENSA_OPTION_CONDITIONAL_STORE
,
6245 .name
= "xsr.vecbase",
6246 .translate
= translate_xsr
,
6247 .test_exceptions
= test_exceptions_sr
,
6248 .par
= (const uint32_t[]){
6250 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6252 .op_flags
= XTENSA_OP_PRIVILEGED
,
6254 .name
= "xsr.windowbase",
6255 .translate
= translate_xsr_windowbase
,
6256 .test_exceptions
= test_exceptions_sr
,
6257 .par
= (const uint32_t[]){
6259 XTENSA_OPTION_WINDOWED_REGISTER
,
6261 .op_flags
= XTENSA_OP_PRIVILEGED
|
6262 XTENSA_OP_EXIT_TB_M1
|
6263 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6265 .name
= "xsr.windowstart",
6266 .translate
= translate_xsr_windowstart
,
6267 .test_exceptions
= test_exceptions_sr
,
6268 .par
= (const uint32_t[]){
6270 XTENSA_OPTION_WINDOWED_REGISTER
,
6272 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6276 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6277 .num_opcodes
= ARRAY_SIZE(core_ops
),
6282 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6283 int o0
, int i0
, int i1
, int i2
)
6285 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6286 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6288 arg32
[o0
].out
= tcg_temp_new_i32();
6291 arg32
[i0
].in
= tcg_temp_new_i32();
6292 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6295 arg32
[i1
].in
= tcg_temp_new_i32();
6296 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6299 arg32
[i2
].in
= tcg_temp_new_i32();
6300 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6304 arg32
[o0
].out
= arg
[o0
].out
;
6307 arg32
[i0
].in
= arg
[i0
].in
;
6310 arg32
[i1
].in
= arg
[i1
].in
;
6313 arg32
[i2
].in
= arg
[i2
].in
;
6318 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6319 int o0
, int i0
, int i1
, int i2
)
6321 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6322 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6324 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6325 tcg_temp_free_i32(arg32
[o0
].out
);
6328 tcg_temp_free_i32(arg32
[i0
].in
);
6331 tcg_temp_free_i32(arg32
[i1
].in
);
6334 tcg_temp_free_i32(arg32
[i2
].in
);
6339 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6340 int o0
, int i0
, int i1
)
6342 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6345 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6346 int o0
, int i0
, int i1
)
6348 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6351 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6354 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6357 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6360 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6363 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6366 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6369 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6372 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6375 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6378 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6381 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6384 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6387 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6390 get_f32_i2(arg
, arg32
, i0
, -1);
6393 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6396 put_f32_i2(arg
, arg32
, i0
, -1);
6400 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6401 const uint32_t par
[])
6403 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6406 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6407 const uint32_t par
[])
6411 get_f32_o1_i1(arg
, arg32
, 0, 1);
6412 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6413 put_f32_o1_i1(arg
, arg32
, 0, 1);
6416 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6417 const uint32_t par
[])
6419 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
6420 arg
[1].in
, arg
[2].in
);
6433 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6434 const uint32_t par
[])
6436 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6437 TCGv_i64 s
, TCGv_i64 t
) = {
6438 [COMPARE_UN
] = gen_helper_un_d
,
6439 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6440 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6441 [COMPARE_OLT
] = gen_helper_olt_d
,
6442 [COMPARE_ULT
] = gen_helper_ult_d
,
6443 [COMPARE_OLE
] = gen_helper_ole_d
,
6444 [COMPARE_ULE
] = gen_helper_ule_d
,
6446 TCGv_i32 zero
= tcg_const_i32(0);
6447 TCGv_i32 res
= tcg_temp_new_i32();
6448 TCGv_i32 set_br
= tcg_temp_new_i32();
6449 TCGv_i32 clr_br
= tcg_temp_new_i32();
6451 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6452 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6454 helper
[par
[0]](res
, cpu_env
, arg
[1].in
, arg
[2].in
);
6455 tcg_gen_movcond_i32(TCG_COND_NE
,
6456 arg
[0].out
, res
, zero
,
6458 tcg_temp_free(zero
);
6460 tcg_temp_free(set_br
);
6461 tcg_temp_free(clr_br
);
6464 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6465 const uint32_t par
[])
6467 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6468 TCGv_i32 s
, TCGv_i32 t
) = {
6469 [COMPARE_UN
] = gen_helper_un_s
,
6470 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6471 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6472 [COMPARE_OLT
] = gen_helper_olt_s
,
6473 [COMPARE_ULT
] = gen_helper_ult_s
,
6474 [COMPARE_OLE
] = gen_helper_ole_s
,
6475 [COMPARE_ULE
] = gen_helper_ule_s
,
6478 TCGv_i32 zero
= tcg_const_i32(0);
6479 TCGv_i32 res
= tcg_temp_new_i32();
6480 TCGv_i32 set_br
= tcg_temp_new_i32();
6481 TCGv_i32 clr_br
= tcg_temp_new_i32();
6483 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6484 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6486 get_f32_i2(arg
, arg32
, 1, 2);
6487 helper
[par
[0]](res
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
6488 tcg_gen_movcond_i32(TCG_COND_NE
,
6489 arg
[0].out
, res
, zero
,
6491 put_f32_i2(arg
, arg32
, 1, 2);
6492 tcg_temp_free(zero
);
6494 tcg_temp_free(set_br
);
6495 tcg_temp_free(clr_br
);
6498 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6499 const uint32_t par
[])
6501 static const uint64_t v
[] = {
6502 UINT64_C(0x0000000000000000),
6503 UINT64_C(0x3ff0000000000000),
6504 UINT64_C(0x4000000000000000),
6505 UINT64_C(0x3fe0000000000000),
6508 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6509 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6510 qemu_log_mask(LOG_GUEST_ERROR
,
6511 "const.d f%d, #%d, immediate value is reserved\n",
6512 arg
[0].imm
, arg
[1].imm
);
6516 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6517 const uint32_t par
[])
6519 static const uint32_t v
[] = {
6526 if (arg
[0].num_bits
== 32) {
6527 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6529 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6531 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6532 qemu_log_mask(LOG_GUEST_ERROR
,
6533 "const.s f%d, #%d, immediate value is reserved\n",
6534 arg
[0].imm
, arg
[1].imm
);
6538 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6539 const uint32_t par
[])
6541 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6544 gen_helper_uitof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6546 gen_helper_itof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6548 tcg_temp_free(scale
);
6551 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6552 const uint32_t par
[])
6554 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6557 get_f32_o1(arg
, arg32
, 0);
6559 gen_helper_uitof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6561 gen_helper_itof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6563 put_f32_o1(arg
, arg32
, 0);
6564 tcg_temp_free(scale
);
6567 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6568 const uint32_t par
[])
6570 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6571 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6574 gen_helper_ftoui_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6575 rounding_mode
, scale
);
6577 gen_helper_ftoi_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6578 rounding_mode
, scale
);
6580 tcg_temp_free(rounding_mode
);
6581 tcg_temp_free(scale
);
6584 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6585 const uint32_t par
[])
6587 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6588 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6591 get_f32_i1(arg
, arg32
, 1);
6593 gen_helper_ftoui_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6594 rounding_mode
, scale
);
6596 gen_helper_ftoi_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6597 rounding_mode
, scale
);
6599 put_f32_i1(arg
, arg32
, 1);
6600 tcg_temp_free(rounding_mode
);
6601 tcg_temp_free(scale
);
6604 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6605 const uint32_t par
[])
6607 TCGv_i32 addr
= tcg_temp_new_i32();
6610 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6611 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6613 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6615 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6618 tcg_gen_mov_i32(arg
[1].out
, addr
);
6620 tcg_temp_free(addr
);
6623 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6624 const uint32_t par
[])
6626 TCGv_i32 addr
= tcg_temp_new_i32();
6629 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6630 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6632 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6634 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6637 tcg_gen_mov_i32(arg
[1].out
, addr
);
6639 tcg_temp_free(addr
);
6642 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6643 const uint32_t par
[])
6645 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
6646 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6649 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6650 const uint32_t par
[])
6652 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6655 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6656 const uint32_t par
[])
6658 if (arg
[0].num_bits
== 32) {
6659 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6661 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6665 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6666 const uint32_t par
[])
6668 TCGv_i64 zero
= tcg_const_i64(0);
6669 TCGv_i64 arg2
= tcg_temp_new_i64();
6671 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6672 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6674 arg
[1].in
, arg
[0].in
);
6675 tcg_temp_free_i64(zero
);
6676 tcg_temp_free_i64(arg2
);
6679 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6680 const uint32_t par
[])
6682 if (arg
[0].num_bits
== 32) {
6683 TCGv_i32 zero
= tcg_const_i32(0);
6685 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6687 arg
[1].in
, arg
[0].in
);
6688 tcg_temp_free(zero
);
6690 translate_movcond_d(dc
, arg
, par
);
6694 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6695 const uint32_t par
[])
6697 TCGv_i64 zero
= tcg_const_i64(0);
6698 TCGv_i32 tmp1
= tcg_temp_new_i32();
6699 TCGv_i64 tmp2
= tcg_temp_new_i64();
6701 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6702 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6703 tcg_gen_movcond_i64(par
[0],
6704 arg
[0].out
, tmp2
, zero
,
6705 arg
[1].in
, arg
[0].in
);
6706 tcg_temp_free_i64(zero
);
6707 tcg_temp_free_i32(tmp1
);
6708 tcg_temp_free_i64(tmp2
);
6711 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6712 const uint32_t par
[])
6714 if (arg
[0].num_bits
== 32) {
6715 TCGv_i32 zero
= tcg_const_i32(0);
6716 TCGv_i32 tmp
= tcg_temp_new_i32();
6718 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6719 tcg_gen_movcond_i32(par
[0],
6720 arg
[0].out
, tmp
, zero
,
6721 arg
[1].in
, arg
[0].in
);
6723 tcg_temp_free(zero
);
6725 translate_movp_d(dc
, arg
, par
);
6729 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6730 const uint32_t par
[])
6732 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
6733 arg
[1].in
, arg
[2].in
);
6736 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6737 const uint32_t par
[])
6739 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
6740 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6743 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6744 const uint32_t par
[])
6746 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6749 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6750 const uint32_t par
[])
6754 get_f32_o1_i1(arg
, arg32
, 0, 1);
6755 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6756 put_f32_o1_i1(arg
, arg32
, 0, 1);
6759 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6760 const uint32_t par
[])
6762 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6765 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6766 const uint32_t par
[])
6768 if (arg
[1].num_bits
== 32) {
6769 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6771 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6775 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6776 const uint32_t par
[])
6778 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
6779 arg
[1].in
, arg
[2].in
);
6782 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6783 const uint32_t par
[])
6785 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6788 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6789 const uint32_t par
[])
6791 if (arg
[0].num_bits
== 32) {
6792 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6794 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6798 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6799 const uint32_t par
[])
6801 gen_helper_wur_fpu2k_fcr(cpu_env
, arg
[0].in
);
6804 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6805 const uint32_t par
[])
6807 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6810 static const XtensaOpcodeOps fpu2000_ops
[] = {
6813 .translate
= translate_abs_s
,
6817 .translate
= translate_fpu2k_add_s
,
6821 .translate
= translate_ftoi_s
,
6822 .par
= (const uint32_t[]){float_round_up
, false},
6826 .translate
= translate_float_s
,
6827 .par
= (const uint32_t[]){false},
6831 .translate
= translate_ftoi_s
,
6832 .par
= (const uint32_t[]){float_round_down
, false},
6836 .translate
= translate_ldsti
,
6837 .par
= (const uint32_t[]){false, false},
6838 .op_flags
= XTENSA_OP_LOAD
,
6842 .translate
= translate_ldsti
,
6843 .par
= (const uint32_t[]){false, true},
6844 .op_flags
= XTENSA_OP_LOAD
,
6848 .translate
= translate_ldstx
,
6849 .par
= (const uint32_t[]){false, false},
6850 .op_flags
= XTENSA_OP_LOAD
,
6854 .translate
= translate_ldstx
,
6855 .par
= (const uint32_t[]){false, true},
6856 .op_flags
= XTENSA_OP_LOAD
,
6860 .translate
= translate_fpu2k_madd_s
,
6864 .translate
= translate_mov_s
,
6868 .translate
= translate_movcond_s
,
6869 .par
= (const uint32_t[]){TCG_COND_EQ
},
6873 .translate
= translate_movp_s
,
6874 .par
= (const uint32_t[]){TCG_COND_EQ
},
6878 .translate
= translate_movcond_s
,
6879 .par
= (const uint32_t[]){TCG_COND_GE
},
6883 .translate
= translate_movcond_s
,
6884 .par
= (const uint32_t[]){TCG_COND_LT
},
6888 .translate
= translate_movcond_s
,
6889 .par
= (const uint32_t[]){TCG_COND_NE
},
6893 .translate
= translate_movp_s
,
6894 .par
= (const uint32_t[]){TCG_COND_NE
},
6898 .translate
= translate_fpu2k_msub_s
,
6902 .translate
= translate_fpu2k_mul_s
,
6906 .translate
= translate_neg_s
,
6910 .translate
= translate_compare_s
,
6911 .par
= (const uint32_t[]){COMPARE_OEQ
},
6915 .translate
= translate_compare_s
,
6916 .par
= (const uint32_t[]){COMPARE_OLE
},
6920 .translate
= translate_compare_s
,
6921 .par
= (const uint32_t[]){COMPARE_OLT
},
6925 .translate
= translate_rfr_s
,
6929 .translate
= translate_ftoi_s
,
6930 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6934 .translate
= translate_rur
,
6935 .par
= (const uint32_t[]){FCR
},
6939 .translate
= translate_rur
,
6940 .par
= (const uint32_t[]){FSR
},
6944 .translate
= translate_ldsti
,
6945 .par
= (const uint32_t[]){true, false},
6946 .op_flags
= XTENSA_OP_STORE
,
6950 .translate
= translate_ldsti
,
6951 .par
= (const uint32_t[]){true, true},
6952 .op_flags
= XTENSA_OP_STORE
,
6956 .translate
= translate_ldstx
,
6957 .par
= (const uint32_t[]){true, false},
6958 .op_flags
= XTENSA_OP_STORE
,
6962 .translate
= translate_ldstx
,
6963 .par
= (const uint32_t[]){true, true},
6964 .op_flags
= XTENSA_OP_STORE
,
6968 .translate
= translate_fpu2k_sub_s
,
6972 .translate
= translate_ftoi_s
,
6973 .par
= (const uint32_t[]){float_round_to_zero
, false},
6977 .translate
= translate_compare_s
,
6978 .par
= (const uint32_t[]){COMPARE_UEQ
},
6982 .translate
= translate_float_s
,
6983 .par
= (const uint32_t[]){true},
6987 .translate
= translate_compare_s
,
6988 .par
= (const uint32_t[]){COMPARE_ULE
},
6992 .translate
= translate_compare_s
,
6993 .par
= (const uint32_t[]){COMPARE_ULT
},
6997 .translate
= translate_compare_s
,
6998 .par
= (const uint32_t[]){COMPARE_UN
},
7002 .translate
= translate_ftoi_s
,
7003 .par
= (const uint32_t[]){float_round_to_zero
, true},
7007 .translate
= translate_wfr_s
,
7011 .translate
= translate_wur_fpu2k_fcr
,
7012 .par
= (const uint32_t[]){FCR
},
7016 .translate
= translate_wur_fpu2k_fsr
,
7017 .par
= (const uint32_t[]){FSR
},
7022 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
7023 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
7024 .opcode
= fpu2000_ops
,
7027 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
7028 const uint32_t par
[])
7030 gen_helper_add_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7033 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
7034 const uint32_t par
[])
7036 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7037 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
7038 arg
[1].in
, arg
[2].in
);
7042 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7043 gen_helper_add_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7044 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7048 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7049 const uint32_t par
[])
7051 TCGv_i32 v
= tcg_temp_new_i32();
7053 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
7054 gen_helper_cvtd_s(arg
[0].out
, cpu_env
, v
);
7055 tcg_temp_free_i32(v
);
7058 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
7059 const uint32_t par
[])
7061 TCGv_i32 v
= tcg_temp_new_i32();
7063 gen_helper_cvts_d(v
, cpu_env
, arg
[1].in
);
7064 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
7065 tcg_temp_free_i32(v
);
7068 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
7069 const uint32_t par
[])
7075 addr
= tcg_temp_new_i32();
7076 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7080 mop
= gen_load_store_alignment(dc
, MO_TEQ
, addr
);
7082 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
7084 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
7088 tcg_gen_mov_i32(arg
[1].out
, addr
);
7090 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7094 tcg_temp_free(addr
);
7098 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
7099 const uint32_t par
[])
7106 addr
= tcg_temp_new_i32();
7107 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7111 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
7113 get_f32_i1(arg
, arg32
, 0);
7114 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
7115 put_f32_i1(arg
, arg32
, 0);
7117 get_f32_o1(arg
, arg32
, 0);
7118 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
7119 put_f32_o1(arg
, arg32
, 0);
7123 tcg_gen_mov_i32(arg
[1].out
, addr
);
7125 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7129 tcg_temp_free(addr
);
7133 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
7134 const uint32_t par
[])
7140 addr
= tcg_temp_new_i32();
7141 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7145 mop
= gen_load_store_alignment(dc
, MO_TEQ
, addr
);
7147 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
7149 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
7153 tcg_gen_mov_i32(arg
[1].out
, addr
);
7155 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7159 tcg_temp_free(addr
);
7163 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
7164 const uint32_t par
[])
7171 addr
= tcg_temp_new_i32();
7172 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7176 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
7178 get_f32_i1(arg
, arg32
, 0);
7179 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
7180 put_f32_i1(arg
, arg32
, 0);
7182 get_f32_o1(arg
, arg32
, 0);
7183 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
7184 put_f32_o1(arg
, arg32
, 0);
7188 tcg_gen_mov_i32(arg
[1].out
, addr
);
7190 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7194 tcg_temp_free(addr
);
7198 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7199 const uint32_t par
[])
7201 gen_helper_madd_d(arg
[0].out
, cpu_env
,
7202 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7205 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7206 const uint32_t par
[])
7208 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7209 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
7210 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7214 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7215 gen_helper_madd_s(arg32
[0].out
, cpu_env
,
7216 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7217 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7221 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7222 const uint32_t par
[])
7224 gen_helper_mul_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7227 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7228 const uint32_t par
[])
7230 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7231 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
7232 arg
[1].in
, arg
[2].in
);
7236 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7237 gen_helper_mul_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7238 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7242 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7243 const uint32_t par
[])
7245 gen_helper_msub_d(arg
[0].out
, cpu_env
,
7246 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7249 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7250 const uint32_t par
[])
7252 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7253 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
7254 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7258 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7259 gen_helper_msub_s(arg32
[0].out
, cpu_env
,
7260 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7261 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7265 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7266 const uint32_t par
[])
7268 gen_helper_sub_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7271 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7272 const uint32_t par
[])
7274 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7275 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
7276 arg
[1].in
, arg
[2].in
);
7280 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7281 gen_helper_sub_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7282 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7286 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7287 const uint32_t par
[])
7289 gen_helper_mkdadj_d(arg
[0].out
, cpu_env
, arg
[0].in
, arg
[1].in
);
7292 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7293 const uint32_t par
[])
7297 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7298 gen_helper_mkdadj_s(arg32
[0].out
, cpu_env
, arg32
[0].in
, arg32
[1].in
);
7299 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7302 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7303 const uint32_t par
[])
7305 gen_helper_mksadj_d(arg
[0].out
, cpu_env
, arg
[1].in
);
7308 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7309 const uint32_t par
[])
7313 get_f32_o1_i1(arg
, arg32
, 0, 1);
7314 gen_helper_mksadj_s(arg32
[0].out
, cpu_env
, arg32
[1].in
);
7315 put_f32_o1_i1(arg
, arg32
, 0, 1);
7318 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7319 const uint32_t par
[])
7321 gen_helper_wur_fpu_fcr(cpu_env
, arg
[0].in
);
7324 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7325 const uint32_t par
[])
7327 gen_helper_rur_fpu_fsr(arg
[0].out
, cpu_env
);
7330 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7331 const uint32_t par
[])
7333 gen_helper_wur_fpu_fsr(cpu_env
, arg
[0].in
);
7336 static const XtensaOpcodeOps fpu_ops
[] = {
7339 .translate
= translate_abs_d
,
7343 .translate
= translate_abs_s
,
7347 .translate
= translate_add_d
,
7351 .translate
= translate_add_s
,
7355 .translate
= translate_nop
,
7359 .translate
= translate_nop
,
7362 .name
= "addexpm.d",
7363 .translate
= translate_mov_s
,
7366 .name
= "addexpm.s",
7367 .translate
= translate_mov_s
,
7371 .translate
= translate_ftoi_d
,
7372 .par
= (const uint32_t[]){float_round_up
, false},
7376 .translate
= translate_ftoi_s
,
7377 .par
= (const uint32_t[]){float_round_up
, false},
7381 .translate
= translate_const_d
,
7385 .translate
= translate_const_s
,
7389 .translate
= translate_cvtd_s
,
7393 .translate
= translate_cvts_d
,
7397 .translate
= translate_nop
,
7401 .translate
= translate_nop
,
7405 .translate
= translate_nop
,
7409 .translate
= translate_nop
,
7413 .translate
= translate_float_d
,
7414 .par
= (const uint32_t[]){false},
7418 .translate
= translate_float_s
,
7419 .par
= (const uint32_t[]){false},
7423 .translate
= translate_ftoi_d
,
7424 .par
= (const uint32_t[]){float_round_down
, false},
7428 .translate
= translate_ftoi_s
,
7429 .par
= (const uint32_t[]){float_round_down
, false},
7433 .translate
= translate_ldsti_d
,
7434 .par
= (const uint32_t[]){false, true, false},
7435 .op_flags
= XTENSA_OP_LOAD
,
7439 .translate
= translate_ldsti_d
,
7440 .par
= (const uint32_t[]){false, false, true},
7441 .op_flags
= XTENSA_OP_LOAD
,
7445 .translate
= translate_ldsti_d
,
7446 .par
= (const uint32_t[]){false, true, true},
7447 .op_flags
= XTENSA_OP_LOAD
,
7451 .translate
= translate_ldstx_d
,
7452 .par
= (const uint32_t[]){false, true, false},
7453 .op_flags
= XTENSA_OP_LOAD
,
7457 .translate
= translate_ldstx_d
,
7458 .par
= (const uint32_t[]){false, false, true},
7459 .op_flags
= XTENSA_OP_LOAD
,
7463 .translate
= translate_ldstx_d
,
7464 .par
= (const uint32_t[]){false, true, true},
7465 .op_flags
= XTENSA_OP_LOAD
,
7469 .translate
= translate_ldsti_s
,
7470 .par
= (const uint32_t[]){false, true, false},
7471 .op_flags
= XTENSA_OP_LOAD
,
7475 .translate
= translate_ldsti_s
,
7476 .par
= (const uint32_t[]){false, false, true},
7477 .op_flags
= XTENSA_OP_LOAD
,
7481 .translate
= translate_ldsti_s
,
7482 .par
= (const uint32_t[]){false, true, true},
7483 .op_flags
= XTENSA_OP_LOAD
,
7487 .translate
= translate_ldstx_s
,
7488 .par
= (const uint32_t[]){false, true, false},
7489 .op_flags
= XTENSA_OP_LOAD
,
7493 .translate
= translate_ldstx_s
,
7494 .par
= (const uint32_t[]){false, false, true},
7495 .op_flags
= XTENSA_OP_LOAD
,
7499 .translate
= translate_ldstx_s
,
7500 .par
= (const uint32_t[]){false, true, true},
7501 .op_flags
= XTENSA_OP_LOAD
,
7505 .translate
= translate_madd_d
,
7509 .translate
= translate_madd_s
,
7513 .translate
= translate_nop
,
7517 .translate
= translate_nop
,
7521 .translate
= translate_mkdadj_d
,
7525 .translate
= translate_mkdadj_s
,
7529 .translate
= translate_mksadj_d
,
7533 .translate
= translate_mksadj_s
,
7537 .translate
= translate_mov_d
,
7541 .translate
= translate_mov_s
,
7545 .translate
= translate_movcond_d
,
7546 .par
= (const uint32_t[]){TCG_COND_EQ
},
7550 .translate
= translate_movcond_s
,
7551 .par
= (const uint32_t[]){TCG_COND_EQ
},
7555 .translate
= translate_movp_d
,
7556 .par
= (const uint32_t[]){TCG_COND_EQ
},
7560 .translate
= translate_movp_s
,
7561 .par
= (const uint32_t[]){TCG_COND_EQ
},
7565 .translate
= translate_movcond_d
,
7566 .par
= (const uint32_t[]){TCG_COND_GE
},
7570 .translate
= translate_movcond_s
,
7571 .par
= (const uint32_t[]){TCG_COND_GE
},
7575 .translate
= translate_movcond_d
,
7576 .par
= (const uint32_t[]){TCG_COND_LT
},
7580 .translate
= translate_movcond_s
,
7581 .par
= (const uint32_t[]){TCG_COND_LT
},
7585 .translate
= translate_movcond_d
,
7586 .par
= (const uint32_t[]){TCG_COND_NE
},
7590 .translate
= translate_movcond_s
,
7591 .par
= (const uint32_t[]){TCG_COND_NE
},
7595 .translate
= translate_movp_d
,
7596 .par
= (const uint32_t[]){TCG_COND_NE
},
7600 .translate
= translate_movp_s
,
7601 .par
= (const uint32_t[]){TCG_COND_NE
},
7605 .translate
= translate_msub_d
,
7609 .translate
= translate_msub_s
,
7613 .translate
= translate_mul_d
,
7617 .translate
= translate_mul_s
,
7621 .translate
= translate_neg_d
,
7625 .translate
= translate_neg_s
,
7629 .translate
= translate_nop
,
7633 .translate
= translate_nop
,
7637 .translate
= translate_compare_d
,
7638 .par
= (const uint32_t[]){COMPARE_OEQ
},
7642 .translate
= translate_compare_s
,
7643 .par
= (const uint32_t[]){COMPARE_OEQ
},
7647 .translate
= translate_compare_d
,
7648 .par
= (const uint32_t[]){COMPARE_OLE
},
7652 .translate
= translate_compare_s
,
7653 .par
= (const uint32_t[]){COMPARE_OLE
},
7657 .translate
= translate_compare_d
,
7658 .par
= (const uint32_t[]){COMPARE_OLT
},
7662 .translate
= translate_compare_s
,
7663 .par
= (const uint32_t[]){COMPARE_OLT
},
7667 .translate
= translate_rfr_s
,
7671 .translate
= translate_rfr_d
,
7675 .translate
= translate_ftoi_d
,
7676 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7680 .translate
= translate_ftoi_s
,
7681 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7685 .translate
= translate_rur
,
7686 .par
= (const uint32_t[]){FCR
},
7690 .translate
= translate_rur_fpu_fsr
,
7694 .translate
= translate_ldsti_d
,
7695 .par
= (const uint32_t[]){true, true, false},
7696 .op_flags
= XTENSA_OP_STORE
,
7700 .translate
= translate_ldsti_d
,
7701 .par
= (const uint32_t[]){true, false, true},
7702 .op_flags
= XTENSA_OP_STORE
,
7706 .translate
= translate_ldsti_d
,
7707 .par
= (const uint32_t[]){true, true, true},
7708 .op_flags
= XTENSA_OP_STORE
,
7712 .translate
= translate_ldstx_d
,
7713 .par
= (const uint32_t[]){true, true, false},
7714 .op_flags
= XTENSA_OP_STORE
,
7718 .translate
= translate_ldstx_d
,
7719 .par
= (const uint32_t[]){true, false, true},
7720 .op_flags
= XTENSA_OP_STORE
,
7724 .translate
= translate_ldstx_d
,
7725 .par
= (const uint32_t[]){true, true, true},
7726 .op_flags
= XTENSA_OP_STORE
,
7730 .translate
= translate_nop
,
7734 .translate
= translate_nop
,
7738 .translate
= translate_ldsti_s
,
7739 .par
= (const uint32_t[]){true, true, false},
7740 .op_flags
= XTENSA_OP_STORE
,
7744 .translate
= translate_ldsti_s
,
7745 .par
= (const uint32_t[]){true, false, true},
7746 .op_flags
= XTENSA_OP_STORE
,
7750 .translate
= translate_ldsti_s
,
7751 .par
= (const uint32_t[]){true, true, true},
7752 .op_flags
= XTENSA_OP_STORE
,
7756 .translate
= translate_ldstx_s
,
7757 .par
= (const uint32_t[]){true, true, false},
7758 .op_flags
= XTENSA_OP_STORE
,
7762 .translate
= translate_ldstx_s
,
7763 .par
= (const uint32_t[]){true, false, true},
7764 .op_flags
= XTENSA_OP_STORE
,
7768 .translate
= translate_ldstx_s
,
7769 .par
= (const uint32_t[]){true, true, true},
7770 .op_flags
= XTENSA_OP_STORE
,
7774 .translate
= translate_sub_d
,
7778 .translate
= translate_sub_s
,
7782 .translate
= translate_ftoi_d
,
7783 .par
= (const uint32_t[]){float_round_to_zero
, false},
7787 .translate
= translate_ftoi_s
,
7788 .par
= (const uint32_t[]){float_round_to_zero
, false},
7792 .translate
= translate_compare_d
,
7793 .par
= (const uint32_t[]){COMPARE_UEQ
},
7797 .translate
= translate_compare_s
,
7798 .par
= (const uint32_t[]){COMPARE_UEQ
},
7802 .translate
= translate_float_d
,
7803 .par
= (const uint32_t[]){true},
7807 .translate
= translate_float_s
,
7808 .par
= (const uint32_t[]){true},
7812 .translate
= translate_compare_d
,
7813 .par
= (const uint32_t[]){COMPARE_ULE
},
7817 .translate
= translate_compare_s
,
7818 .par
= (const uint32_t[]){COMPARE_ULE
},
7822 .translate
= translate_compare_d
,
7823 .par
= (const uint32_t[]){COMPARE_ULT
},
7827 .translate
= translate_compare_s
,
7828 .par
= (const uint32_t[]){COMPARE_ULT
},
7832 .translate
= translate_compare_d
,
7833 .par
= (const uint32_t[]){COMPARE_UN
},
7837 .translate
= translate_compare_s
,
7838 .par
= (const uint32_t[]){COMPARE_UN
},
7842 .translate
= translate_ftoi_d
,
7843 .par
= (const uint32_t[]){float_round_to_zero
, true},
7847 .translate
= translate_ftoi_s
,
7848 .par
= (const uint32_t[]){float_round_to_zero
, true},
7852 .translate
= translate_wfr_s
,
7856 .translate
= translate_wfr_d
,
7860 .translate
= translate_wur_fpu_fcr
,
7861 .par
= (const uint32_t[]){FCR
},
7865 .translate
= translate_wur_fpu_fsr
,
7870 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7871 .num_opcodes
= ARRAY_SIZE(fpu_ops
),