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"
48 #define HELPER_H "helper.h"
49 #include "exec/helper-info.c.inc"
54 DisasContextBase base
;
55 const XtensaConfig
*config
;
77 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
78 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
81 static TCGv_i32 cpu_pc
;
82 static TCGv_i32 cpu_R
[16];
83 static TCGv_i32 cpu_FR
[16];
84 static TCGv_i64 cpu_FRD
[16];
85 static TCGv_i32 cpu_MR
[4];
86 static TCGv_i32 cpu_BR
[16];
87 static TCGv_i32 cpu_BR4
[4];
88 static TCGv_i32 cpu_BR8
[2];
89 static TCGv_i32 cpu_SR
[256];
90 static TCGv_i32 cpu_UR
[256];
91 static TCGv_i32 cpu_windowbase_next
;
92 static TCGv_i32 cpu_exclusive_addr
;
93 static TCGv_i32 cpu_exclusive_val
;
95 static GHashTable
*xtensa_regfile_table
;
97 static char *sr_name
[256];
98 static char *ur_name
[256];
100 void xtensa_collect_sr_names(const XtensaConfig
*config
)
102 xtensa_isa isa
= config
->isa
;
103 int n
= xtensa_isa_num_sysregs(isa
);
106 for (i
= 0; i
< n
; ++i
) {
107 int sr
= xtensa_sysreg_number(isa
, i
);
109 if (sr
>= 0 && sr
< 256) {
110 const char *name
= xtensa_sysreg_name(isa
, i
);
112 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
115 if (strstr(*pname
, name
) == NULL
) {
117 malloc(strlen(*pname
) + strlen(name
) + 2);
119 strcpy(new_name
, *pname
);
120 strcat(new_name
, "/");
121 strcat(new_name
, name
);
126 *pname
= strdup(name
);
132 void xtensa_translate_init(void)
134 static const char * const regnames
[] = {
135 "ar0", "ar1", "ar2", "ar3",
136 "ar4", "ar5", "ar6", "ar7",
137 "ar8", "ar9", "ar10", "ar11",
138 "ar12", "ar13", "ar14", "ar15",
140 static const char * const fregnames
[] = {
141 "f0", "f1", "f2", "f3",
142 "f4", "f5", "f6", "f7",
143 "f8", "f9", "f10", "f11",
144 "f12", "f13", "f14", "f15",
146 static const char * const mregnames
[] = {
147 "m0", "m1", "m2", "m3",
149 static const char * const bregnames
[] = {
150 "b0", "b1", "b2", "b3",
151 "b4", "b5", "b6", "b7",
152 "b8", "b9", "b10", "b11",
153 "b12", "b13", "b14", "b15",
157 cpu_pc
= tcg_global_mem_new_i32(tcg_env
,
158 offsetof(CPUXtensaState
, pc
), "pc");
160 for (i
= 0; i
< 16; i
++) {
161 cpu_R
[i
] = tcg_global_mem_new_i32(tcg_env
,
162 offsetof(CPUXtensaState
, regs
[i
]),
166 for (i
= 0; i
< 16; i
++) {
167 cpu_FR
[i
] = tcg_global_mem_new_i32(tcg_env
,
168 offsetof(CPUXtensaState
,
169 fregs
[i
].f32
[FP_F32_LOW
]),
173 for (i
= 0; i
< 16; i
++) {
174 cpu_FRD
[i
] = tcg_global_mem_new_i64(tcg_env
,
175 offsetof(CPUXtensaState
,
180 for (i
= 0; i
< 4; i
++) {
181 cpu_MR
[i
] = tcg_global_mem_new_i32(tcg_env
,
182 offsetof(CPUXtensaState
,
187 for (i
= 0; i
< 16; i
++) {
188 cpu_BR
[i
] = tcg_global_mem_new_i32(tcg_env
,
189 offsetof(CPUXtensaState
,
193 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(tcg_env
,
194 offsetof(CPUXtensaState
,
199 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(tcg_env
,
200 offsetof(CPUXtensaState
,
206 for (i
= 0; i
< 256; ++i
) {
208 cpu_SR
[i
] = tcg_global_mem_new_i32(tcg_env
,
209 offsetof(CPUXtensaState
,
215 for (i
= 0; i
< 256; ++i
) {
217 cpu_UR
[i
] = tcg_global_mem_new_i32(tcg_env
,
218 offsetof(CPUXtensaState
,
224 cpu_windowbase_next
=
225 tcg_global_mem_new_i32(tcg_env
,
226 offsetof(CPUXtensaState
, windowbase_next
),
229 tcg_global_mem_new_i32(tcg_env
,
230 offsetof(CPUXtensaState
, exclusive_addr
),
233 tcg_global_mem_new_i32(tcg_env
,
234 offsetof(CPUXtensaState
, exclusive_val
),
238 void **xtensa_get_regfile_by_name(const char *name
, int entries
, int bits
)
243 if (xtensa_regfile_table
== NULL
) {
244 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
246 * AR is special. Xtensa translator uses it as a current register
247 * window, but configuration overlays represent it as a complete
248 * physical register file.
250 g_hash_table_insert(xtensa_regfile_table
,
251 (void *)"AR 16x32", (void *)cpu_R
);
252 g_hash_table_insert(xtensa_regfile_table
,
253 (void *)"AR 32x32", (void *)cpu_R
);
254 g_hash_table_insert(xtensa_regfile_table
,
255 (void *)"AR 64x32", (void *)cpu_R
);
257 g_hash_table_insert(xtensa_regfile_table
,
258 (void *)"MR 4x32", (void *)cpu_MR
);
260 g_hash_table_insert(xtensa_regfile_table
,
261 (void *)"FR 16x32", (void *)cpu_FR
);
262 g_hash_table_insert(xtensa_regfile_table
,
263 (void *)"FR 16x64", (void *)cpu_FRD
);
265 g_hash_table_insert(xtensa_regfile_table
,
266 (void *)"BR 16x1", (void *)cpu_BR
);
267 g_hash_table_insert(xtensa_regfile_table
,
268 (void *)"BR4 4x4", (void *)cpu_BR4
);
269 g_hash_table_insert(xtensa_regfile_table
,
270 (void *)"BR8 2x8", (void *)cpu_BR8
);
273 geometry_name
= g_strdup_printf("%s %dx%d", name
, entries
, bits
);
274 res
= (void **)g_hash_table_lookup(xtensa_regfile_table
, geometry_name
);
275 g_free(geometry_name
);
279 static inline bool option_enabled(DisasContext
*dc
, int opt
)
281 return xtensa_option_enabled(dc
->config
, opt
);
284 static void init_sar_tracker(DisasContext
*dc
)
286 dc
->sar_5bit
= false;
287 dc
->sar_m32_5bit
= false;
291 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
293 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
294 if (dc
->sar_m32_5bit
) {
295 tcg_gen_discard_i32(dc
->sar_m32
);
298 dc
->sar_m32_5bit
= false;
301 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
304 dc
->sar_m32
= tcg_temp_new_i32();
306 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
307 tcg_gen_sub_i32(cpu_SR
[SAR
], tcg_constant_i32(32), dc
->sar_m32
);
308 dc
->sar_5bit
= false;
309 dc
->sar_m32_5bit
= true;
312 static void gen_exception(DisasContext
*dc
, int excp
)
314 gen_helper_exception(tcg_env
, tcg_constant_i32(excp
));
317 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
319 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
320 gen_helper_exception_cause(tcg_env
, pc
, tcg_constant_i32(cause
));
321 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
322 cause
== SYSCALL_CAUSE
) {
323 dc
->base
.is_jmp
= DISAS_NORETURN
;
327 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
329 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
330 gen_helper_debug_exception(tcg_env
, pc
, tcg_constant_i32(cause
));
331 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
332 dc
->base
.is_jmp
= DISAS_NORETURN
;
336 static bool gen_check_privilege(DisasContext
*dc
)
338 #ifndef CONFIG_USER_ONLY
343 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
344 dc
->base
.is_jmp
= DISAS_NORETURN
;
348 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
350 cp_mask
&= ~dc
->cpenable
;
352 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
353 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
354 dc
->base
.is_jmp
= DISAS_NORETURN
;
360 static int gen_postprocess(DisasContext
*dc
, int slot
);
362 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
364 tcg_gen_mov_i32(cpu_pc
, dest
);
366 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
368 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
369 slot
= gen_postprocess(dc
, slot
);
372 tcg_gen_goto_tb(slot
);
373 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
375 tcg_gen_exit_tb(NULL
, 0);
377 dc
->base
.is_jmp
= DISAS_NORETURN
;
380 static void gen_jump(DisasContext
*dc
, TCGv dest
)
382 gen_jump_slot(dc
, dest
, -1);
385 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
387 return translator_use_goto_tb(&dc
->base
, dest
) ? slot
: -1;
390 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
392 gen_jump_slot(dc
, tcg_constant_i32(dest
),
393 adjust_jump_slot(dc
, dest
, slot
));
396 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
399 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
400 tcg_constant_i32(callinc
), PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
401 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
402 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
403 gen_jump_slot(dc
, dest
, slot
);
406 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
408 if (dc
->base
.pc_next
== dc
->lend
) {
409 TCGLabel
*label
= gen_new_label();
411 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
412 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
414 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
416 gen_jump(dc
, cpu_SR
[LBEG
]);
418 gen_set_label(label
);
419 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
425 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
427 if (!gen_check_loop_end(dc
, slot
)) {
428 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
432 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
433 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
435 TCGLabel
*label
= gen_new_label();
437 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
438 gen_jumpi_check_loop_end(dc
, 0);
439 gen_set_label(label
);
440 gen_jumpi(dc
, addr
, 1);
443 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
444 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
446 gen_brcond(dc
, cond
, t0
, tcg_constant_i32(t1
), addr
);
449 static uint32_t test_exceptions_sr(DisasContext
*dc
, const OpcodeArg arg
[],
450 const uint32_t par
[])
452 return xtensa_option_enabled(dc
->config
, par
[1]) ? 0 : XTENSA_OP_ILL
;
455 static uint32_t test_exceptions_ccompare(DisasContext
*dc
,
456 const OpcodeArg arg
[],
457 const uint32_t par
[])
459 unsigned n
= par
[0] - CCOMPARE
;
461 if (n
>= dc
->config
->nccompare
) {
462 return XTENSA_OP_ILL
;
464 return test_exceptions_sr(dc
, arg
, par
);
467 static uint32_t test_exceptions_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
468 const uint32_t par
[])
470 unsigned n
= MAX_NDBREAK
;
472 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
473 n
= par
[0] - DBREAKA
;
475 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
476 n
= par
[0] - DBREAKC
;
478 if (n
>= dc
->config
->ndbreak
) {
479 return XTENSA_OP_ILL
;
481 return test_exceptions_sr(dc
, arg
, par
);
484 static uint32_t test_exceptions_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
485 const uint32_t par
[])
487 unsigned n
= par
[0] - IBREAKA
;
489 if (n
>= dc
->config
->nibreak
) {
490 return XTENSA_OP_ILL
;
492 return test_exceptions_sr(dc
, arg
, par
);
495 static uint32_t test_exceptions_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
496 const uint32_t par
[])
498 unsigned n
= MAX_NLEVEL
+ 1;
500 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
501 n
= par
[0] - EXCSAVE1
+ 1;
503 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
504 n
= par
[0] - EPC1
+ 1;
506 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
507 n
= par
[0] - EPS2
+ 2;
509 if (n
> dc
->config
->nlevel
) {
510 return XTENSA_OP_ILL
;
512 return test_exceptions_sr(dc
, arg
, par
);
515 static MemOp
gen_load_store_alignment(DisasContext
*dc
, MemOp mop
,
518 if ((mop
& MO_SIZE
) == MO_8
) {
521 if ((mop
& MO_AMASK
) == MO_UNALN
&&
522 !option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
)) {
525 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
526 tcg_gen_andi_i32(addr
, addr
, ~0 << get_alignment_bits(mop
));
531 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
533 unsigned r
= 31 - clz32(mask
);
535 if (r
/ 4 > dc
->window
) {
536 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
537 TCGv_i32 w
= tcg_constant_i32(r
/ 4);
539 gen_helper_window_check(tcg_env
, pc
, w
);
540 dc
->base
.is_jmp
= DISAS_NORETURN
;
546 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
548 TCGv_i32 m
= tcg_temp_new_i32();
551 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
553 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
558 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
560 TCGLabel
*label
= gen_new_label();
562 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
563 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
564 gen_set_label(label
);
567 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
569 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
572 static int gen_postprocess(DisasContext
*dc
, int slot
)
574 uint32_t op_flags
= dc
->op_flags
;
576 #ifndef CONFIG_USER_ONLY
577 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
578 translator_io_start(&dc
->base
);
579 gen_helper_check_interrupts(tcg_env
);
582 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
583 gen_helper_sync_windowbase(tcg_env
);
585 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
591 struct opcode_arg_copy
{
597 struct opcode_arg_info
{
603 XtensaOpcodeOps
*ops
;
604 OpcodeArg arg
[MAX_OPCODE_ARGS
];
605 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
606 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
618 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
620 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
621 return (r
<< 24) | (g
<< 16) | n
;
624 static enum resource_type
get_resource_type(uint32_t resource
)
626 return resource
>> 24;
630 * a depends on b if b must be executed before a,
631 * because a's side effects will destroy b's inputs.
633 static bool op_depends_on(const struct slot_prop
*a
,
634 const struct slot_prop
*b
)
639 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
642 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
643 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
646 while (i
< a
->n_out
&& j
< b
->n_in
) {
647 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
649 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
659 * Try to break a dependency on b, append temporary register copy records
660 * to the end of copy and update n_copy in case of success.
661 * This is not always possible: e.g. control flow must always be the last,
662 * load/store must be first and state dependencies are not supported yet.
664 static bool break_dependency(struct slot_prop
*a
,
666 struct opcode_arg_copy
*copy
,
671 unsigned n
= *n_copy
;
674 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
677 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
678 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
681 while (i
< a
->n_out
&& j
< b
->n_in
) {
682 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
684 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
687 int index
= b
->in
[j
].index
;
689 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
693 copy
[n
].resource
= b
->in
[j
].resource
;
694 copy
[n
].arg
= b
->arg
+ index
;
705 * Calculate evaluation order for slot opcodes.
706 * Build opcode order graph and output its nodes in topological sort order.
707 * An edge a -> b in the graph means that opcode a must be followed by
710 static bool tsort(struct slot_prop
*slot
,
711 struct slot_prop
*sorted
[],
713 struct opcode_arg_copy
*copy
,
719 unsigned out_edge
[MAX_INSN_SLOTS
];
720 } node
[MAX_INSN_SLOTS
];
722 unsigned in
[MAX_INSN_SLOTS
];
728 unsigned node_idx
= 0;
730 for (i
= 0; i
< n
; ++i
) {
731 node
[i
].n_in_edge
= 0;
732 node
[i
].n_out_edge
= 0;
735 for (i
= 0; i
< n
; ++i
) {
736 unsigned n_out_edge
= 0;
738 for (j
= 0; j
< n
; ++j
) {
739 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
740 node
[i
].out_edge
[n_out_edge
] = j
;
746 node
[i
].n_out_edge
= n_out_edge
;
749 for (i
= 0; i
< n
; ++i
) {
750 if (!node
[i
].n_in_edge
) {
757 for (; in_idx
< n_in
; ++in_idx
) {
759 sorted
[n_out
] = slot
+ i
;
761 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
763 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
764 in
[n_in
] = node
[i
].out_edge
[j
];
770 for (; node_idx
< n
; ++node_idx
) {
771 struct tsnode
*cnode
= node
+ node_idx
;
773 if (cnode
->n_in_edge
) {
774 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
775 unsigned k
= cnode
->out_edge
[j
];
777 if (break_dependency(slot
+ k
, slot
+ node_idx
,
779 --node
[k
].n_in_edge
== 0) {
784 cnode
->out_edge
[cnode
->n_out_edge
- 1];
795 static void opcode_add_resource(struct slot_prop
*op
,
796 uint32_t resource
, char direction
,
802 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
803 op
->in
[op
->n_in
].resource
= resource
;
804 op
->in
[op
->n_in
].index
= index
;
808 if (direction
== 'm' || direction
== 'o') {
809 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
810 op
->out
[op
->n_out
].resource
= resource
;
811 op
->out
[op
->n_out
].index
= index
;
816 g_assert_not_reached();
820 static int resource_compare(const void *a
, const void *b
)
822 const struct opcode_arg_info
*pa
= a
;
823 const struct opcode_arg_info
*pb
= b
;
825 return pa
->resource
< pb
->resource
?
826 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
829 static int arg_copy_compare(const void *a
, const void *b
)
831 const struct opcode_arg_copy
*pa
= a
;
832 const struct opcode_arg_copy
*pb
= b
;
834 return pa
->resource
< pb
->resource
?
835 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
838 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
840 xtensa_isa isa
= dc
->config
->isa
;
841 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, &dc
->base
,
843 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
847 uint32_t op_flags
= 0;
848 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
849 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
850 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
851 unsigned n_arg_copy
= 0;
852 uint32_t debug_cause
= 0;
853 uint32_t windowed_register
= 0;
854 uint32_t coprocessor
= 0;
856 if (len
== XTENSA_UNDEFINED
) {
857 qemu_log_mask(LOG_GUEST_ERROR
,
858 "unknown instruction length (pc = %08x)\n",
860 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
861 dc
->base
.pc_next
= dc
->pc
+ 1;
865 dc
->base
.pc_next
= dc
->pc
+ len
;
866 for (i
= 1; i
< len
; ++i
) {
867 b
[i
] = translator_ldub(env
, &dc
->base
, dc
->pc
+ i
);
869 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
870 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
871 if (fmt
== XTENSA_UNDEFINED
) {
872 qemu_log_mask(LOG_GUEST_ERROR
,
873 "unrecognized instruction format (pc = %08x)\n",
875 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
878 slots
= xtensa_format_num_slots(isa
, fmt
);
879 for (slot
= 0; slot
< slots
; ++slot
) {
881 int opnd
, vopnd
, opnds
;
882 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
883 XtensaOpcodeOps
*ops
;
885 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
886 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
887 if (opc
== XTENSA_UNDEFINED
) {
888 qemu_log_mask(LOG_GUEST_ERROR
,
889 "unrecognized opcode in slot %d (pc = %08x)\n",
891 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
894 opnds
= xtensa_opcode_num_operands(isa
, opc
);
896 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
897 void **register_file
= NULL
;
900 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
901 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
902 register_file
= dc
->config
->regfile
[rf
];
904 if (rf
== dc
->config
->a_regfile
) {
907 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
909 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
910 windowed_register
|= 1u << v
;
913 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
916 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
918 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
919 arg
[vopnd
].raw_imm
= v
;
920 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
921 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
925 arg
[vopnd
].in
= register_file
[v
];
926 arg
[vopnd
].out
= register_file
[v
];
927 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
929 arg
[vopnd
].num_bits
= 32;
934 ops
= dc
->config
->opcode_ops
[opc
];
935 slot_prop
[slot
].ops
= ops
;
938 op_flags
|= ops
->op_flags
;
939 if (ops
->test_exceptions
) {
940 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
943 qemu_log_mask(LOG_UNIMP
,
944 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
945 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
946 op_flags
|= XTENSA_OP_ILL
;
948 if (op_flags
& XTENSA_OP_ILL
) {
949 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
952 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
953 debug_cause
|= ops
->par
[0];
955 if (ops
->test_overflow
) {
956 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
958 coprocessor
|= ops
->coprocessor
;
961 slot_prop
[slot
].n_in
= 0;
962 slot_prop
[slot
].n_out
= 0;
963 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
965 opnds
= xtensa_opcode_num_operands(isa
, opc
);
967 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
968 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
970 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
971 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
974 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
976 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
977 opcode_add_resource(slot_prop
+ slot
,
978 encode_resource(RES_REGFILE
, rf
, v
),
979 xtensa_operand_inout(isa
, opc
, opnd
),
980 visible
? vopnd
: -1);
987 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
989 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
990 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
992 opcode_add_resource(slot_prop
+ slot
,
993 encode_resource(RES_STATE
, 0, state
),
994 xtensa_stateOperand_inout(isa
, opc
, opnd
),
997 if (xtensa_opcode_is_branch(isa
, opc
) ||
998 xtensa_opcode_is_jump(isa
, opc
) ||
999 xtensa_opcode_is_loop(isa
, opc
) ||
1000 xtensa_opcode_is_call(isa
, opc
)) {
1001 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1004 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1005 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1006 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1007 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1012 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1013 qemu_log_mask(LOG_UNIMP
,
1014 "Circular resource dependencies (pc = %08x)\n",
1016 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1020 ordered
[0] = slot_prop
+ 0;
1023 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1024 !gen_check_privilege(dc
)) {
1028 if (op_flags
& XTENSA_OP_SYSCALL
) {
1029 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1033 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1034 gen_debug_exception(dc
, debug_cause
);
1038 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1042 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1043 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1045 gen_helper_test_underflow_retw(tcg_env
, pc
);
1048 if (op_flags
& XTENSA_OP_ALLOCA
) {
1049 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1051 gen_helper_movsp(tcg_env
, pc
);
1054 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1063 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1064 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1065 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1066 resource
= arg_copy
[i
].resource
;
1067 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1068 temp
= tcg_temp_new_i32();
1069 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1070 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1071 temp
= tcg_temp_new_i64();
1072 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1074 g_assert_not_reached();
1076 arg_copy
[i
].temp
= temp
;
1079 arg_copy
[j
] = arg_copy
[i
];
1083 arg_copy
[i
].arg
->in
= temp
;
1088 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1089 for (slot
= 0; slot
< slots
; ++slot
) {
1090 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1091 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1096 dc
->op_flags
= op_flags
;
1098 for (slot
= 0; slot
< slots
; ++slot
) {
1099 struct slot_prop
*pslot
= ordered
[slot
];
1100 XtensaOpcodeOps
*ops
= pslot
->ops
;
1102 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1105 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1106 gen_postprocess(dc
, 0);
1108 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1109 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1110 gen_jumpi_check_loop_end(dc
, -1);
1111 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1112 gen_jumpi_check_loop_end(dc
, 0);
1114 gen_check_loop_end(dc
, 0);
1117 dc
->pc
= dc
->base
.pc_next
;
1120 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1122 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1123 return xtensa_op0_insn_len(dc
, b0
);
1126 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1129 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1130 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1132 dc
->config
= cpu_env(cpu
)->config
;
1133 dc
->pc
= dc
->base
.pc_first
;
1134 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1135 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1136 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1137 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1138 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1139 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1140 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1141 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1142 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1143 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1144 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1145 XTENSA_TBFLAG_WINDOW_SHIFT
);
1146 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1147 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1148 XTENSA_TBFLAG_CALLINC_SHIFT
);
1149 init_sar_tracker(dc
);
1152 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1154 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1157 dc
->next_icount
= tcg_temp_new_i32();
1161 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1163 tcg_gen_insn_start(dcbase
->pc_next
);
1166 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1168 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1169 CPUXtensaState
*env
= cpu_env(cpu
);
1170 target_ulong page_start
;
1172 /* These two conditions only apply to the first insn in the TB,
1173 but this is the first TranslateOps hook that allows exiting. */
1174 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1175 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1176 gen_exception(dc
, EXCP_YIELD
);
1177 dc
->base
.pc_next
= dc
->pc
+ 1;
1178 dc
->base
.is_jmp
= DISAS_NORETURN
;
1183 TCGLabel
*label
= gen_new_label();
1185 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1186 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1187 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1189 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1191 gen_set_label(label
);
1194 disas_xtensa_insn(env
, dc
);
1197 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1200 /* End the TB if the next insn will cross into the next page. */
1201 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1202 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1203 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1204 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1205 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1209 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1211 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1213 switch (dc
->base
.is_jmp
) {
1214 case DISAS_NORETURN
:
1216 case DISAS_TOO_MANY
:
1217 gen_jumpi(dc
, dc
->pc
, 0);
1220 g_assert_not_reached();
1224 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
,
1225 CPUState
*cpu
, FILE *logfile
)
1227 fprintf(logfile
, "IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1228 target_disas(logfile
, cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1231 static const TranslatorOps xtensa_translator_ops
= {
1232 .init_disas_context
= xtensa_tr_init_disas_context
,
1233 .tb_start
= xtensa_tr_tb_start
,
1234 .insn_start
= xtensa_tr_insn_start
,
1235 .translate_insn
= xtensa_tr_translate_insn
,
1236 .tb_stop
= xtensa_tr_tb_stop
,
1237 .disas_log
= xtensa_tr_disas_log
,
1240 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int *max_insns
,
1241 vaddr pc
, void *host_pc
)
1243 DisasContext dc
= {};
1244 translator_loop(cpu
, tb
, max_insns
, pc
, host_pc
,
1245 &xtensa_translator_ops
, &dc
.base
);
1248 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1250 CPUXtensaState
*env
= cpu_env(cs
);
1251 xtensa_isa isa
= env
->config
->isa
;
1254 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1256 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1257 const uint32_t *reg
=
1258 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1259 int regno
= xtensa_sysreg_number(isa
, i
);
1262 qemu_fprintf(f
, "%12s=%08x%c",
1263 xtensa_sysreg_name(isa
, i
),
1265 (j
++ % 4) == 3 ? '\n' : ' ');
1269 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1271 for (i
= 0; i
< 16; ++i
) {
1272 qemu_fprintf(f
, " A%02d=%08x%c",
1273 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1276 xtensa_sync_phys_from_window(env
);
1277 qemu_fprintf(f
, "\n");
1279 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1280 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1282 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1283 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1285 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1289 if ((flags
& CPU_DUMP_FPU
) &&
1290 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1291 qemu_fprintf(f
, "\n");
1293 for (i
= 0; i
< 16; ++i
) {
1294 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1295 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1296 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1297 (i
% 2) == 1 ? '\n' : ' ');
1301 if ((flags
& CPU_DUMP_FPU
) &&
1302 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1303 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1304 qemu_fprintf(f
, "\n");
1306 for (i
= 0; i
< 16; ++i
) {
1307 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1308 float64_val(env
->fregs
[i
].f64
),
1309 *(double *)(&env
->fregs
[i
].f64
),
1310 (i
% 2) == 1 ? '\n' : ' ');
1315 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1316 const uint32_t par
[])
1318 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1321 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1322 const uint32_t par
[])
1324 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1327 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1328 const uint32_t par
[])
1330 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1333 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1334 const uint32_t par
[])
1336 TCGv_i32 tmp
= tcg_temp_new_i32();
1337 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1338 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1341 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1342 const uint32_t par
[])
1344 uint32_t shift
= par
[1];
1345 TCGv_i32 mask
= tcg_constant_i32(((1 << shift
) - 1) << arg
[1].imm
);
1346 TCGv_i32 tmp
= tcg_temp_new_i32();
1348 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1350 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1352 tcg_gen_add_i32(tmp
, tmp
, mask
);
1354 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1355 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1356 tmp
, arg
[0].imm
, 1);
1359 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1360 const uint32_t par
[])
1362 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1365 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1366 const uint32_t par
[])
1368 TCGv_i32 tmp
= tcg_temp_new_i32();
1369 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1370 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1373 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1374 const uint32_t par
[])
1376 TCGv_i32 tmp
= tcg_temp_new_i32();
1377 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1378 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1381 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1382 const uint32_t par
[])
1384 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1387 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1388 const uint32_t par
[])
1390 TCGv_i32 tmp
= tcg_temp_new_i32();
1392 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1393 if (TARGET_BIG_ENDIAN
) {
1394 tcg_gen_shr_i32(tmp
, tcg_constant_i32(0x80000000u
), tmp
);
1396 tcg_gen_shl_i32(tmp
, tcg_constant_i32(0x00000001u
), tmp
);
1398 tcg_gen_and_i32(tmp
, arg
[0].in
, tmp
);
1399 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1402 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1403 const uint32_t par
[])
1405 TCGv_i32 tmp
= tcg_temp_new_i32();
1406 #if TARGET_BIG_ENDIAN
1407 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1409 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1411 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1414 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1415 const uint32_t par
[])
1417 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1420 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1421 const uint32_t par
[])
1423 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1434 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1435 const uint32_t par
[])
1437 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1438 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1439 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1440 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1441 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1442 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1445 TCGv_i32 tmp1
= tcg_temp_new_i32();
1446 TCGv_i32 tmp2
= tcg_temp_new_i32();
1448 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1449 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1450 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1451 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1454 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1455 const uint32_t par
[])
1457 TCGv_i32 tmp
= tcg_temp_new_i32();
1459 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1460 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1463 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1464 const uint32_t par
[])
1466 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1467 gen_jumpi(dc
, arg
[0].imm
, 0);
1470 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1471 const uint32_t par
[])
1473 TCGv_i32 tmp
= tcg_constant_i32(arg
[0].imm
);
1474 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1477 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1478 const uint32_t par
[])
1480 TCGv_i32 tmp
= tcg_temp_new_i32();
1481 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1482 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1486 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1487 const uint32_t par
[])
1489 TCGv_i32 tmp
= tcg_temp_new_i32();
1491 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1492 gen_callw_slot(dc
, par
[0], tmp
, -1);
1495 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1496 const uint32_t par
[])
1498 TCGv_i32 tmp1
= tcg_constant_i32(-1u << arg
[2].imm
);
1499 TCGv_i32 tmp2
= tcg_constant_i32((1 << arg
[2].imm
) - 1);
1501 tcg_gen_smax_i32(arg
[0].out
, tmp1
, arg
[1].in
);
1502 tcg_gen_smin_i32(arg
[0].out
, arg
[0].out
, tmp2
);
1505 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1506 const uint32_t par
[])
1508 /* TODO: GPIO32 may be a part of coprocessor */
1509 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1512 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1513 const uint32_t par
[])
1515 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1518 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1519 const uint32_t par
[])
1521 TCGv_i32 c
= tcg_constant_i32(arg
[1].imm
);
1523 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1526 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1527 const uint32_t par
[])
1529 TCGv_i32 addr
= tcg_temp_new_i32();
1530 TCGv_i32 res
= tcg_temp_new_i32();
1532 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1533 tcg_gen_qemu_ld_i32(res
, addr
, dc
->cring
, MO_UB
);
1536 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1537 const uint32_t par
[])
1539 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1540 arg
[2].imm
, arg
[3].imm
);
1543 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1544 const uint32_t par
[])
1546 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1549 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1550 const uint32_t par
[])
1552 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1553 qemu_log_mask(LOG_GUEST_ERROR
,
1554 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1555 return XTENSA_OP_ILL
;
1561 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1562 const uint32_t par
[])
1564 return 1 << (dc
->callinc
* 4);
1567 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1568 const uint32_t par
[])
1570 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1571 TCGv_i32 s
= tcg_constant_i32(arg
[0].imm
);
1572 TCGv_i32 imm
= tcg_constant_i32(arg
[1].imm
);
1573 gen_helper_entry(tcg_env
, pc
, s
, imm
);
1576 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1577 const uint32_t par
[])
1579 int maskimm
= (1 << arg
[3].imm
) - 1;
1581 TCGv_i32 tmp
= tcg_temp_new_i32();
1582 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1583 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1586 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1587 const uint32_t par
[])
1589 TCGv_i32 tmp
= tcg_temp_new_i32();
1591 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1592 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1593 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1596 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1597 const uint32_t par
[])
1599 #ifndef CONFIG_USER_ONLY
1600 TCGv_i32 addr
= tcg_temp_new_i32();
1602 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1603 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1604 gen_helper_itlb_hit_test(tcg_env
, addr
);
1608 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1609 const uint32_t par
[])
1611 #ifndef CONFIG_USER_ONLY
1612 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1614 gen_helper_itlb(tcg_env
, arg
[0].in
, dtlb
);
1618 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1619 const uint32_t par
[])
1621 gen_jumpi(dc
, arg
[0].imm
, 0);
1624 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1625 const uint32_t par
[])
1627 gen_jump(dc
, arg
[0].in
);
1630 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1631 const uint32_t par
[])
1633 TCGv_i32 addr
= tcg_temp_new_i32();
1636 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1637 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
1638 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, mop
);
1641 #ifdef CONFIG_USER_ONLY
1642 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1646 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1648 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1649 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1651 gen_helper_check_exclusive(tcg_env
, pc
, addr
,
1652 tcg_constant_i32(is_write
));
1657 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1658 const uint32_t par
[])
1660 TCGv_i32 addr
= tcg_temp_new_i32();
1663 tcg_gen_mov_i32(addr
, arg
[1].in
);
1664 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
1665 gen_check_exclusive(dc
, addr
, false);
1666 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->cring
, mop
);
1667 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1668 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1671 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1672 const uint32_t par
[])
1674 TCGv_i32 addr
= tcg_temp_new_i32();
1677 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1678 mop
= gen_load_store_alignment(dc
, par
[0], addr
);
1682 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1684 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
1686 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
1688 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1693 static void translate_lct(DisasContext
*dc
, const OpcodeArg arg
[],
1694 const uint32_t par
[])
1696 tcg_gen_movi_i32(arg
[0].out
, 0);
1699 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1700 const uint32_t par
[])
1704 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1705 tmp
= tcg_temp_new();
1706 tcg_gen_addi_i32(tmp
, cpu_SR
[LITBASE
], arg
[1].raw_imm
- 1);
1708 tmp
= tcg_constant_i32(arg
[1].imm
);
1710 tcg_gen_qemu_ld_i32(arg
[0].out
, tmp
, dc
->cring
, MO_TEUL
);
1713 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1714 const uint32_t par
[])
1716 uint32_t lend
= arg
[1].imm
;
1718 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1719 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1720 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1722 if (par
[0] != TCG_COND_NEVER
) {
1723 TCGLabel
*label
= gen_new_label();
1724 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1725 gen_jumpi(dc
, lend
, 1);
1726 gen_set_label(label
);
1729 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1750 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1751 const uint32_t par
[])
1754 unsigned half
= par
[1];
1755 uint32_t ld_offset
= par
[2];
1756 unsigned off
= ld_offset
? 2 : 0;
1757 TCGv_i32 vaddr
= tcg_temp_new_i32();
1758 TCGv_i32 mem32
= tcg_temp_new_i32();
1763 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1764 mop
= gen_load_store_alignment(dc
, MO_TEUL
, vaddr
);
1765 tcg_gen_qemu_ld_tl(mem32
, vaddr
, dc
->cring
, mop
);
1767 if (op
!= MAC16_NONE
) {
1768 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1769 half
& MAC16_HX
, op
== MAC16_UMUL
);
1770 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1771 half
& MAC16_XH
, op
== MAC16_UMUL
);
1773 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1774 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1775 if (op
== MAC16_UMUL
) {
1776 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1778 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1781 TCGv_i32 lo
= tcg_temp_new_i32();
1782 TCGv_i32 hi
= tcg_temp_new_i32();
1784 tcg_gen_mul_i32(lo
, m1
, m2
);
1785 tcg_gen_sari_i32(hi
, lo
, 31);
1786 if (op
== MAC16_MULA
) {
1787 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1788 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1791 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1792 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1795 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1799 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1800 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1804 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1805 const uint32_t par
[])
1807 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1810 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1811 const uint32_t par
[])
1813 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1816 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1817 const uint32_t par
[])
1819 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1822 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1823 const uint32_t par
[])
1825 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1828 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1829 const uint32_t par
[])
1831 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1834 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1835 const uint32_t par
[])
1837 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1840 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1841 const uint32_t par
[])
1843 TCGv_i32 zero
= tcg_constant_i32(0);
1845 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1846 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1849 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1850 const uint32_t par
[])
1852 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1855 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1856 const uint32_t par
[])
1858 TCGv_i32 zero
= tcg_constant_i32(0);
1859 TCGv_i32 tmp
= tcg_temp_new_i32();
1861 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1862 tcg_gen_movcond_i32(par
[0],
1863 arg
[0].out
, tmp
, zero
,
1864 arg
[1].in
, arg
[0].in
);
1867 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1868 const uint32_t par
[])
1870 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1873 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1874 const uint32_t par
[])
1876 TCGv_i32 v1
= tcg_temp_new_i32();
1877 TCGv_i32 v2
= tcg_temp_new_i32();
1880 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1881 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1883 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1884 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1886 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1889 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1890 const uint32_t par
[])
1892 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1895 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1896 const uint32_t par
[])
1898 TCGv_i32 lo
= tcg_temp_new();
1901 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1903 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1907 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
1908 const uint32_t par
[])
1910 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
1913 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
1914 const uint32_t par
[])
1918 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
1919 const uint32_t par
[])
1921 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
1924 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
1925 const uint32_t par
[])
1927 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
1930 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
1931 const uint32_t par
[])
1933 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1936 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1937 const uint32_t par
[])
1939 #ifndef CONFIG_USER_ONLY
1940 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1942 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1943 gen_helper_ptlb(arg
[0].out
, tcg_env
, arg
[1].in
, dtlb
);
1947 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1948 const uint32_t par
[])
1950 #ifndef CONFIG_USER_ONLY
1951 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1952 gen_helper_pptlb(arg
[0].out
, tcg_env
, arg
[1].in
);
1956 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
1957 const uint32_t par
[])
1959 TCGLabel
*label1
= gen_new_label();
1960 TCGLabel
*label2
= gen_new_label();
1962 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
1964 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
1966 tcg_gen_movi_i32(arg
[0].out
,
1967 par
[0] ? 0x80000000 : 0);
1969 gen_set_label(label1
);
1971 tcg_gen_div_i32(arg
[0].out
,
1972 arg
[1].in
, arg
[2].in
);
1974 tcg_gen_rem_i32(arg
[0].out
,
1975 arg
[1].in
, arg
[2].in
);
1977 gen_set_label(label2
);
1980 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
1981 const uint32_t par
[])
1983 tcg_gen_divu_i32(arg
[0].out
,
1984 arg
[1].in
, arg
[2].in
);
1987 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
1988 const uint32_t par
[])
1990 /* TODO: GPIO32 may be a part of coprocessor */
1991 tcg_gen_movi_i32(arg
[0].out
, 0);
1994 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
1995 const uint32_t par
[])
1997 tcg_gen_remu_i32(arg
[0].out
,
1998 arg
[1].in
, arg
[2].in
);
2001 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2002 const uint32_t par
[])
2004 gen_helper_rer(arg
[0].out
, tcg_env
, arg
[1].in
);
2007 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2008 const uint32_t par
[])
2010 gen_jump(dc
, cpu_R
[0]);
2013 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2014 const uint32_t par
[])
2017 qemu_log_mask(LOG_GUEST_ERROR
,
2018 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2019 return XTENSA_OP_ILL
;
2021 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2023 gen_helper_test_ill_retw(tcg_env
, pc
);
2028 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2029 const uint32_t par
[])
2031 TCGv_i32 tmp
= tcg_temp_new();
2032 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2033 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2034 cpu_SR
[WINDOW_START
], tmp
);
2035 tcg_gen_movi_i32(tmp
, dc
->pc
);
2036 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2037 gen_helper_retw(tcg_env
, cpu_R
[0]);
2041 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2042 const uint32_t par
[])
2044 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2047 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2048 const uint32_t par
[])
2050 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2051 gen_jump(dc
, cpu_SR
[EPC1
]);
2054 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2055 const uint32_t par
[])
2057 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2058 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2061 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2062 const uint32_t par
[])
2064 TCGv_i32 tmp
= tcg_temp_new();
2066 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2067 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2070 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2071 cpu_SR
[WINDOW_START
], tmp
);
2073 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2074 cpu_SR
[WINDOW_START
], tmp
);
2077 gen_helper_restore_owb(tcg_env
);
2078 gen_jump(dc
, cpu_SR
[EPC1
]);
2081 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2082 const uint32_t par
[])
2084 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2087 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2088 const uint32_t par
[])
2090 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2091 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2092 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2095 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2096 const uint32_t par
[])
2098 if (sr_name
[par
[0]]) {
2099 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2101 tcg_gen_movi_i32(arg
[0].out
, 0);
2105 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2106 const uint32_t par
[])
2108 #ifndef CONFIG_USER_ONLY
2109 translator_io_start(&dc
->base
);
2110 gen_helper_update_ccount(tcg_env
);
2111 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2115 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2116 const uint32_t par
[])
2118 #ifndef CONFIG_USER_ONLY
2119 TCGv_i32 tmp
= tcg_temp_new_i32();
2121 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2122 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2123 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2127 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2128 const uint32_t par
[])
2130 #ifndef CONFIG_USER_ONLY
2131 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2136 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2138 helper
[par
[1]](arg
[0].out
, tcg_env
, arg
[1].in
, dtlb
);
2142 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2143 const uint32_t par
[])
2145 #ifndef CONFIG_USER_ONLY
2146 gen_helper_rptlb0(arg
[0].out
, tcg_env
, arg
[1].in
);
2150 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2151 const uint32_t par
[])
2153 #ifndef CONFIG_USER_ONLY
2154 gen_helper_rptlb1(arg
[0].out
, tcg_env
, arg
[1].in
);
2158 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2159 const uint32_t par
[])
2161 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2164 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2165 const uint32_t par
[])
2167 /* TODO: GPIO32 may be a part of coprocessor */
2168 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2171 #ifdef CONFIG_USER_ONLY
2172 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2176 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2178 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2180 gen_helper_check_atomctl(tcg_env
, pc
, addr
);
2184 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2185 const uint32_t par
[])
2187 TCGv_i32 tmp
= tcg_temp_new_i32();
2188 TCGv_i32 addr
= tcg_temp_new_i32();
2191 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2192 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2193 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2194 gen_check_atomctl(dc
, addr
);
2195 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2196 tmp
, dc
->cring
, mop
);
2199 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2200 const uint32_t par
[])
2202 TCGv_i32 addr
= tcg_temp_new_i32();
2205 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2206 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
2207 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, mop
);
2210 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2211 const uint32_t par
[])
2213 TCGv_i32 prev
= tcg_temp_new_i32();
2214 TCGv_i32 addr
= tcg_temp_new_i32();
2215 TCGv_i32 res
= tcg_temp_new_i32();
2216 TCGLabel
*label
= gen_new_label();
2219 tcg_gen_movi_i32(res
, 0);
2220 tcg_gen_mov_i32(addr
, arg
[1].in
);
2221 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2222 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2223 gen_check_exclusive(dc
, addr
, true);
2224 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2225 arg
[0].in
, dc
->cring
, mop
);
2226 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2227 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2228 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2229 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2230 gen_set_label(label
);
2231 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2232 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2235 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2236 const uint32_t par
[])
2238 tcg_gen_setcond_i32(par
[0],
2240 arg
[1].in
, arg
[2].in
);
2243 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2244 const uint32_t par
[])
2246 tcg_gen_sextract_i32(arg
[0].out
, arg
[1].in
, 0, arg
[2].imm
+ 1);
2249 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2250 const OpcodeArg arg
[],
2251 const uint32_t par
[])
2253 bool is_semi
= semihosting_enabled(dc
->cring
!= 0);
2254 #ifdef CONFIG_USER_ONLY
2257 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2258 bool ill
= dc
->config
->hw_version
<= 250002 && !is_semi
;
2260 if (ill
|| !is_semi
) {
2261 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2263 return ill
? XTENSA_OP_ILL
: 0;
2266 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2267 const uint32_t par
[])
2269 #ifndef CONFIG_USER_ONLY
2270 if (semihosting_enabled(dc
->cring
!= 0)) {
2271 gen_helper_simcall(tcg_env
);
2277 * Note: 64 bit ops are used here solely because SAR values
2280 #define gen_shift_reg(cmd, reg) do { \
2281 TCGv_i64 tmp = tcg_temp_new_i64(); \
2282 tcg_gen_extu_i32_i64(tmp, reg); \
2283 tcg_gen_##cmd##_i64(v, v, tmp); \
2284 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2287 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2289 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2290 const uint32_t par
[])
2292 if (dc
->sar_m32_5bit
) {
2293 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2295 TCGv_i64 v
= tcg_temp_new_i64();
2296 TCGv_i32 s
= tcg_temp_new();
2297 tcg_gen_subfi_i32(s
, 32, cpu_SR
[SAR
]);
2298 tcg_gen_andi_i32(s
, s
, 0x3f);
2299 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2300 gen_shift_reg(shl
, s
);
2304 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2305 const uint32_t par
[])
2307 if (arg
[2].imm
== 32) {
2308 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2309 arg
[0].imm
, arg
[1].imm
);
2311 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2314 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2315 const uint32_t par
[])
2317 if (dc
->sar_m32_5bit
) {
2318 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2320 TCGv_i64 v
= tcg_temp_new_i64();
2321 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2326 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2327 const uint32_t par
[])
2329 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2332 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2333 const uint32_t par
[])
2335 TCGv_i64 v
= tcg_temp_new_i64();
2336 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2340 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2341 const uint32_t par
[])
2343 if (dc
->sar_m32_5bit
) {
2344 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2346 TCGv_i64 v
= tcg_temp_new_i64();
2347 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2353 #undef gen_shift_reg
2355 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2356 const uint32_t par
[])
2358 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2361 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2362 const uint32_t par
[])
2364 TCGv_i32 tmp
= tcg_temp_new_i32();
2365 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2366 gen_left_shift_sar(dc
, tmp
);
2369 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2370 const uint32_t par
[])
2372 TCGv_i32 tmp
= tcg_temp_new_i32();
2373 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2374 gen_right_shift_sar(dc
, tmp
);
2377 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2378 const uint32_t par
[])
2380 gen_right_shift_sar(dc
, tcg_constant_i32(arg
[0].imm
));
2383 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2384 const uint32_t par
[])
2386 gen_left_shift_sar(dc
, arg
[0].in
);
2389 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2390 const uint32_t par
[])
2392 gen_right_shift_sar(dc
, arg
[0].in
);
2395 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2396 const uint32_t par
[])
2398 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2401 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2402 const uint32_t par
[])
2404 TCGv_i32 tmp
= tcg_temp_new_i32();
2405 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2406 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2409 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2410 const uint32_t par
[])
2412 #ifndef CONFIG_USER_ONLY
2413 TCGv_i32 pc
= tcg_constant_i32(dc
->base
.pc_next
);
2415 translator_io_start(&dc
->base
);
2416 gen_helper_waiti(tcg_env
, pc
, tcg_constant_i32(arg
[0].imm
));
2420 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2421 const uint32_t par
[])
2423 #ifndef CONFIG_USER_ONLY
2424 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2426 gen_helper_wtlb(tcg_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2430 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2431 const uint32_t par
[])
2433 #ifndef CONFIG_USER_ONLY
2434 gen_helper_wptlb(tcg_env
, arg
[0].in
, arg
[1].in
);
2438 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2439 const uint32_t par
[])
2441 gen_helper_wer(tcg_env
, arg
[0].in
, arg
[1].in
);
2444 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2445 const uint32_t par
[])
2447 /* TODO: GPIO32 may be a part of coprocessor */
2448 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2451 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2452 const uint32_t par
[])
2454 if (sr_name
[par
[0]]) {
2455 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2459 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2460 const uint32_t par
[])
2462 if (sr_name
[par
[0]]) {
2463 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2467 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2468 const uint32_t par
[])
2470 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2473 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2474 const uint32_t par
[])
2476 #ifndef CONFIG_USER_ONLY
2477 uint32_t id
= par
[0] - CCOMPARE
;
2479 assert(id
< dc
->config
->nccompare
);
2480 translator_io_start(&dc
->base
);
2481 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2482 gen_helper_update_ccompare(tcg_env
, tcg_constant_i32(id
));
2486 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2487 const uint32_t par
[])
2489 #ifndef CONFIG_USER_ONLY
2490 translator_io_start(&dc
->base
);
2491 gen_helper_wsr_ccount(tcg_env
, arg
[0].in
);
2495 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2496 const uint32_t par
[])
2498 #ifndef CONFIG_USER_ONLY
2499 unsigned id
= par
[0] - DBREAKA
;
2501 assert(id
< dc
->config
->ndbreak
);
2502 gen_helper_wsr_dbreaka(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2506 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2507 const uint32_t par
[])
2509 #ifndef CONFIG_USER_ONLY
2510 unsigned id
= par
[0] - DBREAKC
;
2512 assert(id
< dc
->config
->ndbreak
);
2513 gen_helper_wsr_dbreakc(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2517 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2518 const uint32_t par
[])
2520 #ifndef CONFIG_USER_ONLY
2521 unsigned id
= par
[0] - IBREAKA
;
2523 assert(id
< dc
->config
->nibreak
);
2524 gen_helper_wsr_ibreaka(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2528 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2529 const uint32_t par
[])
2531 #ifndef CONFIG_USER_ONLY
2532 gen_helper_wsr_ibreakenable(tcg_env
, arg
[0].in
);
2536 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2537 const uint32_t par
[])
2539 #ifndef CONFIG_USER_ONLY
2541 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2543 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2548 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2549 const uint32_t par
[])
2551 #ifndef CONFIG_USER_ONLY
2552 gen_helper_intclear(tcg_env
, arg
[0].in
);
2556 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2557 const uint32_t par
[])
2559 #ifndef CONFIG_USER_ONLY
2560 gen_helper_intset(tcg_env
, arg
[0].in
);
2564 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2565 const uint32_t par
[])
2567 #ifndef CONFIG_USER_ONLY
2568 gen_helper_wsr_memctl(tcg_env
, arg
[0].in
);
2572 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2573 const uint32_t par
[])
2575 #ifndef CONFIG_USER_ONLY
2576 gen_helper_wsr_mpuenb(tcg_env
, arg
[0].in
);
2580 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2581 const uint32_t par
[])
2583 #ifndef CONFIG_USER_ONLY
2584 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2585 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2587 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2588 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2591 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2595 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2596 const uint32_t par
[])
2598 #ifndef CONFIG_USER_ONLY
2599 gen_helper_wsr_rasid(tcg_env
, arg
[0].in
);
2603 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2604 const uint32_t par
[])
2606 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2607 if (dc
->sar_m32_5bit
) {
2608 tcg_gen_discard_i32(dc
->sar_m32
);
2610 dc
->sar_5bit
= false;
2611 dc
->sar_m32_5bit
= false;
2614 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2615 const uint32_t par
[])
2617 #ifndef CONFIG_USER_ONLY
2618 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2622 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2623 const uint32_t par
[])
2625 #ifndef CONFIG_USER_ONLY
2626 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2627 (1 << dc
->config
->nareg
/ 4) - 1);
2631 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2632 const uint32_t par
[])
2634 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2637 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2638 const uint32_t par
[])
2640 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2643 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2644 const uint32_t par
[])
2646 if (sr_name
[par
[0]]) {
2647 TCGv_i32 tmp
= tcg_temp_new_i32();
2649 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2650 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2651 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2653 tcg_gen_movi_i32(arg
[0].out
, 0);
2657 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2658 const uint32_t par
[])
2660 if (sr_name
[par
[0]]) {
2661 TCGv_i32 tmp
= tcg_temp_new_i32();
2663 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2664 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2665 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2667 tcg_gen_movi_i32(arg
[0].out
, 0);
2671 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2672 const uint32_t par
[])
2674 #ifndef CONFIG_USER_ONLY
2675 TCGv_i32 tmp
= tcg_temp_new_i32();
2677 translator_io_start(&dc
->base
);
2678 gen_helper_update_ccount(tcg_env
);
2679 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2680 gen_helper_wsr_ccount(tcg_env
, arg
[0].in
);
2681 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2686 #define gen_translate_xsr(name) \
2687 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2688 const uint32_t par[]) \
2690 TCGv_i32 tmp = tcg_temp_new_i32(); \
2692 if (sr_name[par[0]]) { \
2693 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2695 tcg_gen_movi_i32(tmp, 0); \
2697 translate_wsr_##name(dc, arg, par); \
2698 tcg_gen_mov_i32(arg[0].out, tmp); \
2701 gen_translate_xsr(acchi
)
2702 gen_translate_xsr(ccompare
)
2703 gen_translate_xsr(dbreaka
)
2704 gen_translate_xsr(dbreakc
)
2705 gen_translate_xsr(ibreaka
)
2706 gen_translate_xsr(ibreakenable
)
2707 gen_translate_xsr(icount
)
2708 gen_translate_xsr(memctl
)
2709 gen_translate_xsr(mpuenb
)
2710 gen_translate_xsr(ps
)
2711 gen_translate_xsr(rasid
)
2712 gen_translate_xsr(sar
)
2713 gen_translate_xsr(windowbase
)
2714 gen_translate_xsr(windowstart
)
2716 #undef gen_translate_xsr
2718 static const XtensaOpcodeOps core_ops
[] = {
2721 .translate
= translate_abs
,
2723 .name
= (const char * const[]) {
2724 "add", "add.n", NULL
,
2726 .translate
= translate_add
,
2727 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2729 .name
= (const char * const[]) {
2730 "addi", "addi.n", NULL
,
2732 .translate
= translate_addi
,
2733 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2736 .translate
= translate_addi
,
2739 .translate
= translate_addx
,
2740 .par
= (const uint32_t[]){1},
2743 .translate
= translate_addx
,
2744 .par
= (const uint32_t[]){2},
2747 .translate
= translate_addx
,
2748 .par
= (const uint32_t[]){3},
2751 .translate
= translate_all
,
2752 .par
= (const uint32_t[]){true, 4},
2755 .translate
= translate_all
,
2756 .par
= (const uint32_t[]){true, 8},
2759 .translate
= translate_and
,
2762 .translate
= translate_boolean
,
2763 .par
= (const uint32_t[]){BOOLEAN_AND
},
2766 .translate
= translate_boolean
,
2767 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2770 .translate
= translate_all
,
2771 .par
= (const uint32_t[]){false, 4},
2774 .translate
= translate_all
,
2775 .par
= (const uint32_t[]){false, 8},
2777 .name
= (const char * const[]) {
2778 "ball", "ball.w15", "ball.w18", NULL
,
2780 .translate
= translate_ball
,
2781 .par
= (const uint32_t[]){TCG_COND_EQ
},
2782 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2784 .name
= (const char * const[]) {
2785 "bany", "bany.w15", "bany.w18", NULL
,
2787 .translate
= translate_bany
,
2788 .par
= (const uint32_t[]){TCG_COND_NE
},
2789 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2791 .name
= (const char * const[]) {
2792 "bbc", "bbc.w15", "bbc.w18", NULL
,
2794 .translate
= translate_bb
,
2795 .par
= (const uint32_t[]){TCG_COND_EQ
},
2796 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2798 .name
= (const char * const[]) {
2799 "bbci", "bbci.w15", "bbci.w18", NULL
,
2801 .translate
= translate_bbi
,
2802 .par
= (const uint32_t[]){TCG_COND_EQ
},
2803 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2805 .name
= (const char * const[]) {
2806 "bbs", "bbs.w15", "bbs.w18", NULL
,
2808 .translate
= translate_bb
,
2809 .par
= (const uint32_t[]){TCG_COND_NE
},
2810 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2812 .name
= (const char * const[]) {
2813 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2815 .translate
= translate_bbi
,
2816 .par
= (const uint32_t[]){TCG_COND_NE
},
2817 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2819 .name
= (const char * const[]) {
2820 "beq", "beq.w15", "beq.w18", NULL
,
2822 .translate
= translate_b
,
2823 .par
= (const uint32_t[]){TCG_COND_EQ
},
2824 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2826 .name
= (const char * const[]) {
2827 "beqi", "beqi.w15", "beqi.w18", NULL
,
2829 .translate
= translate_bi
,
2830 .par
= (const uint32_t[]){TCG_COND_EQ
},
2831 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2833 .name
= (const char * const[]) {
2834 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2836 .translate
= translate_bz
,
2837 .par
= (const uint32_t[]){TCG_COND_EQ
},
2838 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2841 .translate
= translate_bp
,
2842 .par
= (const uint32_t[]){TCG_COND_EQ
},
2844 .name
= (const char * const[]) {
2845 "bge", "bge.w15", "bge.w18", NULL
,
2847 .translate
= translate_b
,
2848 .par
= (const uint32_t[]){TCG_COND_GE
},
2849 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2851 .name
= (const char * const[]) {
2852 "bgei", "bgei.w15", "bgei.w18", NULL
,
2854 .translate
= translate_bi
,
2855 .par
= (const uint32_t[]){TCG_COND_GE
},
2856 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2858 .name
= (const char * const[]) {
2859 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
2861 .translate
= translate_b
,
2862 .par
= (const uint32_t[]){TCG_COND_GEU
},
2863 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2865 .name
= (const char * const[]) {
2866 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
2868 .translate
= translate_bi
,
2869 .par
= (const uint32_t[]){TCG_COND_GEU
},
2870 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2872 .name
= (const char * const[]) {
2873 "bgez", "bgez.w15", "bgez.w18", NULL
,
2875 .translate
= translate_bz
,
2876 .par
= (const uint32_t[]){TCG_COND_GE
},
2877 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2879 .name
= (const char * const[]) {
2880 "blt", "blt.w15", "blt.w18", NULL
,
2882 .translate
= translate_b
,
2883 .par
= (const uint32_t[]){TCG_COND_LT
},
2884 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2886 .name
= (const char * const[]) {
2887 "blti", "blti.w15", "blti.w18", NULL
,
2889 .translate
= translate_bi
,
2890 .par
= (const uint32_t[]){TCG_COND_LT
},
2891 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2893 .name
= (const char * const[]) {
2894 "bltu", "bltu.w15", "bltu.w18", NULL
,
2896 .translate
= translate_b
,
2897 .par
= (const uint32_t[]){TCG_COND_LTU
},
2898 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2900 .name
= (const char * const[]) {
2901 "bltui", "bltui.w15", "bltui.w18", NULL
,
2903 .translate
= translate_bi
,
2904 .par
= (const uint32_t[]){TCG_COND_LTU
},
2905 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2907 .name
= (const char * const[]) {
2908 "bltz", "bltz.w15", "bltz.w18", NULL
,
2910 .translate
= translate_bz
,
2911 .par
= (const uint32_t[]){TCG_COND_LT
},
2912 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2914 .name
= (const char * const[]) {
2915 "bnall", "bnall.w15", "bnall.w18", NULL
,
2917 .translate
= translate_ball
,
2918 .par
= (const uint32_t[]){TCG_COND_NE
},
2919 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2921 .name
= (const char * const[]) {
2922 "bne", "bne.w15", "bne.w18", NULL
,
2924 .translate
= translate_b
,
2925 .par
= (const uint32_t[]){TCG_COND_NE
},
2926 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2928 .name
= (const char * const[]) {
2929 "bnei", "bnei.w15", "bnei.w18", NULL
,
2931 .translate
= translate_bi
,
2932 .par
= (const uint32_t[]){TCG_COND_NE
},
2933 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2935 .name
= (const char * const[]) {
2936 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
2938 .translate
= translate_bz
,
2939 .par
= (const uint32_t[]){TCG_COND_NE
},
2940 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2942 .name
= (const char * const[]) {
2943 "bnone", "bnone.w15", "bnone.w18", NULL
,
2945 .translate
= translate_bany
,
2946 .par
= (const uint32_t[]){TCG_COND_EQ
},
2947 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2950 .translate
= translate_nop
,
2951 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
2952 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2955 .translate
= translate_nop
,
2956 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
2957 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2960 .translate
= translate_bp
,
2961 .par
= (const uint32_t[]){TCG_COND_NE
},
2964 .translate
= translate_call0
,
2967 .translate
= translate_callw
,
2968 .par
= (const uint32_t[]){3},
2971 .translate
= translate_callw
,
2972 .par
= (const uint32_t[]){1},
2975 .translate
= translate_callw
,
2976 .par
= (const uint32_t[]){2},
2979 .translate
= translate_callx0
,
2982 .translate
= translate_callxw
,
2983 .par
= (const uint32_t[]){3},
2986 .translate
= translate_callxw
,
2987 .par
= (const uint32_t[]){1},
2990 .translate
= translate_callxw
,
2991 .par
= (const uint32_t[]){2},
2994 .translate
= translate_clamps
,
2996 .name
= "clrb_expstate",
2997 .translate
= translate_clrb_expstate
,
3000 .translate
= translate_clrex
,
3003 .translate
= translate_const16
,
3006 .translate
= translate_depbits
,
3009 .translate
= translate_dcache
,
3010 .op_flags
= XTENSA_OP_PRIVILEGED
,
3013 .translate
= translate_nop
,
3016 .translate
= translate_dcache
,
3017 .op_flags
= XTENSA_OP_PRIVILEGED
,
3020 .translate
= translate_dcache
,
3023 .translate
= translate_nop
,
3026 .translate
= translate_dcache
,
3029 .translate
= translate_nop
,
3032 .translate
= translate_nop
,
3033 .op_flags
= XTENSA_OP_PRIVILEGED
,
3036 .translate
= translate_nop
,
3037 .op_flags
= XTENSA_OP_PRIVILEGED
,
3040 .translate
= translate_nop
,
3041 .op_flags
= XTENSA_OP_PRIVILEGED
,
3044 .translate
= translate_nop
,
3045 .op_flags
= XTENSA_OP_PRIVILEGED
,
3048 .translate
= translate_diwbuip
,
3049 .op_flags
= XTENSA_OP_PRIVILEGED
,
3052 .translate
= translate_dcache
,
3053 .op_flags
= XTENSA_OP_PRIVILEGED
,
3056 .translate
= translate_nop
,
3059 .translate
= translate_nop
,
3062 .translate
= translate_nop
,
3065 .translate
= translate_nop
,
3068 .translate
= translate_nop
,
3071 .translate
= translate_nop
,
3074 .translate
= translate_nop
,
3077 .translate
= translate_nop
,
3080 .translate
= translate_nop
,
3083 .translate
= translate_nop
,
3086 .translate
= translate_nop
,
3089 .translate
= translate_entry
,
3090 .test_exceptions
= test_exceptions_entry
,
3091 .test_overflow
= test_overflow_entry
,
3092 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3093 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3096 .translate
= translate_nop
,
3099 .translate
= translate_nop
,
3102 .translate
= translate_extui
,
3105 .translate
= translate_memw
,
3108 .translate
= translate_getex
,
3111 .op_flags
= XTENSA_OP_ILL
,
3114 .op_flags
= XTENSA_OP_ILL
,
3117 .translate
= translate_itlb
,
3118 .par
= (const uint32_t[]){true},
3119 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3122 .translate
= translate_icache
,
3125 .translate
= translate_icache
,
3126 .op_flags
= XTENSA_OP_PRIVILEGED
,
3129 .translate
= translate_nop
,
3130 .op_flags
= XTENSA_OP_PRIVILEGED
,
3133 .translate
= translate_itlb
,
3134 .par
= (const uint32_t[]){false},
3135 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3138 .translate
= translate_nop
,
3139 .op_flags
= XTENSA_OP_PRIVILEGED
,
3141 .name
= (const char * const[]) {
3142 "ill", "ill.n", NULL
,
3144 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3147 .translate
= translate_nop
,
3150 .translate
= translate_icache
,
3151 .op_flags
= XTENSA_OP_PRIVILEGED
,
3154 .translate
= translate_nop
,
3157 .translate
= translate_j
,
3160 .translate
= translate_jx
,
3163 .translate
= translate_ldst
,
3164 .par
= (const uint32_t[]){MO_TESW
, false, false},
3165 .op_flags
= XTENSA_OP_LOAD
,
3168 .translate
= translate_ldst
,
3169 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3170 .op_flags
= XTENSA_OP_LOAD
,
3173 .translate
= translate_ldst
,
3174 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, false},
3175 .op_flags
= XTENSA_OP_LOAD
,
3178 .translate
= translate_l32e
,
3179 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3182 .translate
= translate_l32ex
,
3183 .op_flags
= XTENSA_OP_LOAD
,
3185 .name
= (const char * const[]) {
3186 "l32i", "l32i.n", NULL
,
3188 .translate
= translate_ldst
,
3189 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3190 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3193 .translate
= translate_l32r
,
3194 .op_flags
= XTENSA_OP_LOAD
,
3197 .translate
= translate_ldst
,
3198 .par
= (const uint32_t[]){MO_UB
, false, false},
3199 .op_flags
= XTENSA_OP_LOAD
,
3202 .translate
= translate_lct
,
3203 .op_flags
= XTENSA_OP_PRIVILEGED
,
3206 .translate
= translate_nop
,
3207 .op_flags
= XTENSA_OP_PRIVILEGED
,
3210 .translate
= translate_mac16
,
3211 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3212 .op_flags
= XTENSA_OP_LOAD
,
3215 .translate
= translate_mac16
,
3216 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3217 .op_flags
= XTENSA_OP_LOAD
,
3220 .op_flags
= XTENSA_OP_ILL
,
3223 .translate
= translate_lct
,
3224 .op_flags
= XTENSA_OP_PRIVILEGED
,
3227 .translate
= translate_nop
,
3228 .op_flags
= XTENSA_OP_PRIVILEGED
,
3230 .name
= (const char * const[]) {
3231 "loop", "loop.w15", NULL
,
3233 .translate
= translate_loop
,
3234 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3235 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3237 .name
= (const char * const[]) {
3238 "loopgtz", "loopgtz.w15", NULL
,
3240 .translate
= translate_loop
,
3241 .par
= (const uint32_t[]){TCG_COND_GT
},
3242 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3244 .name
= (const char * const[]) {
3245 "loopnez", "loopnez.w15", NULL
,
3247 .translate
= translate_loop
,
3248 .par
= (const uint32_t[]){TCG_COND_NE
},
3249 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3252 .translate
= translate_smax
,
3255 .translate
= translate_umax
,
3258 .translate
= translate_memw
,
3261 .translate
= translate_smin
,
3264 .translate
= translate_umin
,
3266 .name
= (const char * const[]) {
3267 "mov", "mov.n", NULL
,
3269 .translate
= translate_mov
,
3270 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3273 .translate
= translate_movcond
,
3274 .par
= (const uint32_t[]){TCG_COND_EQ
},
3277 .translate
= translate_movp
,
3278 .par
= (const uint32_t[]){TCG_COND_EQ
},
3281 .translate
= translate_movcond
,
3282 .par
= (const uint32_t[]){TCG_COND_GE
},
3285 .translate
= translate_movi
,
3288 .translate
= translate_movi
,
3291 .translate
= translate_movcond
,
3292 .par
= (const uint32_t[]){TCG_COND_LT
},
3295 .translate
= translate_movcond
,
3296 .par
= (const uint32_t[]){TCG_COND_NE
},
3299 .translate
= translate_movsp
,
3300 .op_flags
= XTENSA_OP_ALLOCA
,
3303 .translate
= translate_movp
,
3304 .par
= (const uint32_t[]){TCG_COND_NE
},
3306 .name
= "mul.aa.hh",
3307 .translate
= translate_mac16
,
3308 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3310 .name
= "mul.aa.hl",
3311 .translate
= translate_mac16
,
3312 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3314 .name
= "mul.aa.lh",
3315 .translate
= translate_mac16
,
3316 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3318 .name
= "mul.aa.ll",
3319 .translate
= translate_mac16
,
3320 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3322 .name
= "mul.ad.hh",
3323 .translate
= translate_mac16
,
3324 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3326 .name
= "mul.ad.hl",
3327 .translate
= translate_mac16
,
3328 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3330 .name
= "mul.ad.lh",
3331 .translate
= translate_mac16
,
3332 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3334 .name
= "mul.ad.ll",
3335 .translate
= translate_mac16
,
3336 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3338 .name
= "mul.da.hh",
3339 .translate
= translate_mac16
,
3340 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3342 .name
= "mul.da.hl",
3343 .translate
= translate_mac16
,
3344 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3346 .name
= "mul.da.lh",
3347 .translate
= translate_mac16
,
3348 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3350 .name
= "mul.da.ll",
3351 .translate
= translate_mac16
,
3352 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3354 .name
= "mul.dd.hh",
3355 .translate
= translate_mac16
,
3356 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3358 .name
= "mul.dd.hl",
3359 .translate
= translate_mac16
,
3360 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3362 .name
= "mul.dd.lh",
3363 .translate
= translate_mac16
,
3364 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3366 .name
= "mul.dd.ll",
3367 .translate
= translate_mac16
,
3368 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3371 .translate
= translate_mul16
,
3372 .par
= (const uint32_t[]){true},
3375 .translate
= translate_mul16
,
3376 .par
= (const uint32_t[]){false},
3378 .name
= "mula.aa.hh",
3379 .translate
= translate_mac16
,
3380 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3382 .name
= "mula.aa.hl",
3383 .translate
= translate_mac16
,
3384 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3386 .name
= "mula.aa.lh",
3387 .translate
= translate_mac16
,
3388 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3390 .name
= "mula.aa.ll",
3391 .translate
= translate_mac16
,
3392 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3394 .name
= "mula.ad.hh",
3395 .translate
= translate_mac16
,
3396 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3398 .name
= "mula.ad.hl",
3399 .translate
= translate_mac16
,
3400 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3402 .name
= "mula.ad.lh",
3403 .translate
= translate_mac16
,
3404 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3406 .name
= "mula.ad.ll",
3407 .translate
= translate_mac16
,
3408 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3410 .name
= "mula.da.hh",
3411 .translate
= translate_mac16
,
3412 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3414 .name
= "mula.da.hh.lddec",
3415 .translate
= translate_mac16
,
3416 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3418 .name
= "mula.da.hh.ldinc",
3419 .translate
= translate_mac16
,
3420 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3422 .name
= "mula.da.hl",
3423 .translate
= translate_mac16
,
3424 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3426 .name
= "mula.da.hl.lddec",
3427 .translate
= translate_mac16
,
3428 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3430 .name
= "mula.da.hl.ldinc",
3431 .translate
= translate_mac16
,
3432 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3434 .name
= "mula.da.lh",
3435 .translate
= translate_mac16
,
3436 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3438 .name
= "mula.da.lh.lddec",
3439 .translate
= translate_mac16
,
3440 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3442 .name
= "mula.da.lh.ldinc",
3443 .translate
= translate_mac16
,
3444 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3446 .name
= "mula.da.ll",
3447 .translate
= translate_mac16
,
3448 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3450 .name
= "mula.da.ll.lddec",
3451 .translate
= translate_mac16
,
3452 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3454 .name
= "mula.da.ll.ldinc",
3455 .translate
= translate_mac16
,
3456 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3458 .name
= "mula.dd.hh",
3459 .translate
= translate_mac16
,
3460 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3462 .name
= "mula.dd.hh.lddec",
3463 .translate
= translate_mac16
,
3464 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3466 .name
= "mula.dd.hh.ldinc",
3467 .translate
= translate_mac16
,
3468 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3470 .name
= "mula.dd.hl",
3471 .translate
= translate_mac16
,
3472 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3474 .name
= "mula.dd.hl.lddec",
3475 .translate
= translate_mac16
,
3476 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3478 .name
= "mula.dd.hl.ldinc",
3479 .translate
= translate_mac16
,
3480 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3482 .name
= "mula.dd.lh",
3483 .translate
= translate_mac16
,
3484 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3486 .name
= "mula.dd.lh.lddec",
3487 .translate
= translate_mac16
,
3488 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3490 .name
= "mula.dd.lh.ldinc",
3491 .translate
= translate_mac16
,
3492 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3494 .name
= "mula.dd.ll",
3495 .translate
= translate_mac16
,
3496 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3498 .name
= "mula.dd.ll.lddec",
3499 .translate
= translate_mac16
,
3500 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3502 .name
= "mula.dd.ll.ldinc",
3503 .translate
= translate_mac16
,
3504 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3507 .translate
= translate_mull
,
3509 .name
= "muls.aa.hh",
3510 .translate
= translate_mac16
,
3511 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3513 .name
= "muls.aa.hl",
3514 .translate
= translate_mac16
,
3515 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3517 .name
= "muls.aa.lh",
3518 .translate
= translate_mac16
,
3519 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3521 .name
= "muls.aa.ll",
3522 .translate
= translate_mac16
,
3523 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3525 .name
= "muls.ad.hh",
3526 .translate
= translate_mac16
,
3527 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3529 .name
= "muls.ad.hl",
3530 .translate
= translate_mac16
,
3531 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3533 .name
= "muls.ad.lh",
3534 .translate
= translate_mac16
,
3535 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3537 .name
= "muls.ad.ll",
3538 .translate
= translate_mac16
,
3539 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3541 .name
= "muls.da.hh",
3542 .translate
= translate_mac16
,
3543 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3545 .name
= "muls.da.hl",
3546 .translate
= translate_mac16
,
3547 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3549 .name
= "muls.da.lh",
3550 .translate
= translate_mac16
,
3551 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3553 .name
= "muls.da.ll",
3554 .translate
= translate_mac16
,
3555 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3557 .name
= "muls.dd.hh",
3558 .translate
= translate_mac16
,
3559 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3561 .name
= "muls.dd.hl",
3562 .translate
= translate_mac16
,
3563 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3565 .name
= "muls.dd.lh",
3566 .translate
= translate_mac16
,
3567 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3569 .name
= "muls.dd.ll",
3570 .translate
= translate_mac16
,
3571 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3574 .translate
= translate_mulh
,
3575 .par
= (const uint32_t[]){true},
3578 .translate
= translate_mulh
,
3579 .par
= (const uint32_t[]){false},
3582 .translate
= translate_neg
,
3584 .name
= (const char * const[]) {
3585 "nop", "nop.n", NULL
,
3587 .translate
= translate_nop
,
3588 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3591 .translate
= translate_nsa
,
3594 .translate
= translate_nsau
,
3597 .translate
= translate_or
,
3600 .translate
= translate_boolean
,
3601 .par
= (const uint32_t[]){BOOLEAN_OR
},
3604 .translate
= translate_boolean
,
3605 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3608 .translate
= translate_ptlb
,
3609 .par
= (const uint32_t[]){true},
3610 .op_flags
= XTENSA_OP_PRIVILEGED
,
3613 .translate
= translate_nop
,
3616 .translate
= translate_nop
,
3619 .translate
= translate_nop
,
3622 .translate
= translate_nop
,
3625 .translate
= translate_nop
,
3628 .translate
= translate_ptlb
,
3629 .par
= (const uint32_t[]){false},
3630 .op_flags
= XTENSA_OP_PRIVILEGED
,
3633 .translate
= translate_pptlb
,
3634 .op_flags
= XTENSA_OP_PRIVILEGED
,
3637 .translate
= translate_quos
,
3638 .par
= (const uint32_t[]){true},
3639 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3642 .translate
= translate_quou
,
3643 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3646 .translate
= translate_rtlb
,
3647 .par
= (const uint32_t[]){true, 0},
3648 .op_flags
= XTENSA_OP_PRIVILEGED
,
3651 .translate
= translate_rtlb
,
3652 .par
= (const uint32_t[]){true, 1},
3653 .op_flags
= XTENSA_OP_PRIVILEGED
,
3655 .name
= "read_impwire",
3656 .translate
= translate_read_impwire
,
3659 .translate
= translate_quos
,
3660 .par
= (const uint32_t[]){false},
3661 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3664 .translate
= translate_remu
,
3665 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3668 .translate
= translate_rer
,
3669 .op_flags
= XTENSA_OP_PRIVILEGED
,
3671 .name
= (const char * const[]) {
3672 "ret", "ret.n", NULL
,
3674 .translate
= translate_ret
,
3675 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3677 .name
= (const char * const[]) {
3678 "retw", "retw.n", NULL
,
3680 .translate
= translate_retw
,
3681 .test_exceptions
= test_exceptions_retw
,
3682 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3685 .op_flags
= XTENSA_OP_ILL
,
3688 .translate
= translate_rfde
,
3689 .op_flags
= XTENSA_OP_PRIVILEGED
,
3692 .op_flags
= XTENSA_OP_ILL
,
3695 .translate
= translate_rfe
,
3696 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3699 .translate
= translate_rfi
,
3700 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3703 .translate
= translate_rfw
,
3704 .par
= (const uint32_t[]){true},
3705 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3708 .translate
= translate_rfw
,
3709 .par
= (const uint32_t[]){false},
3710 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3713 .translate
= translate_rtlb
,
3714 .par
= (const uint32_t[]){false, 0},
3715 .op_flags
= XTENSA_OP_PRIVILEGED
,
3718 .translate
= translate_rtlb
,
3719 .par
= (const uint32_t[]){false, 1},
3720 .op_flags
= XTENSA_OP_PRIVILEGED
,
3723 .translate
= translate_rptlb0
,
3724 .op_flags
= XTENSA_OP_PRIVILEGED
,
3727 .translate
= translate_rptlb1
,
3728 .op_flags
= XTENSA_OP_PRIVILEGED
,
3731 .translate
= translate_rotw
,
3732 .op_flags
= XTENSA_OP_PRIVILEGED
|
3733 XTENSA_OP_EXIT_TB_M1
|
3734 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3737 .translate
= translate_rsil
,
3739 XTENSA_OP_PRIVILEGED
|
3740 XTENSA_OP_EXIT_TB_0
|
3741 XTENSA_OP_CHECK_INTERRUPTS
,
3744 .translate
= translate_rsr
,
3745 .par
= (const uint32_t[]){176},
3746 .op_flags
= XTENSA_OP_PRIVILEGED
,
3749 .translate
= translate_rsr
,
3750 .par
= (const uint32_t[]){208},
3751 .op_flags
= XTENSA_OP_PRIVILEGED
,
3753 .name
= "rsr.acchi",
3754 .translate
= translate_rsr
,
3755 .test_exceptions
= test_exceptions_sr
,
3756 .par
= (const uint32_t[]){
3758 XTENSA_OPTION_MAC16
,
3761 .name
= "rsr.acclo",
3762 .translate
= translate_rsr
,
3763 .test_exceptions
= test_exceptions_sr
,
3764 .par
= (const uint32_t[]){
3766 XTENSA_OPTION_MAC16
,
3769 .name
= "rsr.atomctl",
3770 .translate
= translate_rsr
,
3771 .test_exceptions
= test_exceptions_sr
,
3772 .par
= (const uint32_t[]){
3774 XTENSA_OPTION_ATOMCTL
,
3776 .op_flags
= XTENSA_OP_PRIVILEGED
,
3779 .translate
= translate_rsr
,
3780 .test_exceptions
= test_exceptions_sr
,
3781 .par
= (const uint32_t[]){
3783 XTENSA_OPTION_BOOLEAN
,
3786 .name
= "rsr.cacheadrdis",
3787 .translate
= translate_rsr
,
3788 .test_exceptions
= test_exceptions_sr
,
3789 .par
= (const uint32_t[]){
3793 .op_flags
= XTENSA_OP_PRIVILEGED
,
3795 .name
= "rsr.cacheattr",
3796 .translate
= translate_rsr
,
3797 .test_exceptions
= test_exceptions_sr
,
3798 .par
= (const uint32_t[]){
3800 XTENSA_OPTION_CACHEATTR
,
3802 .op_flags
= XTENSA_OP_PRIVILEGED
,
3804 .name
= "rsr.ccompare0",
3805 .translate
= translate_rsr
,
3806 .test_exceptions
= test_exceptions_ccompare
,
3807 .par
= (const uint32_t[]){
3809 XTENSA_OPTION_TIMER_INTERRUPT
,
3811 .op_flags
= XTENSA_OP_PRIVILEGED
,
3813 .name
= "rsr.ccompare1",
3814 .translate
= translate_rsr
,
3815 .test_exceptions
= test_exceptions_ccompare
,
3816 .par
= (const uint32_t[]){
3818 XTENSA_OPTION_TIMER_INTERRUPT
,
3820 .op_flags
= XTENSA_OP_PRIVILEGED
,
3822 .name
= "rsr.ccompare2",
3823 .translate
= translate_rsr
,
3824 .test_exceptions
= test_exceptions_ccompare
,
3825 .par
= (const uint32_t[]){
3827 XTENSA_OPTION_TIMER_INTERRUPT
,
3829 .op_flags
= XTENSA_OP_PRIVILEGED
,
3831 .name
= "rsr.ccount",
3832 .translate
= translate_rsr_ccount
,
3833 .test_exceptions
= test_exceptions_sr
,
3834 .par
= (const uint32_t[]){
3836 XTENSA_OPTION_TIMER_INTERRUPT
,
3838 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3840 .name
= "rsr.configid0",
3841 .translate
= translate_rsr
,
3842 .par
= (const uint32_t[]){CONFIGID0
},
3843 .op_flags
= XTENSA_OP_PRIVILEGED
,
3845 .name
= "rsr.configid1",
3846 .translate
= translate_rsr
,
3847 .par
= (const uint32_t[]){CONFIGID1
},
3848 .op_flags
= XTENSA_OP_PRIVILEGED
,
3850 .name
= "rsr.cpenable",
3851 .translate
= translate_rsr
,
3852 .test_exceptions
= test_exceptions_sr
,
3853 .par
= (const uint32_t[]){
3855 XTENSA_OPTION_COPROCESSOR
,
3857 .op_flags
= XTENSA_OP_PRIVILEGED
,
3859 .name
= "rsr.dbreaka0",
3860 .translate
= translate_rsr
,
3861 .test_exceptions
= test_exceptions_dbreak
,
3862 .par
= (const uint32_t[]){
3864 XTENSA_OPTION_DEBUG
,
3866 .op_flags
= XTENSA_OP_PRIVILEGED
,
3868 .name
= "rsr.dbreaka1",
3869 .translate
= translate_rsr
,
3870 .test_exceptions
= test_exceptions_dbreak
,
3871 .par
= (const uint32_t[]){
3873 XTENSA_OPTION_DEBUG
,
3875 .op_flags
= XTENSA_OP_PRIVILEGED
,
3877 .name
= "rsr.dbreakc0",
3878 .translate
= translate_rsr
,
3879 .test_exceptions
= test_exceptions_dbreak
,
3880 .par
= (const uint32_t[]){
3882 XTENSA_OPTION_DEBUG
,
3884 .op_flags
= XTENSA_OP_PRIVILEGED
,
3886 .name
= "rsr.dbreakc1",
3887 .translate
= translate_rsr
,
3888 .test_exceptions
= test_exceptions_dbreak
,
3889 .par
= (const uint32_t[]){
3891 XTENSA_OPTION_DEBUG
,
3893 .op_flags
= XTENSA_OP_PRIVILEGED
,
3896 .translate
= translate_rsr
,
3897 .test_exceptions
= test_exceptions_sr
,
3898 .par
= (const uint32_t[]){
3900 XTENSA_OPTION_DEBUG
,
3902 .op_flags
= XTENSA_OP_PRIVILEGED
,
3904 .name
= "rsr.debugcause",
3905 .translate
= translate_rsr
,
3906 .test_exceptions
= test_exceptions_sr
,
3907 .par
= (const uint32_t[]){
3909 XTENSA_OPTION_DEBUG
,
3911 .op_flags
= XTENSA_OP_PRIVILEGED
,
3914 .translate
= translate_rsr
,
3915 .test_exceptions
= test_exceptions_sr
,
3916 .par
= (const uint32_t[]){
3918 XTENSA_OPTION_EXCEPTION
,
3920 .op_flags
= XTENSA_OP_PRIVILEGED
,
3922 .name
= "rsr.dtlbcfg",
3923 .translate
= translate_rsr
,
3924 .test_exceptions
= test_exceptions_sr
,
3925 .par
= (const uint32_t[]){
3929 .op_flags
= XTENSA_OP_PRIVILEGED
,
3932 .translate
= translate_rsr
,
3933 .test_exceptions
= test_exceptions_sr
,
3934 .par
= (const uint32_t[]){
3936 XTENSA_OPTION_EXCEPTION
,
3938 .op_flags
= XTENSA_OP_PRIVILEGED
,
3941 .translate
= translate_rsr
,
3942 .test_exceptions
= test_exceptions_hpi
,
3943 .par
= (const uint32_t[]){
3945 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3947 .op_flags
= XTENSA_OP_PRIVILEGED
,
3950 .translate
= translate_rsr
,
3951 .test_exceptions
= test_exceptions_hpi
,
3952 .par
= (const uint32_t[]){
3954 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3956 .op_flags
= XTENSA_OP_PRIVILEGED
,
3959 .translate
= translate_rsr
,
3960 .test_exceptions
= test_exceptions_hpi
,
3961 .par
= (const uint32_t[]){
3963 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3965 .op_flags
= XTENSA_OP_PRIVILEGED
,
3968 .translate
= translate_rsr
,
3969 .test_exceptions
= test_exceptions_hpi
,
3970 .par
= (const uint32_t[]){
3972 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3974 .op_flags
= XTENSA_OP_PRIVILEGED
,
3977 .translate
= translate_rsr
,
3978 .test_exceptions
= test_exceptions_hpi
,
3979 .par
= (const uint32_t[]){
3981 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3983 .op_flags
= XTENSA_OP_PRIVILEGED
,
3986 .translate
= translate_rsr
,
3987 .test_exceptions
= test_exceptions_hpi
,
3988 .par
= (const uint32_t[]){
3990 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3992 .op_flags
= XTENSA_OP_PRIVILEGED
,
3995 .translate
= translate_rsr
,
3996 .test_exceptions
= test_exceptions_hpi
,
3997 .par
= (const uint32_t[]){
3999 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4001 .op_flags
= XTENSA_OP_PRIVILEGED
,
4004 .translate
= translate_rsr
,
4005 .test_exceptions
= test_exceptions_hpi
,
4006 .par
= (const uint32_t[]){
4008 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4010 .op_flags
= XTENSA_OP_PRIVILEGED
,
4013 .translate
= translate_rsr
,
4014 .test_exceptions
= test_exceptions_hpi
,
4015 .par
= (const uint32_t[]){
4017 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4019 .op_flags
= XTENSA_OP_PRIVILEGED
,
4022 .translate
= translate_rsr
,
4023 .test_exceptions
= test_exceptions_hpi
,
4024 .par
= (const uint32_t[]){
4026 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4028 .op_flags
= XTENSA_OP_PRIVILEGED
,
4031 .translate
= translate_rsr
,
4032 .test_exceptions
= test_exceptions_hpi
,
4033 .par
= (const uint32_t[]){
4035 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4037 .op_flags
= XTENSA_OP_PRIVILEGED
,
4040 .translate
= translate_rsr
,
4041 .test_exceptions
= test_exceptions_hpi
,
4042 .par
= (const uint32_t[]){
4044 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4046 .op_flags
= XTENSA_OP_PRIVILEGED
,
4048 .name
= "rsr.eraccess",
4049 .translate
= translate_rsr
,
4050 .par
= (const uint32_t[]){ERACCESS
},
4051 .op_flags
= XTENSA_OP_PRIVILEGED
,
4053 .name
= "rsr.exccause",
4054 .translate
= translate_rsr
,
4055 .test_exceptions
= test_exceptions_sr
,
4056 .par
= (const uint32_t[]){
4058 XTENSA_OPTION_EXCEPTION
,
4060 .op_flags
= XTENSA_OP_PRIVILEGED
,
4062 .name
= "rsr.excsave1",
4063 .translate
= translate_rsr
,
4064 .test_exceptions
= test_exceptions_sr
,
4065 .par
= (const uint32_t[]){
4067 XTENSA_OPTION_EXCEPTION
,
4069 .op_flags
= XTENSA_OP_PRIVILEGED
,
4071 .name
= "rsr.excsave2",
4072 .translate
= translate_rsr
,
4073 .test_exceptions
= test_exceptions_hpi
,
4074 .par
= (const uint32_t[]){
4076 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4078 .op_flags
= XTENSA_OP_PRIVILEGED
,
4080 .name
= "rsr.excsave3",
4081 .translate
= translate_rsr
,
4082 .test_exceptions
= test_exceptions_hpi
,
4083 .par
= (const uint32_t[]){
4085 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4087 .op_flags
= XTENSA_OP_PRIVILEGED
,
4089 .name
= "rsr.excsave4",
4090 .translate
= translate_rsr
,
4091 .test_exceptions
= test_exceptions_hpi
,
4092 .par
= (const uint32_t[]){
4094 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4096 .op_flags
= XTENSA_OP_PRIVILEGED
,
4098 .name
= "rsr.excsave5",
4099 .translate
= translate_rsr
,
4100 .test_exceptions
= test_exceptions_hpi
,
4101 .par
= (const uint32_t[]){
4103 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4105 .op_flags
= XTENSA_OP_PRIVILEGED
,
4107 .name
= "rsr.excsave6",
4108 .translate
= translate_rsr
,
4109 .test_exceptions
= test_exceptions_hpi
,
4110 .par
= (const uint32_t[]){
4112 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4114 .op_flags
= XTENSA_OP_PRIVILEGED
,
4116 .name
= "rsr.excsave7",
4117 .translate
= translate_rsr
,
4118 .test_exceptions
= test_exceptions_hpi
,
4119 .par
= (const uint32_t[]){
4121 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4123 .op_flags
= XTENSA_OP_PRIVILEGED
,
4125 .name
= "rsr.excvaddr",
4126 .translate
= translate_rsr
,
4127 .test_exceptions
= test_exceptions_sr
,
4128 .par
= (const uint32_t[]){
4130 XTENSA_OPTION_EXCEPTION
,
4132 .op_flags
= XTENSA_OP_PRIVILEGED
,
4134 .name
= "rsr.ibreaka0",
4135 .translate
= translate_rsr
,
4136 .test_exceptions
= test_exceptions_ibreak
,
4137 .par
= (const uint32_t[]){
4139 XTENSA_OPTION_DEBUG
,
4141 .op_flags
= XTENSA_OP_PRIVILEGED
,
4143 .name
= "rsr.ibreaka1",
4144 .translate
= translate_rsr
,
4145 .test_exceptions
= test_exceptions_ibreak
,
4146 .par
= (const uint32_t[]){
4148 XTENSA_OPTION_DEBUG
,
4150 .op_flags
= XTENSA_OP_PRIVILEGED
,
4152 .name
= "rsr.ibreakenable",
4153 .translate
= translate_rsr
,
4154 .test_exceptions
= test_exceptions_sr
,
4155 .par
= (const uint32_t[]){
4157 XTENSA_OPTION_DEBUG
,
4159 .op_flags
= XTENSA_OP_PRIVILEGED
,
4161 .name
= "rsr.icount",
4162 .translate
= translate_rsr
,
4163 .test_exceptions
= test_exceptions_sr
,
4164 .par
= (const uint32_t[]){
4166 XTENSA_OPTION_DEBUG
,
4168 .op_flags
= XTENSA_OP_PRIVILEGED
,
4170 .name
= "rsr.icountlevel",
4171 .translate
= translate_rsr
,
4172 .test_exceptions
= test_exceptions_sr
,
4173 .par
= (const uint32_t[]){
4175 XTENSA_OPTION_DEBUG
,
4177 .op_flags
= XTENSA_OP_PRIVILEGED
,
4179 .name
= "rsr.intclear",
4180 .translate
= translate_rsr
,
4181 .test_exceptions
= test_exceptions_sr
,
4182 .par
= (const uint32_t[]){
4184 XTENSA_OPTION_INTERRUPT
,
4186 .op_flags
= XTENSA_OP_PRIVILEGED
,
4188 .name
= "rsr.intenable",
4189 .translate
= translate_rsr
,
4190 .test_exceptions
= test_exceptions_sr
,
4191 .par
= (const uint32_t[]){
4193 XTENSA_OPTION_INTERRUPT
,
4195 .op_flags
= XTENSA_OP_PRIVILEGED
,
4197 .name
= "rsr.interrupt",
4198 .translate
= translate_rsr_ccount
,
4199 .test_exceptions
= test_exceptions_sr
,
4200 .par
= (const uint32_t[]){
4202 XTENSA_OPTION_INTERRUPT
,
4204 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4206 .name
= "rsr.intset",
4207 .translate
= translate_rsr_ccount
,
4208 .test_exceptions
= test_exceptions_sr
,
4209 .par
= (const uint32_t[]){
4211 XTENSA_OPTION_INTERRUPT
,
4213 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4215 .name
= "rsr.itlbcfg",
4216 .translate
= translate_rsr
,
4217 .test_exceptions
= test_exceptions_sr
,
4218 .par
= (const uint32_t[]){
4222 .op_flags
= XTENSA_OP_PRIVILEGED
,
4225 .translate
= translate_rsr
,
4226 .test_exceptions
= test_exceptions_sr
,
4227 .par
= (const uint32_t[]){
4232 .name
= "rsr.lcount",
4233 .translate
= translate_rsr
,
4234 .test_exceptions
= test_exceptions_sr
,
4235 .par
= (const uint32_t[]){
4241 .translate
= translate_rsr
,
4242 .test_exceptions
= test_exceptions_sr
,
4243 .par
= (const uint32_t[]){
4248 .name
= "rsr.litbase",
4249 .translate
= translate_rsr
,
4250 .test_exceptions
= test_exceptions_sr
,
4251 .par
= (const uint32_t[]){
4253 XTENSA_OPTION_EXTENDED_L32R
,
4257 .translate
= translate_rsr
,
4258 .test_exceptions
= test_exceptions_sr
,
4259 .par
= (const uint32_t[]){
4261 XTENSA_OPTION_MAC16
,
4265 .translate
= translate_rsr
,
4266 .test_exceptions
= test_exceptions_sr
,
4267 .par
= (const uint32_t[]){
4269 XTENSA_OPTION_MAC16
,
4273 .translate
= translate_rsr
,
4274 .test_exceptions
= test_exceptions_sr
,
4275 .par
= (const uint32_t[]){
4277 XTENSA_OPTION_MAC16
,
4281 .translate
= translate_rsr
,
4282 .test_exceptions
= test_exceptions_sr
,
4283 .par
= (const uint32_t[]){
4285 XTENSA_OPTION_MAC16
,
4288 .name
= "rsr.memctl",
4289 .translate
= translate_rsr
,
4290 .par
= (const uint32_t[]){MEMCTL
},
4291 .op_flags
= XTENSA_OP_PRIVILEGED
,
4294 .translate
= translate_rsr
,
4295 .test_exceptions
= test_exceptions_sr
,
4296 .par
= (const uint32_t[]){
4298 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4300 .op_flags
= XTENSA_OP_PRIVILEGED
,
4303 .translate
= translate_rsr
,
4304 .test_exceptions
= test_exceptions_sr
,
4305 .par
= (const uint32_t[]){
4307 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4309 .op_flags
= XTENSA_OP_PRIVILEGED
,
4312 .translate
= translate_rsr
,
4313 .test_exceptions
= test_exceptions_sr
,
4314 .par
= (const uint32_t[]){
4316 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4318 .op_flags
= XTENSA_OP_PRIVILEGED
,
4320 .name
= "rsr.mesave",
4321 .translate
= translate_rsr
,
4322 .test_exceptions
= test_exceptions_sr
,
4323 .par
= (const uint32_t[]){
4325 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4327 .op_flags
= XTENSA_OP_PRIVILEGED
,
4330 .translate
= translate_rsr
,
4331 .test_exceptions
= test_exceptions_sr
,
4332 .par
= (const uint32_t[]){
4334 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4336 .op_flags
= XTENSA_OP_PRIVILEGED
,
4338 .name
= "rsr.mevaddr",
4339 .translate
= translate_rsr
,
4340 .test_exceptions
= test_exceptions_sr
,
4341 .par
= (const uint32_t[]){
4343 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4345 .op_flags
= XTENSA_OP_PRIVILEGED
,
4347 .name
= "rsr.misc0",
4348 .translate
= translate_rsr
,
4349 .test_exceptions
= test_exceptions_sr
,
4350 .par
= (const uint32_t[]){
4352 XTENSA_OPTION_MISC_SR
,
4354 .op_flags
= XTENSA_OP_PRIVILEGED
,
4356 .name
= "rsr.misc1",
4357 .translate
= translate_rsr
,
4358 .test_exceptions
= test_exceptions_sr
,
4359 .par
= (const uint32_t[]){
4361 XTENSA_OPTION_MISC_SR
,
4363 .op_flags
= XTENSA_OP_PRIVILEGED
,
4365 .name
= "rsr.misc2",
4366 .translate
= translate_rsr
,
4367 .test_exceptions
= test_exceptions_sr
,
4368 .par
= (const uint32_t[]){
4370 XTENSA_OPTION_MISC_SR
,
4372 .op_flags
= XTENSA_OP_PRIVILEGED
,
4374 .name
= "rsr.misc3",
4375 .translate
= translate_rsr
,
4376 .test_exceptions
= test_exceptions_sr
,
4377 .par
= (const uint32_t[]){
4379 XTENSA_OPTION_MISC_SR
,
4381 .op_flags
= XTENSA_OP_PRIVILEGED
,
4383 .name
= "rsr.mpucfg",
4384 .translate
= translate_rsr
,
4385 .test_exceptions
= test_exceptions_sr
,
4386 .par
= (const uint32_t[]){
4390 .op_flags
= XTENSA_OP_PRIVILEGED
,
4392 .name
= "rsr.mpuenb",
4393 .translate
= translate_rsr
,
4394 .test_exceptions
= test_exceptions_sr
,
4395 .par
= (const uint32_t[]){
4399 .op_flags
= XTENSA_OP_PRIVILEGED
,
4401 .name
= "rsr.prefctl",
4402 .translate
= translate_rsr
,
4403 .par
= (const uint32_t[]){PREFCTL
},
4406 .translate
= translate_rsr
,
4407 .test_exceptions
= test_exceptions_sr
,
4408 .par
= (const uint32_t[]){
4410 XTENSA_OPTION_PROCESSOR_ID
,
4412 .op_flags
= XTENSA_OP_PRIVILEGED
,
4415 .translate
= translate_rsr
,
4416 .test_exceptions
= test_exceptions_sr
,
4417 .par
= (const uint32_t[]){
4419 XTENSA_OPTION_EXCEPTION
,
4421 .op_flags
= XTENSA_OP_PRIVILEGED
,
4423 .name
= "rsr.ptevaddr",
4424 .translate
= translate_rsr_ptevaddr
,
4425 .test_exceptions
= test_exceptions_sr
,
4426 .par
= (const uint32_t[]){
4430 .op_flags
= XTENSA_OP_PRIVILEGED
,
4432 .name
= "rsr.rasid",
4433 .translate
= translate_rsr
,
4434 .test_exceptions
= test_exceptions_sr
,
4435 .par
= (const uint32_t[]){
4439 .op_flags
= XTENSA_OP_PRIVILEGED
,
4442 .translate
= translate_rsr
,
4443 .par
= (const uint32_t[]){SAR
},
4445 .name
= "rsr.scompare1",
4446 .translate
= translate_rsr
,
4447 .test_exceptions
= test_exceptions_sr
,
4448 .par
= (const uint32_t[]){
4450 XTENSA_OPTION_CONDITIONAL_STORE
,
4453 .name
= "rsr.vecbase",
4454 .translate
= translate_rsr
,
4455 .test_exceptions
= test_exceptions_sr
,
4456 .par
= (const uint32_t[]){
4458 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4460 .op_flags
= XTENSA_OP_PRIVILEGED
,
4462 .name
= "rsr.windowbase",
4463 .translate
= translate_rsr
,
4464 .test_exceptions
= test_exceptions_sr
,
4465 .par
= (const uint32_t[]){
4467 XTENSA_OPTION_WINDOWED_REGISTER
,
4469 .op_flags
= XTENSA_OP_PRIVILEGED
,
4471 .name
= "rsr.windowstart",
4472 .translate
= translate_rsr
,
4473 .test_exceptions
= test_exceptions_sr
,
4474 .par
= (const uint32_t[]){
4476 XTENSA_OPTION_WINDOWED_REGISTER
,
4478 .op_flags
= XTENSA_OP_PRIVILEGED
,
4481 .translate
= translate_nop
,
4483 .name
= "rur.expstate",
4484 .translate
= translate_rur
,
4485 .par
= (const uint32_t[]){EXPSTATE
},
4487 .name
= "rur.threadptr",
4488 .translate
= translate_rur
,
4489 .par
= (const uint32_t[]){THREADPTR
},
4492 .translate
= translate_ldst
,
4493 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4494 .op_flags
= XTENSA_OP_STORE
,
4497 .translate
= translate_s32c1i
,
4498 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4501 .translate
= translate_s32e
,
4502 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4505 .translate
= translate_s32ex
,
4506 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4508 .name
= (const char * const[]) {
4509 "s32i", "s32i.n", "s32nb", NULL
,
4511 .translate
= translate_ldst
,
4512 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4513 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4516 .translate
= translate_ldst
,
4517 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, true},
4518 .op_flags
= XTENSA_OP_STORE
,
4521 .translate
= translate_ldst
,
4522 .par
= (const uint32_t[]){MO_UB
, false, true},
4523 .op_flags
= XTENSA_OP_STORE
,
4526 .translate
= translate_salt
,
4527 .par
= (const uint32_t[]){TCG_COND_LT
},
4530 .translate
= translate_salt
,
4531 .par
= (const uint32_t[]){TCG_COND_LTU
},
4534 .translate
= translate_nop
,
4535 .op_flags
= XTENSA_OP_PRIVILEGED
,
4538 .translate
= translate_nop
,
4539 .op_flags
= XTENSA_OP_PRIVILEGED
,
4541 .name
= "setb_expstate",
4542 .translate
= translate_setb_expstate
,
4545 .translate
= translate_sext
,
4548 .translate
= translate_nop
,
4549 .op_flags
= XTENSA_OP_PRIVILEGED
,
4552 .translate
= translate_nop
,
4553 .op_flags
= XTENSA_OP_PRIVILEGED
,
4556 .translate
= translate_simcall
,
4557 .test_exceptions
= test_exceptions_simcall
,
4558 .op_flags
= XTENSA_OP_PRIVILEGED
,
4561 .translate
= translate_sll
,
4564 .translate
= translate_slli
,
4567 .translate
= translate_sra
,
4570 .translate
= translate_srai
,
4573 .translate
= translate_src
,
4576 .translate
= translate_srl
,
4579 .translate
= translate_srli
,
4582 .translate
= translate_ssa8b
,
4585 .translate
= translate_ssa8l
,
4588 .translate
= translate_ssai
,
4591 .translate
= translate_ssl
,
4594 .translate
= translate_ssr
,
4597 .translate
= translate_sub
,
4600 .translate
= translate_subx
,
4601 .par
= (const uint32_t[]){1},
4604 .translate
= translate_subx
,
4605 .par
= (const uint32_t[]){2},
4608 .translate
= translate_subx
,
4609 .par
= (const uint32_t[]){3},
4612 .op_flags
= XTENSA_OP_SYSCALL
,
4614 .name
= "umul.aa.hh",
4615 .translate
= translate_mac16
,
4616 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4618 .name
= "umul.aa.hl",
4619 .translate
= translate_mac16
,
4620 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4622 .name
= "umul.aa.lh",
4623 .translate
= translate_mac16
,
4624 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4626 .name
= "umul.aa.ll",
4627 .translate
= translate_mac16
,
4628 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4631 .translate
= translate_waiti
,
4632 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4635 .translate
= translate_wtlb
,
4636 .par
= (const uint32_t[]){true},
4637 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4640 .translate
= translate_wer
,
4641 .op_flags
= XTENSA_OP_PRIVILEGED
,
4644 .translate
= translate_wtlb
,
4645 .par
= (const uint32_t[]){false},
4646 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4649 .translate
= translate_wptlb
,
4650 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4652 .name
= "wrmsk_expstate",
4653 .translate
= translate_wrmsk_expstate
,
4656 .op_flags
= XTENSA_OP_ILL
,
4659 .op_flags
= XTENSA_OP_ILL
,
4661 .name
= "wsr.acchi",
4662 .translate
= translate_wsr_acchi
,
4663 .test_exceptions
= test_exceptions_sr
,
4664 .par
= (const uint32_t[]){
4666 XTENSA_OPTION_MAC16
,
4669 .name
= "wsr.acclo",
4670 .translate
= translate_wsr
,
4671 .test_exceptions
= test_exceptions_sr
,
4672 .par
= (const uint32_t[]){
4674 XTENSA_OPTION_MAC16
,
4677 .name
= "wsr.atomctl",
4678 .translate
= translate_wsr_mask
,
4679 .test_exceptions
= test_exceptions_sr
,
4680 .par
= (const uint32_t[]){
4682 XTENSA_OPTION_ATOMCTL
,
4685 .op_flags
= XTENSA_OP_PRIVILEGED
,
4688 .translate
= translate_wsr_mask
,
4689 .test_exceptions
= test_exceptions_sr
,
4690 .par
= (const uint32_t[]){
4692 XTENSA_OPTION_BOOLEAN
,
4696 .name
= "wsr.cacheadrdis",
4697 .translate
= translate_wsr_mask
,
4698 .test_exceptions
= test_exceptions_sr
,
4699 .par
= (const uint32_t[]){
4704 .op_flags
= XTENSA_OP_PRIVILEGED
,
4706 .name
= "wsr.cacheattr",
4707 .translate
= translate_wsr
,
4708 .test_exceptions
= test_exceptions_sr
,
4709 .par
= (const uint32_t[]){
4711 XTENSA_OPTION_CACHEATTR
,
4713 .op_flags
= XTENSA_OP_PRIVILEGED
,
4715 .name
= "wsr.ccompare0",
4716 .translate
= translate_wsr_ccompare
,
4717 .test_exceptions
= test_exceptions_ccompare
,
4718 .par
= (const uint32_t[]){
4720 XTENSA_OPTION_TIMER_INTERRUPT
,
4722 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4724 .name
= "wsr.ccompare1",
4725 .translate
= translate_wsr_ccompare
,
4726 .test_exceptions
= test_exceptions_ccompare
,
4727 .par
= (const uint32_t[]){
4729 XTENSA_OPTION_TIMER_INTERRUPT
,
4731 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4733 .name
= "wsr.ccompare2",
4734 .translate
= translate_wsr_ccompare
,
4735 .test_exceptions
= test_exceptions_ccompare
,
4736 .par
= (const uint32_t[]){
4738 XTENSA_OPTION_TIMER_INTERRUPT
,
4740 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4742 .name
= "wsr.ccount",
4743 .translate
= translate_wsr_ccount
,
4744 .test_exceptions
= test_exceptions_sr
,
4745 .par
= (const uint32_t[]){
4747 XTENSA_OPTION_TIMER_INTERRUPT
,
4749 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4751 .name
= "wsr.configid0",
4752 .op_flags
= XTENSA_OP_ILL
,
4754 .name
= "wsr.configid1",
4755 .op_flags
= XTENSA_OP_ILL
,
4757 .name
= "wsr.cpenable",
4758 .translate
= translate_wsr_mask
,
4759 .test_exceptions
= test_exceptions_sr
,
4760 .par
= (const uint32_t[]){
4762 XTENSA_OPTION_COPROCESSOR
,
4765 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4767 .name
= "wsr.dbreaka0",
4768 .translate
= translate_wsr_dbreaka
,
4769 .test_exceptions
= test_exceptions_dbreak
,
4770 .par
= (const uint32_t[]){
4772 XTENSA_OPTION_DEBUG
,
4774 .op_flags
= XTENSA_OP_PRIVILEGED
,
4776 .name
= "wsr.dbreaka1",
4777 .translate
= translate_wsr_dbreaka
,
4778 .test_exceptions
= test_exceptions_dbreak
,
4779 .par
= (const uint32_t[]){
4781 XTENSA_OPTION_DEBUG
,
4783 .op_flags
= XTENSA_OP_PRIVILEGED
,
4785 .name
= "wsr.dbreakc0",
4786 .translate
= translate_wsr_dbreakc
,
4787 .test_exceptions
= test_exceptions_dbreak
,
4788 .par
= (const uint32_t[]){
4790 XTENSA_OPTION_DEBUG
,
4792 .op_flags
= XTENSA_OP_PRIVILEGED
,
4794 .name
= "wsr.dbreakc1",
4795 .translate
= translate_wsr_dbreakc
,
4796 .test_exceptions
= test_exceptions_dbreak
,
4797 .par
= (const uint32_t[]){
4799 XTENSA_OPTION_DEBUG
,
4801 .op_flags
= XTENSA_OP_PRIVILEGED
,
4804 .translate
= translate_wsr
,
4805 .test_exceptions
= test_exceptions_sr
,
4806 .par
= (const uint32_t[]){
4808 XTENSA_OPTION_DEBUG
,
4810 .op_flags
= XTENSA_OP_PRIVILEGED
,
4812 .name
= "wsr.debugcause",
4813 .op_flags
= XTENSA_OP_ILL
,
4816 .translate
= translate_wsr
,
4817 .test_exceptions
= test_exceptions_sr
,
4818 .par
= (const uint32_t[]){
4820 XTENSA_OPTION_EXCEPTION
,
4822 .op_flags
= XTENSA_OP_PRIVILEGED
,
4824 .name
= "wsr.dtlbcfg",
4825 .translate
= translate_wsr_mask
,
4826 .test_exceptions
= test_exceptions_sr
,
4827 .par
= (const uint32_t[]){
4832 .op_flags
= XTENSA_OP_PRIVILEGED
,
4835 .translate
= translate_wsr
,
4836 .test_exceptions
= test_exceptions_sr
,
4837 .par
= (const uint32_t[]){
4839 XTENSA_OPTION_EXCEPTION
,
4841 .op_flags
= XTENSA_OP_PRIVILEGED
,
4844 .translate
= translate_wsr
,
4845 .test_exceptions
= test_exceptions_hpi
,
4846 .par
= (const uint32_t[]){
4848 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4850 .op_flags
= XTENSA_OP_PRIVILEGED
,
4853 .translate
= translate_wsr
,
4854 .test_exceptions
= test_exceptions_hpi
,
4855 .par
= (const uint32_t[]){
4857 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4859 .op_flags
= XTENSA_OP_PRIVILEGED
,
4862 .translate
= translate_wsr
,
4863 .test_exceptions
= test_exceptions_hpi
,
4864 .par
= (const uint32_t[]){
4866 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4868 .op_flags
= XTENSA_OP_PRIVILEGED
,
4871 .translate
= translate_wsr
,
4872 .test_exceptions
= test_exceptions_hpi
,
4873 .par
= (const uint32_t[]){
4875 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4877 .op_flags
= XTENSA_OP_PRIVILEGED
,
4880 .translate
= translate_wsr
,
4881 .test_exceptions
= test_exceptions_hpi
,
4882 .par
= (const uint32_t[]){
4884 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4886 .op_flags
= XTENSA_OP_PRIVILEGED
,
4889 .translate
= translate_wsr
,
4890 .test_exceptions
= test_exceptions_hpi
,
4891 .par
= (const uint32_t[]){
4893 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4895 .op_flags
= XTENSA_OP_PRIVILEGED
,
4898 .translate
= translate_wsr
,
4899 .test_exceptions
= test_exceptions_hpi
,
4900 .par
= (const uint32_t[]){
4902 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4904 .op_flags
= XTENSA_OP_PRIVILEGED
,
4907 .translate
= translate_wsr
,
4908 .test_exceptions
= test_exceptions_hpi
,
4909 .par
= (const uint32_t[]){
4911 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4913 .op_flags
= XTENSA_OP_PRIVILEGED
,
4916 .translate
= translate_wsr
,
4917 .test_exceptions
= test_exceptions_hpi
,
4918 .par
= (const uint32_t[]){
4920 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4922 .op_flags
= XTENSA_OP_PRIVILEGED
,
4925 .translate
= translate_wsr
,
4926 .test_exceptions
= test_exceptions_hpi
,
4927 .par
= (const uint32_t[]){
4929 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4931 .op_flags
= XTENSA_OP_PRIVILEGED
,
4934 .translate
= translate_wsr
,
4935 .test_exceptions
= test_exceptions_hpi
,
4936 .par
= (const uint32_t[]){
4938 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4940 .op_flags
= XTENSA_OP_PRIVILEGED
,
4943 .translate
= translate_wsr
,
4944 .test_exceptions
= test_exceptions_hpi
,
4945 .par
= (const uint32_t[]){
4947 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4949 .op_flags
= XTENSA_OP_PRIVILEGED
,
4951 .name
= "wsr.eraccess",
4952 .translate
= translate_wsr_mask
,
4953 .par
= (const uint32_t[]){
4958 .op_flags
= XTENSA_OP_PRIVILEGED
,
4960 .name
= "wsr.exccause",
4961 .translate
= translate_wsr
,
4962 .test_exceptions
= test_exceptions_sr
,
4963 .par
= (const uint32_t[]){
4965 XTENSA_OPTION_EXCEPTION
,
4967 .op_flags
= XTENSA_OP_PRIVILEGED
,
4969 .name
= "wsr.excsave1",
4970 .translate
= translate_wsr
,
4971 .test_exceptions
= test_exceptions_sr
,
4972 .par
= (const uint32_t[]){
4974 XTENSA_OPTION_EXCEPTION
,
4976 .op_flags
= XTENSA_OP_PRIVILEGED
,
4978 .name
= "wsr.excsave2",
4979 .translate
= translate_wsr
,
4980 .test_exceptions
= test_exceptions_hpi
,
4981 .par
= (const uint32_t[]){
4983 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4985 .op_flags
= XTENSA_OP_PRIVILEGED
,
4987 .name
= "wsr.excsave3",
4988 .translate
= translate_wsr
,
4989 .test_exceptions
= test_exceptions_hpi
,
4990 .par
= (const uint32_t[]){
4992 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4994 .op_flags
= XTENSA_OP_PRIVILEGED
,
4996 .name
= "wsr.excsave4",
4997 .translate
= translate_wsr
,
4998 .test_exceptions
= test_exceptions_hpi
,
4999 .par
= (const uint32_t[]){
5001 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5003 .op_flags
= XTENSA_OP_PRIVILEGED
,
5005 .name
= "wsr.excsave5",
5006 .translate
= translate_wsr
,
5007 .test_exceptions
= test_exceptions_hpi
,
5008 .par
= (const uint32_t[]){
5010 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5012 .op_flags
= XTENSA_OP_PRIVILEGED
,
5014 .name
= "wsr.excsave6",
5015 .translate
= translate_wsr
,
5016 .test_exceptions
= test_exceptions_hpi
,
5017 .par
= (const uint32_t[]){
5019 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5021 .op_flags
= XTENSA_OP_PRIVILEGED
,
5023 .name
= "wsr.excsave7",
5024 .translate
= translate_wsr
,
5025 .test_exceptions
= test_exceptions_hpi
,
5026 .par
= (const uint32_t[]){
5028 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5030 .op_flags
= XTENSA_OP_PRIVILEGED
,
5032 .name
= "wsr.excvaddr",
5033 .translate
= translate_wsr
,
5034 .test_exceptions
= test_exceptions_sr
,
5035 .par
= (const uint32_t[]){
5037 XTENSA_OPTION_EXCEPTION
,
5039 .op_flags
= XTENSA_OP_PRIVILEGED
,
5041 .name
= "wsr.ibreaka0",
5042 .translate
= translate_wsr_ibreaka
,
5043 .test_exceptions
= test_exceptions_ibreak
,
5044 .par
= (const uint32_t[]){
5046 XTENSA_OPTION_DEBUG
,
5048 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5050 .name
= "wsr.ibreaka1",
5051 .translate
= translate_wsr_ibreaka
,
5052 .test_exceptions
= test_exceptions_ibreak
,
5053 .par
= (const uint32_t[]){
5055 XTENSA_OPTION_DEBUG
,
5057 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5059 .name
= "wsr.ibreakenable",
5060 .translate
= translate_wsr_ibreakenable
,
5061 .test_exceptions
= test_exceptions_sr
,
5062 .par
= (const uint32_t[]){
5064 XTENSA_OPTION_DEBUG
,
5066 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5068 .name
= "wsr.icount",
5069 .translate
= translate_wsr_icount
,
5070 .test_exceptions
= test_exceptions_sr
,
5071 .par
= (const uint32_t[]){
5073 XTENSA_OPTION_DEBUG
,
5075 .op_flags
= XTENSA_OP_PRIVILEGED
,
5077 .name
= "wsr.icountlevel",
5078 .translate
= translate_wsr_mask
,
5079 .test_exceptions
= test_exceptions_sr
,
5080 .par
= (const uint32_t[]){
5082 XTENSA_OPTION_DEBUG
,
5085 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5087 .name
= "wsr.intclear",
5088 .translate
= translate_wsr_intclear
,
5089 .test_exceptions
= test_exceptions_sr
,
5090 .par
= (const uint32_t[]){
5092 XTENSA_OPTION_INTERRUPT
,
5095 XTENSA_OP_PRIVILEGED
|
5096 XTENSA_OP_EXIT_TB_0
|
5097 XTENSA_OP_CHECK_INTERRUPTS
,
5099 .name
= "wsr.intenable",
5100 .translate
= translate_wsr
,
5101 .test_exceptions
= test_exceptions_sr
,
5102 .par
= (const uint32_t[]){
5104 XTENSA_OPTION_INTERRUPT
,
5107 XTENSA_OP_PRIVILEGED
|
5108 XTENSA_OP_EXIT_TB_0
|
5109 XTENSA_OP_CHECK_INTERRUPTS
,
5111 .name
= "wsr.interrupt",
5112 .translate
= translate_wsr
,
5113 .test_exceptions
= test_exceptions_sr
,
5114 .par
= (const uint32_t[]){
5116 XTENSA_OPTION_INTERRUPT
,
5119 XTENSA_OP_PRIVILEGED
|
5120 XTENSA_OP_EXIT_TB_0
|
5121 XTENSA_OP_CHECK_INTERRUPTS
,
5123 .name
= "wsr.intset",
5124 .translate
= translate_wsr_intset
,
5125 .test_exceptions
= test_exceptions_sr
,
5126 .par
= (const uint32_t[]){
5128 XTENSA_OPTION_INTERRUPT
,
5131 XTENSA_OP_PRIVILEGED
|
5132 XTENSA_OP_EXIT_TB_0
|
5133 XTENSA_OP_CHECK_INTERRUPTS
,
5135 .name
= "wsr.itlbcfg",
5136 .translate
= translate_wsr_mask
,
5137 .test_exceptions
= test_exceptions_sr
,
5138 .par
= (const uint32_t[]){
5143 .op_flags
= XTENSA_OP_PRIVILEGED
,
5146 .translate
= translate_wsr
,
5147 .test_exceptions
= test_exceptions_sr
,
5148 .par
= (const uint32_t[]){
5152 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5154 .name
= "wsr.lcount",
5155 .translate
= translate_wsr
,
5156 .test_exceptions
= test_exceptions_sr
,
5157 .par
= (const uint32_t[]){
5163 .translate
= translate_wsr
,
5164 .test_exceptions
= test_exceptions_sr
,
5165 .par
= (const uint32_t[]){
5169 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5171 .name
= "wsr.litbase",
5172 .translate
= translate_wsr_mask
,
5173 .test_exceptions
= test_exceptions_sr
,
5174 .par
= (const uint32_t[]){
5176 XTENSA_OPTION_EXTENDED_L32R
,
5179 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5182 .translate
= translate_wsr
,
5183 .test_exceptions
= test_exceptions_sr
,
5184 .par
= (const uint32_t[]){
5186 XTENSA_OPTION_MAC16
,
5190 .translate
= translate_wsr
,
5191 .test_exceptions
= test_exceptions_sr
,
5192 .par
= (const uint32_t[]){
5194 XTENSA_OPTION_MAC16
,
5198 .translate
= translate_wsr
,
5199 .test_exceptions
= test_exceptions_sr
,
5200 .par
= (const uint32_t[]){
5202 XTENSA_OPTION_MAC16
,
5206 .translate
= translate_wsr
,
5207 .test_exceptions
= test_exceptions_sr
,
5208 .par
= (const uint32_t[]){
5210 XTENSA_OPTION_MAC16
,
5213 .name
= "wsr.memctl",
5214 .translate
= translate_wsr_memctl
,
5215 .par
= (const uint32_t[]){MEMCTL
},
5216 .op_flags
= XTENSA_OP_PRIVILEGED
,
5219 .translate
= translate_wsr
,
5220 .test_exceptions
= test_exceptions_sr
,
5221 .par
= (const uint32_t[]){
5223 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5225 .op_flags
= XTENSA_OP_PRIVILEGED
,
5228 .translate
= translate_wsr
,
5229 .test_exceptions
= test_exceptions_sr
,
5230 .par
= (const uint32_t[]){
5232 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5234 .op_flags
= XTENSA_OP_PRIVILEGED
,
5237 .translate
= translate_wsr
,
5238 .test_exceptions
= test_exceptions_sr
,
5239 .par
= (const uint32_t[]){
5241 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5243 .op_flags
= XTENSA_OP_PRIVILEGED
,
5245 .name
= "wsr.mesave",
5246 .translate
= translate_wsr
,
5247 .test_exceptions
= test_exceptions_sr
,
5248 .par
= (const uint32_t[]){
5250 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5252 .op_flags
= XTENSA_OP_PRIVILEGED
,
5255 .translate
= translate_wsr
,
5256 .test_exceptions
= test_exceptions_sr
,
5257 .par
= (const uint32_t[]){
5259 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5261 .op_flags
= XTENSA_OP_PRIVILEGED
,
5263 .name
= "wsr.mevaddr",
5264 .translate
= translate_wsr
,
5265 .test_exceptions
= test_exceptions_sr
,
5266 .par
= (const uint32_t[]){
5268 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5270 .op_flags
= XTENSA_OP_PRIVILEGED
,
5272 .name
= "wsr.misc0",
5273 .translate
= translate_wsr
,
5274 .test_exceptions
= test_exceptions_sr
,
5275 .par
= (const uint32_t[]){
5277 XTENSA_OPTION_MISC_SR
,
5279 .op_flags
= XTENSA_OP_PRIVILEGED
,
5281 .name
= "wsr.misc1",
5282 .translate
= translate_wsr
,
5283 .test_exceptions
= test_exceptions_sr
,
5284 .par
= (const uint32_t[]){
5286 XTENSA_OPTION_MISC_SR
,
5288 .op_flags
= XTENSA_OP_PRIVILEGED
,
5290 .name
= "wsr.misc2",
5291 .translate
= translate_wsr
,
5292 .test_exceptions
= test_exceptions_sr
,
5293 .par
= (const uint32_t[]){
5295 XTENSA_OPTION_MISC_SR
,
5297 .op_flags
= XTENSA_OP_PRIVILEGED
,
5299 .name
= "wsr.misc3",
5300 .translate
= translate_wsr
,
5301 .test_exceptions
= test_exceptions_sr
,
5302 .par
= (const uint32_t[]){
5304 XTENSA_OPTION_MISC_SR
,
5306 .op_flags
= XTENSA_OP_PRIVILEGED
,
5309 .translate
= translate_wsr
,
5310 .test_exceptions
= test_exceptions_sr
,
5311 .par
= (const uint32_t[]){
5313 XTENSA_OPTION_TRACE_PORT
,
5315 .op_flags
= XTENSA_OP_PRIVILEGED
,
5317 .name
= "wsr.mpuenb",
5318 .translate
= translate_wsr_mpuenb
,
5319 .test_exceptions
= test_exceptions_sr
,
5320 .par
= (const uint32_t[]){
5324 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5326 .name
= "wsr.prefctl",
5327 .translate
= translate_wsr
,
5328 .par
= (const uint32_t[]){PREFCTL
},
5331 .op_flags
= XTENSA_OP_ILL
,
5334 .translate
= translate_wsr_ps
,
5335 .test_exceptions
= test_exceptions_sr
,
5336 .par
= (const uint32_t[]){
5338 XTENSA_OPTION_EXCEPTION
,
5341 XTENSA_OP_PRIVILEGED
|
5342 XTENSA_OP_EXIT_TB_M1
|
5343 XTENSA_OP_CHECK_INTERRUPTS
,
5345 .name
= "wsr.ptevaddr",
5346 .translate
= translate_wsr_mask
,
5347 .test_exceptions
= test_exceptions_sr
,
5348 .par
= (const uint32_t[]){
5353 .op_flags
= XTENSA_OP_PRIVILEGED
,
5355 .name
= "wsr.rasid",
5356 .translate
= translate_wsr_rasid
,
5357 .test_exceptions
= test_exceptions_sr
,
5358 .par
= (const uint32_t[]){
5362 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5365 .translate
= translate_wsr_sar
,
5366 .par
= (const uint32_t[]){SAR
},
5368 .name
= "wsr.scompare1",
5369 .translate
= translate_wsr
,
5370 .test_exceptions
= test_exceptions_sr
,
5371 .par
= (const uint32_t[]){
5373 XTENSA_OPTION_CONDITIONAL_STORE
,
5376 .name
= "wsr.vecbase",
5377 .translate
= translate_wsr
,
5378 .test_exceptions
= test_exceptions_sr
,
5379 .par
= (const uint32_t[]){
5381 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5383 .op_flags
= XTENSA_OP_PRIVILEGED
,
5385 .name
= "wsr.windowbase",
5386 .translate
= translate_wsr_windowbase
,
5387 .test_exceptions
= test_exceptions_sr
,
5388 .par
= (const uint32_t[]){
5390 XTENSA_OPTION_WINDOWED_REGISTER
,
5392 .op_flags
= XTENSA_OP_PRIVILEGED
|
5393 XTENSA_OP_EXIT_TB_M1
|
5394 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5396 .name
= "wsr.windowstart",
5397 .translate
= translate_wsr_windowstart
,
5398 .test_exceptions
= test_exceptions_sr
,
5399 .par
= (const uint32_t[]){
5401 XTENSA_OPTION_WINDOWED_REGISTER
,
5403 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5405 .name
= "wur.expstate",
5406 .translate
= translate_wur
,
5407 .par
= (const uint32_t[]){EXPSTATE
},
5409 .name
= "wur.threadptr",
5410 .translate
= translate_wur
,
5411 .par
= (const uint32_t[]){THREADPTR
},
5414 .translate
= translate_xor
,
5417 .translate
= translate_boolean
,
5418 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5421 .op_flags
= XTENSA_OP_ILL
,
5424 .op_flags
= XTENSA_OP_ILL
,
5426 .name
= "xsr.acchi",
5427 .translate
= translate_xsr_acchi
,
5428 .test_exceptions
= test_exceptions_sr
,
5429 .par
= (const uint32_t[]){
5431 XTENSA_OPTION_MAC16
,
5434 .name
= "xsr.acclo",
5435 .translate
= translate_xsr
,
5436 .test_exceptions
= test_exceptions_sr
,
5437 .par
= (const uint32_t[]){
5439 XTENSA_OPTION_MAC16
,
5442 .name
= "xsr.atomctl",
5443 .translate
= translate_xsr_mask
,
5444 .test_exceptions
= test_exceptions_sr
,
5445 .par
= (const uint32_t[]){
5447 XTENSA_OPTION_ATOMCTL
,
5450 .op_flags
= XTENSA_OP_PRIVILEGED
,
5453 .translate
= translate_xsr_mask
,
5454 .test_exceptions
= test_exceptions_sr
,
5455 .par
= (const uint32_t[]){
5457 XTENSA_OPTION_BOOLEAN
,
5461 .name
= "xsr.cacheadrdis",
5462 .translate
= translate_xsr_mask
,
5463 .test_exceptions
= test_exceptions_sr
,
5464 .par
= (const uint32_t[]){
5469 .op_flags
= XTENSA_OP_PRIVILEGED
,
5471 .name
= "xsr.cacheattr",
5472 .translate
= translate_xsr
,
5473 .test_exceptions
= test_exceptions_sr
,
5474 .par
= (const uint32_t[]){
5476 XTENSA_OPTION_CACHEATTR
,
5478 .op_flags
= XTENSA_OP_PRIVILEGED
,
5480 .name
= "xsr.ccompare0",
5481 .translate
= translate_xsr_ccompare
,
5482 .test_exceptions
= test_exceptions_ccompare
,
5483 .par
= (const uint32_t[]){
5485 XTENSA_OPTION_TIMER_INTERRUPT
,
5487 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5489 .name
= "xsr.ccompare1",
5490 .translate
= translate_xsr_ccompare
,
5491 .test_exceptions
= test_exceptions_ccompare
,
5492 .par
= (const uint32_t[]){
5494 XTENSA_OPTION_TIMER_INTERRUPT
,
5496 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5498 .name
= "xsr.ccompare2",
5499 .translate
= translate_xsr_ccompare
,
5500 .test_exceptions
= test_exceptions_ccompare
,
5501 .par
= (const uint32_t[]){
5503 XTENSA_OPTION_TIMER_INTERRUPT
,
5505 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5507 .name
= "xsr.ccount",
5508 .translate
= translate_xsr_ccount
,
5509 .test_exceptions
= test_exceptions_sr
,
5510 .par
= (const uint32_t[]){
5512 XTENSA_OPTION_TIMER_INTERRUPT
,
5514 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5516 .name
= "xsr.configid0",
5517 .op_flags
= XTENSA_OP_ILL
,
5519 .name
= "xsr.configid1",
5520 .op_flags
= XTENSA_OP_ILL
,
5522 .name
= "xsr.cpenable",
5523 .translate
= translate_xsr_mask
,
5524 .test_exceptions
= test_exceptions_sr
,
5525 .par
= (const uint32_t[]){
5527 XTENSA_OPTION_COPROCESSOR
,
5530 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5532 .name
= "xsr.dbreaka0",
5533 .translate
= translate_xsr_dbreaka
,
5534 .test_exceptions
= test_exceptions_dbreak
,
5535 .par
= (const uint32_t[]){
5537 XTENSA_OPTION_DEBUG
,
5539 .op_flags
= XTENSA_OP_PRIVILEGED
,
5541 .name
= "xsr.dbreaka1",
5542 .translate
= translate_xsr_dbreaka
,
5543 .test_exceptions
= test_exceptions_dbreak
,
5544 .par
= (const uint32_t[]){
5546 XTENSA_OPTION_DEBUG
,
5548 .op_flags
= XTENSA_OP_PRIVILEGED
,
5550 .name
= "xsr.dbreakc0",
5551 .translate
= translate_xsr_dbreakc
,
5552 .test_exceptions
= test_exceptions_dbreak
,
5553 .par
= (const uint32_t[]){
5555 XTENSA_OPTION_DEBUG
,
5557 .op_flags
= XTENSA_OP_PRIVILEGED
,
5559 .name
= "xsr.dbreakc1",
5560 .translate
= translate_xsr_dbreakc
,
5561 .test_exceptions
= test_exceptions_dbreak
,
5562 .par
= (const uint32_t[]){
5564 XTENSA_OPTION_DEBUG
,
5566 .op_flags
= XTENSA_OP_PRIVILEGED
,
5569 .translate
= translate_xsr
,
5570 .test_exceptions
= test_exceptions_sr
,
5571 .par
= (const uint32_t[]){
5573 XTENSA_OPTION_DEBUG
,
5575 .op_flags
= XTENSA_OP_PRIVILEGED
,
5577 .name
= "xsr.debugcause",
5578 .op_flags
= XTENSA_OP_ILL
,
5581 .translate
= translate_xsr
,
5582 .test_exceptions
= test_exceptions_sr
,
5583 .par
= (const uint32_t[]){
5585 XTENSA_OPTION_EXCEPTION
,
5587 .op_flags
= XTENSA_OP_PRIVILEGED
,
5589 .name
= "xsr.dtlbcfg",
5590 .translate
= translate_xsr_mask
,
5591 .test_exceptions
= test_exceptions_sr
,
5592 .par
= (const uint32_t[]){
5597 .op_flags
= XTENSA_OP_PRIVILEGED
,
5600 .translate
= translate_xsr
,
5601 .test_exceptions
= test_exceptions_sr
,
5602 .par
= (const uint32_t[]){
5604 XTENSA_OPTION_EXCEPTION
,
5606 .op_flags
= XTENSA_OP_PRIVILEGED
,
5609 .translate
= translate_xsr
,
5610 .test_exceptions
= test_exceptions_hpi
,
5611 .par
= (const uint32_t[]){
5613 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5615 .op_flags
= XTENSA_OP_PRIVILEGED
,
5618 .translate
= translate_xsr
,
5619 .test_exceptions
= test_exceptions_hpi
,
5620 .par
= (const uint32_t[]){
5622 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5624 .op_flags
= XTENSA_OP_PRIVILEGED
,
5627 .translate
= translate_xsr
,
5628 .test_exceptions
= test_exceptions_hpi
,
5629 .par
= (const uint32_t[]){
5631 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5633 .op_flags
= XTENSA_OP_PRIVILEGED
,
5636 .translate
= translate_xsr
,
5637 .test_exceptions
= test_exceptions_hpi
,
5638 .par
= (const uint32_t[]){
5640 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5642 .op_flags
= XTENSA_OP_PRIVILEGED
,
5645 .translate
= translate_xsr
,
5646 .test_exceptions
= test_exceptions_hpi
,
5647 .par
= (const uint32_t[]){
5649 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5651 .op_flags
= XTENSA_OP_PRIVILEGED
,
5654 .translate
= translate_xsr
,
5655 .test_exceptions
= test_exceptions_hpi
,
5656 .par
= (const uint32_t[]){
5658 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5660 .op_flags
= XTENSA_OP_PRIVILEGED
,
5663 .translate
= translate_xsr
,
5664 .test_exceptions
= test_exceptions_hpi
,
5665 .par
= (const uint32_t[]){
5667 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5669 .op_flags
= XTENSA_OP_PRIVILEGED
,
5672 .translate
= translate_xsr
,
5673 .test_exceptions
= test_exceptions_hpi
,
5674 .par
= (const uint32_t[]){
5676 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5678 .op_flags
= XTENSA_OP_PRIVILEGED
,
5681 .translate
= translate_xsr
,
5682 .test_exceptions
= test_exceptions_hpi
,
5683 .par
= (const uint32_t[]){
5685 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5687 .op_flags
= XTENSA_OP_PRIVILEGED
,
5690 .translate
= translate_xsr
,
5691 .test_exceptions
= test_exceptions_hpi
,
5692 .par
= (const uint32_t[]){
5694 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5696 .op_flags
= XTENSA_OP_PRIVILEGED
,
5699 .translate
= translate_xsr
,
5700 .test_exceptions
= test_exceptions_hpi
,
5701 .par
= (const uint32_t[]){
5703 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5705 .op_flags
= XTENSA_OP_PRIVILEGED
,
5708 .translate
= translate_xsr
,
5709 .test_exceptions
= test_exceptions_hpi
,
5710 .par
= (const uint32_t[]){
5712 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5714 .op_flags
= XTENSA_OP_PRIVILEGED
,
5716 .name
= "xsr.eraccess",
5717 .translate
= translate_xsr_mask
,
5718 .par
= (const uint32_t[]){
5723 .op_flags
= XTENSA_OP_PRIVILEGED
,
5725 .name
= "xsr.exccause",
5726 .translate
= translate_xsr
,
5727 .test_exceptions
= test_exceptions_sr
,
5728 .par
= (const uint32_t[]){
5730 XTENSA_OPTION_EXCEPTION
,
5732 .op_flags
= XTENSA_OP_PRIVILEGED
,
5734 .name
= "xsr.excsave1",
5735 .translate
= translate_xsr
,
5736 .test_exceptions
= test_exceptions_sr
,
5737 .par
= (const uint32_t[]){
5739 XTENSA_OPTION_EXCEPTION
,
5741 .op_flags
= XTENSA_OP_PRIVILEGED
,
5743 .name
= "xsr.excsave2",
5744 .translate
= translate_xsr
,
5745 .test_exceptions
= test_exceptions_hpi
,
5746 .par
= (const uint32_t[]){
5748 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5750 .op_flags
= XTENSA_OP_PRIVILEGED
,
5752 .name
= "xsr.excsave3",
5753 .translate
= translate_xsr
,
5754 .test_exceptions
= test_exceptions_hpi
,
5755 .par
= (const uint32_t[]){
5757 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5759 .op_flags
= XTENSA_OP_PRIVILEGED
,
5761 .name
= "xsr.excsave4",
5762 .translate
= translate_xsr
,
5763 .test_exceptions
= test_exceptions_hpi
,
5764 .par
= (const uint32_t[]){
5766 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5768 .op_flags
= XTENSA_OP_PRIVILEGED
,
5770 .name
= "xsr.excsave5",
5771 .translate
= translate_xsr
,
5772 .test_exceptions
= test_exceptions_hpi
,
5773 .par
= (const uint32_t[]){
5775 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5777 .op_flags
= XTENSA_OP_PRIVILEGED
,
5779 .name
= "xsr.excsave6",
5780 .translate
= translate_xsr
,
5781 .test_exceptions
= test_exceptions_hpi
,
5782 .par
= (const uint32_t[]){
5784 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5786 .op_flags
= XTENSA_OP_PRIVILEGED
,
5788 .name
= "xsr.excsave7",
5789 .translate
= translate_xsr
,
5790 .test_exceptions
= test_exceptions_hpi
,
5791 .par
= (const uint32_t[]){
5793 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5795 .op_flags
= XTENSA_OP_PRIVILEGED
,
5797 .name
= "xsr.excvaddr",
5798 .translate
= translate_xsr
,
5799 .test_exceptions
= test_exceptions_sr
,
5800 .par
= (const uint32_t[]){
5802 XTENSA_OPTION_EXCEPTION
,
5804 .op_flags
= XTENSA_OP_PRIVILEGED
,
5806 .name
= "xsr.ibreaka0",
5807 .translate
= translate_xsr_ibreaka
,
5808 .test_exceptions
= test_exceptions_ibreak
,
5809 .par
= (const uint32_t[]){
5811 XTENSA_OPTION_DEBUG
,
5813 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5815 .name
= "xsr.ibreaka1",
5816 .translate
= translate_xsr_ibreaka
,
5817 .test_exceptions
= test_exceptions_ibreak
,
5818 .par
= (const uint32_t[]){
5820 XTENSA_OPTION_DEBUG
,
5822 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5824 .name
= "xsr.ibreakenable",
5825 .translate
= translate_xsr_ibreakenable
,
5826 .test_exceptions
= test_exceptions_sr
,
5827 .par
= (const uint32_t[]){
5829 XTENSA_OPTION_DEBUG
,
5831 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5833 .name
= "xsr.icount",
5834 .translate
= translate_xsr_icount
,
5835 .test_exceptions
= test_exceptions_sr
,
5836 .par
= (const uint32_t[]){
5838 XTENSA_OPTION_DEBUG
,
5840 .op_flags
= XTENSA_OP_PRIVILEGED
,
5842 .name
= "xsr.icountlevel",
5843 .translate
= translate_xsr_mask
,
5844 .test_exceptions
= test_exceptions_sr
,
5845 .par
= (const uint32_t[]){
5847 XTENSA_OPTION_DEBUG
,
5850 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5852 .name
= "xsr.intclear",
5853 .op_flags
= XTENSA_OP_ILL
,
5855 .name
= "xsr.intenable",
5856 .translate
= translate_xsr
,
5857 .test_exceptions
= test_exceptions_sr
,
5858 .par
= (const uint32_t[]){
5860 XTENSA_OPTION_INTERRUPT
,
5863 XTENSA_OP_PRIVILEGED
|
5864 XTENSA_OP_EXIT_TB_0
|
5865 XTENSA_OP_CHECK_INTERRUPTS
,
5867 .name
= "xsr.interrupt",
5868 .op_flags
= XTENSA_OP_ILL
,
5870 .name
= "xsr.intset",
5871 .op_flags
= XTENSA_OP_ILL
,
5873 .name
= "xsr.itlbcfg",
5874 .translate
= translate_xsr_mask
,
5875 .test_exceptions
= test_exceptions_sr
,
5876 .par
= (const uint32_t[]){
5881 .op_flags
= XTENSA_OP_PRIVILEGED
,
5884 .translate
= translate_xsr
,
5885 .test_exceptions
= test_exceptions_sr
,
5886 .par
= (const uint32_t[]){
5890 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5892 .name
= "xsr.lcount",
5893 .translate
= translate_xsr
,
5894 .test_exceptions
= test_exceptions_sr
,
5895 .par
= (const uint32_t[]){
5901 .translate
= translate_xsr
,
5902 .test_exceptions
= test_exceptions_sr
,
5903 .par
= (const uint32_t[]){
5907 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5909 .name
= "xsr.litbase",
5910 .translate
= translate_xsr_mask
,
5911 .test_exceptions
= test_exceptions_sr
,
5912 .par
= (const uint32_t[]){
5914 XTENSA_OPTION_EXTENDED_L32R
,
5917 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5920 .translate
= translate_xsr
,
5921 .test_exceptions
= test_exceptions_sr
,
5922 .par
= (const uint32_t[]){
5924 XTENSA_OPTION_MAC16
,
5928 .translate
= translate_xsr
,
5929 .test_exceptions
= test_exceptions_sr
,
5930 .par
= (const uint32_t[]){
5932 XTENSA_OPTION_MAC16
,
5936 .translate
= translate_xsr
,
5937 .test_exceptions
= test_exceptions_sr
,
5938 .par
= (const uint32_t[]){
5940 XTENSA_OPTION_MAC16
,
5944 .translate
= translate_xsr
,
5945 .test_exceptions
= test_exceptions_sr
,
5946 .par
= (const uint32_t[]){
5948 XTENSA_OPTION_MAC16
,
5951 .name
= "xsr.memctl",
5952 .translate
= translate_xsr_memctl
,
5953 .par
= (const uint32_t[]){MEMCTL
},
5954 .op_flags
= XTENSA_OP_PRIVILEGED
,
5957 .translate
= translate_xsr
,
5958 .test_exceptions
= test_exceptions_sr
,
5959 .par
= (const uint32_t[]){
5961 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5963 .op_flags
= XTENSA_OP_PRIVILEGED
,
5966 .translate
= translate_xsr
,
5967 .test_exceptions
= test_exceptions_sr
,
5968 .par
= (const uint32_t[]){
5970 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5972 .op_flags
= XTENSA_OP_PRIVILEGED
,
5975 .translate
= translate_xsr
,
5976 .test_exceptions
= test_exceptions_sr
,
5977 .par
= (const uint32_t[]){
5979 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5981 .op_flags
= XTENSA_OP_PRIVILEGED
,
5983 .name
= "xsr.mesave",
5984 .translate
= translate_xsr
,
5985 .test_exceptions
= test_exceptions_sr
,
5986 .par
= (const uint32_t[]){
5988 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5990 .op_flags
= XTENSA_OP_PRIVILEGED
,
5993 .translate
= translate_xsr
,
5994 .test_exceptions
= test_exceptions_sr
,
5995 .par
= (const uint32_t[]){
5997 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5999 .op_flags
= XTENSA_OP_PRIVILEGED
,
6001 .name
= "xsr.mevaddr",
6002 .translate
= translate_xsr
,
6003 .test_exceptions
= test_exceptions_sr
,
6004 .par
= (const uint32_t[]){
6006 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6008 .op_flags
= XTENSA_OP_PRIVILEGED
,
6010 .name
= "xsr.misc0",
6011 .translate
= translate_xsr
,
6012 .test_exceptions
= test_exceptions_sr
,
6013 .par
= (const uint32_t[]){
6015 XTENSA_OPTION_MISC_SR
,
6017 .op_flags
= XTENSA_OP_PRIVILEGED
,
6019 .name
= "xsr.misc1",
6020 .translate
= translate_xsr
,
6021 .test_exceptions
= test_exceptions_sr
,
6022 .par
= (const uint32_t[]){
6024 XTENSA_OPTION_MISC_SR
,
6026 .op_flags
= XTENSA_OP_PRIVILEGED
,
6028 .name
= "xsr.misc2",
6029 .translate
= translate_xsr
,
6030 .test_exceptions
= test_exceptions_sr
,
6031 .par
= (const uint32_t[]){
6033 XTENSA_OPTION_MISC_SR
,
6035 .op_flags
= XTENSA_OP_PRIVILEGED
,
6037 .name
= "xsr.misc3",
6038 .translate
= translate_xsr
,
6039 .test_exceptions
= test_exceptions_sr
,
6040 .par
= (const uint32_t[]){
6042 XTENSA_OPTION_MISC_SR
,
6044 .op_flags
= XTENSA_OP_PRIVILEGED
,
6046 .name
= "xsr.mpuenb",
6047 .translate
= translate_xsr_mpuenb
,
6048 .test_exceptions
= test_exceptions_sr
,
6049 .par
= (const uint32_t[]){
6053 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6055 .name
= "xsr.prefctl",
6056 .translate
= translate_xsr
,
6057 .par
= (const uint32_t[]){PREFCTL
},
6060 .op_flags
= XTENSA_OP_ILL
,
6063 .translate
= translate_xsr_ps
,
6064 .test_exceptions
= test_exceptions_sr
,
6065 .par
= (const uint32_t[]){
6067 XTENSA_OPTION_EXCEPTION
,
6070 XTENSA_OP_PRIVILEGED
|
6071 XTENSA_OP_EXIT_TB_M1
|
6072 XTENSA_OP_CHECK_INTERRUPTS
,
6074 .name
= "xsr.ptevaddr",
6075 .translate
= translate_xsr_mask
,
6076 .test_exceptions
= test_exceptions_sr
,
6077 .par
= (const uint32_t[]){
6082 .op_flags
= XTENSA_OP_PRIVILEGED
,
6084 .name
= "xsr.rasid",
6085 .translate
= translate_xsr_rasid
,
6086 .test_exceptions
= test_exceptions_sr
,
6087 .par
= (const uint32_t[]){
6091 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6094 .translate
= translate_xsr_sar
,
6095 .par
= (const uint32_t[]){SAR
},
6097 .name
= "xsr.scompare1",
6098 .translate
= translate_xsr
,
6099 .test_exceptions
= test_exceptions_sr
,
6100 .par
= (const uint32_t[]){
6102 XTENSA_OPTION_CONDITIONAL_STORE
,
6105 .name
= "xsr.vecbase",
6106 .translate
= translate_xsr
,
6107 .test_exceptions
= test_exceptions_sr
,
6108 .par
= (const uint32_t[]){
6110 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6112 .op_flags
= XTENSA_OP_PRIVILEGED
,
6114 .name
= "xsr.windowbase",
6115 .translate
= translate_xsr_windowbase
,
6116 .test_exceptions
= test_exceptions_sr
,
6117 .par
= (const uint32_t[]){
6119 XTENSA_OPTION_WINDOWED_REGISTER
,
6121 .op_flags
= XTENSA_OP_PRIVILEGED
|
6122 XTENSA_OP_EXIT_TB_M1
|
6123 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6125 .name
= "xsr.windowstart",
6126 .translate
= translate_xsr_windowstart
,
6127 .test_exceptions
= test_exceptions_sr
,
6128 .par
= (const uint32_t[]){
6130 XTENSA_OPTION_WINDOWED_REGISTER
,
6132 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6136 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6137 .num_opcodes
= ARRAY_SIZE(core_ops
),
6142 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6143 int o0
, int i0
, int i1
, int i2
)
6145 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6146 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6148 arg32
[o0
].out
= tcg_temp_new_i32();
6151 arg32
[i0
].in
= tcg_temp_new_i32();
6152 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6155 arg32
[i1
].in
= tcg_temp_new_i32();
6156 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6159 arg32
[i2
].in
= tcg_temp_new_i32();
6160 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6164 arg32
[o0
].out
= arg
[o0
].out
;
6167 arg32
[i0
].in
= arg
[i0
].in
;
6170 arg32
[i1
].in
= arg
[i1
].in
;
6173 arg32
[i2
].in
= arg
[i2
].in
;
6178 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6179 int o0
, int i0
, int i1
, int i2
)
6181 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6182 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6184 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6189 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6190 int o0
, int i0
, int i1
)
6192 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6195 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6196 int o0
, int i0
, int i1
)
6198 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6201 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6204 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6207 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6210 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6213 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6216 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6219 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6222 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6225 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6228 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6231 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6234 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6237 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6240 get_f32_i2(arg
, arg32
, i0
, -1);
6243 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6246 put_f32_i2(arg
, arg32
, i0
, -1);
6250 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6251 const uint32_t par
[])
6253 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6256 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6257 const uint32_t par
[])
6261 get_f32_o1_i1(arg
, arg32
, 0, 1);
6262 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6263 put_f32_o1_i1(arg
, arg32
, 0, 1);
6266 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6267 const uint32_t par
[])
6269 gen_helper_fpu2k_add_s(arg
[0].out
, tcg_env
,
6270 arg
[1].in
, arg
[2].in
);
6283 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6284 const uint32_t par
[])
6286 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6287 TCGv_i64 s
, TCGv_i64 t
) = {
6288 [COMPARE_UN
] = gen_helper_un_d
,
6289 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6290 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6291 [COMPARE_OLT
] = gen_helper_olt_d
,
6292 [COMPARE_ULT
] = gen_helper_ult_d
,
6293 [COMPARE_OLE
] = gen_helper_ole_d
,
6294 [COMPARE_ULE
] = gen_helper_ule_d
,
6296 TCGv_i32 zero
= tcg_constant_i32(0);
6297 TCGv_i32 res
= tcg_temp_new_i32();
6298 TCGv_i32 set_br
= tcg_temp_new_i32();
6299 TCGv_i32 clr_br
= tcg_temp_new_i32();
6301 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6302 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6304 helper
[par
[0]](res
, tcg_env
, arg
[1].in
, arg
[2].in
);
6305 tcg_gen_movcond_i32(TCG_COND_NE
,
6306 arg
[0].out
, res
, zero
,
6310 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6311 const uint32_t par
[])
6313 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6314 TCGv_i32 s
, TCGv_i32 t
) = {
6315 [COMPARE_UN
] = gen_helper_un_s
,
6316 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6317 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6318 [COMPARE_OLT
] = gen_helper_olt_s
,
6319 [COMPARE_ULT
] = gen_helper_ult_s
,
6320 [COMPARE_OLE
] = gen_helper_ole_s
,
6321 [COMPARE_ULE
] = gen_helper_ule_s
,
6324 TCGv_i32 zero
= tcg_constant_i32(0);
6325 TCGv_i32 res
= tcg_temp_new_i32();
6326 TCGv_i32 set_br
= tcg_temp_new_i32();
6327 TCGv_i32 clr_br
= tcg_temp_new_i32();
6329 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6330 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6332 get_f32_i2(arg
, arg32
, 1, 2);
6333 helper
[par
[0]](res
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
6334 tcg_gen_movcond_i32(TCG_COND_NE
,
6335 arg
[0].out
, res
, zero
,
6337 put_f32_i2(arg
, arg32
, 1, 2);
6340 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6341 const uint32_t par
[])
6343 static const uint64_t v
[] = {
6344 UINT64_C(0x0000000000000000),
6345 UINT64_C(0x3ff0000000000000),
6346 UINT64_C(0x4000000000000000),
6347 UINT64_C(0x3fe0000000000000),
6350 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6351 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6352 qemu_log_mask(LOG_GUEST_ERROR
,
6353 "const.d f%d, #%d, immediate value is reserved\n",
6354 arg
[0].imm
, arg
[1].imm
);
6358 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6359 const uint32_t par
[])
6361 static const uint32_t v
[] = {
6368 if (arg
[0].num_bits
== 32) {
6369 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6371 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6373 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6374 qemu_log_mask(LOG_GUEST_ERROR
,
6375 "const.s f%d, #%d, immediate value is reserved\n",
6376 arg
[0].imm
, arg
[1].imm
);
6380 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6381 const uint32_t par
[])
6383 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6386 gen_helper_uitof_d(arg
[0].out
, tcg_env
, arg
[1].in
, scale
);
6388 gen_helper_itof_d(arg
[0].out
, tcg_env
, arg
[1].in
, scale
);
6392 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6393 const uint32_t par
[])
6395 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6398 get_f32_o1(arg
, arg32
, 0);
6400 gen_helper_uitof_s(arg32
[0].out
, tcg_env
, arg
[1].in
, scale
);
6402 gen_helper_itof_s(arg32
[0].out
, tcg_env
, arg
[1].in
, scale
);
6404 put_f32_o1(arg
, arg32
, 0);
6407 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6408 const uint32_t par
[])
6410 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6411 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6414 gen_helper_ftoui_d(arg
[0].out
, tcg_env
, arg
[1].in
,
6415 rounding_mode
, scale
);
6417 gen_helper_ftoi_d(arg
[0].out
, tcg_env
, arg
[1].in
,
6418 rounding_mode
, scale
);
6422 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6423 const uint32_t par
[])
6425 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6426 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6429 get_f32_i1(arg
, arg32
, 1);
6431 gen_helper_ftoui_s(arg
[0].out
, tcg_env
, arg32
[1].in
,
6432 rounding_mode
, scale
);
6434 gen_helper_ftoi_s(arg
[0].out
, tcg_env
, arg32
[1].in
,
6435 rounding_mode
, scale
);
6437 put_f32_i1(arg
, arg32
, 1);
6440 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6441 const uint32_t par
[])
6443 TCGv_i32 addr
= tcg_temp_new_i32();
6446 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6447 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6449 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6451 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6454 tcg_gen_mov_i32(arg
[1].out
, addr
);
6458 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6459 const uint32_t par
[])
6461 TCGv_i32 addr
= tcg_temp_new_i32();
6464 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6465 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6467 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6469 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6472 tcg_gen_mov_i32(arg
[1].out
, addr
);
6476 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6477 const uint32_t par
[])
6479 gen_helper_fpu2k_madd_s(arg
[0].out
, tcg_env
,
6480 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6483 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6484 const uint32_t par
[])
6486 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6489 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6490 const uint32_t par
[])
6492 if (arg
[0].num_bits
== 32) {
6493 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6495 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6499 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6500 const uint32_t par
[])
6502 TCGv_i64 zero
= tcg_constant_i64(0);
6503 TCGv_i64 arg2
= tcg_temp_new_i64();
6505 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6506 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6508 arg
[1].in
, arg
[0].in
);
6511 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6512 const uint32_t par
[])
6514 if (arg
[0].num_bits
== 32) {
6515 TCGv_i32 zero
= tcg_constant_i32(0);
6517 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6519 arg
[1].in
, arg
[0].in
);
6521 translate_movcond_d(dc
, arg
, par
);
6525 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6526 const uint32_t par
[])
6528 TCGv_i64 zero
= tcg_constant_i64(0);
6529 TCGv_i32 tmp1
= tcg_temp_new_i32();
6530 TCGv_i64 tmp2
= tcg_temp_new_i64();
6532 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6533 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6534 tcg_gen_movcond_i64(par
[0],
6535 arg
[0].out
, tmp2
, zero
,
6536 arg
[1].in
, arg
[0].in
);
6539 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6540 const uint32_t par
[])
6542 if (arg
[0].num_bits
== 32) {
6543 TCGv_i32 zero
= tcg_constant_i32(0);
6544 TCGv_i32 tmp
= tcg_temp_new_i32();
6546 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6547 tcg_gen_movcond_i32(par
[0],
6548 arg
[0].out
, tmp
, zero
,
6549 arg
[1].in
, arg
[0].in
);
6551 translate_movp_d(dc
, arg
, par
);
6555 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6556 const uint32_t par
[])
6558 gen_helper_fpu2k_mul_s(arg
[0].out
, tcg_env
,
6559 arg
[1].in
, arg
[2].in
);
6562 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6563 const uint32_t par
[])
6565 gen_helper_fpu2k_msub_s(arg
[0].out
, tcg_env
,
6566 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6569 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6570 const uint32_t par
[])
6572 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6575 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6576 const uint32_t par
[])
6580 get_f32_o1_i1(arg
, arg32
, 0, 1);
6581 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6582 put_f32_o1_i1(arg
, arg32
, 0, 1);
6585 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6586 const uint32_t par
[])
6588 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6591 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6592 const uint32_t par
[])
6594 if (arg
[1].num_bits
== 32) {
6595 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6597 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6601 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6602 const uint32_t par
[])
6604 gen_helper_fpu2k_sub_s(arg
[0].out
, tcg_env
,
6605 arg
[1].in
, arg
[2].in
);
6608 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6609 const uint32_t par
[])
6611 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6614 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6615 const uint32_t par
[])
6617 if (arg
[0].num_bits
== 32) {
6618 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6620 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6624 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6625 const uint32_t par
[])
6627 gen_helper_wur_fpu2k_fcr(tcg_env
, arg
[0].in
);
6630 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6631 const uint32_t par
[])
6633 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6636 static const XtensaOpcodeOps fpu2000_ops
[] = {
6639 .translate
= translate_abs_s
,
6643 .translate
= translate_fpu2k_add_s
,
6647 .translate
= translate_ftoi_s
,
6648 .par
= (const uint32_t[]){float_round_up
, false},
6652 .translate
= translate_float_s
,
6653 .par
= (const uint32_t[]){false},
6657 .translate
= translate_ftoi_s
,
6658 .par
= (const uint32_t[]){float_round_down
, false},
6662 .translate
= translate_ldsti
,
6663 .par
= (const uint32_t[]){false, false},
6664 .op_flags
= XTENSA_OP_LOAD
,
6668 .translate
= translate_ldsti
,
6669 .par
= (const uint32_t[]){false, true},
6670 .op_flags
= XTENSA_OP_LOAD
,
6674 .translate
= translate_ldstx
,
6675 .par
= (const uint32_t[]){false, false},
6676 .op_flags
= XTENSA_OP_LOAD
,
6680 .translate
= translate_ldstx
,
6681 .par
= (const uint32_t[]){false, true},
6682 .op_flags
= XTENSA_OP_LOAD
,
6686 .translate
= translate_fpu2k_madd_s
,
6690 .translate
= translate_mov_s
,
6694 .translate
= translate_movcond_s
,
6695 .par
= (const uint32_t[]){TCG_COND_EQ
},
6699 .translate
= translate_movp_s
,
6700 .par
= (const uint32_t[]){TCG_COND_EQ
},
6704 .translate
= translate_movcond_s
,
6705 .par
= (const uint32_t[]){TCG_COND_GE
},
6709 .translate
= translate_movcond_s
,
6710 .par
= (const uint32_t[]){TCG_COND_LT
},
6714 .translate
= translate_movcond_s
,
6715 .par
= (const uint32_t[]){TCG_COND_NE
},
6719 .translate
= translate_movp_s
,
6720 .par
= (const uint32_t[]){TCG_COND_NE
},
6724 .translate
= translate_fpu2k_msub_s
,
6728 .translate
= translate_fpu2k_mul_s
,
6732 .translate
= translate_neg_s
,
6736 .translate
= translate_compare_s
,
6737 .par
= (const uint32_t[]){COMPARE_OEQ
},
6741 .translate
= translate_compare_s
,
6742 .par
= (const uint32_t[]){COMPARE_OLE
},
6746 .translate
= translate_compare_s
,
6747 .par
= (const uint32_t[]){COMPARE_OLT
},
6751 .translate
= translate_rfr_s
,
6755 .translate
= translate_ftoi_s
,
6756 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6760 .translate
= translate_rur
,
6761 .par
= (const uint32_t[]){FCR
},
6765 .translate
= translate_rur
,
6766 .par
= (const uint32_t[]){FSR
},
6770 .translate
= translate_ldsti
,
6771 .par
= (const uint32_t[]){true, false},
6772 .op_flags
= XTENSA_OP_STORE
,
6776 .translate
= translate_ldsti
,
6777 .par
= (const uint32_t[]){true, true},
6778 .op_flags
= XTENSA_OP_STORE
,
6782 .translate
= translate_ldstx
,
6783 .par
= (const uint32_t[]){true, false},
6784 .op_flags
= XTENSA_OP_STORE
,
6788 .translate
= translate_ldstx
,
6789 .par
= (const uint32_t[]){true, true},
6790 .op_flags
= XTENSA_OP_STORE
,
6794 .translate
= translate_fpu2k_sub_s
,
6798 .translate
= translate_ftoi_s
,
6799 .par
= (const uint32_t[]){float_round_to_zero
, false},
6803 .translate
= translate_compare_s
,
6804 .par
= (const uint32_t[]){COMPARE_UEQ
},
6808 .translate
= translate_float_s
,
6809 .par
= (const uint32_t[]){true},
6813 .translate
= translate_compare_s
,
6814 .par
= (const uint32_t[]){COMPARE_ULE
},
6818 .translate
= translate_compare_s
,
6819 .par
= (const uint32_t[]){COMPARE_ULT
},
6823 .translate
= translate_compare_s
,
6824 .par
= (const uint32_t[]){COMPARE_UN
},
6828 .translate
= translate_ftoi_s
,
6829 .par
= (const uint32_t[]){float_round_to_zero
, true},
6833 .translate
= translate_wfr_s
,
6837 .translate
= translate_wur_fpu2k_fcr
,
6838 .par
= (const uint32_t[]){FCR
},
6842 .translate
= translate_wur_fpu2k_fsr
,
6843 .par
= (const uint32_t[]){FSR
},
6848 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6849 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6850 .opcode
= fpu2000_ops
,
6853 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
6854 const uint32_t par
[])
6856 gen_helper_add_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
6859 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6860 const uint32_t par
[])
6862 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
6863 gen_helper_fpu2k_add_s(arg
[0].out
, tcg_env
,
6864 arg
[1].in
, arg
[2].in
);
6868 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6869 gen_helper_add_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
6870 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6874 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6875 const uint32_t par
[])
6877 TCGv_i32 v
= tcg_temp_new_i32();
6879 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
6880 gen_helper_cvtd_s(arg
[0].out
, tcg_env
, v
);
6883 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
6884 const uint32_t par
[])
6886 TCGv_i32 v
= tcg_temp_new_i32();
6888 gen_helper_cvts_d(v
, tcg_env
, arg
[1].in
);
6889 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
6892 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
6893 const uint32_t par
[])
6899 addr
= tcg_temp_new_i32();
6900 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6904 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
6906 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
6908 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
6912 tcg_gen_mov_i32(arg
[1].out
, addr
);
6914 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6919 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
6920 const uint32_t par
[])
6927 addr
= tcg_temp_new_i32();
6928 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6932 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6934 get_f32_i1(arg
, arg32
, 0);
6935 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
6936 put_f32_i1(arg
, arg32
, 0);
6938 get_f32_o1(arg
, arg32
, 0);
6939 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
6940 put_f32_o1(arg
, arg32
, 0);
6944 tcg_gen_mov_i32(arg
[1].out
, addr
);
6946 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6951 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
6952 const uint32_t par
[])
6958 addr
= tcg_temp_new_i32();
6959 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6963 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
6965 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
6967 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
6971 tcg_gen_mov_i32(arg
[1].out
, addr
);
6973 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
6978 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
6979 const uint32_t par
[])
6986 addr
= tcg_temp_new_i32();
6987 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6991 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6993 get_f32_i1(arg
, arg32
, 0);
6994 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
6995 put_f32_i1(arg
, arg32
, 0);
6997 get_f32_o1(arg
, arg32
, 0);
6998 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
6999 put_f32_o1(arg
, arg32
, 0);
7003 tcg_gen_mov_i32(arg
[1].out
, addr
);
7005 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7010 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7011 const uint32_t par
[])
7013 gen_helper_madd_d(arg
[0].out
, tcg_env
,
7014 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7017 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7018 const uint32_t par
[])
7020 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7021 gen_helper_fpu2k_madd_s(arg
[0].out
, tcg_env
,
7022 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7026 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7027 gen_helper_madd_s(arg32
[0].out
, tcg_env
,
7028 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7029 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7033 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7034 const uint32_t par
[])
7036 gen_helper_mul_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
7039 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7040 const uint32_t par
[])
7042 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7043 gen_helper_fpu2k_mul_s(arg
[0].out
, tcg_env
,
7044 arg
[1].in
, arg
[2].in
);
7048 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7049 gen_helper_mul_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
7050 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7054 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7055 const uint32_t par
[])
7057 gen_helper_msub_d(arg
[0].out
, tcg_env
,
7058 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7061 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7062 const uint32_t par
[])
7064 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7065 gen_helper_fpu2k_msub_s(arg
[0].out
, tcg_env
,
7066 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7070 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7071 gen_helper_msub_s(arg32
[0].out
, tcg_env
,
7072 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7073 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7077 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7078 const uint32_t par
[])
7080 gen_helper_sub_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
7083 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7084 const uint32_t par
[])
7086 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7087 gen_helper_fpu2k_sub_s(arg
[0].out
, tcg_env
,
7088 arg
[1].in
, arg
[2].in
);
7092 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7093 gen_helper_sub_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
7094 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7098 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7099 const uint32_t par
[])
7101 gen_helper_mkdadj_d(arg
[0].out
, tcg_env
, arg
[0].in
, arg
[1].in
);
7104 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7105 const uint32_t par
[])
7109 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7110 gen_helper_mkdadj_s(arg32
[0].out
, tcg_env
, arg32
[0].in
, arg32
[1].in
);
7111 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7114 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7115 const uint32_t par
[])
7117 gen_helper_mksadj_d(arg
[0].out
, tcg_env
, arg
[1].in
);
7120 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7121 const uint32_t par
[])
7125 get_f32_o1_i1(arg
, arg32
, 0, 1);
7126 gen_helper_mksadj_s(arg32
[0].out
, tcg_env
, arg32
[1].in
);
7127 put_f32_o1_i1(arg
, arg32
, 0, 1);
7130 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7131 const uint32_t par
[])
7133 gen_helper_wur_fpu_fcr(tcg_env
, arg
[0].in
);
7136 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7137 const uint32_t par
[])
7139 gen_helper_rur_fpu_fsr(arg
[0].out
, tcg_env
);
7142 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7143 const uint32_t par
[])
7145 gen_helper_wur_fpu_fsr(tcg_env
, arg
[0].in
);
7148 static const XtensaOpcodeOps fpu_ops
[] = {
7151 .translate
= translate_abs_d
,
7155 .translate
= translate_abs_s
,
7159 .translate
= translate_add_d
,
7163 .translate
= translate_add_s
,
7167 .translate
= translate_nop
,
7171 .translate
= translate_nop
,
7174 .name
= "addexpm.d",
7175 .translate
= translate_mov_s
,
7178 .name
= "addexpm.s",
7179 .translate
= translate_mov_s
,
7183 .translate
= translate_ftoi_d
,
7184 .par
= (const uint32_t[]){float_round_up
, false},
7188 .translate
= translate_ftoi_s
,
7189 .par
= (const uint32_t[]){float_round_up
, false},
7193 .translate
= translate_const_d
,
7197 .translate
= translate_const_s
,
7201 .translate
= translate_cvtd_s
,
7205 .translate
= translate_cvts_d
,
7209 .translate
= translate_nop
,
7213 .translate
= translate_nop
,
7217 .translate
= translate_nop
,
7221 .translate
= translate_nop
,
7225 .translate
= translate_float_d
,
7226 .par
= (const uint32_t[]){false},
7230 .translate
= translate_float_s
,
7231 .par
= (const uint32_t[]){false},
7235 .translate
= translate_ftoi_d
,
7236 .par
= (const uint32_t[]){float_round_down
, false},
7240 .translate
= translate_ftoi_s
,
7241 .par
= (const uint32_t[]){float_round_down
, false},
7245 .translate
= translate_ldsti_d
,
7246 .par
= (const uint32_t[]){false, true, false},
7247 .op_flags
= XTENSA_OP_LOAD
,
7251 .translate
= translate_ldsti_d
,
7252 .par
= (const uint32_t[]){false, false, true},
7253 .op_flags
= XTENSA_OP_LOAD
,
7257 .translate
= translate_ldsti_d
,
7258 .par
= (const uint32_t[]){false, true, true},
7259 .op_flags
= XTENSA_OP_LOAD
,
7263 .translate
= translate_ldstx_d
,
7264 .par
= (const uint32_t[]){false, true, false},
7265 .op_flags
= XTENSA_OP_LOAD
,
7269 .translate
= translate_ldstx_d
,
7270 .par
= (const uint32_t[]){false, false, true},
7271 .op_flags
= XTENSA_OP_LOAD
,
7275 .translate
= translate_ldstx_d
,
7276 .par
= (const uint32_t[]){false, true, true},
7277 .op_flags
= XTENSA_OP_LOAD
,
7281 .translate
= translate_ldsti_s
,
7282 .par
= (const uint32_t[]){false, true, false},
7283 .op_flags
= XTENSA_OP_LOAD
,
7287 .translate
= translate_ldsti_s
,
7288 .par
= (const uint32_t[]){false, false, true},
7289 .op_flags
= XTENSA_OP_LOAD
,
7293 .translate
= translate_ldsti_s
,
7294 .par
= (const uint32_t[]){false, true, true},
7295 .op_flags
= XTENSA_OP_LOAD
,
7299 .translate
= translate_ldstx_s
,
7300 .par
= (const uint32_t[]){false, true, false},
7301 .op_flags
= XTENSA_OP_LOAD
,
7305 .translate
= translate_ldstx_s
,
7306 .par
= (const uint32_t[]){false, false, true},
7307 .op_flags
= XTENSA_OP_LOAD
,
7311 .translate
= translate_ldstx_s
,
7312 .par
= (const uint32_t[]){false, true, true},
7313 .op_flags
= XTENSA_OP_LOAD
,
7317 .translate
= translate_madd_d
,
7321 .translate
= translate_madd_s
,
7325 .translate
= translate_nop
,
7329 .translate
= translate_nop
,
7333 .translate
= translate_mkdadj_d
,
7337 .translate
= translate_mkdadj_s
,
7341 .translate
= translate_mksadj_d
,
7345 .translate
= translate_mksadj_s
,
7349 .translate
= translate_mov_d
,
7353 .translate
= translate_mov_s
,
7357 .translate
= translate_movcond_d
,
7358 .par
= (const uint32_t[]){TCG_COND_EQ
},
7362 .translate
= translate_movcond_s
,
7363 .par
= (const uint32_t[]){TCG_COND_EQ
},
7367 .translate
= translate_movp_d
,
7368 .par
= (const uint32_t[]){TCG_COND_EQ
},
7372 .translate
= translate_movp_s
,
7373 .par
= (const uint32_t[]){TCG_COND_EQ
},
7377 .translate
= translate_movcond_d
,
7378 .par
= (const uint32_t[]){TCG_COND_GE
},
7382 .translate
= translate_movcond_s
,
7383 .par
= (const uint32_t[]){TCG_COND_GE
},
7387 .translate
= translate_movcond_d
,
7388 .par
= (const uint32_t[]){TCG_COND_LT
},
7392 .translate
= translate_movcond_s
,
7393 .par
= (const uint32_t[]){TCG_COND_LT
},
7397 .translate
= translate_movcond_d
,
7398 .par
= (const uint32_t[]){TCG_COND_NE
},
7402 .translate
= translate_movcond_s
,
7403 .par
= (const uint32_t[]){TCG_COND_NE
},
7407 .translate
= translate_movp_d
,
7408 .par
= (const uint32_t[]){TCG_COND_NE
},
7412 .translate
= translate_movp_s
,
7413 .par
= (const uint32_t[]){TCG_COND_NE
},
7417 .translate
= translate_msub_d
,
7421 .translate
= translate_msub_s
,
7425 .translate
= translate_mul_d
,
7429 .translate
= translate_mul_s
,
7433 .translate
= translate_neg_d
,
7437 .translate
= translate_neg_s
,
7441 .translate
= translate_nop
,
7445 .translate
= translate_nop
,
7449 .translate
= translate_compare_d
,
7450 .par
= (const uint32_t[]){COMPARE_OEQ
},
7454 .translate
= translate_compare_s
,
7455 .par
= (const uint32_t[]){COMPARE_OEQ
},
7459 .translate
= translate_compare_d
,
7460 .par
= (const uint32_t[]){COMPARE_OLE
},
7464 .translate
= translate_compare_s
,
7465 .par
= (const uint32_t[]){COMPARE_OLE
},
7469 .translate
= translate_compare_d
,
7470 .par
= (const uint32_t[]){COMPARE_OLT
},
7474 .translate
= translate_compare_s
,
7475 .par
= (const uint32_t[]){COMPARE_OLT
},
7479 .translate
= translate_rfr_s
,
7483 .translate
= translate_rfr_d
,
7487 .translate
= translate_ftoi_d
,
7488 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7492 .translate
= translate_ftoi_s
,
7493 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7497 .translate
= translate_rur
,
7498 .par
= (const uint32_t[]){FCR
},
7502 .translate
= translate_rur_fpu_fsr
,
7506 .translate
= translate_ldsti_d
,
7507 .par
= (const uint32_t[]){true, true, false},
7508 .op_flags
= XTENSA_OP_STORE
,
7512 .translate
= translate_ldsti_d
,
7513 .par
= (const uint32_t[]){true, false, true},
7514 .op_flags
= XTENSA_OP_STORE
,
7518 .translate
= translate_ldsti_d
,
7519 .par
= (const uint32_t[]){true, true, true},
7520 .op_flags
= XTENSA_OP_STORE
,
7524 .translate
= translate_ldstx_d
,
7525 .par
= (const uint32_t[]){true, true, false},
7526 .op_flags
= XTENSA_OP_STORE
,
7530 .translate
= translate_ldstx_d
,
7531 .par
= (const uint32_t[]){true, false, true},
7532 .op_flags
= XTENSA_OP_STORE
,
7536 .translate
= translate_ldstx_d
,
7537 .par
= (const uint32_t[]){true, true, true},
7538 .op_flags
= XTENSA_OP_STORE
,
7542 .translate
= translate_nop
,
7546 .translate
= translate_nop
,
7550 .translate
= translate_ldsti_s
,
7551 .par
= (const uint32_t[]){true, true, false},
7552 .op_flags
= XTENSA_OP_STORE
,
7556 .translate
= translate_ldsti_s
,
7557 .par
= (const uint32_t[]){true, false, true},
7558 .op_flags
= XTENSA_OP_STORE
,
7562 .translate
= translate_ldsti_s
,
7563 .par
= (const uint32_t[]){true, true, true},
7564 .op_flags
= XTENSA_OP_STORE
,
7568 .translate
= translate_ldstx_s
,
7569 .par
= (const uint32_t[]){true, true, false},
7570 .op_flags
= XTENSA_OP_STORE
,
7574 .translate
= translate_ldstx_s
,
7575 .par
= (const uint32_t[]){true, false, true},
7576 .op_flags
= XTENSA_OP_STORE
,
7580 .translate
= translate_ldstx_s
,
7581 .par
= (const uint32_t[]){true, true, true},
7582 .op_flags
= XTENSA_OP_STORE
,
7586 .translate
= translate_sub_d
,
7590 .translate
= translate_sub_s
,
7594 .translate
= translate_ftoi_d
,
7595 .par
= (const uint32_t[]){float_round_to_zero
, false},
7599 .translate
= translate_ftoi_s
,
7600 .par
= (const uint32_t[]){float_round_to_zero
, false},
7604 .translate
= translate_compare_d
,
7605 .par
= (const uint32_t[]){COMPARE_UEQ
},
7609 .translate
= translate_compare_s
,
7610 .par
= (const uint32_t[]){COMPARE_UEQ
},
7614 .translate
= translate_float_d
,
7615 .par
= (const uint32_t[]){true},
7619 .translate
= translate_float_s
,
7620 .par
= (const uint32_t[]){true},
7624 .translate
= translate_compare_d
,
7625 .par
= (const uint32_t[]){COMPARE_ULE
},
7629 .translate
= translate_compare_s
,
7630 .par
= (const uint32_t[]){COMPARE_ULE
},
7634 .translate
= translate_compare_d
,
7635 .par
= (const uint32_t[]){COMPARE_ULT
},
7639 .translate
= translate_compare_s
,
7640 .par
= (const uint32_t[]){COMPARE_ULT
},
7644 .translate
= translate_compare_d
,
7645 .par
= (const uint32_t[]){COMPARE_UN
},
7649 .translate
= translate_compare_s
,
7650 .par
= (const uint32_t[]){COMPARE_UN
},
7654 .translate
= translate_ftoi_d
,
7655 .par
= (const uint32_t[]){float_round_to_zero
, true},
7659 .translate
= translate_ftoi_s
,
7660 .par
= (const uint32_t[]){float_round_to_zero
, true},
7664 .translate
= translate_wfr_s
,
7668 .translate
= translate_wfr_d
,
7672 .translate
= translate_wur_fpu_fcr
,
7673 .par
= (const uint32_t[]){FCR
},
7677 .translate
= translate_wur_fpu_fsr
,
7682 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7683 .num_opcodes
= ARRAY_SIZE(fpu_ops
),