3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm
5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Open Source and Linux Lab nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "qemu/osdep.h"
34 #include "exec/exec-all.h"
35 #include "disas/disas.h"
36 #include "tcg/tcg-op.h"
38 #include "qemu/qemu-print.h"
39 #include "exec/cpu_ldst.h"
40 #include "hw/semihosting/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
46 #include "trace-tcg.h"
51 DisasContextBase base
;
52 const XtensaConfig
*config
;
61 bool sar_m32_allocated
;
75 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
76 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i32 cpu_MR
[4];
83 static TCGv_i32 cpu_BR
[16];
84 static TCGv_i32 cpu_BR4
[4];
85 static TCGv_i32 cpu_BR8
[2];
86 static TCGv_i32 cpu_SR
[256];
87 static TCGv_i32 cpu_UR
[256];
88 static TCGv_i32 cpu_windowbase_next
;
89 static TCGv_i32 cpu_exclusive_addr
;
90 static TCGv_i32 cpu_exclusive_val
;
92 static GHashTable
*xtensa_regfile_table
;
94 #include "exec/gen-icount.h"
96 static char *sr_name
[256];
97 static char *ur_name
[256];
99 void xtensa_collect_sr_names(const XtensaConfig
*config
)
101 xtensa_isa isa
= config
->isa
;
102 int n
= xtensa_isa_num_sysregs(isa
);
105 for (i
= 0; i
< n
; ++i
) {
106 int sr
= xtensa_sysreg_number(isa
, i
);
108 if (sr
>= 0 && sr
< 256) {
109 const char *name
= xtensa_sysreg_name(isa
, i
);
111 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
114 if (strstr(*pname
, name
) == NULL
) {
116 malloc(strlen(*pname
) + strlen(name
) + 2);
118 strcpy(new_name
, *pname
);
119 strcat(new_name
, "/");
120 strcat(new_name
, name
);
125 *pname
= strdup(name
);
131 void xtensa_translate_init(void)
133 static const char * const regnames
[] = {
134 "ar0", "ar1", "ar2", "ar3",
135 "ar4", "ar5", "ar6", "ar7",
136 "ar8", "ar9", "ar10", "ar11",
137 "ar12", "ar13", "ar14", "ar15",
139 static const char * const fregnames
[] = {
140 "f0", "f1", "f2", "f3",
141 "f4", "f5", "f6", "f7",
142 "f8", "f9", "f10", "f11",
143 "f12", "f13", "f14", "f15",
145 static const char * const mregnames
[] = {
146 "m0", "m1", "m2", "m3",
148 static const char * const bregnames
[] = {
149 "b0", "b1", "b2", "b3",
150 "b4", "b5", "b6", "b7",
151 "b8", "b9", "b10", "b11",
152 "b12", "b13", "b14", "b15",
156 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
157 offsetof(CPUXtensaState
, pc
), "pc");
159 for (i
= 0; i
< 16; i
++) {
160 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
161 offsetof(CPUXtensaState
, regs
[i
]),
165 for (i
= 0; i
< 16; i
++) {
166 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
167 offsetof(CPUXtensaState
,
168 fregs
[i
].f32
[FP_F32_LOW
]),
172 for (i
= 0; i
< 4; i
++) {
173 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
174 offsetof(CPUXtensaState
,
179 for (i
= 0; i
< 16; i
++) {
180 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
181 offsetof(CPUXtensaState
,
185 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
186 offsetof(CPUXtensaState
,
191 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
192 offsetof(CPUXtensaState
,
198 for (i
= 0; i
< 256; ++i
) {
200 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
201 offsetof(CPUXtensaState
,
207 for (i
= 0; i
< 256; ++i
) {
209 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
210 offsetof(CPUXtensaState
,
216 cpu_windowbase_next
=
217 tcg_global_mem_new_i32(cpu_env
,
218 offsetof(CPUXtensaState
, windowbase_next
),
221 tcg_global_mem_new_i32(cpu_env
,
222 offsetof(CPUXtensaState
, exclusive_addr
),
225 tcg_global_mem_new_i32(cpu_env
,
226 offsetof(CPUXtensaState
, exclusive_val
),
230 void **xtensa_get_regfile_by_name(const char *name
)
232 if (xtensa_regfile_table
== NULL
) {
233 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
234 g_hash_table_insert(xtensa_regfile_table
,
235 (void *)"AR", (void *)cpu_R
);
236 g_hash_table_insert(xtensa_regfile_table
,
237 (void *)"MR", (void *)cpu_MR
);
238 g_hash_table_insert(xtensa_regfile_table
,
239 (void *)"FR", (void *)cpu_FR
);
240 g_hash_table_insert(xtensa_regfile_table
,
241 (void *)"BR", (void *)cpu_BR
);
242 g_hash_table_insert(xtensa_regfile_table
,
243 (void *)"BR4", (void *)cpu_BR4
);
244 g_hash_table_insert(xtensa_regfile_table
,
245 (void *)"BR8", (void *)cpu_BR8
);
247 return (void **)g_hash_table_lookup(xtensa_regfile_table
, (void *)name
);
250 static inline bool option_enabled(DisasContext
*dc
, int opt
)
252 return xtensa_option_enabled(dc
->config
, opt
);
255 static void init_sar_tracker(DisasContext
*dc
)
257 dc
->sar_5bit
= false;
258 dc
->sar_m32_5bit
= false;
259 dc
->sar_m32_allocated
= false;
262 static void reset_sar_tracker(DisasContext
*dc
)
264 if (dc
->sar_m32_allocated
) {
265 tcg_temp_free(dc
->sar_m32
);
269 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
271 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
272 if (dc
->sar_m32_5bit
) {
273 tcg_gen_discard_i32(dc
->sar_m32
);
276 dc
->sar_m32_5bit
= false;
279 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
281 TCGv_i32 tmp
= tcg_const_i32(32);
282 if (!dc
->sar_m32_allocated
) {
283 dc
->sar_m32
= tcg_temp_local_new_i32();
284 dc
->sar_m32_allocated
= true;
286 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
287 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
288 dc
->sar_5bit
= false;
289 dc
->sar_m32_5bit
= true;
293 static void gen_exception(DisasContext
*dc
, int excp
)
295 TCGv_i32 tmp
= tcg_const_i32(excp
);
296 gen_helper_exception(cpu_env
, tmp
);
300 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
302 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
303 TCGv_i32 tcause
= tcg_const_i32(cause
);
304 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
306 tcg_temp_free(tcause
);
307 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
308 cause
== SYSCALL_CAUSE
) {
309 dc
->base
.is_jmp
= DISAS_NORETURN
;
313 static void gen_exception_cause_vaddr(DisasContext
*dc
, uint32_t cause
,
316 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
317 TCGv_i32 tcause
= tcg_const_i32(cause
);
318 gen_helper_exception_cause_vaddr(cpu_env
, tpc
, tcause
, vaddr
);
320 tcg_temp_free(tcause
);
323 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
325 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
326 TCGv_i32 tcause
= tcg_const_i32(cause
);
327 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
329 tcg_temp_free(tcause
);
330 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
331 dc
->base
.is_jmp
= DISAS_NORETURN
;
335 static bool gen_check_privilege(DisasContext
*dc
)
337 #ifndef CONFIG_USER_ONLY
342 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
343 dc
->base
.is_jmp
= DISAS_NORETURN
;
347 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
349 cp_mask
&= ~dc
->cpenable
;
351 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
352 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
353 dc
->base
.is_jmp
= DISAS_NORETURN
;
359 static int gen_postprocess(DisasContext
*dc
, int slot
);
361 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
363 tcg_gen_mov_i32(cpu_pc
, dest
);
365 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
367 if (dc
->base
.singlestep_enabled
) {
368 gen_exception(dc
, EXCP_DEBUG
);
370 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
371 slot
= gen_postprocess(dc
, slot
);
374 tcg_gen_goto_tb(slot
);
375 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
377 tcg_gen_exit_tb(NULL
, 0);
380 dc
->base
.is_jmp
= DISAS_NORETURN
;
383 static void gen_jump(DisasContext
*dc
, TCGv dest
)
385 gen_jump_slot(dc
, dest
, -1);
388 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
390 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
397 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
399 TCGv_i32 tmp
= tcg_const_i32(dest
);
400 gen_jump_slot(dc
, tmp
, adjust_jump_slot(dc
, dest
, slot
));
404 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
407 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
409 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
410 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
411 tcg_temp_free(tcallinc
);
412 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
413 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
414 gen_jump_slot(dc
, dest
, slot
);
417 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
419 if (dc
->base
.pc_next
== dc
->lend
) {
420 TCGLabel
*label
= gen_new_label();
422 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
423 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
425 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
427 gen_jump(dc
, cpu_SR
[LBEG
]);
429 gen_set_label(label
);
430 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
436 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
438 if (!gen_check_loop_end(dc
, slot
)) {
439 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
443 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
444 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
446 TCGLabel
*label
= gen_new_label();
448 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
449 gen_jumpi_check_loop_end(dc
, 0);
450 gen_set_label(label
);
451 gen_jumpi(dc
, addr
, 1);
454 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
455 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
457 TCGv_i32 tmp
= tcg_const_i32(t1
);
458 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
462 static bool test_ill_sr(DisasContext
*dc
, const OpcodeArg arg
[],
463 const uint32_t par
[])
465 return !xtensa_option_enabled(dc
->config
, par
[1]);
468 static bool test_ill_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
469 const uint32_t par
[])
471 unsigned n
= par
[0] - CCOMPARE
;
473 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->nccompare
;
476 static bool test_ill_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
477 const uint32_t par
[])
479 unsigned n
= MAX_NDBREAK
;
481 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
482 n
= par
[0] - DBREAKA
;
484 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
485 n
= par
[0] - DBREAKC
;
487 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->ndbreak
;
490 static bool test_ill_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
491 const uint32_t par
[])
493 unsigned n
= par
[0] - IBREAKA
;
495 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->nibreak
;
498 static bool test_ill_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
499 const uint32_t par
[])
501 unsigned n
= MAX_NLEVEL
+ 1;
503 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
504 n
= par
[0] - EXCSAVE1
+ 1;
506 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
507 n
= par
[0] - EPC1
+ 1;
509 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
510 n
= par
[0] - EPS2
+ 2;
512 return test_ill_sr(dc
, arg
, par
) || n
> dc
->config
->nlevel
;
515 static void gen_load_store_alignment(DisasContext
*dc
, int shift
,
516 TCGv_i32 addr
, bool no_hw_alignment
)
518 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
519 tcg_gen_andi_i32(addr
, addr
, ~0 << shift
);
520 } else if (option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
) &&
522 TCGLabel
*label
= gen_new_label();
523 TCGv_i32 tmp
= tcg_temp_new_i32();
524 tcg_gen_andi_i32(tmp
, addr
, ~(~0 << shift
));
525 tcg_gen_brcondi_i32(TCG_COND_EQ
, tmp
, 0, label
);
526 gen_exception_cause_vaddr(dc
, LOAD_STORE_ALIGNMENT_CAUSE
, addr
);
527 gen_set_label(label
);
532 #ifndef CONFIG_USER_ONLY
533 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
535 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
536 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
538 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
541 gen_helper_waiti(cpu_env
, pc
, intlevel
);
543 tcg_temp_free(intlevel
);
547 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
549 unsigned r
= 31 - clz32(mask
);
551 if (r
/ 4 > dc
->window
) {
552 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
553 TCGv_i32 w
= tcg_const_i32(r
/ 4);
555 gen_helper_window_check(cpu_env
, pc
, w
);
556 dc
->base
.is_jmp
= DISAS_NORETURN
;
562 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
564 TCGv_i32 m
= tcg_temp_new_i32();
567 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
569 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
574 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
576 TCGLabel
*label
= gen_new_label();
578 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
579 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
580 gen_set_label(label
);
583 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
585 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
588 static int gen_postprocess(DisasContext
*dc
, int slot
)
590 uint32_t op_flags
= dc
->op_flags
;
592 #ifndef CONFIG_USER_ONLY
593 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
594 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
597 gen_helper_check_interrupts(cpu_env
);
598 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
603 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
604 gen_helper_sync_windowbase(cpu_env
);
606 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
612 struct opcode_arg_copy
{
618 struct opcode_arg_info
{
624 XtensaOpcodeOps
*ops
;
625 OpcodeArg arg
[MAX_OPCODE_ARGS
];
626 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
627 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
639 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
641 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
642 return (r
<< 24) | (g
<< 16) | n
;
645 static enum resource_type
get_resource_type(uint32_t resource
)
647 return resource
>> 24;
651 * a depends on b if b must be executed before a,
652 * because a's side effects will destroy b's inputs.
654 static bool op_depends_on(const struct slot_prop
*a
,
655 const struct slot_prop
*b
)
660 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
663 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
664 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
667 while (i
< a
->n_out
&& j
< b
->n_in
) {
668 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
670 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
680 * Try to break a dependency on b, append temporary register copy records
681 * to the end of copy and update n_copy in case of success.
682 * This is not always possible: e.g. control flow must always be the last,
683 * load/store must be first and state dependencies are not supported yet.
685 static bool break_dependency(struct slot_prop
*a
,
687 struct opcode_arg_copy
*copy
,
692 unsigned n
= *n_copy
;
695 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
698 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
699 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
702 while (i
< a
->n_out
&& j
< b
->n_in
) {
703 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
705 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
708 int index
= b
->in
[j
].index
;
710 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
714 copy
[n
].resource
= b
->in
[j
].resource
;
715 copy
[n
].arg
= b
->arg
+ index
;
726 * Calculate evaluation order for slot opcodes.
727 * Build opcode order graph and output its nodes in topological sort order.
728 * An edge a -> b in the graph means that opcode a must be followed by
731 static bool tsort(struct slot_prop
*slot
,
732 struct slot_prop
*sorted
[],
734 struct opcode_arg_copy
*copy
,
740 unsigned out_edge
[MAX_INSN_SLOTS
];
741 } node
[MAX_INSN_SLOTS
];
743 unsigned in
[MAX_INSN_SLOTS
];
749 unsigned node_idx
= 0;
751 for (i
= 0; i
< n
; ++i
) {
752 node
[i
].n_in_edge
= 0;
753 node
[i
].n_out_edge
= 0;
756 for (i
= 0; i
< n
; ++i
) {
757 unsigned n_out_edge
= 0;
759 for (j
= 0; j
< n
; ++j
) {
760 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
761 node
[i
].out_edge
[n_out_edge
] = j
;
767 node
[i
].n_out_edge
= n_out_edge
;
770 for (i
= 0; i
< n
; ++i
) {
771 if (!node
[i
].n_in_edge
) {
778 for (; in_idx
< n_in
; ++in_idx
) {
780 sorted
[n_out
] = slot
+ i
;
782 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
784 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
785 in
[n_in
] = node
[i
].out_edge
[j
];
791 for (; node_idx
< n
; ++node_idx
) {
792 struct tsnode
*cnode
= node
+ node_idx
;
794 if (cnode
->n_in_edge
) {
795 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
796 unsigned k
= cnode
->out_edge
[j
];
798 if (break_dependency(slot
+ k
, slot
+ node_idx
,
800 --node
[k
].n_in_edge
== 0) {
805 cnode
->out_edge
[cnode
->n_out_edge
- 1];
816 static void opcode_add_resource(struct slot_prop
*op
,
817 uint32_t resource
, char direction
,
823 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
824 op
->in
[op
->n_in
].resource
= resource
;
825 op
->in
[op
->n_in
].index
= index
;
829 if (direction
== 'm' || direction
== 'o') {
830 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
831 op
->out
[op
->n_out
].resource
= resource
;
832 op
->out
[op
->n_out
].index
= index
;
837 g_assert_not_reached();
841 static int resource_compare(const void *a
, const void *b
)
843 const struct opcode_arg_info
*pa
= a
;
844 const struct opcode_arg_info
*pb
= b
;
846 return pa
->resource
< pb
->resource
?
847 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
850 static int arg_copy_compare(const void *a
, const void *b
)
852 const struct opcode_arg_copy
*pa
= a
;
853 const struct opcode_arg_copy
*pb
= b
;
855 return pa
->resource
< pb
->resource
?
856 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
859 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
861 xtensa_isa isa
= dc
->config
->isa
;
862 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, dc
->pc
)};
863 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
867 uint32_t op_flags
= 0;
868 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
869 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
870 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
871 unsigned n_arg_copy
= 0;
872 uint32_t debug_cause
= 0;
873 uint32_t windowed_register
= 0;
874 uint32_t coprocessor
= 0;
876 if (len
== XTENSA_UNDEFINED
) {
877 qemu_log_mask(LOG_GUEST_ERROR
,
878 "unknown instruction length (pc = %08x)\n",
880 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
884 dc
->base
.pc_next
= dc
->pc
+ len
;
885 for (i
= 1; i
< len
; ++i
) {
886 b
[i
] = translator_ldub(env
, dc
->pc
+ i
);
888 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
889 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
890 if (fmt
== XTENSA_UNDEFINED
) {
891 qemu_log_mask(LOG_GUEST_ERROR
,
892 "unrecognized instruction format (pc = %08x)\n",
894 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
897 slots
= xtensa_format_num_slots(isa
, fmt
);
898 for (slot
= 0; slot
< slots
; ++slot
) {
900 int opnd
, vopnd
, opnds
;
901 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
902 XtensaOpcodeOps
*ops
;
904 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
905 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
906 if (opc
== XTENSA_UNDEFINED
) {
907 qemu_log_mask(LOG_GUEST_ERROR
,
908 "unrecognized opcode in slot %d (pc = %08x)\n",
910 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
913 opnds
= xtensa_opcode_num_operands(isa
, opc
);
915 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
916 void **register_file
= NULL
;
918 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
919 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
921 register_file
= dc
->config
->regfile
[rf
];
923 if (rf
== dc
->config
->a_regfile
) {
926 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
928 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
929 windowed_register
|= 1u << v
;
932 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
935 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
937 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
938 arg
[vopnd
].raw_imm
= v
;
939 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
940 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
944 arg
[vopnd
].in
= register_file
[v
];
945 arg
[vopnd
].out
= register_file
[v
];
950 ops
= dc
->config
->opcode_ops
[opc
];
951 slot_prop
[slot
].ops
= ops
;
954 op_flags
|= ops
->op_flags
;
956 qemu_log_mask(LOG_UNIMP
,
957 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
958 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
959 op_flags
|= XTENSA_OP_ILL
;
961 if ((op_flags
& XTENSA_OP_ILL
) ||
962 (ops
&& ops
->test_ill
&& ops
->test_ill(dc
, arg
, ops
->par
))) {
963 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
966 if (ops
->op_flags
& XTENSA_OP_DEBUG_BREAK
) {
967 debug_cause
|= ops
->par
[0];
969 if (ops
->test_overflow
) {
970 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
972 coprocessor
|= ops
->coprocessor
;
975 slot_prop
[slot
].n_in
= 0;
976 slot_prop
[slot
].n_out
= 0;
977 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
979 opnds
= xtensa_opcode_num_operands(isa
, opc
);
981 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
982 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
984 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
985 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
988 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
990 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
991 opcode_add_resource(slot_prop
+ slot
,
992 encode_resource(RES_REGFILE
, rf
, v
),
993 xtensa_operand_inout(isa
, opc
, opnd
),
994 visible
? vopnd
: -1);
1001 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
1003 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
1004 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
1006 opcode_add_resource(slot_prop
+ slot
,
1007 encode_resource(RES_STATE
, 0, state
),
1008 xtensa_stateOperand_inout(isa
, opc
, opnd
),
1011 if (xtensa_opcode_is_branch(isa
, opc
) ||
1012 xtensa_opcode_is_jump(isa
, opc
) ||
1013 xtensa_opcode_is_loop(isa
, opc
) ||
1014 xtensa_opcode_is_call(isa
, opc
)) {
1015 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1018 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1019 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1020 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1021 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1026 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1027 qemu_log_mask(LOG_UNIMP
,
1028 "Circular resource dependencies (pc = %08x)\n",
1030 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1034 ordered
[0] = slot_prop
+ 0;
1037 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1038 !gen_check_privilege(dc
)) {
1042 if (op_flags
& XTENSA_OP_SYSCALL
) {
1043 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1047 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1048 gen_debug_exception(dc
, debug_cause
);
1052 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1056 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1057 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1059 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1063 if (op_flags
& XTENSA_OP_ALLOCA
) {
1064 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1066 gen_helper_movsp(cpu_env
, tmp
);
1070 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1079 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1080 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1081 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1082 resource
= arg_copy
[i
].resource
;
1083 temp
= tcg_temp_local_new();
1084 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1085 arg_copy
[i
].temp
= temp
;
1088 arg_copy
[j
] = arg_copy
[i
];
1092 arg_copy
[i
].arg
->in
= temp
;
1097 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1098 for (slot
= 0; slot
< slots
; ++slot
) {
1099 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1100 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1105 dc
->op_flags
= op_flags
;
1107 for (slot
= 0; slot
< slots
; ++slot
) {
1108 struct slot_prop
*pslot
= ordered
[slot
];
1109 XtensaOpcodeOps
*ops
= pslot
->ops
;
1111 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1114 for (i
= 0; i
< n_arg_copy
; ++i
) {
1115 tcg_temp_free(arg_copy
[i
].temp
);
1118 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1119 gen_postprocess(dc
, 0);
1121 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1122 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1123 gen_jumpi_check_loop_end(dc
, -1);
1124 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1125 gen_jumpi_check_loop_end(dc
, 0);
1127 gen_check_loop_end(dc
, 0);
1130 dc
->pc
= dc
->base
.pc_next
;
1133 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1135 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1136 return xtensa_op0_insn_len(dc
, b0
);
1139 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1143 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1144 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1145 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1146 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1152 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1155 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1156 CPUXtensaState
*env
= cpu
->env_ptr
;
1157 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1159 dc
->config
= env
->config
;
1160 dc
->pc
= dc
->base
.pc_first
;
1161 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1162 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1163 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1164 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1165 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1166 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1167 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1168 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1169 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1170 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1171 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1172 XTENSA_TBFLAG_WINDOW_SHIFT
);
1173 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1174 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1175 XTENSA_TBFLAG_CALLINC_SHIFT
);
1176 init_sar_tracker(dc
);
1179 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1181 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1184 dc
->next_icount
= tcg_temp_local_new_i32();
1188 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1190 tcg_gen_insn_start(dcbase
->pc_next
);
1193 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1194 const CPUBreakpoint
*bp
)
1196 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1198 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1199 gen_exception(dc
, EXCP_DEBUG
);
1200 dc
->base
.is_jmp
= DISAS_NORETURN
;
1201 /* The address covered by the breakpoint must be included in
1202 [tb->pc, tb->pc + tb->size) in order to for it to be
1203 properly cleared -- thus we increment the PC here so that
1204 the logic setting tb->size below does the right thing. */
1205 dc
->base
.pc_next
+= 2;
1209 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1211 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1212 CPUXtensaState
*env
= cpu
->env_ptr
;
1213 target_ulong page_start
;
1215 /* These two conditions only apply to the first insn in the TB,
1216 but this is the first TranslateOps hook that allows exiting. */
1217 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1218 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1219 gen_exception(dc
, EXCP_YIELD
);
1220 dc
->base
.is_jmp
= DISAS_NORETURN
;
1223 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1224 gen_exception(dc
, EXCP_DEBUG
);
1225 dc
->base
.is_jmp
= DISAS_NORETURN
;
1230 TCGLabel
*label
= gen_new_label();
1232 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1233 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1234 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1236 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1238 gen_set_label(label
);
1242 gen_ibreak_check(env
, dc
);
1245 disas_xtensa_insn(env
, dc
);
1248 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1251 /* End the TB if the next insn will cross into the next page. */
1252 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1253 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1254 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1255 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1256 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1260 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1262 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1264 reset_sar_tracker(dc
);
1266 tcg_temp_free(dc
->next_icount
);
1269 switch (dc
->base
.is_jmp
) {
1270 case DISAS_NORETURN
:
1272 case DISAS_TOO_MANY
:
1273 if (dc
->base
.singlestep_enabled
) {
1274 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1275 gen_exception(dc
, EXCP_DEBUG
);
1277 gen_jumpi(dc
, dc
->pc
, 0);
1281 g_assert_not_reached();
1285 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1287 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1288 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1291 static const TranslatorOps xtensa_translator_ops
= {
1292 .init_disas_context
= xtensa_tr_init_disas_context
,
1293 .tb_start
= xtensa_tr_tb_start
,
1294 .insn_start
= xtensa_tr_insn_start
,
1295 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1296 .translate_insn
= xtensa_tr_translate_insn
,
1297 .tb_stop
= xtensa_tr_tb_stop
,
1298 .disas_log
= xtensa_tr_disas_log
,
1301 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1303 DisasContext dc
= {};
1304 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1307 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1309 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1310 CPUXtensaState
*env
= &cpu
->env
;
1311 xtensa_isa isa
= env
->config
->isa
;
1314 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1316 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1317 const uint32_t *reg
=
1318 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1319 int regno
= xtensa_sysreg_number(isa
, i
);
1322 qemu_fprintf(f
, "%12s=%08x%c",
1323 xtensa_sysreg_name(isa
, i
),
1325 (j
++ % 4) == 3 ? '\n' : ' ');
1329 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1331 for (i
= 0; i
< 16; ++i
) {
1332 qemu_fprintf(f
, " A%02d=%08x%c",
1333 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1336 xtensa_sync_phys_from_window(env
);
1337 qemu_fprintf(f
, "\n");
1339 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1340 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1342 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1343 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1345 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1349 if ((flags
& CPU_DUMP_FPU
) &&
1350 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1351 qemu_fprintf(f
, "\n");
1353 for (i
= 0; i
< 16; ++i
) {
1354 qemu_fprintf(f
, "F%02d=%08x (%+10.8e)%c", i
,
1355 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1356 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1357 (i
% 2) == 1 ? '\n' : ' ');
1362 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1368 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1369 const uint32_t par
[])
1371 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1374 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1375 const uint32_t par
[])
1377 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1380 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1381 const uint32_t par
[])
1383 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1386 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1387 const uint32_t par
[])
1389 TCGv_i32 tmp
= tcg_temp_new_i32();
1390 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1391 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1395 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1396 const uint32_t par
[])
1398 uint32_t shift
= par
[1];
1399 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1400 TCGv_i32 tmp
= tcg_temp_new_i32();
1402 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1404 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1406 tcg_gen_add_i32(tmp
, tmp
, mask
);
1408 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1409 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1410 tmp
, arg
[0].imm
, 1);
1411 tcg_temp_free(mask
);
1415 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1416 const uint32_t par
[])
1418 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1421 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1422 const uint32_t par
[])
1424 TCGv_i32 tmp
= tcg_temp_new_i32();
1425 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1426 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1430 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1431 const uint32_t par
[])
1433 TCGv_i32 tmp
= tcg_temp_new_i32();
1434 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1435 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1439 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1440 const uint32_t par
[])
1442 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1445 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1446 const uint32_t par
[])
1448 #ifdef TARGET_WORDS_BIGENDIAN
1449 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1451 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1453 TCGv_i32 tmp
= tcg_temp_new_i32();
1454 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1455 #ifdef TARGET_WORDS_BIGENDIAN
1456 tcg_gen_shr_i32(bit
, bit
, tmp
);
1458 tcg_gen_shl_i32(bit
, bit
, tmp
);
1460 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1461 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1466 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1467 const uint32_t par
[])
1469 TCGv_i32 tmp
= tcg_temp_new_i32();
1470 #ifdef TARGET_WORDS_BIGENDIAN
1471 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1473 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1475 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1479 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1480 const uint32_t par
[])
1482 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1485 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1486 const uint32_t par
[])
1488 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1499 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1500 const uint32_t par
[])
1502 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1503 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1504 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1505 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1506 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1507 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1510 TCGv_i32 tmp1
= tcg_temp_new_i32();
1511 TCGv_i32 tmp2
= tcg_temp_new_i32();
1513 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1514 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1515 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1516 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1517 tcg_temp_free(tmp1
);
1518 tcg_temp_free(tmp2
);
1521 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1522 const uint32_t par
[])
1524 TCGv_i32 tmp
= tcg_temp_new_i32();
1526 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1527 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1531 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1532 const uint32_t par
[])
1534 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1535 gen_jumpi(dc
, arg
[0].imm
, 0);
1538 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1539 const uint32_t par
[])
1541 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1542 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1546 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1547 const uint32_t par
[])
1549 TCGv_i32 tmp
= tcg_temp_new_i32();
1550 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1551 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1556 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1557 const uint32_t par
[])
1559 TCGv_i32 tmp
= tcg_temp_new_i32();
1561 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1562 gen_callw_slot(dc
, par
[0], tmp
, -1);
1566 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1567 const uint32_t par
[])
1569 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1570 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1572 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1573 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1574 tcg_temp_free(tmp1
);
1575 tcg_temp_free(tmp2
);
1578 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1579 const uint32_t par
[])
1581 /* TODO: GPIO32 may be a part of coprocessor */
1582 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1585 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1586 const uint32_t par
[])
1588 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1591 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1592 const uint32_t par
[])
1594 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1596 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1600 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1601 const uint32_t par
[])
1603 TCGv_i32 addr
= tcg_temp_new_i32();
1604 TCGv_i32 res
= tcg_temp_new_i32();
1606 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1607 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1608 tcg_temp_free(addr
);
1612 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1613 const uint32_t par
[])
1615 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1616 arg
[2].imm
, arg
[3].imm
);
1619 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1620 const uint32_t par
[])
1622 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1625 static bool test_ill_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1626 const uint32_t par
[])
1628 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1629 qemu_log_mask(LOG_GUEST_ERROR
,
1630 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1637 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1638 const uint32_t par
[])
1640 return 1 << (dc
->callinc
* 4);
1643 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1644 const uint32_t par
[])
1646 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1647 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1648 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1649 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1655 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1656 const uint32_t par
[])
1658 int maskimm
= (1 << arg
[3].imm
) - 1;
1660 TCGv_i32 tmp
= tcg_temp_new_i32();
1661 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1662 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1666 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1667 const uint32_t par
[])
1669 TCGv_i32 tmp
= tcg_temp_new_i32();
1671 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1672 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1673 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1677 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1678 const uint32_t par
[])
1680 #ifndef CONFIG_USER_ONLY
1681 TCGv_i32 addr
= tcg_temp_new_i32();
1683 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1684 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1685 gen_helper_itlb_hit_test(cpu_env
, addr
);
1686 tcg_temp_free(addr
);
1690 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1691 const uint32_t par
[])
1693 #ifndef CONFIG_USER_ONLY
1694 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1696 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1697 tcg_temp_free(dtlb
);
1701 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1702 const uint32_t par
[])
1704 gen_jumpi(dc
, arg
[0].imm
, 0);
1707 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1708 const uint32_t par
[])
1710 gen_jump(dc
, arg
[0].in
);
1713 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1714 const uint32_t par
[])
1716 TCGv_i32 addr
= tcg_temp_new_i32();
1718 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1719 gen_load_store_alignment(dc
, 2, addr
, false);
1720 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1721 tcg_temp_free(addr
);
1724 #ifdef CONFIG_USER_ONLY
1725 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1729 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1731 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1732 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1733 TCGv_i32 write
= tcg_const_i32(is_write
);
1735 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1737 tcg_temp_free(write
);
1742 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1743 const uint32_t par
[])
1745 TCGv_i32 addr
= tcg_temp_new_i32();
1747 tcg_gen_mov_i32(addr
, arg
[1].in
);
1748 gen_load_store_alignment(dc
, 2, addr
, true);
1749 gen_check_exclusive(dc
, addr
, false);
1750 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1751 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1752 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1753 tcg_temp_free(addr
);
1756 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1757 const uint32_t par
[])
1759 TCGv_i32 addr
= tcg_temp_new_i32();
1761 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1762 if (par
[0] & MO_SIZE
) {
1763 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1767 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1769 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, par
[0]);
1771 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, par
[0]);
1773 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1776 tcg_temp_free(addr
);
1779 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1780 const uint32_t par
[])
1784 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1785 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1786 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1788 tmp
= tcg_const_i32(arg
[1].imm
);
1790 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1794 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1795 const uint32_t par
[])
1797 uint32_t lend
= arg
[1].imm
;
1799 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1800 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1801 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1803 if (par
[0] != TCG_COND_NEVER
) {
1804 TCGLabel
*label
= gen_new_label();
1805 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1806 gen_jumpi(dc
, lend
, 1);
1807 gen_set_label(label
);
1810 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1831 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1832 const uint32_t par
[])
1835 unsigned half
= par
[1];
1836 uint32_t ld_offset
= par
[2];
1837 unsigned off
= ld_offset
? 2 : 0;
1838 TCGv_i32 vaddr
= tcg_temp_new_i32();
1839 TCGv_i32 mem32
= tcg_temp_new_i32();
1842 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1843 gen_load_store_alignment(dc
, 2, vaddr
, false);
1844 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1846 if (op
!= MAC16_NONE
) {
1847 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1848 half
& MAC16_HX
, op
== MAC16_UMUL
);
1849 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1850 half
& MAC16_XH
, op
== MAC16_UMUL
);
1852 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1853 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1854 if (op
== MAC16_UMUL
) {
1855 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1857 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1860 TCGv_i32 lo
= tcg_temp_new_i32();
1861 TCGv_i32 hi
= tcg_temp_new_i32();
1863 tcg_gen_mul_i32(lo
, m1
, m2
);
1864 tcg_gen_sari_i32(hi
, lo
, 31);
1865 if (op
== MAC16_MULA
) {
1866 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1867 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1870 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1871 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1874 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1876 tcg_temp_free_i32(lo
);
1877 tcg_temp_free_i32(hi
);
1883 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1884 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1886 tcg_temp_free(vaddr
);
1887 tcg_temp_free(mem32
);
1890 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1891 const uint32_t par
[])
1893 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1896 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1897 const uint32_t par
[])
1899 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1902 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1903 const uint32_t par
[])
1905 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1908 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1909 const uint32_t par
[])
1911 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1914 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1915 const uint32_t par
[])
1917 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1920 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1921 const uint32_t par
[])
1923 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1926 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1927 const uint32_t par
[])
1929 TCGv_i32 zero
= tcg_const_i32(0);
1931 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1932 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1933 tcg_temp_free(zero
);
1936 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1937 const uint32_t par
[])
1939 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1942 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1943 const uint32_t par
[])
1945 TCGv_i32 zero
= tcg_const_i32(0);
1946 TCGv_i32 tmp
= tcg_temp_new_i32();
1948 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1949 tcg_gen_movcond_i32(par
[0],
1950 arg
[0].out
, tmp
, zero
,
1951 arg
[1].in
, arg
[0].in
);
1953 tcg_temp_free(zero
);
1956 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1957 const uint32_t par
[])
1959 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1962 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1963 const uint32_t par
[])
1965 TCGv_i32 v1
= tcg_temp_new_i32();
1966 TCGv_i32 v2
= tcg_temp_new_i32();
1969 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1970 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1972 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1973 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1975 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1980 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1981 const uint32_t par
[])
1983 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1986 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1987 const uint32_t par
[])
1989 TCGv_i32 lo
= tcg_temp_new();
1992 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1994 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1999 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
2000 const uint32_t par
[])
2002 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2005 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2006 const uint32_t par
[])
2010 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2011 const uint32_t par
[])
2013 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2016 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2017 const uint32_t par
[])
2019 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2022 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2023 const uint32_t par
[])
2025 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2028 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2029 const uint32_t par
[])
2031 #ifndef CONFIG_USER_ONLY
2032 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2034 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2035 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2036 tcg_temp_free(dtlb
);
2040 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2041 const uint32_t par
[])
2043 #ifndef CONFIG_USER_ONLY
2044 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2045 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2049 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2050 const uint32_t par
[])
2052 TCGLabel
*label1
= gen_new_label();
2053 TCGLabel
*label2
= gen_new_label();
2055 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2057 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2059 tcg_gen_movi_i32(arg
[0].out
,
2060 par
[0] ? 0x80000000 : 0);
2062 gen_set_label(label1
);
2064 tcg_gen_div_i32(arg
[0].out
,
2065 arg
[1].in
, arg
[2].in
);
2067 tcg_gen_rem_i32(arg
[0].out
,
2068 arg
[1].in
, arg
[2].in
);
2070 gen_set_label(label2
);
2073 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2074 const uint32_t par
[])
2076 tcg_gen_divu_i32(arg
[0].out
,
2077 arg
[1].in
, arg
[2].in
);
2080 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2081 const uint32_t par
[])
2083 /* TODO: GPIO32 may be a part of coprocessor */
2084 tcg_gen_movi_i32(arg
[0].out
, 0);
2087 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2088 const uint32_t par
[])
2090 tcg_gen_remu_i32(arg
[0].out
,
2091 arg
[1].in
, arg
[2].in
);
2094 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2095 const uint32_t par
[])
2097 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2100 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2101 const uint32_t par
[])
2103 gen_jump(dc
, cpu_R
[0]);
2106 static bool test_ill_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2107 const uint32_t par
[])
2110 qemu_log_mask(LOG_GUEST_ERROR
,
2111 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2114 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2116 gen_helper_test_ill_retw(cpu_env
, tmp
);
2122 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2123 const uint32_t par
[])
2125 TCGv_i32 tmp
= tcg_const_i32(1);
2126 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2127 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2128 cpu_SR
[WINDOW_START
], tmp
);
2129 tcg_gen_movi_i32(tmp
, dc
->pc
);
2130 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2131 gen_helper_retw(cpu_env
, cpu_R
[0]);
2136 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2137 const uint32_t par
[])
2139 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2142 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2143 const uint32_t par
[])
2145 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2146 gen_jump(dc
, cpu_SR
[EPC1
]);
2149 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2150 const uint32_t par
[])
2152 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2153 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2156 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2157 const uint32_t par
[])
2159 TCGv_i32 tmp
= tcg_const_i32(1);
2161 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2162 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2165 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2166 cpu_SR
[WINDOW_START
], tmp
);
2168 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2169 cpu_SR
[WINDOW_START
], tmp
);
2173 gen_helper_restore_owb(cpu_env
);
2174 gen_jump(dc
, cpu_SR
[EPC1
]);
2177 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2178 const uint32_t par
[])
2180 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2183 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2184 const uint32_t par
[])
2186 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2187 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2188 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2191 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2192 const uint32_t par
[])
2194 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2197 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2198 const uint32_t par
[])
2200 #ifndef CONFIG_USER_ONLY
2201 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2204 gen_helper_update_ccount(cpu_env
);
2205 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2209 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2210 const uint32_t par
[])
2212 #ifndef CONFIG_USER_ONLY
2213 TCGv_i32 tmp
= tcg_temp_new_i32();
2215 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2216 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2217 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2222 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2223 const uint32_t par
[])
2225 #ifndef CONFIG_USER_ONLY
2226 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2231 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2233 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2234 tcg_temp_free(dtlb
);
2238 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2239 const uint32_t par
[])
2241 #ifndef CONFIG_USER_ONLY
2242 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2246 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2247 const uint32_t par
[])
2249 #ifndef CONFIG_USER_ONLY
2250 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2254 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2255 const uint32_t par
[])
2257 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2260 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2261 const uint32_t par
[])
2263 /* TODO: GPIO32 may be a part of coprocessor */
2264 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2267 #ifdef CONFIG_USER_ONLY
2268 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2272 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2274 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2276 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2281 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2282 const uint32_t par
[])
2284 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2285 TCGv_i32 addr
= tcg_temp_local_new_i32();
2287 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2288 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2289 gen_load_store_alignment(dc
, 2, addr
, true);
2290 gen_check_atomctl(dc
, addr
);
2291 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2292 tmp
, dc
->cring
, MO_TEUL
);
2293 tcg_temp_free(addr
);
2297 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2298 const uint32_t par
[])
2300 TCGv_i32 addr
= tcg_temp_new_i32();
2302 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2303 gen_load_store_alignment(dc
, 2, addr
, false);
2304 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, MO_TEUL
);
2305 tcg_temp_free(addr
);
2308 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2309 const uint32_t par
[])
2311 TCGv_i32 prev
= tcg_temp_new_i32();
2312 TCGv_i32 addr
= tcg_temp_local_new_i32();
2313 TCGv_i32 res
= tcg_temp_local_new_i32();
2314 TCGLabel
*label
= gen_new_label();
2316 tcg_gen_movi_i32(res
, 0);
2317 tcg_gen_mov_i32(addr
, arg
[1].in
);
2318 gen_load_store_alignment(dc
, 2, addr
, true);
2319 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2320 gen_check_exclusive(dc
, addr
, true);
2321 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2322 arg
[0].in
, dc
->cring
, MO_TEUL
);
2323 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2324 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2325 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2326 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2327 gen_set_label(label
);
2328 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2329 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2330 tcg_temp_free(prev
);
2331 tcg_temp_free(addr
);
2335 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2336 const uint32_t par
[])
2338 tcg_gen_setcond_i32(par
[0],
2340 arg
[1].in
, arg
[2].in
);
2343 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2344 const uint32_t par
[])
2346 int shift
= 31 - arg
[2].imm
;
2349 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2350 } else if (shift
== 16) {
2351 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2353 TCGv_i32 tmp
= tcg_temp_new_i32();
2354 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2355 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2360 static bool test_ill_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2361 const uint32_t par
[])
2363 #ifdef CONFIG_USER_ONLY
2366 bool ill
= !semihosting_enabled();
2369 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2374 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2375 const uint32_t par
[])
2377 #ifndef CONFIG_USER_ONLY
2378 gen_helper_simcall(cpu_env
);
2383 * Note: 64 bit ops are used here solely because SAR values
2386 #define gen_shift_reg(cmd, reg) do { \
2387 TCGv_i64 tmp = tcg_temp_new_i64(); \
2388 tcg_gen_extu_i32_i64(tmp, reg); \
2389 tcg_gen_##cmd##_i64(v, v, tmp); \
2390 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2391 tcg_temp_free_i64(v); \
2392 tcg_temp_free_i64(tmp); \
2395 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2397 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2398 const uint32_t par
[])
2400 if (dc
->sar_m32_5bit
) {
2401 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2403 TCGv_i64 v
= tcg_temp_new_i64();
2404 TCGv_i32 s
= tcg_const_i32(32);
2405 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2406 tcg_gen_andi_i32(s
, s
, 0x3f);
2407 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2408 gen_shift_reg(shl
, s
);
2413 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2414 const uint32_t par
[])
2416 if (arg
[2].imm
== 32) {
2417 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2418 arg
[0].imm
, arg
[1].imm
);
2420 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2423 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2424 const uint32_t par
[])
2426 if (dc
->sar_m32_5bit
) {
2427 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2429 TCGv_i64 v
= tcg_temp_new_i64();
2430 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2435 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2436 const uint32_t par
[])
2438 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2441 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2442 const uint32_t par
[])
2444 TCGv_i64 v
= tcg_temp_new_i64();
2445 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2449 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2450 const uint32_t par
[])
2452 if (dc
->sar_m32_5bit
) {
2453 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2455 TCGv_i64 v
= tcg_temp_new_i64();
2456 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2462 #undef gen_shift_reg
2464 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2465 const uint32_t par
[])
2467 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2470 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2471 const uint32_t par
[])
2473 TCGv_i32 tmp
= tcg_temp_new_i32();
2474 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2475 gen_left_shift_sar(dc
, tmp
);
2479 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2480 const uint32_t par
[])
2482 TCGv_i32 tmp
= tcg_temp_new_i32();
2483 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2484 gen_right_shift_sar(dc
, tmp
);
2488 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2489 const uint32_t par
[])
2491 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2492 gen_right_shift_sar(dc
, tmp
);
2496 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2497 const uint32_t par
[])
2499 gen_left_shift_sar(dc
, arg
[0].in
);
2502 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2503 const uint32_t par
[])
2505 gen_right_shift_sar(dc
, arg
[0].in
);
2508 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2509 const uint32_t par
[])
2511 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2514 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2515 const uint32_t par
[])
2517 TCGv_i32 tmp
= tcg_temp_new_i32();
2518 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2519 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2523 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2524 const uint32_t par
[])
2526 #ifndef CONFIG_USER_ONLY
2527 gen_waiti(dc
, arg
[0].imm
);
2531 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2532 const uint32_t par
[])
2534 #ifndef CONFIG_USER_ONLY
2535 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2537 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2538 tcg_temp_free(dtlb
);
2542 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2543 const uint32_t par
[])
2545 #ifndef CONFIG_USER_ONLY
2546 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2550 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2551 const uint32_t par
[])
2553 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2556 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2557 const uint32_t par
[])
2559 /* TODO: GPIO32 may be a part of coprocessor */
2560 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2563 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2564 const uint32_t par
[])
2566 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2569 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2570 const uint32_t par
[])
2572 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2575 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2576 const uint32_t par
[])
2578 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2581 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2582 const uint32_t par
[])
2584 #ifndef CONFIG_USER_ONLY
2585 uint32_t id
= par
[0] - CCOMPARE
;
2586 TCGv_i32 tmp
= tcg_const_i32(id
);
2588 assert(id
< dc
->config
->nccompare
);
2589 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2592 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2593 gen_helper_update_ccompare(cpu_env
, tmp
);
2598 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2599 const uint32_t par
[])
2601 #ifndef CONFIG_USER_ONLY
2602 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2605 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2609 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2610 const uint32_t par
[])
2612 #ifndef CONFIG_USER_ONLY
2613 unsigned id
= par
[0] - DBREAKA
;
2614 TCGv_i32 tmp
= tcg_const_i32(id
);
2616 assert(id
< dc
->config
->ndbreak
);
2617 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2622 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2623 const uint32_t par
[])
2625 #ifndef CONFIG_USER_ONLY
2626 unsigned id
= par
[0] - DBREAKC
;
2627 TCGv_i32 tmp
= tcg_const_i32(id
);
2629 assert(id
< dc
->config
->ndbreak
);
2630 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2635 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2636 const uint32_t par
[])
2638 #ifndef CONFIG_USER_ONLY
2639 unsigned id
= par
[0] - IBREAKA
;
2640 TCGv_i32 tmp
= tcg_const_i32(id
);
2642 assert(id
< dc
->config
->nibreak
);
2643 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2648 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2649 const uint32_t par
[])
2651 #ifndef CONFIG_USER_ONLY
2652 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2656 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2657 const uint32_t par
[])
2659 #ifndef CONFIG_USER_ONLY
2661 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2663 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2668 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2669 const uint32_t par
[])
2671 #ifndef CONFIG_USER_ONLY
2672 gen_helper_intclear(cpu_env
, arg
[0].in
);
2676 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2677 const uint32_t par
[])
2679 #ifndef CONFIG_USER_ONLY
2680 gen_helper_intset(cpu_env
, arg
[0].in
);
2684 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2685 const uint32_t par
[])
2687 #ifndef CONFIG_USER_ONLY
2688 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2692 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2693 const uint32_t par
[])
2695 #ifndef CONFIG_USER_ONLY
2696 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2700 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2701 const uint32_t par
[])
2703 #ifndef CONFIG_USER_ONLY
2704 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2705 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2707 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2708 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2711 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2715 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2716 const uint32_t par
[])
2718 #ifndef CONFIG_USER_ONLY
2719 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2723 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2724 const uint32_t par
[])
2726 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2727 if (dc
->sar_m32_5bit
) {
2728 tcg_gen_discard_i32(dc
->sar_m32
);
2730 dc
->sar_5bit
= false;
2731 dc
->sar_m32_5bit
= false;
2734 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2735 const uint32_t par
[])
2737 #ifndef CONFIG_USER_ONLY
2738 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2742 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2743 const uint32_t par
[])
2745 #ifndef CONFIG_USER_ONLY
2746 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2747 (1 << dc
->config
->nareg
/ 4) - 1);
2751 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2752 const uint32_t par
[])
2754 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2757 static void translate_wur_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
2758 const uint32_t par
[])
2760 gen_helper_wur_fcr(cpu_env
, arg
[0].in
);
2763 static void translate_wur_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
2764 const uint32_t par
[])
2766 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
2769 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2770 const uint32_t par
[])
2772 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2775 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2776 const uint32_t par
[])
2778 TCGv_i32 tmp
= tcg_temp_new_i32();
2780 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2781 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2782 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2786 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2787 const uint32_t par
[])
2789 TCGv_i32 tmp
= tcg_temp_new_i32();
2791 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2792 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2793 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2797 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2798 const uint32_t par
[])
2800 #ifndef CONFIG_USER_ONLY
2801 TCGv_i32 tmp
= tcg_temp_new_i32();
2803 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2807 gen_helper_update_ccount(cpu_env
);
2808 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2809 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2810 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2816 #define gen_translate_xsr(name) \
2817 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2818 const uint32_t par[]) \
2820 TCGv_i32 tmp = tcg_temp_new_i32(); \
2822 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2823 translate_wsr_##name(dc, arg, par); \
2824 tcg_gen_mov_i32(arg[0].out, tmp); \
2825 tcg_temp_free(tmp); \
2828 gen_translate_xsr(acchi
)
2829 gen_translate_xsr(ccompare
)
2830 gen_translate_xsr(dbreaka
)
2831 gen_translate_xsr(dbreakc
)
2832 gen_translate_xsr(ibreaka
)
2833 gen_translate_xsr(ibreakenable
)
2834 gen_translate_xsr(icount
)
2835 gen_translate_xsr(memctl
)
2836 gen_translate_xsr(mpuenb
)
2837 gen_translate_xsr(ps
)
2838 gen_translate_xsr(rasid
)
2839 gen_translate_xsr(sar
)
2840 gen_translate_xsr(windowbase
)
2841 gen_translate_xsr(windowstart
)
2843 #undef gen_translate_xsr
2845 static const XtensaOpcodeOps core_ops
[] = {
2848 .translate
= translate_abs
,
2850 .name
= (const char * const[]) {
2851 "add", "add.n", NULL
,
2853 .translate
= translate_add
,
2854 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2856 .name
= (const char * const[]) {
2857 "addi", "addi.n", NULL
,
2859 .translate
= translate_addi
,
2860 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2863 .translate
= translate_addi
,
2866 .translate
= translate_addx
,
2867 .par
= (const uint32_t[]){1},
2870 .translate
= translate_addx
,
2871 .par
= (const uint32_t[]){2},
2874 .translate
= translate_addx
,
2875 .par
= (const uint32_t[]){3},
2878 .translate
= translate_all
,
2879 .par
= (const uint32_t[]){true, 4},
2882 .translate
= translate_all
,
2883 .par
= (const uint32_t[]){true, 8},
2886 .translate
= translate_and
,
2889 .translate
= translate_boolean
,
2890 .par
= (const uint32_t[]){BOOLEAN_AND
},
2893 .translate
= translate_boolean
,
2894 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2897 .translate
= translate_all
,
2898 .par
= (const uint32_t[]){false, 4},
2901 .translate
= translate_all
,
2902 .par
= (const uint32_t[]){false, 8},
2904 .name
= (const char * const[]) {
2905 "ball", "ball.w15", "ball.w18", NULL
,
2907 .translate
= translate_ball
,
2908 .par
= (const uint32_t[]){TCG_COND_EQ
},
2909 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2911 .name
= (const char * const[]) {
2912 "bany", "bany.w15", "bany.w18", NULL
,
2914 .translate
= translate_bany
,
2915 .par
= (const uint32_t[]){TCG_COND_NE
},
2916 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2918 .name
= (const char * const[]) {
2919 "bbc", "bbc.w15", "bbc.w18", NULL
,
2921 .translate
= translate_bb
,
2922 .par
= (const uint32_t[]){TCG_COND_EQ
},
2923 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2925 .name
= (const char * const[]) {
2926 "bbci", "bbci.w15", "bbci.w18", NULL
,
2928 .translate
= translate_bbi
,
2929 .par
= (const uint32_t[]){TCG_COND_EQ
},
2930 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2932 .name
= (const char * const[]) {
2933 "bbs", "bbs.w15", "bbs.w18", NULL
,
2935 .translate
= translate_bb
,
2936 .par
= (const uint32_t[]){TCG_COND_NE
},
2937 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2939 .name
= (const char * const[]) {
2940 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2942 .translate
= translate_bbi
,
2943 .par
= (const uint32_t[]){TCG_COND_NE
},
2944 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2946 .name
= (const char * const[]) {
2947 "beq", "beq.w15", "beq.w18", NULL
,
2949 .translate
= translate_b
,
2950 .par
= (const uint32_t[]){TCG_COND_EQ
},
2951 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2953 .name
= (const char * const[]) {
2954 "beqi", "beqi.w15", "beqi.w18", NULL
,
2956 .translate
= translate_bi
,
2957 .par
= (const uint32_t[]){TCG_COND_EQ
},
2958 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2960 .name
= (const char * const[]) {
2961 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2963 .translate
= translate_bz
,
2964 .par
= (const uint32_t[]){TCG_COND_EQ
},
2965 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2968 .translate
= translate_bp
,
2969 .par
= (const uint32_t[]){TCG_COND_EQ
},
2971 .name
= (const char * const[]) {
2972 "bge", "bge.w15", "bge.w18", NULL
,
2974 .translate
= translate_b
,
2975 .par
= (const uint32_t[]){TCG_COND_GE
},
2976 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2978 .name
= (const char * const[]) {
2979 "bgei", "bgei.w15", "bgei.w18", NULL
,
2981 .translate
= translate_bi
,
2982 .par
= (const uint32_t[]){TCG_COND_GE
},
2983 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2985 .name
= (const char * const[]) {
2986 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
2988 .translate
= translate_b
,
2989 .par
= (const uint32_t[]){TCG_COND_GEU
},
2990 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2992 .name
= (const char * const[]) {
2993 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
2995 .translate
= translate_bi
,
2996 .par
= (const uint32_t[]){TCG_COND_GEU
},
2997 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2999 .name
= (const char * const[]) {
3000 "bgez", "bgez.w15", "bgez.w18", NULL
,
3002 .translate
= translate_bz
,
3003 .par
= (const uint32_t[]){TCG_COND_GE
},
3004 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3006 .name
= (const char * const[]) {
3007 "blt", "blt.w15", "blt.w18", NULL
,
3009 .translate
= translate_b
,
3010 .par
= (const uint32_t[]){TCG_COND_LT
},
3011 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3013 .name
= (const char * const[]) {
3014 "blti", "blti.w15", "blti.w18", NULL
,
3016 .translate
= translate_bi
,
3017 .par
= (const uint32_t[]){TCG_COND_LT
},
3018 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3020 .name
= (const char * const[]) {
3021 "bltu", "bltu.w15", "bltu.w18", NULL
,
3023 .translate
= translate_b
,
3024 .par
= (const uint32_t[]){TCG_COND_LTU
},
3025 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3027 .name
= (const char * const[]) {
3028 "bltui", "bltui.w15", "bltui.w18", NULL
,
3030 .translate
= translate_bi
,
3031 .par
= (const uint32_t[]){TCG_COND_LTU
},
3032 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3034 .name
= (const char * const[]) {
3035 "bltz", "bltz.w15", "bltz.w18", NULL
,
3037 .translate
= translate_bz
,
3038 .par
= (const uint32_t[]){TCG_COND_LT
},
3039 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3041 .name
= (const char * const[]) {
3042 "bnall", "bnall.w15", "bnall.w18", NULL
,
3044 .translate
= translate_ball
,
3045 .par
= (const uint32_t[]){TCG_COND_NE
},
3046 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3048 .name
= (const char * const[]) {
3049 "bne", "bne.w15", "bne.w18", NULL
,
3051 .translate
= translate_b
,
3052 .par
= (const uint32_t[]){TCG_COND_NE
},
3053 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3055 .name
= (const char * const[]) {
3056 "bnei", "bnei.w15", "bnei.w18", NULL
,
3058 .translate
= translate_bi
,
3059 .par
= (const uint32_t[]){TCG_COND_NE
},
3060 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3062 .name
= (const char * const[]) {
3063 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3065 .translate
= translate_bz
,
3066 .par
= (const uint32_t[]){TCG_COND_NE
},
3067 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3069 .name
= (const char * const[]) {
3070 "bnone", "bnone.w15", "bnone.w18", NULL
,
3072 .translate
= translate_bany
,
3073 .par
= (const uint32_t[]){TCG_COND_EQ
},
3074 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3077 .translate
= translate_nop
,
3078 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3079 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3082 .translate
= translate_nop
,
3083 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3084 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3087 .translate
= translate_bp
,
3088 .par
= (const uint32_t[]){TCG_COND_NE
},
3091 .translate
= translate_call0
,
3094 .translate
= translate_callw
,
3095 .par
= (const uint32_t[]){3},
3098 .translate
= translate_callw
,
3099 .par
= (const uint32_t[]){1},
3102 .translate
= translate_callw
,
3103 .par
= (const uint32_t[]){2},
3106 .translate
= translate_callx0
,
3109 .translate
= translate_callxw
,
3110 .par
= (const uint32_t[]){3},
3113 .translate
= translate_callxw
,
3114 .par
= (const uint32_t[]){1},
3117 .translate
= translate_callxw
,
3118 .par
= (const uint32_t[]){2},
3121 .translate
= translate_clamps
,
3123 .name
= "clrb_expstate",
3124 .translate
= translate_clrb_expstate
,
3127 .translate
= translate_clrex
,
3130 .translate
= translate_const16
,
3133 .translate
= translate_depbits
,
3136 .translate
= translate_dcache
,
3137 .op_flags
= XTENSA_OP_PRIVILEGED
,
3140 .translate
= translate_nop
,
3143 .translate
= translate_dcache
,
3144 .op_flags
= XTENSA_OP_PRIVILEGED
,
3147 .translate
= translate_dcache
,
3150 .translate
= translate_nop
,
3153 .translate
= translate_dcache
,
3156 .translate
= translate_nop
,
3159 .translate
= translate_nop
,
3160 .op_flags
= XTENSA_OP_PRIVILEGED
,
3163 .translate
= translate_nop
,
3164 .op_flags
= XTENSA_OP_PRIVILEGED
,
3167 .translate
= translate_nop
,
3168 .op_flags
= XTENSA_OP_PRIVILEGED
,
3171 .translate
= translate_nop
,
3172 .op_flags
= XTENSA_OP_PRIVILEGED
,
3175 .translate
= translate_diwbuip
,
3176 .op_flags
= XTENSA_OP_PRIVILEGED
,
3179 .translate
= translate_dcache
,
3180 .op_flags
= XTENSA_OP_PRIVILEGED
,
3183 .translate
= translate_nop
,
3186 .translate
= translate_nop
,
3189 .translate
= translate_nop
,
3192 .translate
= translate_nop
,
3195 .translate
= translate_nop
,
3198 .translate
= translate_nop
,
3201 .translate
= translate_nop
,
3204 .translate
= translate_nop
,
3207 .translate
= translate_nop
,
3210 .translate
= translate_nop
,
3213 .translate
= translate_nop
,
3216 .translate
= translate_entry
,
3217 .test_ill
= test_ill_entry
,
3218 .test_overflow
= test_overflow_entry
,
3219 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3220 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3223 .translate
= translate_nop
,
3226 .translate
= translate_nop
,
3229 .translate
= translate_extui
,
3232 .translate
= translate_memw
,
3235 .translate
= translate_getex
,
3238 .op_flags
= XTENSA_OP_ILL
,
3241 .op_flags
= XTENSA_OP_ILL
,
3244 .translate
= translate_itlb
,
3245 .par
= (const uint32_t[]){true},
3246 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3249 .translate
= translate_icache
,
3252 .translate
= translate_icache
,
3253 .op_flags
= XTENSA_OP_PRIVILEGED
,
3256 .translate
= translate_nop
,
3257 .op_flags
= XTENSA_OP_PRIVILEGED
,
3260 .translate
= translate_itlb
,
3261 .par
= (const uint32_t[]){false},
3262 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3265 .translate
= translate_nop
,
3266 .op_flags
= XTENSA_OP_PRIVILEGED
,
3268 .name
= (const char * const[]) {
3269 "ill", "ill.n", NULL
,
3271 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3274 .translate
= translate_nop
,
3277 .translate
= translate_icache
,
3278 .op_flags
= XTENSA_OP_PRIVILEGED
,
3281 .translate
= translate_nop
,
3284 .translate
= translate_j
,
3287 .translate
= translate_jx
,
3290 .translate
= translate_ldst
,
3291 .par
= (const uint32_t[]){MO_TESW
, false, false},
3292 .op_flags
= XTENSA_OP_LOAD
,
3295 .translate
= translate_ldst
,
3296 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3297 .op_flags
= XTENSA_OP_LOAD
,
3300 .translate
= translate_ldst
,
3301 .par
= (const uint32_t[]){MO_TEUL
, true, false},
3302 .op_flags
= XTENSA_OP_LOAD
,
3305 .translate
= translate_l32e
,
3306 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3309 .translate
= translate_l32ex
,
3310 .op_flags
= XTENSA_OP_LOAD
,
3312 .name
= (const char * const[]) {
3313 "l32i", "l32i.n", NULL
,
3315 .translate
= translate_ldst
,
3316 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3317 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3320 .translate
= translate_l32r
,
3321 .op_flags
= XTENSA_OP_LOAD
,
3324 .translate
= translate_ldst
,
3325 .par
= (const uint32_t[]){MO_UB
, false, false},
3326 .op_flags
= XTENSA_OP_LOAD
,
3329 .translate
= translate_mac16
,
3330 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3331 .op_flags
= XTENSA_OP_LOAD
,
3334 .translate
= translate_mac16
,
3335 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3336 .op_flags
= XTENSA_OP_LOAD
,
3339 .op_flags
= XTENSA_OP_ILL
,
3341 .name
= (const char * const[]) {
3342 "loop", "loop.w15", NULL
,
3344 .translate
= translate_loop
,
3345 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3346 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3348 .name
= (const char * const[]) {
3349 "loopgtz", "loopgtz.w15", NULL
,
3351 .translate
= translate_loop
,
3352 .par
= (const uint32_t[]){TCG_COND_GT
},
3353 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3355 .name
= (const char * const[]) {
3356 "loopnez", "loopnez.w15", NULL
,
3358 .translate
= translate_loop
,
3359 .par
= (const uint32_t[]){TCG_COND_NE
},
3360 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3363 .translate
= translate_smax
,
3366 .translate
= translate_umax
,
3369 .translate
= translate_memw
,
3372 .translate
= translate_smin
,
3375 .translate
= translate_umin
,
3377 .name
= (const char * const[]) {
3378 "mov", "mov.n", NULL
,
3380 .translate
= translate_mov
,
3381 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3384 .translate
= translate_movcond
,
3385 .par
= (const uint32_t[]){TCG_COND_EQ
},
3388 .translate
= translate_movp
,
3389 .par
= (const uint32_t[]){TCG_COND_EQ
},
3392 .translate
= translate_movcond
,
3393 .par
= (const uint32_t[]){TCG_COND_GE
},
3396 .translate
= translate_movi
,
3399 .translate
= translate_movi
,
3402 .translate
= translate_movcond
,
3403 .par
= (const uint32_t[]){TCG_COND_LT
},
3406 .translate
= translate_movcond
,
3407 .par
= (const uint32_t[]){TCG_COND_NE
},
3410 .translate
= translate_movsp
,
3411 .op_flags
= XTENSA_OP_ALLOCA
,
3414 .translate
= translate_movp
,
3415 .par
= (const uint32_t[]){TCG_COND_NE
},
3417 .name
= "mul.aa.hh",
3418 .translate
= translate_mac16
,
3419 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3421 .name
= "mul.aa.hl",
3422 .translate
= translate_mac16
,
3423 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3425 .name
= "mul.aa.lh",
3426 .translate
= translate_mac16
,
3427 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3429 .name
= "mul.aa.ll",
3430 .translate
= translate_mac16
,
3431 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3433 .name
= "mul.ad.hh",
3434 .translate
= translate_mac16
,
3435 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3437 .name
= "mul.ad.hl",
3438 .translate
= translate_mac16
,
3439 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3441 .name
= "mul.ad.lh",
3442 .translate
= translate_mac16
,
3443 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3445 .name
= "mul.ad.ll",
3446 .translate
= translate_mac16
,
3447 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3449 .name
= "mul.da.hh",
3450 .translate
= translate_mac16
,
3451 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3453 .name
= "mul.da.hl",
3454 .translate
= translate_mac16
,
3455 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3457 .name
= "mul.da.lh",
3458 .translate
= translate_mac16
,
3459 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3461 .name
= "mul.da.ll",
3462 .translate
= translate_mac16
,
3463 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3465 .name
= "mul.dd.hh",
3466 .translate
= translate_mac16
,
3467 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3469 .name
= "mul.dd.hl",
3470 .translate
= translate_mac16
,
3471 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3473 .name
= "mul.dd.lh",
3474 .translate
= translate_mac16
,
3475 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3477 .name
= "mul.dd.ll",
3478 .translate
= translate_mac16
,
3479 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3482 .translate
= translate_mul16
,
3483 .par
= (const uint32_t[]){true},
3486 .translate
= translate_mul16
,
3487 .par
= (const uint32_t[]){false},
3489 .name
= "mula.aa.hh",
3490 .translate
= translate_mac16
,
3491 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3493 .name
= "mula.aa.hl",
3494 .translate
= translate_mac16
,
3495 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3497 .name
= "mula.aa.lh",
3498 .translate
= translate_mac16
,
3499 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3501 .name
= "mula.aa.ll",
3502 .translate
= translate_mac16
,
3503 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3505 .name
= "mula.ad.hh",
3506 .translate
= translate_mac16
,
3507 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3509 .name
= "mula.ad.hl",
3510 .translate
= translate_mac16
,
3511 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3513 .name
= "mula.ad.lh",
3514 .translate
= translate_mac16
,
3515 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3517 .name
= "mula.ad.ll",
3518 .translate
= translate_mac16
,
3519 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3521 .name
= "mula.da.hh",
3522 .translate
= translate_mac16
,
3523 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3525 .name
= "mula.da.hh.lddec",
3526 .translate
= translate_mac16
,
3527 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3529 .name
= "mula.da.hh.ldinc",
3530 .translate
= translate_mac16
,
3531 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3533 .name
= "mula.da.hl",
3534 .translate
= translate_mac16
,
3535 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3537 .name
= "mula.da.hl.lddec",
3538 .translate
= translate_mac16
,
3539 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3541 .name
= "mula.da.hl.ldinc",
3542 .translate
= translate_mac16
,
3543 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3545 .name
= "mula.da.lh",
3546 .translate
= translate_mac16
,
3547 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3549 .name
= "mula.da.lh.lddec",
3550 .translate
= translate_mac16
,
3551 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3553 .name
= "mula.da.lh.ldinc",
3554 .translate
= translate_mac16
,
3555 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3557 .name
= "mula.da.ll",
3558 .translate
= translate_mac16
,
3559 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3561 .name
= "mula.da.ll.lddec",
3562 .translate
= translate_mac16
,
3563 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3565 .name
= "mula.da.ll.ldinc",
3566 .translate
= translate_mac16
,
3567 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3569 .name
= "mula.dd.hh",
3570 .translate
= translate_mac16
,
3571 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3573 .name
= "mula.dd.hh.lddec",
3574 .translate
= translate_mac16
,
3575 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3577 .name
= "mula.dd.hh.ldinc",
3578 .translate
= translate_mac16
,
3579 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3581 .name
= "mula.dd.hl",
3582 .translate
= translate_mac16
,
3583 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3585 .name
= "mula.dd.hl.lddec",
3586 .translate
= translate_mac16
,
3587 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3589 .name
= "mula.dd.hl.ldinc",
3590 .translate
= translate_mac16
,
3591 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3593 .name
= "mula.dd.lh",
3594 .translate
= translate_mac16
,
3595 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3597 .name
= "mula.dd.lh.lddec",
3598 .translate
= translate_mac16
,
3599 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3601 .name
= "mula.dd.lh.ldinc",
3602 .translate
= translate_mac16
,
3603 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3605 .name
= "mula.dd.ll",
3606 .translate
= translate_mac16
,
3607 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3609 .name
= "mula.dd.ll.lddec",
3610 .translate
= translate_mac16
,
3611 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3613 .name
= "mula.dd.ll.ldinc",
3614 .translate
= translate_mac16
,
3615 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3618 .translate
= translate_mull
,
3620 .name
= "muls.aa.hh",
3621 .translate
= translate_mac16
,
3622 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3624 .name
= "muls.aa.hl",
3625 .translate
= translate_mac16
,
3626 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3628 .name
= "muls.aa.lh",
3629 .translate
= translate_mac16
,
3630 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3632 .name
= "muls.aa.ll",
3633 .translate
= translate_mac16
,
3634 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3636 .name
= "muls.ad.hh",
3637 .translate
= translate_mac16
,
3638 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3640 .name
= "muls.ad.hl",
3641 .translate
= translate_mac16
,
3642 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3644 .name
= "muls.ad.lh",
3645 .translate
= translate_mac16
,
3646 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3648 .name
= "muls.ad.ll",
3649 .translate
= translate_mac16
,
3650 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3652 .name
= "muls.da.hh",
3653 .translate
= translate_mac16
,
3654 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3656 .name
= "muls.da.hl",
3657 .translate
= translate_mac16
,
3658 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3660 .name
= "muls.da.lh",
3661 .translate
= translate_mac16
,
3662 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3664 .name
= "muls.da.ll",
3665 .translate
= translate_mac16
,
3666 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3668 .name
= "muls.dd.hh",
3669 .translate
= translate_mac16
,
3670 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3672 .name
= "muls.dd.hl",
3673 .translate
= translate_mac16
,
3674 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3676 .name
= "muls.dd.lh",
3677 .translate
= translate_mac16
,
3678 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3680 .name
= "muls.dd.ll",
3681 .translate
= translate_mac16
,
3682 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3685 .translate
= translate_mulh
,
3686 .par
= (const uint32_t[]){true},
3689 .translate
= translate_mulh
,
3690 .par
= (const uint32_t[]){false},
3693 .translate
= translate_neg
,
3695 .name
= (const char * const[]) {
3696 "nop", "nop.n", NULL
,
3698 .translate
= translate_nop
,
3699 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3702 .translate
= translate_nsa
,
3705 .translate
= translate_nsau
,
3708 .translate
= translate_or
,
3711 .translate
= translate_boolean
,
3712 .par
= (const uint32_t[]){BOOLEAN_OR
},
3715 .translate
= translate_boolean
,
3716 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3719 .translate
= translate_ptlb
,
3720 .par
= (const uint32_t[]){true},
3721 .op_flags
= XTENSA_OP_PRIVILEGED
,
3724 .translate
= translate_nop
,
3727 .translate
= translate_nop
,
3730 .translate
= translate_nop
,
3733 .translate
= translate_nop
,
3736 .translate
= translate_nop
,
3739 .translate
= translate_ptlb
,
3740 .par
= (const uint32_t[]){false},
3741 .op_flags
= XTENSA_OP_PRIVILEGED
,
3744 .translate
= translate_pptlb
,
3745 .op_flags
= XTENSA_OP_PRIVILEGED
,
3748 .translate
= translate_quos
,
3749 .par
= (const uint32_t[]){true},
3750 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3753 .translate
= translate_quou
,
3754 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3757 .translate
= translate_rtlb
,
3758 .par
= (const uint32_t[]){true, 0},
3759 .op_flags
= XTENSA_OP_PRIVILEGED
,
3762 .translate
= translate_rtlb
,
3763 .par
= (const uint32_t[]){true, 1},
3764 .op_flags
= XTENSA_OP_PRIVILEGED
,
3766 .name
= "read_impwire",
3767 .translate
= translate_read_impwire
,
3770 .translate
= translate_quos
,
3771 .par
= (const uint32_t[]){false},
3772 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3775 .translate
= translate_remu
,
3776 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3779 .translate
= translate_rer
,
3780 .op_flags
= XTENSA_OP_PRIVILEGED
,
3782 .name
= (const char * const[]) {
3783 "ret", "ret.n", NULL
,
3785 .translate
= translate_ret
,
3786 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3788 .name
= (const char * const[]) {
3789 "retw", "retw.n", NULL
,
3791 .translate
= translate_retw
,
3792 .test_ill
= test_ill_retw
,
3793 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3796 .op_flags
= XTENSA_OP_ILL
,
3799 .translate
= translate_rfde
,
3800 .op_flags
= XTENSA_OP_PRIVILEGED
,
3803 .op_flags
= XTENSA_OP_ILL
,
3806 .translate
= translate_rfe
,
3807 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3810 .translate
= translate_rfi
,
3811 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3814 .translate
= translate_rfw
,
3815 .par
= (const uint32_t[]){true},
3816 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3819 .translate
= translate_rfw
,
3820 .par
= (const uint32_t[]){false},
3821 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3824 .translate
= translate_rtlb
,
3825 .par
= (const uint32_t[]){false, 0},
3826 .op_flags
= XTENSA_OP_PRIVILEGED
,
3829 .translate
= translate_rtlb
,
3830 .par
= (const uint32_t[]){false, 1},
3831 .op_flags
= XTENSA_OP_PRIVILEGED
,
3834 .translate
= translate_rptlb0
,
3835 .op_flags
= XTENSA_OP_PRIVILEGED
,
3838 .translate
= translate_rptlb1
,
3839 .op_flags
= XTENSA_OP_PRIVILEGED
,
3842 .translate
= translate_rotw
,
3843 .op_flags
= XTENSA_OP_PRIVILEGED
|
3844 XTENSA_OP_EXIT_TB_M1
|
3845 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3848 .translate
= translate_rsil
,
3850 XTENSA_OP_PRIVILEGED
|
3851 XTENSA_OP_EXIT_TB_0
|
3852 XTENSA_OP_CHECK_INTERRUPTS
,
3855 .translate
= translate_rsr
,
3856 .par
= (const uint32_t[]){176},
3857 .op_flags
= XTENSA_OP_PRIVILEGED
,
3860 .translate
= translate_rsr
,
3861 .par
= (const uint32_t[]){208},
3862 .op_flags
= XTENSA_OP_PRIVILEGED
,
3864 .name
= "rsr.acchi",
3865 .translate
= translate_rsr
,
3866 .test_ill
= test_ill_sr
,
3867 .par
= (const uint32_t[]){
3869 XTENSA_OPTION_MAC16
,
3872 .name
= "rsr.acclo",
3873 .translate
= translate_rsr
,
3874 .test_ill
= test_ill_sr
,
3875 .par
= (const uint32_t[]){
3877 XTENSA_OPTION_MAC16
,
3880 .name
= "rsr.atomctl",
3881 .translate
= translate_rsr
,
3882 .test_ill
= test_ill_sr
,
3883 .par
= (const uint32_t[]){
3885 XTENSA_OPTION_ATOMCTL
,
3887 .op_flags
= XTENSA_OP_PRIVILEGED
,
3890 .translate
= translate_rsr
,
3891 .test_ill
= test_ill_sr
,
3892 .par
= (const uint32_t[]){
3894 XTENSA_OPTION_BOOLEAN
,
3897 .name
= "rsr.cacheadrdis",
3898 .translate
= translate_rsr
,
3899 .test_ill
= test_ill_sr
,
3900 .par
= (const uint32_t[]){
3904 .op_flags
= XTENSA_OP_PRIVILEGED
,
3906 .name
= "rsr.cacheattr",
3907 .translate
= translate_rsr
,
3908 .test_ill
= test_ill_sr
,
3909 .par
= (const uint32_t[]){
3911 XTENSA_OPTION_CACHEATTR
,
3913 .op_flags
= XTENSA_OP_PRIVILEGED
,
3915 .name
= "rsr.ccompare0",
3916 .translate
= translate_rsr
,
3917 .test_ill
= test_ill_ccompare
,
3918 .par
= (const uint32_t[]){
3920 XTENSA_OPTION_TIMER_INTERRUPT
,
3922 .op_flags
= XTENSA_OP_PRIVILEGED
,
3924 .name
= "rsr.ccompare1",
3925 .translate
= translate_rsr
,
3926 .test_ill
= test_ill_ccompare
,
3927 .par
= (const uint32_t[]){
3929 XTENSA_OPTION_TIMER_INTERRUPT
,
3931 .op_flags
= XTENSA_OP_PRIVILEGED
,
3933 .name
= "rsr.ccompare2",
3934 .translate
= translate_rsr
,
3935 .test_ill
= test_ill_ccompare
,
3936 .par
= (const uint32_t[]){
3938 XTENSA_OPTION_TIMER_INTERRUPT
,
3940 .op_flags
= XTENSA_OP_PRIVILEGED
,
3942 .name
= "rsr.ccount",
3943 .translate
= translate_rsr_ccount
,
3944 .test_ill
= test_ill_sr
,
3945 .par
= (const uint32_t[]){
3947 XTENSA_OPTION_TIMER_INTERRUPT
,
3949 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3951 .name
= "rsr.configid0",
3952 .translate
= translate_rsr
,
3953 .par
= (const uint32_t[]){CONFIGID0
},
3954 .op_flags
= XTENSA_OP_PRIVILEGED
,
3956 .name
= "rsr.configid1",
3957 .translate
= translate_rsr
,
3958 .par
= (const uint32_t[]){CONFIGID1
},
3959 .op_flags
= XTENSA_OP_PRIVILEGED
,
3961 .name
= "rsr.cpenable",
3962 .translate
= translate_rsr
,
3963 .test_ill
= test_ill_sr
,
3964 .par
= (const uint32_t[]){
3966 XTENSA_OPTION_COPROCESSOR
,
3968 .op_flags
= XTENSA_OP_PRIVILEGED
,
3970 .name
= "rsr.dbreaka0",
3971 .translate
= translate_rsr
,
3972 .test_ill
= test_ill_dbreak
,
3973 .par
= (const uint32_t[]){
3975 XTENSA_OPTION_DEBUG
,
3977 .op_flags
= XTENSA_OP_PRIVILEGED
,
3979 .name
= "rsr.dbreaka1",
3980 .translate
= translate_rsr
,
3981 .test_ill
= test_ill_dbreak
,
3982 .par
= (const uint32_t[]){
3984 XTENSA_OPTION_DEBUG
,
3986 .op_flags
= XTENSA_OP_PRIVILEGED
,
3988 .name
= "rsr.dbreakc0",
3989 .translate
= translate_rsr
,
3990 .test_ill
= test_ill_dbreak
,
3991 .par
= (const uint32_t[]){
3993 XTENSA_OPTION_DEBUG
,
3995 .op_flags
= XTENSA_OP_PRIVILEGED
,
3997 .name
= "rsr.dbreakc1",
3998 .translate
= translate_rsr
,
3999 .test_ill
= test_ill_dbreak
,
4000 .par
= (const uint32_t[]){
4002 XTENSA_OPTION_DEBUG
,
4004 .op_flags
= XTENSA_OP_PRIVILEGED
,
4007 .translate
= translate_rsr
,
4008 .test_ill
= test_ill_sr
,
4009 .par
= (const uint32_t[]){
4011 XTENSA_OPTION_DEBUG
,
4013 .op_flags
= XTENSA_OP_PRIVILEGED
,
4015 .name
= "rsr.debugcause",
4016 .translate
= translate_rsr
,
4017 .test_ill
= test_ill_sr
,
4018 .par
= (const uint32_t[]){
4020 XTENSA_OPTION_DEBUG
,
4022 .op_flags
= XTENSA_OP_PRIVILEGED
,
4025 .translate
= translate_rsr
,
4026 .test_ill
= test_ill_sr
,
4027 .par
= (const uint32_t[]){
4029 XTENSA_OPTION_EXCEPTION
,
4031 .op_flags
= XTENSA_OP_PRIVILEGED
,
4033 .name
= "rsr.dtlbcfg",
4034 .translate
= translate_rsr
,
4035 .test_ill
= test_ill_sr
,
4036 .par
= (const uint32_t[]){
4040 .op_flags
= XTENSA_OP_PRIVILEGED
,
4043 .translate
= translate_rsr
,
4044 .test_ill
= test_ill_sr
,
4045 .par
= (const uint32_t[]){
4047 XTENSA_OPTION_EXCEPTION
,
4049 .op_flags
= XTENSA_OP_PRIVILEGED
,
4052 .translate
= translate_rsr
,
4053 .test_ill
= test_ill_hpi
,
4054 .par
= (const uint32_t[]){
4056 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4058 .op_flags
= XTENSA_OP_PRIVILEGED
,
4061 .translate
= translate_rsr
,
4062 .test_ill
= test_ill_hpi
,
4063 .par
= (const uint32_t[]){
4065 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4067 .op_flags
= XTENSA_OP_PRIVILEGED
,
4070 .translate
= translate_rsr
,
4071 .test_ill
= test_ill_hpi
,
4072 .par
= (const uint32_t[]){
4074 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4076 .op_flags
= XTENSA_OP_PRIVILEGED
,
4079 .translate
= translate_rsr
,
4080 .test_ill
= test_ill_hpi
,
4081 .par
= (const uint32_t[]){
4083 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4085 .op_flags
= XTENSA_OP_PRIVILEGED
,
4088 .translate
= translate_rsr
,
4089 .test_ill
= test_ill_hpi
,
4090 .par
= (const uint32_t[]){
4092 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4094 .op_flags
= XTENSA_OP_PRIVILEGED
,
4097 .translate
= translate_rsr
,
4098 .test_ill
= test_ill_hpi
,
4099 .par
= (const uint32_t[]){
4101 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4103 .op_flags
= XTENSA_OP_PRIVILEGED
,
4106 .translate
= translate_rsr
,
4107 .test_ill
= test_ill_hpi
,
4108 .par
= (const uint32_t[]){
4110 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4112 .op_flags
= XTENSA_OP_PRIVILEGED
,
4115 .translate
= translate_rsr
,
4116 .test_ill
= test_ill_hpi
,
4117 .par
= (const uint32_t[]){
4119 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4121 .op_flags
= XTENSA_OP_PRIVILEGED
,
4124 .translate
= translate_rsr
,
4125 .test_ill
= test_ill_hpi
,
4126 .par
= (const uint32_t[]){
4128 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4130 .op_flags
= XTENSA_OP_PRIVILEGED
,
4133 .translate
= translate_rsr
,
4134 .test_ill
= test_ill_hpi
,
4135 .par
= (const uint32_t[]){
4137 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4139 .op_flags
= XTENSA_OP_PRIVILEGED
,
4142 .translate
= translate_rsr
,
4143 .test_ill
= test_ill_hpi
,
4144 .par
= (const uint32_t[]){
4146 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4148 .op_flags
= XTENSA_OP_PRIVILEGED
,
4151 .translate
= translate_rsr
,
4152 .test_ill
= test_ill_hpi
,
4153 .par
= (const uint32_t[]){
4155 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4157 .op_flags
= XTENSA_OP_PRIVILEGED
,
4159 .name
= "rsr.eraccess",
4160 .translate
= translate_rsr
,
4161 .par
= (const uint32_t[]){ERACCESS
},
4162 .op_flags
= XTENSA_OP_PRIVILEGED
,
4164 .name
= "rsr.exccause",
4165 .translate
= translate_rsr
,
4166 .test_ill
= test_ill_sr
,
4167 .par
= (const uint32_t[]){
4169 XTENSA_OPTION_EXCEPTION
,
4171 .op_flags
= XTENSA_OP_PRIVILEGED
,
4173 .name
= "rsr.excsave1",
4174 .translate
= translate_rsr
,
4175 .test_ill
= test_ill_sr
,
4176 .par
= (const uint32_t[]){
4178 XTENSA_OPTION_EXCEPTION
,
4180 .op_flags
= XTENSA_OP_PRIVILEGED
,
4182 .name
= "rsr.excsave2",
4183 .translate
= translate_rsr
,
4184 .test_ill
= test_ill_hpi
,
4185 .par
= (const uint32_t[]){
4187 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4189 .op_flags
= XTENSA_OP_PRIVILEGED
,
4191 .name
= "rsr.excsave3",
4192 .translate
= translate_rsr
,
4193 .test_ill
= test_ill_hpi
,
4194 .par
= (const uint32_t[]){
4196 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4198 .op_flags
= XTENSA_OP_PRIVILEGED
,
4200 .name
= "rsr.excsave4",
4201 .translate
= translate_rsr
,
4202 .test_ill
= test_ill_hpi
,
4203 .par
= (const uint32_t[]){
4205 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4207 .op_flags
= XTENSA_OP_PRIVILEGED
,
4209 .name
= "rsr.excsave5",
4210 .translate
= translate_rsr
,
4211 .test_ill
= test_ill_hpi
,
4212 .par
= (const uint32_t[]){
4214 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4216 .op_flags
= XTENSA_OP_PRIVILEGED
,
4218 .name
= "rsr.excsave6",
4219 .translate
= translate_rsr
,
4220 .test_ill
= test_ill_hpi
,
4221 .par
= (const uint32_t[]){
4223 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4225 .op_flags
= XTENSA_OP_PRIVILEGED
,
4227 .name
= "rsr.excsave7",
4228 .translate
= translate_rsr
,
4229 .test_ill
= test_ill_hpi
,
4230 .par
= (const uint32_t[]){
4232 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4234 .op_flags
= XTENSA_OP_PRIVILEGED
,
4236 .name
= "rsr.excvaddr",
4237 .translate
= translate_rsr
,
4238 .test_ill
= test_ill_sr
,
4239 .par
= (const uint32_t[]){
4241 XTENSA_OPTION_EXCEPTION
,
4243 .op_flags
= XTENSA_OP_PRIVILEGED
,
4245 .name
= "rsr.ibreaka0",
4246 .translate
= translate_rsr
,
4247 .test_ill
= test_ill_ibreak
,
4248 .par
= (const uint32_t[]){
4250 XTENSA_OPTION_DEBUG
,
4252 .op_flags
= XTENSA_OP_PRIVILEGED
,
4254 .name
= "rsr.ibreaka1",
4255 .translate
= translate_rsr
,
4256 .test_ill
= test_ill_ibreak
,
4257 .par
= (const uint32_t[]){
4259 XTENSA_OPTION_DEBUG
,
4261 .op_flags
= XTENSA_OP_PRIVILEGED
,
4263 .name
= "rsr.ibreakenable",
4264 .translate
= translate_rsr
,
4265 .test_ill
= test_ill_sr
,
4266 .par
= (const uint32_t[]){
4268 XTENSA_OPTION_DEBUG
,
4270 .op_flags
= XTENSA_OP_PRIVILEGED
,
4272 .name
= "rsr.icount",
4273 .translate
= translate_rsr
,
4274 .test_ill
= test_ill_sr
,
4275 .par
= (const uint32_t[]){
4277 XTENSA_OPTION_DEBUG
,
4279 .op_flags
= XTENSA_OP_PRIVILEGED
,
4281 .name
= "rsr.icountlevel",
4282 .translate
= translate_rsr
,
4283 .test_ill
= test_ill_sr
,
4284 .par
= (const uint32_t[]){
4286 XTENSA_OPTION_DEBUG
,
4288 .op_flags
= XTENSA_OP_PRIVILEGED
,
4290 .name
= "rsr.intclear",
4291 .translate
= translate_rsr
,
4292 .test_ill
= test_ill_sr
,
4293 .par
= (const uint32_t[]){
4295 XTENSA_OPTION_INTERRUPT
,
4297 .op_flags
= XTENSA_OP_PRIVILEGED
,
4299 .name
= "rsr.intenable",
4300 .translate
= translate_rsr
,
4301 .test_ill
= test_ill_sr
,
4302 .par
= (const uint32_t[]){
4304 XTENSA_OPTION_INTERRUPT
,
4306 .op_flags
= XTENSA_OP_PRIVILEGED
,
4308 .name
= "rsr.interrupt",
4309 .translate
= translate_rsr_ccount
,
4310 .test_ill
= test_ill_sr
,
4311 .par
= (const uint32_t[]){
4313 XTENSA_OPTION_INTERRUPT
,
4315 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4317 .name
= "rsr.intset",
4318 .translate
= translate_rsr_ccount
,
4319 .test_ill
= test_ill_sr
,
4320 .par
= (const uint32_t[]){
4322 XTENSA_OPTION_INTERRUPT
,
4324 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4326 .name
= "rsr.itlbcfg",
4327 .translate
= translate_rsr
,
4328 .test_ill
= test_ill_sr
,
4329 .par
= (const uint32_t[]){
4333 .op_flags
= XTENSA_OP_PRIVILEGED
,
4336 .translate
= translate_rsr
,
4337 .test_ill
= test_ill_sr
,
4338 .par
= (const uint32_t[]){
4343 .name
= "rsr.lcount",
4344 .translate
= translate_rsr
,
4345 .test_ill
= test_ill_sr
,
4346 .par
= (const uint32_t[]){
4352 .translate
= translate_rsr
,
4353 .test_ill
= test_ill_sr
,
4354 .par
= (const uint32_t[]){
4359 .name
= "rsr.litbase",
4360 .translate
= translate_rsr
,
4361 .test_ill
= test_ill_sr
,
4362 .par
= (const uint32_t[]){
4364 XTENSA_OPTION_EXTENDED_L32R
,
4368 .translate
= translate_rsr
,
4369 .test_ill
= test_ill_sr
,
4370 .par
= (const uint32_t[]){
4372 XTENSA_OPTION_MAC16
,
4376 .translate
= translate_rsr
,
4377 .test_ill
= test_ill_sr
,
4378 .par
= (const uint32_t[]){
4380 XTENSA_OPTION_MAC16
,
4384 .translate
= translate_rsr
,
4385 .test_ill
= test_ill_sr
,
4386 .par
= (const uint32_t[]){
4388 XTENSA_OPTION_MAC16
,
4392 .translate
= translate_rsr
,
4393 .test_ill
= test_ill_sr
,
4394 .par
= (const uint32_t[]){
4396 XTENSA_OPTION_MAC16
,
4399 .name
= "rsr.memctl",
4400 .translate
= translate_rsr
,
4401 .par
= (const uint32_t[]){MEMCTL
},
4402 .op_flags
= XTENSA_OP_PRIVILEGED
,
4405 .translate
= translate_rsr
,
4406 .test_ill
= test_ill_sr
,
4407 .par
= (const uint32_t[]){
4409 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4411 .op_flags
= XTENSA_OP_PRIVILEGED
,
4414 .translate
= translate_rsr
,
4415 .test_ill
= test_ill_sr
,
4416 .par
= (const uint32_t[]){
4418 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4420 .op_flags
= XTENSA_OP_PRIVILEGED
,
4423 .translate
= translate_rsr
,
4424 .test_ill
= test_ill_sr
,
4425 .par
= (const uint32_t[]){
4427 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4429 .op_flags
= XTENSA_OP_PRIVILEGED
,
4431 .name
= "rsr.mesave",
4432 .translate
= translate_rsr
,
4433 .test_ill
= test_ill_sr
,
4434 .par
= (const uint32_t[]){
4436 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4438 .op_flags
= XTENSA_OP_PRIVILEGED
,
4441 .translate
= translate_rsr
,
4442 .test_ill
= test_ill_sr
,
4443 .par
= (const uint32_t[]){
4445 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4447 .op_flags
= XTENSA_OP_PRIVILEGED
,
4449 .name
= "rsr.mevaddr",
4450 .translate
= translate_rsr
,
4451 .test_ill
= test_ill_sr
,
4452 .par
= (const uint32_t[]){
4454 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4456 .op_flags
= XTENSA_OP_PRIVILEGED
,
4458 .name
= "rsr.misc0",
4459 .translate
= translate_rsr
,
4460 .test_ill
= test_ill_sr
,
4461 .par
= (const uint32_t[]){
4463 XTENSA_OPTION_MISC_SR
,
4465 .op_flags
= XTENSA_OP_PRIVILEGED
,
4467 .name
= "rsr.misc1",
4468 .translate
= translate_rsr
,
4469 .test_ill
= test_ill_sr
,
4470 .par
= (const uint32_t[]){
4472 XTENSA_OPTION_MISC_SR
,
4474 .op_flags
= XTENSA_OP_PRIVILEGED
,
4476 .name
= "rsr.misc2",
4477 .translate
= translate_rsr
,
4478 .test_ill
= test_ill_sr
,
4479 .par
= (const uint32_t[]){
4481 XTENSA_OPTION_MISC_SR
,
4483 .op_flags
= XTENSA_OP_PRIVILEGED
,
4485 .name
= "rsr.misc3",
4486 .translate
= translate_rsr
,
4487 .test_ill
= test_ill_sr
,
4488 .par
= (const uint32_t[]){
4490 XTENSA_OPTION_MISC_SR
,
4492 .op_flags
= XTENSA_OP_PRIVILEGED
,
4494 .name
= "rsr.mpucfg",
4495 .translate
= translate_rsr
,
4496 .test_ill
= test_ill_sr
,
4497 .par
= (const uint32_t[]){
4501 .op_flags
= XTENSA_OP_PRIVILEGED
,
4503 .name
= "rsr.mpuenb",
4504 .translate
= translate_rsr
,
4505 .test_ill
= test_ill_sr
,
4506 .par
= (const uint32_t[]){
4510 .op_flags
= XTENSA_OP_PRIVILEGED
,
4512 .name
= "rsr.prefctl",
4513 .translate
= translate_rsr
,
4514 .par
= (const uint32_t[]){PREFCTL
},
4517 .translate
= translate_rsr
,
4518 .test_ill
= test_ill_sr
,
4519 .par
= (const uint32_t[]){
4521 XTENSA_OPTION_PROCESSOR_ID
,
4523 .op_flags
= XTENSA_OP_PRIVILEGED
,
4526 .translate
= translate_rsr
,
4527 .test_ill
= test_ill_sr
,
4528 .par
= (const uint32_t[]){
4530 XTENSA_OPTION_EXCEPTION
,
4532 .op_flags
= XTENSA_OP_PRIVILEGED
,
4534 .name
= "rsr.ptevaddr",
4535 .translate
= translate_rsr_ptevaddr
,
4536 .test_ill
= test_ill_sr
,
4537 .par
= (const uint32_t[]){
4541 .op_flags
= XTENSA_OP_PRIVILEGED
,
4543 .name
= "rsr.rasid",
4544 .translate
= translate_rsr
,
4545 .test_ill
= test_ill_sr
,
4546 .par
= (const uint32_t[]){
4550 .op_flags
= XTENSA_OP_PRIVILEGED
,
4553 .translate
= translate_rsr
,
4554 .par
= (const uint32_t[]){SAR
},
4556 .name
= "rsr.scompare1",
4557 .translate
= translate_rsr
,
4558 .test_ill
= test_ill_sr
,
4559 .par
= (const uint32_t[]){
4561 XTENSA_OPTION_CONDITIONAL_STORE
,
4564 .name
= "rsr.vecbase",
4565 .translate
= translate_rsr
,
4566 .test_ill
= test_ill_sr
,
4567 .par
= (const uint32_t[]){
4569 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4571 .op_flags
= XTENSA_OP_PRIVILEGED
,
4573 .name
= "rsr.windowbase",
4574 .translate
= translate_rsr
,
4575 .test_ill
= test_ill_sr
,
4576 .par
= (const uint32_t[]){
4578 XTENSA_OPTION_WINDOWED_REGISTER
,
4580 .op_flags
= XTENSA_OP_PRIVILEGED
,
4582 .name
= "rsr.windowstart",
4583 .translate
= translate_rsr
,
4584 .test_ill
= test_ill_sr
,
4585 .par
= (const uint32_t[]){
4587 XTENSA_OPTION_WINDOWED_REGISTER
,
4589 .op_flags
= XTENSA_OP_PRIVILEGED
,
4592 .translate
= translate_nop
,
4594 .name
= "rur.expstate",
4595 .translate
= translate_rur
,
4596 .par
= (const uint32_t[]){EXPSTATE
},
4599 .translate
= translate_rur
,
4600 .par
= (const uint32_t[]){FCR
},
4604 .translate
= translate_rur
,
4605 .par
= (const uint32_t[]){FSR
},
4608 .name
= "rur.threadptr",
4609 .translate
= translate_rur
,
4610 .par
= (const uint32_t[]){THREADPTR
},
4613 .translate
= translate_ldst
,
4614 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4615 .op_flags
= XTENSA_OP_STORE
,
4618 .translate
= translate_s32c1i
,
4619 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4622 .translate
= translate_s32e
,
4623 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4626 .translate
= translate_s32ex
,
4627 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4629 .name
= (const char * const[]) {
4630 "s32i", "s32i.n", "s32nb", NULL
,
4632 .translate
= translate_ldst
,
4633 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4634 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4637 .translate
= translate_ldst
,
4638 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4639 .op_flags
= XTENSA_OP_STORE
,
4642 .translate
= translate_ldst
,
4643 .par
= (const uint32_t[]){MO_UB
, false, true},
4644 .op_flags
= XTENSA_OP_STORE
,
4647 .translate
= translate_salt
,
4648 .par
= (const uint32_t[]){TCG_COND_LT
},
4651 .translate
= translate_salt
,
4652 .par
= (const uint32_t[]){TCG_COND_LTU
},
4654 .name
= "setb_expstate",
4655 .translate
= translate_setb_expstate
,
4658 .translate
= translate_sext
,
4661 .translate
= translate_simcall
,
4662 .test_ill
= test_ill_simcall
,
4663 .op_flags
= XTENSA_OP_PRIVILEGED
,
4666 .translate
= translate_sll
,
4669 .translate
= translate_slli
,
4672 .translate
= translate_sra
,
4675 .translate
= translate_srai
,
4678 .translate
= translate_src
,
4681 .translate
= translate_srl
,
4684 .translate
= translate_srli
,
4687 .translate
= translate_ssa8b
,
4690 .translate
= translate_ssa8l
,
4693 .translate
= translate_ssai
,
4696 .translate
= translate_ssl
,
4699 .translate
= translate_ssr
,
4702 .translate
= translate_sub
,
4705 .translate
= translate_subx
,
4706 .par
= (const uint32_t[]){1},
4709 .translate
= translate_subx
,
4710 .par
= (const uint32_t[]){2},
4713 .translate
= translate_subx
,
4714 .par
= (const uint32_t[]){3},
4717 .op_flags
= XTENSA_OP_SYSCALL
,
4719 .name
= "umul.aa.hh",
4720 .translate
= translate_mac16
,
4721 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4723 .name
= "umul.aa.hl",
4724 .translate
= translate_mac16
,
4725 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4727 .name
= "umul.aa.lh",
4728 .translate
= translate_mac16
,
4729 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4731 .name
= "umul.aa.ll",
4732 .translate
= translate_mac16
,
4733 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4736 .translate
= translate_waiti
,
4737 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4740 .translate
= translate_wtlb
,
4741 .par
= (const uint32_t[]){true},
4742 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4745 .translate
= translate_wer
,
4746 .op_flags
= XTENSA_OP_PRIVILEGED
,
4749 .translate
= translate_wtlb
,
4750 .par
= (const uint32_t[]){false},
4751 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4754 .translate
= translate_wptlb
,
4755 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4757 .name
= "wrmsk_expstate",
4758 .translate
= translate_wrmsk_expstate
,
4761 .op_flags
= XTENSA_OP_ILL
,
4764 .op_flags
= XTENSA_OP_ILL
,
4766 .name
= "wsr.acchi",
4767 .translate
= translate_wsr_acchi
,
4768 .test_ill
= test_ill_sr
,
4769 .par
= (const uint32_t[]){
4771 XTENSA_OPTION_MAC16
,
4774 .name
= "wsr.acclo",
4775 .translate
= translate_wsr
,
4776 .test_ill
= test_ill_sr
,
4777 .par
= (const uint32_t[]){
4779 XTENSA_OPTION_MAC16
,
4782 .name
= "wsr.atomctl",
4783 .translate
= translate_wsr_mask
,
4784 .test_ill
= test_ill_sr
,
4785 .par
= (const uint32_t[]){
4787 XTENSA_OPTION_ATOMCTL
,
4790 .op_flags
= XTENSA_OP_PRIVILEGED
,
4793 .translate
= translate_wsr_mask
,
4794 .test_ill
= test_ill_sr
,
4795 .par
= (const uint32_t[]){
4797 XTENSA_OPTION_BOOLEAN
,
4801 .name
= "wsr.cacheadrdis",
4802 .translate
= translate_wsr_mask
,
4803 .test_ill
= test_ill_sr
,
4804 .par
= (const uint32_t[]){
4809 .op_flags
= XTENSA_OP_PRIVILEGED
,
4811 .name
= "wsr.cacheattr",
4812 .translate
= translate_wsr
,
4813 .test_ill
= test_ill_sr
,
4814 .par
= (const uint32_t[]){
4816 XTENSA_OPTION_CACHEATTR
,
4818 .op_flags
= XTENSA_OP_PRIVILEGED
,
4820 .name
= "wsr.ccompare0",
4821 .translate
= translate_wsr_ccompare
,
4822 .test_ill
= test_ill_ccompare
,
4823 .par
= (const uint32_t[]){
4825 XTENSA_OPTION_TIMER_INTERRUPT
,
4827 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4829 .name
= "wsr.ccompare1",
4830 .translate
= translate_wsr_ccompare
,
4831 .test_ill
= test_ill_ccompare
,
4832 .par
= (const uint32_t[]){
4834 XTENSA_OPTION_TIMER_INTERRUPT
,
4836 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4838 .name
= "wsr.ccompare2",
4839 .translate
= translate_wsr_ccompare
,
4840 .test_ill
= test_ill_ccompare
,
4841 .par
= (const uint32_t[]){
4843 XTENSA_OPTION_TIMER_INTERRUPT
,
4845 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4847 .name
= "wsr.ccount",
4848 .translate
= translate_wsr_ccount
,
4849 .test_ill
= test_ill_sr
,
4850 .par
= (const uint32_t[]){
4852 XTENSA_OPTION_TIMER_INTERRUPT
,
4854 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4856 .name
= "wsr.configid0",
4857 .op_flags
= XTENSA_OP_ILL
,
4859 .name
= "wsr.configid1",
4860 .op_flags
= XTENSA_OP_ILL
,
4862 .name
= "wsr.cpenable",
4863 .translate
= translate_wsr_mask
,
4864 .test_ill
= test_ill_sr
,
4865 .par
= (const uint32_t[]){
4867 XTENSA_OPTION_COPROCESSOR
,
4870 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4872 .name
= "wsr.dbreaka0",
4873 .translate
= translate_wsr_dbreaka
,
4874 .test_ill
= test_ill_dbreak
,
4875 .par
= (const uint32_t[]){
4877 XTENSA_OPTION_DEBUG
,
4879 .op_flags
= XTENSA_OP_PRIVILEGED
,
4881 .name
= "wsr.dbreaka1",
4882 .translate
= translate_wsr_dbreaka
,
4883 .test_ill
= test_ill_dbreak
,
4884 .par
= (const uint32_t[]){
4886 XTENSA_OPTION_DEBUG
,
4888 .op_flags
= XTENSA_OP_PRIVILEGED
,
4890 .name
= "wsr.dbreakc0",
4891 .translate
= translate_wsr_dbreakc
,
4892 .test_ill
= test_ill_dbreak
,
4893 .par
= (const uint32_t[]){
4895 XTENSA_OPTION_DEBUG
,
4897 .op_flags
= XTENSA_OP_PRIVILEGED
,
4899 .name
= "wsr.dbreakc1",
4900 .translate
= translate_wsr_dbreakc
,
4901 .test_ill
= test_ill_dbreak
,
4902 .par
= (const uint32_t[]){
4904 XTENSA_OPTION_DEBUG
,
4906 .op_flags
= XTENSA_OP_PRIVILEGED
,
4909 .translate
= translate_wsr
,
4910 .test_ill
= test_ill_sr
,
4911 .par
= (const uint32_t[]){
4913 XTENSA_OPTION_DEBUG
,
4915 .op_flags
= XTENSA_OP_PRIVILEGED
,
4917 .name
= "wsr.debugcause",
4918 .op_flags
= XTENSA_OP_ILL
,
4921 .translate
= translate_wsr
,
4922 .test_ill
= test_ill_sr
,
4923 .par
= (const uint32_t[]){
4925 XTENSA_OPTION_EXCEPTION
,
4927 .op_flags
= XTENSA_OP_PRIVILEGED
,
4929 .name
= "wsr.dtlbcfg",
4930 .translate
= translate_wsr_mask
,
4931 .test_ill
= test_ill_sr
,
4932 .par
= (const uint32_t[]){
4937 .op_flags
= XTENSA_OP_PRIVILEGED
,
4940 .translate
= translate_wsr
,
4941 .test_ill
= test_ill_sr
,
4942 .par
= (const uint32_t[]){
4944 XTENSA_OPTION_EXCEPTION
,
4946 .op_flags
= XTENSA_OP_PRIVILEGED
,
4949 .translate
= translate_wsr
,
4950 .test_ill
= test_ill_hpi
,
4951 .par
= (const uint32_t[]){
4953 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4955 .op_flags
= XTENSA_OP_PRIVILEGED
,
4958 .translate
= translate_wsr
,
4959 .test_ill
= test_ill_hpi
,
4960 .par
= (const uint32_t[]){
4962 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4964 .op_flags
= XTENSA_OP_PRIVILEGED
,
4967 .translate
= translate_wsr
,
4968 .test_ill
= test_ill_hpi
,
4969 .par
= (const uint32_t[]){
4971 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4973 .op_flags
= XTENSA_OP_PRIVILEGED
,
4976 .translate
= translate_wsr
,
4977 .test_ill
= test_ill_hpi
,
4978 .par
= (const uint32_t[]){
4980 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4982 .op_flags
= XTENSA_OP_PRIVILEGED
,
4985 .translate
= translate_wsr
,
4986 .test_ill
= test_ill_hpi
,
4987 .par
= (const uint32_t[]){
4989 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4991 .op_flags
= XTENSA_OP_PRIVILEGED
,
4994 .translate
= translate_wsr
,
4995 .test_ill
= test_ill_hpi
,
4996 .par
= (const uint32_t[]){
4998 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5000 .op_flags
= XTENSA_OP_PRIVILEGED
,
5003 .translate
= translate_wsr
,
5004 .test_ill
= test_ill_hpi
,
5005 .par
= (const uint32_t[]){
5007 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5009 .op_flags
= XTENSA_OP_PRIVILEGED
,
5012 .translate
= translate_wsr
,
5013 .test_ill
= test_ill_hpi
,
5014 .par
= (const uint32_t[]){
5016 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5018 .op_flags
= XTENSA_OP_PRIVILEGED
,
5021 .translate
= translate_wsr
,
5022 .test_ill
= test_ill_hpi
,
5023 .par
= (const uint32_t[]){
5025 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5027 .op_flags
= XTENSA_OP_PRIVILEGED
,
5030 .translate
= translate_wsr
,
5031 .test_ill
= test_ill_hpi
,
5032 .par
= (const uint32_t[]){
5034 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5036 .op_flags
= XTENSA_OP_PRIVILEGED
,
5039 .translate
= translate_wsr
,
5040 .test_ill
= test_ill_hpi
,
5041 .par
= (const uint32_t[]){
5043 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5045 .op_flags
= XTENSA_OP_PRIVILEGED
,
5048 .translate
= translate_wsr
,
5049 .test_ill
= test_ill_hpi
,
5050 .par
= (const uint32_t[]){
5052 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5054 .op_flags
= XTENSA_OP_PRIVILEGED
,
5056 .name
= "wsr.eraccess",
5057 .translate
= translate_wsr_mask
,
5058 .par
= (const uint32_t[]){
5063 .op_flags
= XTENSA_OP_PRIVILEGED
,
5065 .name
= "wsr.exccause",
5066 .translate
= translate_wsr
,
5067 .test_ill
= test_ill_sr
,
5068 .par
= (const uint32_t[]){
5070 XTENSA_OPTION_EXCEPTION
,
5072 .op_flags
= XTENSA_OP_PRIVILEGED
,
5074 .name
= "wsr.excsave1",
5075 .translate
= translate_wsr
,
5076 .test_ill
= test_ill_sr
,
5077 .par
= (const uint32_t[]){
5079 XTENSA_OPTION_EXCEPTION
,
5081 .op_flags
= XTENSA_OP_PRIVILEGED
,
5083 .name
= "wsr.excsave2",
5084 .translate
= translate_wsr
,
5085 .test_ill
= test_ill_hpi
,
5086 .par
= (const uint32_t[]){
5088 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5090 .op_flags
= XTENSA_OP_PRIVILEGED
,
5092 .name
= "wsr.excsave3",
5093 .translate
= translate_wsr
,
5094 .test_ill
= test_ill_hpi
,
5095 .par
= (const uint32_t[]){
5097 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5099 .op_flags
= XTENSA_OP_PRIVILEGED
,
5101 .name
= "wsr.excsave4",
5102 .translate
= translate_wsr
,
5103 .test_ill
= test_ill_hpi
,
5104 .par
= (const uint32_t[]){
5106 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5108 .op_flags
= XTENSA_OP_PRIVILEGED
,
5110 .name
= "wsr.excsave5",
5111 .translate
= translate_wsr
,
5112 .test_ill
= test_ill_hpi
,
5113 .par
= (const uint32_t[]){
5115 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5117 .op_flags
= XTENSA_OP_PRIVILEGED
,
5119 .name
= "wsr.excsave6",
5120 .translate
= translate_wsr
,
5121 .test_ill
= test_ill_hpi
,
5122 .par
= (const uint32_t[]){
5124 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5126 .op_flags
= XTENSA_OP_PRIVILEGED
,
5128 .name
= "wsr.excsave7",
5129 .translate
= translate_wsr
,
5130 .test_ill
= test_ill_hpi
,
5131 .par
= (const uint32_t[]){
5133 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5135 .op_flags
= XTENSA_OP_PRIVILEGED
,
5137 .name
= "wsr.excvaddr",
5138 .translate
= translate_wsr
,
5139 .test_ill
= test_ill_sr
,
5140 .par
= (const uint32_t[]){
5142 XTENSA_OPTION_EXCEPTION
,
5144 .op_flags
= XTENSA_OP_PRIVILEGED
,
5146 .name
= "wsr.ibreaka0",
5147 .translate
= translate_wsr_ibreaka
,
5148 .test_ill
= test_ill_ibreak
,
5149 .par
= (const uint32_t[]){
5151 XTENSA_OPTION_DEBUG
,
5153 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5155 .name
= "wsr.ibreaka1",
5156 .translate
= translate_wsr_ibreaka
,
5157 .test_ill
= test_ill_ibreak
,
5158 .par
= (const uint32_t[]){
5160 XTENSA_OPTION_DEBUG
,
5162 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5164 .name
= "wsr.ibreakenable",
5165 .translate
= translate_wsr_ibreakenable
,
5166 .test_ill
= test_ill_sr
,
5167 .par
= (const uint32_t[]){
5169 XTENSA_OPTION_DEBUG
,
5171 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5173 .name
= "wsr.icount",
5174 .translate
= translate_wsr_icount
,
5175 .test_ill
= test_ill_sr
,
5176 .par
= (const uint32_t[]){
5178 XTENSA_OPTION_DEBUG
,
5180 .op_flags
= XTENSA_OP_PRIVILEGED
,
5182 .name
= "wsr.icountlevel",
5183 .translate
= translate_wsr_mask
,
5184 .test_ill
= test_ill_sr
,
5185 .par
= (const uint32_t[]){
5187 XTENSA_OPTION_DEBUG
,
5190 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5192 .name
= "wsr.intclear",
5193 .translate
= translate_wsr_intclear
,
5194 .test_ill
= test_ill_sr
,
5195 .par
= (const uint32_t[]){
5197 XTENSA_OPTION_INTERRUPT
,
5200 XTENSA_OP_PRIVILEGED
|
5201 XTENSA_OP_EXIT_TB_0
|
5202 XTENSA_OP_CHECK_INTERRUPTS
,
5204 .name
= "wsr.intenable",
5205 .translate
= translate_wsr
,
5206 .test_ill
= test_ill_sr
,
5207 .par
= (const uint32_t[]){
5209 XTENSA_OPTION_INTERRUPT
,
5212 XTENSA_OP_PRIVILEGED
|
5213 XTENSA_OP_EXIT_TB_0
|
5214 XTENSA_OP_CHECK_INTERRUPTS
,
5216 .name
= "wsr.interrupt",
5217 .translate
= translate_wsr
,
5218 .test_ill
= test_ill_sr
,
5219 .par
= (const uint32_t[]){
5221 XTENSA_OPTION_INTERRUPT
,
5224 XTENSA_OP_PRIVILEGED
|
5225 XTENSA_OP_EXIT_TB_0
|
5226 XTENSA_OP_CHECK_INTERRUPTS
,
5228 .name
= "wsr.intset",
5229 .translate
= translate_wsr_intset
,
5230 .test_ill
= test_ill_sr
,
5231 .par
= (const uint32_t[]){
5233 XTENSA_OPTION_INTERRUPT
,
5236 XTENSA_OP_PRIVILEGED
|
5237 XTENSA_OP_EXIT_TB_0
|
5238 XTENSA_OP_CHECK_INTERRUPTS
,
5240 .name
= "wsr.itlbcfg",
5241 .translate
= translate_wsr_mask
,
5242 .test_ill
= test_ill_sr
,
5243 .par
= (const uint32_t[]){
5248 .op_flags
= XTENSA_OP_PRIVILEGED
,
5251 .translate
= translate_wsr
,
5252 .test_ill
= test_ill_sr
,
5253 .par
= (const uint32_t[]){
5257 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5259 .name
= "wsr.lcount",
5260 .translate
= translate_wsr
,
5261 .test_ill
= test_ill_sr
,
5262 .par
= (const uint32_t[]){
5268 .translate
= translate_wsr
,
5269 .test_ill
= test_ill_sr
,
5270 .par
= (const uint32_t[]){
5274 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5276 .name
= "wsr.litbase",
5277 .translate
= translate_wsr_mask
,
5278 .test_ill
= test_ill_sr
,
5279 .par
= (const uint32_t[]){
5281 XTENSA_OPTION_EXTENDED_L32R
,
5284 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5287 .translate
= translate_wsr
,
5288 .test_ill
= test_ill_sr
,
5289 .par
= (const uint32_t[]){
5291 XTENSA_OPTION_MAC16
,
5295 .translate
= translate_wsr
,
5296 .test_ill
= test_ill_sr
,
5297 .par
= (const uint32_t[]){
5299 XTENSA_OPTION_MAC16
,
5303 .translate
= translate_wsr
,
5304 .test_ill
= test_ill_sr
,
5305 .par
= (const uint32_t[]){
5307 XTENSA_OPTION_MAC16
,
5311 .translate
= translate_wsr
,
5312 .test_ill
= test_ill_sr
,
5313 .par
= (const uint32_t[]){
5315 XTENSA_OPTION_MAC16
,
5318 .name
= "wsr.memctl",
5319 .translate
= translate_wsr_memctl
,
5320 .par
= (const uint32_t[]){MEMCTL
},
5321 .op_flags
= XTENSA_OP_PRIVILEGED
,
5324 .translate
= translate_wsr
,
5325 .test_ill
= test_ill_sr
,
5326 .par
= (const uint32_t[]){
5328 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5330 .op_flags
= XTENSA_OP_PRIVILEGED
,
5333 .translate
= translate_wsr
,
5334 .test_ill
= test_ill_sr
,
5335 .par
= (const uint32_t[]){
5337 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5339 .op_flags
= XTENSA_OP_PRIVILEGED
,
5342 .translate
= translate_wsr
,
5343 .test_ill
= test_ill_sr
,
5344 .par
= (const uint32_t[]){
5346 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5348 .op_flags
= XTENSA_OP_PRIVILEGED
,
5350 .name
= "wsr.mesave",
5351 .translate
= translate_wsr
,
5352 .test_ill
= test_ill_sr
,
5353 .par
= (const uint32_t[]){
5355 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5357 .op_flags
= XTENSA_OP_PRIVILEGED
,
5360 .translate
= translate_wsr
,
5361 .test_ill
= test_ill_sr
,
5362 .par
= (const uint32_t[]){
5364 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5366 .op_flags
= XTENSA_OP_PRIVILEGED
,
5368 .name
= "wsr.mevaddr",
5369 .translate
= translate_wsr
,
5370 .test_ill
= test_ill_sr
,
5371 .par
= (const uint32_t[]){
5373 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5375 .op_flags
= XTENSA_OP_PRIVILEGED
,
5377 .name
= "wsr.misc0",
5378 .translate
= translate_wsr
,
5379 .test_ill
= test_ill_sr
,
5380 .par
= (const uint32_t[]){
5382 XTENSA_OPTION_MISC_SR
,
5384 .op_flags
= XTENSA_OP_PRIVILEGED
,
5386 .name
= "wsr.misc1",
5387 .translate
= translate_wsr
,
5388 .test_ill
= test_ill_sr
,
5389 .par
= (const uint32_t[]){
5391 XTENSA_OPTION_MISC_SR
,
5393 .op_flags
= XTENSA_OP_PRIVILEGED
,
5395 .name
= "wsr.misc2",
5396 .translate
= translate_wsr
,
5397 .test_ill
= test_ill_sr
,
5398 .par
= (const uint32_t[]){
5400 XTENSA_OPTION_MISC_SR
,
5402 .op_flags
= XTENSA_OP_PRIVILEGED
,
5404 .name
= "wsr.misc3",
5405 .translate
= translate_wsr
,
5406 .test_ill
= test_ill_sr
,
5407 .par
= (const uint32_t[]){
5409 XTENSA_OPTION_MISC_SR
,
5411 .op_flags
= XTENSA_OP_PRIVILEGED
,
5414 .translate
= translate_wsr
,
5415 .test_ill
= test_ill_sr
,
5416 .par
= (const uint32_t[]){
5418 XTENSA_OPTION_TRACE_PORT
,
5420 .op_flags
= XTENSA_OP_PRIVILEGED
,
5422 .name
= "wsr.mpuenb",
5423 .translate
= translate_wsr_mpuenb
,
5424 .test_ill
= test_ill_sr
,
5425 .par
= (const uint32_t[]){
5429 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5431 .name
= "wsr.prefctl",
5432 .translate
= translate_wsr
,
5433 .par
= (const uint32_t[]){PREFCTL
},
5436 .op_flags
= XTENSA_OP_ILL
,
5439 .translate
= translate_wsr_ps
,
5440 .test_ill
= test_ill_sr
,
5441 .par
= (const uint32_t[]){
5443 XTENSA_OPTION_EXCEPTION
,
5446 XTENSA_OP_PRIVILEGED
|
5447 XTENSA_OP_EXIT_TB_M1
|
5448 XTENSA_OP_CHECK_INTERRUPTS
,
5450 .name
= "wsr.ptevaddr",
5451 .translate
= translate_wsr_mask
,
5452 .test_ill
= test_ill_sr
,
5453 .par
= (const uint32_t[]){
5458 .op_flags
= XTENSA_OP_PRIVILEGED
,
5460 .name
= "wsr.rasid",
5461 .translate
= translate_wsr_rasid
,
5462 .test_ill
= test_ill_sr
,
5463 .par
= (const uint32_t[]){
5467 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5470 .translate
= translate_wsr_sar
,
5471 .par
= (const uint32_t[]){SAR
},
5473 .name
= "wsr.scompare1",
5474 .translate
= translate_wsr
,
5475 .test_ill
= test_ill_sr
,
5476 .par
= (const uint32_t[]){
5478 XTENSA_OPTION_CONDITIONAL_STORE
,
5481 .name
= "wsr.vecbase",
5482 .translate
= translate_wsr
,
5483 .test_ill
= test_ill_sr
,
5484 .par
= (const uint32_t[]){
5486 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5488 .op_flags
= XTENSA_OP_PRIVILEGED
,
5490 .name
= "wsr.windowbase",
5491 .translate
= translate_wsr_windowbase
,
5492 .test_ill
= test_ill_sr
,
5493 .par
= (const uint32_t[]){
5495 XTENSA_OPTION_WINDOWED_REGISTER
,
5497 .op_flags
= XTENSA_OP_PRIVILEGED
|
5498 XTENSA_OP_EXIT_TB_M1
|
5499 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5501 .name
= "wsr.windowstart",
5502 .translate
= translate_wsr_windowstart
,
5503 .test_ill
= test_ill_sr
,
5504 .par
= (const uint32_t[]){
5506 XTENSA_OPTION_WINDOWED_REGISTER
,
5508 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5510 .name
= "wur.expstate",
5511 .translate
= translate_wur
,
5512 .par
= (const uint32_t[]){EXPSTATE
},
5515 .translate
= translate_wur_fcr
,
5516 .par
= (const uint32_t[]){FCR
},
5520 .translate
= translate_wur_fsr
,
5521 .par
= (const uint32_t[]){FSR
},
5524 .name
= "wur.threadptr",
5525 .translate
= translate_wur
,
5526 .par
= (const uint32_t[]){THREADPTR
},
5529 .translate
= translate_xor
,
5532 .translate
= translate_boolean
,
5533 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5536 .op_flags
= XTENSA_OP_ILL
,
5539 .op_flags
= XTENSA_OP_ILL
,
5541 .name
= "xsr.acchi",
5542 .translate
= translate_xsr_acchi
,
5543 .test_ill
= test_ill_sr
,
5544 .par
= (const uint32_t[]){
5546 XTENSA_OPTION_MAC16
,
5549 .name
= "xsr.acclo",
5550 .translate
= translate_xsr
,
5551 .test_ill
= test_ill_sr
,
5552 .par
= (const uint32_t[]){
5554 XTENSA_OPTION_MAC16
,
5557 .name
= "xsr.atomctl",
5558 .translate
= translate_xsr_mask
,
5559 .test_ill
= test_ill_sr
,
5560 .par
= (const uint32_t[]){
5562 XTENSA_OPTION_ATOMCTL
,
5565 .op_flags
= XTENSA_OP_PRIVILEGED
,
5568 .translate
= translate_xsr_mask
,
5569 .test_ill
= test_ill_sr
,
5570 .par
= (const uint32_t[]){
5572 XTENSA_OPTION_BOOLEAN
,
5576 .name
= "xsr.cacheadrdis",
5577 .translate
= translate_xsr_mask
,
5578 .test_ill
= test_ill_sr
,
5579 .par
= (const uint32_t[]){
5584 .op_flags
= XTENSA_OP_PRIVILEGED
,
5586 .name
= "xsr.cacheattr",
5587 .translate
= translate_xsr
,
5588 .test_ill
= test_ill_sr
,
5589 .par
= (const uint32_t[]){
5591 XTENSA_OPTION_CACHEATTR
,
5593 .op_flags
= XTENSA_OP_PRIVILEGED
,
5595 .name
= "xsr.ccompare0",
5596 .translate
= translate_xsr_ccompare
,
5597 .test_ill
= test_ill_ccompare
,
5598 .par
= (const uint32_t[]){
5600 XTENSA_OPTION_TIMER_INTERRUPT
,
5602 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5604 .name
= "xsr.ccompare1",
5605 .translate
= translate_xsr_ccompare
,
5606 .test_ill
= test_ill_ccompare
,
5607 .par
= (const uint32_t[]){
5609 XTENSA_OPTION_TIMER_INTERRUPT
,
5611 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5613 .name
= "xsr.ccompare2",
5614 .translate
= translate_xsr_ccompare
,
5615 .test_ill
= test_ill_ccompare
,
5616 .par
= (const uint32_t[]){
5618 XTENSA_OPTION_TIMER_INTERRUPT
,
5620 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5622 .name
= "xsr.ccount",
5623 .translate
= translate_xsr_ccount
,
5624 .test_ill
= test_ill_sr
,
5625 .par
= (const uint32_t[]){
5627 XTENSA_OPTION_TIMER_INTERRUPT
,
5629 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5631 .name
= "xsr.configid0",
5632 .op_flags
= XTENSA_OP_ILL
,
5634 .name
= "xsr.configid1",
5635 .op_flags
= XTENSA_OP_ILL
,
5637 .name
= "xsr.cpenable",
5638 .translate
= translate_xsr_mask
,
5639 .test_ill
= test_ill_sr
,
5640 .par
= (const uint32_t[]){
5642 XTENSA_OPTION_COPROCESSOR
,
5645 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5647 .name
= "xsr.dbreaka0",
5648 .translate
= translate_xsr_dbreaka
,
5649 .test_ill
= test_ill_dbreak
,
5650 .par
= (const uint32_t[]){
5652 XTENSA_OPTION_DEBUG
,
5654 .op_flags
= XTENSA_OP_PRIVILEGED
,
5656 .name
= "xsr.dbreaka1",
5657 .translate
= translate_xsr_dbreaka
,
5658 .test_ill
= test_ill_dbreak
,
5659 .par
= (const uint32_t[]){
5661 XTENSA_OPTION_DEBUG
,
5663 .op_flags
= XTENSA_OP_PRIVILEGED
,
5665 .name
= "xsr.dbreakc0",
5666 .translate
= translate_xsr_dbreakc
,
5667 .test_ill
= test_ill_dbreak
,
5668 .par
= (const uint32_t[]){
5670 XTENSA_OPTION_DEBUG
,
5672 .op_flags
= XTENSA_OP_PRIVILEGED
,
5674 .name
= "xsr.dbreakc1",
5675 .translate
= translate_xsr_dbreakc
,
5676 .test_ill
= test_ill_dbreak
,
5677 .par
= (const uint32_t[]){
5679 XTENSA_OPTION_DEBUG
,
5681 .op_flags
= XTENSA_OP_PRIVILEGED
,
5684 .translate
= translate_xsr
,
5685 .test_ill
= test_ill_sr
,
5686 .par
= (const uint32_t[]){
5688 XTENSA_OPTION_DEBUG
,
5690 .op_flags
= XTENSA_OP_PRIVILEGED
,
5692 .name
= "xsr.debugcause",
5693 .op_flags
= XTENSA_OP_ILL
,
5696 .translate
= translate_xsr
,
5697 .test_ill
= test_ill_sr
,
5698 .par
= (const uint32_t[]){
5700 XTENSA_OPTION_EXCEPTION
,
5702 .op_flags
= XTENSA_OP_PRIVILEGED
,
5704 .name
= "xsr.dtlbcfg",
5705 .translate
= translate_xsr_mask
,
5706 .test_ill
= test_ill_sr
,
5707 .par
= (const uint32_t[]){
5712 .op_flags
= XTENSA_OP_PRIVILEGED
,
5715 .translate
= translate_xsr
,
5716 .test_ill
= test_ill_sr
,
5717 .par
= (const uint32_t[]){
5719 XTENSA_OPTION_EXCEPTION
,
5721 .op_flags
= XTENSA_OP_PRIVILEGED
,
5724 .translate
= translate_xsr
,
5725 .test_ill
= test_ill_hpi
,
5726 .par
= (const uint32_t[]){
5728 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5730 .op_flags
= XTENSA_OP_PRIVILEGED
,
5733 .translate
= translate_xsr
,
5734 .test_ill
= test_ill_hpi
,
5735 .par
= (const uint32_t[]){
5737 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5739 .op_flags
= XTENSA_OP_PRIVILEGED
,
5742 .translate
= translate_xsr
,
5743 .test_ill
= test_ill_hpi
,
5744 .par
= (const uint32_t[]){
5746 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5748 .op_flags
= XTENSA_OP_PRIVILEGED
,
5751 .translate
= translate_xsr
,
5752 .test_ill
= test_ill_hpi
,
5753 .par
= (const uint32_t[]){
5755 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5757 .op_flags
= XTENSA_OP_PRIVILEGED
,
5760 .translate
= translate_xsr
,
5761 .test_ill
= test_ill_hpi
,
5762 .par
= (const uint32_t[]){
5764 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5766 .op_flags
= XTENSA_OP_PRIVILEGED
,
5769 .translate
= translate_xsr
,
5770 .test_ill
= test_ill_hpi
,
5771 .par
= (const uint32_t[]){
5773 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5775 .op_flags
= XTENSA_OP_PRIVILEGED
,
5778 .translate
= translate_xsr
,
5779 .test_ill
= test_ill_hpi
,
5780 .par
= (const uint32_t[]){
5782 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5784 .op_flags
= XTENSA_OP_PRIVILEGED
,
5787 .translate
= translate_xsr
,
5788 .test_ill
= test_ill_hpi
,
5789 .par
= (const uint32_t[]){
5791 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5793 .op_flags
= XTENSA_OP_PRIVILEGED
,
5796 .translate
= translate_xsr
,
5797 .test_ill
= test_ill_hpi
,
5798 .par
= (const uint32_t[]){
5800 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5802 .op_flags
= XTENSA_OP_PRIVILEGED
,
5805 .translate
= translate_xsr
,
5806 .test_ill
= test_ill_hpi
,
5807 .par
= (const uint32_t[]){
5809 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5811 .op_flags
= XTENSA_OP_PRIVILEGED
,
5814 .translate
= translate_xsr
,
5815 .test_ill
= test_ill_hpi
,
5816 .par
= (const uint32_t[]){
5818 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5820 .op_flags
= XTENSA_OP_PRIVILEGED
,
5823 .translate
= translate_xsr
,
5824 .test_ill
= test_ill_hpi
,
5825 .par
= (const uint32_t[]){
5827 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5829 .op_flags
= XTENSA_OP_PRIVILEGED
,
5831 .name
= "xsr.eraccess",
5832 .translate
= translate_xsr_mask
,
5833 .par
= (const uint32_t[]){
5838 .op_flags
= XTENSA_OP_PRIVILEGED
,
5840 .name
= "xsr.exccause",
5841 .translate
= translate_xsr
,
5842 .test_ill
= test_ill_sr
,
5843 .par
= (const uint32_t[]){
5845 XTENSA_OPTION_EXCEPTION
,
5847 .op_flags
= XTENSA_OP_PRIVILEGED
,
5849 .name
= "xsr.excsave1",
5850 .translate
= translate_xsr
,
5851 .test_ill
= test_ill_sr
,
5852 .par
= (const uint32_t[]){
5854 XTENSA_OPTION_EXCEPTION
,
5856 .op_flags
= XTENSA_OP_PRIVILEGED
,
5858 .name
= "xsr.excsave2",
5859 .translate
= translate_xsr
,
5860 .test_ill
= test_ill_hpi
,
5861 .par
= (const uint32_t[]){
5863 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5865 .op_flags
= XTENSA_OP_PRIVILEGED
,
5867 .name
= "xsr.excsave3",
5868 .translate
= translate_xsr
,
5869 .test_ill
= test_ill_hpi
,
5870 .par
= (const uint32_t[]){
5872 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5874 .op_flags
= XTENSA_OP_PRIVILEGED
,
5876 .name
= "xsr.excsave4",
5877 .translate
= translate_xsr
,
5878 .test_ill
= test_ill_hpi
,
5879 .par
= (const uint32_t[]){
5881 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5883 .op_flags
= XTENSA_OP_PRIVILEGED
,
5885 .name
= "xsr.excsave5",
5886 .translate
= translate_xsr
,
5887 .test_ill
= test_ill_hpi
,
5888 .par
= (const uint32_t[]){
5890 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5892 .op_flags
= XTENSA_OP_PRIVILEGED
,
5894 .name
= "xsr.excsave6",
5895 .translate
= translate_xsr
,
5896 .test_ill
= test_ill_hpi
,
5897 .par
= (const uint32_t[]){
5899 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5901 .op_flags
= XTENSA_OP_PRIVILEGED
,
5903 .name
= "xsr.excsave7",
5904 .translate
= translate_xsr
,
5905 .test_ill
= test_ill_hpi
,
5906 .par
= (const uint32_t[]){
5908 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5910 .op_flags
= XTENSA_OP_PRIVILEGED
,
5912 .name
= "xsr.excvaddr",
5913 .translate
= translate_xsr
,
5914 .test_ill
= test_ill_sr
,
5915 .par
= (const uint32_t[]){
5917 XTENSA_OPTION_EXCEPTION
,
5919 .op_flags
= XTENSA_OP_PRIVILEGED
,
5921 .name
= "xsr.ibreaka0",
5922 .translate
= translate_xsr_ibreaka
,
5923 .test_ill
= test_ill_ibreak
,
5924 .par
= (const uint32_t[]){
5926 XTENSA_OPTION_DEBUG
,
5928 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5930 .name
= "xsr.ibreaka1",
5931 .translate
= translate_xsr_ibreaka
,
5932 .test_ill
= test_ill_ibreak
,
5933 .par
= (const uint32_t[]){
5935 XTENSA_OPTION_DEBUG
,
5937 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5939 .name
= "xsr.ibreakenable",
5940 .translate
= translate_xsr_ibreakenable
,
5941 .test_ill
= test_ill_sr
,
5942 .par
= (const uint32_t[]){
5944 XTENSA_OPTION_DEBUG
,
5946 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5948 .name
= "xsr.icount",
5949 .translate
= translate_xsr_icount
,
5950 .test_ill
= test_ill_sr
,
5951 .par
= (const uint32_t[]){
5953 XTENSA_OPTION_DEBUG
,
5955 .op_flags
= XTENSA_OP_PRIVILEGED
,
5957 .name
= "xsr.icountlevel",
5958 .translate
= translate_xsr_mask
,
5959 .test_ill
= test_ill_sr
,
5960 .par
= (const uint32_t[]){
5962 XTENSA_OPTION_DEBUG
,
5965 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5967 .name
= "xsr.intclear",
5968 .op_flags
= XTENSA_OP_ILL
,
5970 .name
= "xsr.intenable",
5971 .translate
= translate_xsr
,
5972 .test_ill
= test_ill_sr
,
5973 .par
= (const uint32_t[]){
5975 XTENSA_OPTION_INTERRUPT
,
5978 XTENSA_OP_PRIVILEGED
|
5979 XTENSA_OP_EXIT_TB_0
|
5980 XTENSA_OP_CHECK_INTERRUPTS
,
5982 .name
= "xsr.interrupt",
5983 .op_flags
= XTENSA_OP_ILL
,
5985 .name
= "xsr.intset",
5986 .op_flags
= XTENSA_OP_ILL
,
5988 .name
= "xsr.itlbcfg",
5989 .translate
= translate_xsr_mask
,
5990 .test_ill
= test_ill_sr
,
5991 .par
= (const uint32_t[]){
5996 .op_flags
= XTENSA_OP_PRIVILEGED
,
5999 .translate
= translate_xsr
,
6000 .test_ill
= test_ill_sr
,
6001 .par
= (const uint32_t[]){
6005 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6007 .name
= "xsr.lcount",
6008 .translate
= translate_xsr
,
6009 .test_ill
= test_ill_sr
,
6010 .par
= (const uint32_t[]){
6016 .translate
= translate_xsr
,
6017 .test_ill
= test_ill_sr
,
6018 .par
= (const uint32_t[]){
6022 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6024 .name
= "xsr.litbase",
6025 .translate
= translate_xsr_mask
,
6026 .test_ill
= test_ill_sr
,
6027 .par
= (const uint32_t[]){
6029 XTENSA_OPTION_EXTENDED_L32R
,
6032 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6035 .translate
= translate_xsr
,
6036 .test_ill
= test_ill_sr
,
6037 .par
= (const uint32_t[]){
6039 XTENSA_OPTION_MAC16
,
6043 .translate
= translate_xsr
,
6044 .test_ill
= test_ill_sr
,
6045 .par
= (const uint32_t[]){
6047 XTENSA_OPTION_MAC16
,
6051 .translate
= translate_xsr
,
6052 .test_ill
= test_ill_sr
,
6053 .par
= (const uint32_t[]){
6055 XTENSA_OPTION_MAC16
,
6059 .translate
= translate_xsr
,
6060 .test_ill
= test_ill_sr
,
6061 .par
= (const uint32_t[]){
6063 XTENSA_OPTION_MAC16
,
6066 .name
= "xsr.memctl",
6067 .translate
= translate_xsr_memctl
,
6068 .par
= (const uint32_t[]){MEMCTL
},
6069 .op_flags
= XTENSA_OP_PRIVILEGED
,
6072 .translate
= translate_xsr
,
6073 .test_ill
= test_ill_sr
,
6074 .par
= (const uint32_t[]){
6076 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6078 .op_flags
= XTENSA_OP_PRIVILEGED
,
6081 .translate
= translate_xsr
,
6082 .test_ill
= test_ill_sr
,
6083 .par
= (const uint32_t[]){
6085 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6087 .op_flags
= XTENSA_OP_PRIVILEGED
,
6090 .translate
= translate_xsr
,
6091 .test_ill
= test_ill_sr
,
6092 .par
= (const uint32_t[]){
6094 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6096 .op_flags
= XTENSA_OP_PRIVILEGED
,
6098 .name
= "xsr.mesave",
6099 .translate
= translate_xsr
,
6100 .test_ill
= test_ill_sr
,
6101 .par
= (const uint32_t[]){
6103 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6105 .op_flags
= XTENSA_OP_PRIVILEGED
,
6108 .translate
= translate_xsr
,
6109 .test_ill
= test_ill_sr
,
6110 .par
= (const uint32_t[]){
6112 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6114 .op_flags
= XTENSA_OP_PRIVILEGED
,
6116 .name
= "xsr.mevaddr",
6117 .translate
= translate_xsr
,
6118 .test_ill
= test_ill_sr
,
6119 .par
= (const uint32_t[]){
6121 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6123 .op_flags
= XTENSA_OP_PRIVILEGED
,
6125 .name
= "xsr.misc0",
6126 .translate
= translate_xsr
,
6127 .test_ill
= test_ill_sr
,
6128 .par
= (const uint32_t[]){
6130 XTENSA_OPTION_MISC_SR
,
6132 .op_flags
= XTENSA_OP_PRIVILEGED
,
6134 .name
= "xsr.misc1",
6135 .translate
= translate_xsr
,
6136 .test_ill
= test_ill_sr
,
6137 .par
= (const uint32_t[]){
6139 XTENSA_OPTION_MISC_SR
,
6141 .op_flags
= XTENSA_OP_PRIVILEGED
,
6143 .name
= "xsr.misc2",
6144 .translate
= translate_xsr
,
6145 .test_ill
= test_ill_sr
,
6146 .par
= (const uint32_t[]){
6148 XTENSA_OPTION_MISC_SR
,
6150 .op_flags
= XTENSA_OP_PRIVILEGED
,
6152 .name
= "xsr.misc3",
6153 .translate
= translate_xsr
,
6154 .test_ill
= test_ill_sr
,
6155 .par
= (const uint32_t[]){
6157 XTENSA_OPTION_MISC_SR
,
6159 .op_flags
= XTENSA_OP_PRIVILEGED
,
6161 .name
= "xsr.mpuenb",
6162 .translate
= translate_xsr_mpuenb
,
6163 .test_ill
= test_ill_sr
,
6164 .par
= (const uint32_t[]){
6168 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6170 .name
= "xsr.prefctl",
6171 .translate
= translate_xsr
,
6172 .par
= (const uint32_t[]){PREFCTL
},
6175 .op_flags
= XTENSA_OP_ILL
,
6178 .translate
= translate_xsr_ps
,
6179 .test_ill
= test_ill_sr
,
6180 .par
= (const uint32_t[]){
6182 XTENSA_OPTION_EXCEPTION
,
6185 XTENSA_OP_PRIVILEGED
|
6186 XTENSA_OP_EXIT_TB_M1
|
6187 XTENSA_OP_CHECK_INTERRUPTS
,
6189 .name
= "xsr.ptevaddr",
6190 .translate
= translate_xsr_mask
,
6191 .test_ill
= test_ill_sr
,
6192 .par
= (const uint32_t[]){
6197 .op_flags
= XTENSA_OP_PRIVILEGED
,
6199 .name
= "xsr.rasid",
6200 .translate
= translate_xsr_rasid
,
6201 .test_ill
= test_ill_sr
,
6202 .par
= (const uint32_t[]){
6206 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6209 .translate
= translate_xsr_sar
,
6210 .par
= (const uint32_t[]){SAR
},
6212 .name
= "xsr.scompare1",
6213 .translate
= translate_xsr
,
6214 .test_ill
= test_ill_sr
,
6215 .par
= (const uint32_t[]){
6217 XTENSA_OPTION_CONDITIONAL_STORE
,
6220 .name
= "xsr.vecbase",
6221 .translate
= translate_xsr
,
6222 .test_ill
= test_ill_sr
,
6223 .par
= (const uint32_t[]){
6225 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6227 .op_flags
= XTENSA_OP_PRIVILEGED
,
6229 .name
= "xsr.windowbase",
6230 .translate
= translate_xsr_windowbase
,
6231 .test_ill
= test_ill_sr
,
6232 .par
= (const uint32_t[]){
6234 XTENSA_OPTION_WINDOWED_REGISTER
,
6236 .op_flags
= XTENSA_OP_PRIVILEGED
|
6237 XTENSA_OP_EXIT_TB_M1
|
6238 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6240 .name
= "xsr.windowstart",
6241 .translate
= translate_xsr_windowstart
,
6242 .test_ill
= test_ill_sr
,
6243 .par
= (const uint32_t[]){
6245 XTENSA_OPTION_WINDOWED_REGISTER
,
6247 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6251 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6252 .num_opcodes
= ARRAY_SIZE(core_ops
),
6257 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6258 const uint32_t par
[])
6260 gen_helper_abs_s(arg
[0].out
, arg
[1].in
);
6263 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6264 const uint32_t par
[])
6266 gen_helper_add_s(arg
[0].out
, cpu_env
,
6267 arg
[1].in
, arg
[2].in
);
6280 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6281 const uint32_t par
[])
6283 static void (* const helper
[])(TCGv_env env
, TCGv_i32 bit
,
6284 TCGv_i32 s
, TCGv_i32 t
) = {
6285 [COMPARE_UN
] = gen_helper_un_s
,
6286 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6287 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6288 [COMPARE_OLT
] = gen_helper_olt_s
,
6289 [COMPARE_ULT
] = gen_helper_ult_s
,
6290 [COMPARE_OLE
] = gen_helper_ole_s
,
6291 [COMPARE_ULE
] = gen_helper_ule_s
,
6293 TCGv_i32 bit
= tcg_const_i32(1 << arg
[0].imm
);
6295 helper
[par
[0]](cpu_env
, bit
, arg
[1].in
, arg
[2].in
);
6299 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6300 const uint32_t par
[])
6302 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6305 gen_helper_uitof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6307 gen_helper_itof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6309 tcg_temp_free(scale
);
6312 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6313 const uint32_t par
[])
6315 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6316 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6319 gen_helper_ftoui(arg
[0].out
, arg
[1].in
,
6320 rounding_mode
, scale
);
6322 gen_helper_ftoi(arg
[0].out
, arg
[1].in
,
6323 rounding_mode
, scale
);
6325 tcg_temp_free(rounding_mode
);
6326 tcg_temp_free(scale
);
6329 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6330 const uint32_t par
[])
6332 TCGv_i32 addr
= tcg_temp_new_i32();
6334 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6335 gen_load_store_alignment(dc
, 2, addr
, false);
6337 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6339 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6342 tcg_gen_mov_i32(arg
[1].out
, addr
);
6344 tcg_temp_free(addr
);
6347 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6348 const uint32_t par
[])
6350 TCGv_i32 addr
= tcg_temp_new_i32();
6352 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6353 gen_load_store_alignment(dc
, 2, addr
, false);
6355 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6357 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6360 tcg_gen_mov_i32(arg
[1].out
, addr
);
6362 tcg_temp_free(addr
);
6365 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6366 const uint32_t par
[])
6368 gen_helper_madd_s(arg
[0].out
, cpu_env
,
6369 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6372 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6373 const uint32_t par
[])
6375 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6378 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6379 const uint32_t par
[])
6381 TCGv_i32 zero
= tcg_const_i32(0);
6383 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6385 arg
[1].in
, arg
[0].in
);
6386 tcg_temp_free(zero
);
6389 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6390 const uint32_t par
[])
6392 TCGv_i32 zero
= tcg_const_i32(0);
6393 TCGv_i32 tmp
= tcg_temp_new_i32();
6395 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6396 tcg_gen_movcond_i32(par
[0],
6397 arg
[0].out
, tmp
, zero
,
6398 arg
[1].in
, arg
[0].in
);
6400 tcg_temp_free(zero
);
6403 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6404 const uint32_t par
[])
6406 gen_helper_mul_s(arg
[0].out
, cpu_env
,
6407 arg
[1].in
, arg
[2].in
);
6410 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6411 const uint32_t par
[])
6413 gen_helper_msub_s(arg
[0].out
, cpu_env
,
6414 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6417 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6418 const uint32_t par
[])
6420 gen_helper_neg_s(arg
[0].out
, arg
[1].in
);
6423 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6424 const uint32_t par
[])
6426 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6429 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6430 const uint32_t par
[])
6432 gen_helper_sub_s(arg
[0].out
, cpu_env
,
6433 arg
[1].in
, arg
[2].in
);
6436 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6437 const uint32_t par
[])
6439 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6442 static const XtensaOpcodeOps fpu2000_ops
[] = {
6445 .translate
= translate_abs_s
,
6449 .translate
= translate_add_s
,
6453 .translate
= translate_ftoi_s
,
6454 .par
= (const uint32_t[]){float_round_up
, false},
6458 .translate
= translate_float_s
,
6459 .par
= (const uint32_t[]){false},
6463 .translate
= translate_ftoi_s
,
6464 .par
= (const uint32_t[]){float_round_down
, false},
6468 .translate
= translate_ldsti
,
6469 .par
= (const uint32_t[]){false, false},
6470 .op_flags
= XTENSA_OP_LOAD
,
6474 .translate
= translate_ldsti
,
6475 .par
= (const uint32_t[]){false, true},
6476 .op_flags
= XTENSA_OP_LOAD
,
6480 .translate
= translate_ldstx
,
6481 .par
= (const uint32_t[]){false, false},
6482 .op_flags
= XTENSA_OP_LOAD
,
6486 .translate
= translate_ldstx
,
6487 .par
= (const uint32_t[]){false, true},
6488 .op_flags
= XTENSA_OP_LOAD
,
6492 .translate
= translate_madd_s
,
6496 .translate
= translate_mov_s
,
6500 .translate
= translate_movcond_s
,
6501 .par
= (const uint32_t[]){TCG_COND_EQ
},
6505 .translate
= translate_movp_s
,
6506 .par
= (const uint32_t[]){TCG_COND_EQ
},
6510 .translate
= translate_movcond_s
,
6511 .par
= (const uint32_t[]){TCG_COND_GE
},
6515 .translate
= translate_movcond_s
,
6516 .par
= (const uint32_t[]){TCG_COND_LT
},
6520 .translate
= translate_movcond_s
,
6521 .par
= (const uint32_t[]){TCG_COND_NE
},
6525 .translate
= translate_movp_s
,
6526 .par
= (const uint32_t[]){TCG_COND_NE
},
6530 .translate
= translate_msub_s
,
6534 .translate
= translate_mul_s
,
6538 .translate
= translate_neg_s
,
6542 .translate
= translate_compare_s
,
6543 .par
= (const uint32_t[]){COMPARE_OEQ
},
6547 .translate
= translate_compare_s
,
6548 .par
= (const uint32_t[]){COMPARE_OLE
},
6552 .translate
= translate_compare_s
,
6553 .par
= (const uint32_t[]){COMPARE_OLT
},
6557 .translate
= translate_rfr_s
,
6561 .translate
= translate_ftoi_s
,
6562 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6566 .translate
= translate_ldsti
,
6567 .par
= (const uint32_t[]){true, false},
6568 .op_flags
= XTENSA_OP_STORE
,
6572 .translate
= translate_ldsti
,
6573 .par
= (const uint32_t[]){true, true},
6574 .op_flags
= XTENSA_OP_STORE
,
6578 .translate
= translate_ldstx
,
6579 .par
= (const uint32_t[]){true, false},
6580 .op_flags
= XTENSA_OP_STORE
,
6584 .translate
= translate_ldstx
,
6585 .par
= (const uint32_t[]){true, true},
6586 .op_flags
= XTENSA_OP_STORE
,
6590 .translate
= translate_sub_s
,
6594 .translate
= translate_ftoi_s
,
6595 .par
= (const uint32_t[]){float_round_to_zero
, false},
6599 .translate
= translate_compare_s
,
6600 .par
= (const uint32_t[]){COMPARE_UEQ
},
6604 .translate
= translate_float_s
,
6605 .par
= (const uint32_t[]){true},
6609 .translate
= translate_compare_s
,
6610 .par
= (const uint32_t[]){COMPARE_ULE
},
6614 .translate
= translate_compare_s
,
6615 .par
= (const uint32_t[]){COMPARE_ULT
},
6619 .translate
= translate_compare_s
,
6620 .par
= (const uint32_t[]){COMPARE_UN
},
6624 .translate
= translate_ftoi_s
,
6625 .par
= (const uint32_t[]){float_round_to_zero
, true},
6629 .translate
= translate_wfr_s
,
6634 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6635 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6636 .opcode
= fpu2000_ops
,