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"
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 insnbuf
;
76 xtensa_insnbuf slotbuf
;
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
);
1177 if (dc
->config
->isa
) {
1178 dc
->insnbuf
= xtensa_insnbuf_alloc(dc
->config
->isa
);
1179 dc
->slotbuf
= xtensa_insnbuf_alloc(dc
->config
->isa
);
1181 init_sar_tracker(dc
);
1184 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1186 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1189 dc
->next_icount
= tcg_temp_local_new_i32();
1193 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1195 tcg_gen_insn_start(dcbase
->pc_next
);
1198 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1199 const CPUBreakpoint
*bp
)
1201 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1203 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1204 gen_exception(dc
, EXCP_DEBUG
);
1205 dc
->base
.is_jmp
= DISAS_NORETURN
;
1206 /* The address covered by the breakpoint must be included in
1207 [tb->pc, tb->pc + tb->size) in order to for it to be
1208 properly cleared -- thus we increment the PC here so that
1209 the logic setting tb->size below does the right thing. */
1210 dc
->base
.pc_next
+= 2;
1214 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1216 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1217 CPUXtensaState
*env
= cpu
->env_ptr
;
1218 target_ulong page_start
;
1220 /* These two conditions only apply to the first insn in the TB,
1221 but this is the first TranslateOps hook that allows exiting. */
1222 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1223 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1224 gen_exception(dc
, EXCP_YIELD
);
1225 dc
->base
.is_jmp
= DISAS_NORETURN
;
1228 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1229 gen_exception(dc
, EXCP_DEBUG
);
1230 dc
->base
.is_jmp
= DISAS_NORETURN
;
1235 TCGLabel
*label
= gen_new_label();
1237 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1238 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1239 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1241 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1243 gen_set_label(label
);
1247 gen_ibreak_check(env
, dc
);
1250 disas_xtensa_insn(env
, dc
);
1253 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1256 /* End the TB if the next insn will cross into the next page. */
1257 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1258 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1259 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1260 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1261 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1265 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1267 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1269 reset_sar_tracker(dc
);
1270 if (dc
->config
->isa
) {
1271 xtensa_insnbuf_free(dc
->config
->isa
, dc
->insnbuf
);
1272 xtensa_insnbuf_free(dc
->config
->isa
, dc
->slotbuf
);
1275 tcg_temp_free(dc
->next_icount
);
1278 switch (dc
->base
.is_jmp
) {
1279 case DISAS_NORETURN
:
1281 case DISAS_TOO_MANY
:
1282 if (dc
->base
.singlestep_enabled
) {
1283 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1284 gen_exception(dc
, EXCP_DEBUG
);
1286 gen_jumpi(dc
, dc
->pc
, 0);
1290 g_assert_not_reached();
1294 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1296 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1297 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1300 static const TranslatorOps xtensa_translator_ops
= {
1301 .init_disas_context
= xtensa_tr_init_disas_context
,
1302 .tb_start
= xtensa_tr_tb_start
,
1303 .insn_start
= xtensa_tr_insn_start
,
1304 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1305 .translate_insn
= xtensa_tr_translate_insn
,
1306 .tb_stop
= xtensa_tr_tb_stop
,
1307 .disas_log
= xtensa_tr_disas_log
,
1310 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1312 DisasContext dc
= {};
1313 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1316 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1318 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1319 CPUXtensaState
*env
= &cpu
->env
;
1320 xtensa_isa isa
= env
->config
->isa
;
1323 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1325 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1326 const uint32_t *reg
=
1327 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1328 int regno
= xtensa_sysreg_number(isa
, i
);
1331 qemu_fprintf(f
, "%12s=%08x%c",
1332 xtensa_sysreg_name(isa
, i
),
1334 (j
++ % 4) == 3 ? '\n' : ' ');
1338 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1340 for (i
= 0; i
< 16; ++i
) {
1341 qemu_fprintf(f
, " A%02d=%08x%c",
1342 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1345 xtensa_sync_phys_from_window(env
);
1346 qemu_fprintf(f
, "\n");
1348 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1349 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1351 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1352 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1354 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1358 if ((flags
& CPU_DUMP_FPU
) &&
1359 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1360 qemu_fprintf(f
, "\n");
1362 for (i
= 0; i
< 16; ++i
) {
1363 qemu_fprintf(f
, "F%02d=%08x (%+10.8e)%c", i
,
1364 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1365 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1366 (i
% 2) == 1 ? '\n' : ' ');
1371 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1377 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1378 const uint32_t par
[])
1380 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1383 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1384 const uint32_t par
[])
1386 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1389 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1390 const uint32_t par
[])
1392 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1395 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1396 const uint32_t par
[])
1398 TCGv_i32 tmp
= tcg_temp_new_i32();
1399 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1400 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1404 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1405 const uint32_t par
[])
1407 uint32_t shift
= par
[1];
1408 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1409 TCGv_i32 tmp
= tcg_temp_new_i32();
1411 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1413 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1415 tcg_gen_add_i32(tmp
, tmp
, mask
);
1417 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1418 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1419 tmp
, arg
[0].imm
, 1);
1420 tcg_temp_free(mask
);
1424 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1425 const uint32_t par
[])
1427 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1430 static void translate_ball(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_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1439 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1440 const uint32_t par
[])
1442 TCGv_i32 tmp
= tcg_temp_new_i32();
1443 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1444 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1448 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1449 const uint32_t par
[])
1451 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1454 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1455 const uint32_t par
[])
1457 #ifdef TARGET_WORDS_BIGENDIAN
1458 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1460 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1462 TCGv_i32 tmp
= tcg_temp_new_i32();
1463 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1464 #ifdef TARGET_WORDS_BIGENDIAN
1465 tcg_gen_shr_i32(bit
, bit
, tmp
);
1467 tcg_gen_shl_i32(bit
, bit
, tmp
);
1469 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1470 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1475 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1476 const uint32_t par
[])
1478 TCGv_i32 tmp
= tcg_temp_new_i32();
1479 #ifdef TARGET_WORDS_BIGENDIAN
1480 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1482 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1484 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1488 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1489 const uint32_t par
[])
1491 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1494 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1495 const uint32_t par
[])
1497 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1508 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1509 const uint32_t par
[])
1511 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1512 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1513 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1514 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1515 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1516 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1519 TCGv_i32 tmp1
= tcg_temp_new_i32();
1520 TCGv_i32 tmp2
= tcg_temp_new_i32();
1522 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1523 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1524 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1525 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1526 tcg_temp_free(tmp1
);
1527 tcg_temp_free(tmp2
);
1530 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1531 const uint32_t par
[])
1533 TCGv_i32 tmp
= tcg_temp_new_i32();
1535 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1536 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1540 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1541 const uint32_t par
[])
1543 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1544 gen_jumpi(dc
, arg
[0].imm
, 0);
1547 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1548 const uint32_t par
[])
1550 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1551 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1555 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1556 const uint32_t par
[])
1558 TCGv_i32 tmp
= tcg_temp_new_i32();
1559 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1560 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1565 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1566 const uint32_t par
[])
1568 TCGv_i32 tmp
= tcg_temp_new_i32();
1570 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1571 gen_callw_slot(dc
, par
[0], tmp
, -1);
1575 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1576 const uint32_t par
[])
1578 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1579 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1581 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1582 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1583 tcg_temp_free(tmp1
);
1584 tcg_temp_free(tmp2
);
1587 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1588 const uint32_t par
[])
1590 /* TODO: GPIO32 may be a part of coprocessor */
1591 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1594 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1595 const uint32_t par
[])
1597 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1600 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1601 const uint32_t par
[])
1603 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1605 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1609 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1610 const uint32_t par
[])
1612 TCGv_i32 addr
= tcg_temp_new_i32();
1613 TCGv_i32 res
= tcg_temp_new_i32();
1615 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1616 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1617 tcg_temp_free(addr
);
1621 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1622 const uint32_t par
[])
1624 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1625 arg
[2].imm
, arg
[3].imm
);
1628 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1629 const uint32_t par
[])
1631 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1634 static bool test_ill_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1635 const uint32_t par
[])
1637 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1638 qemu_log_mask(LOG_GUEST_ERROR
,
1639 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1646 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1647 const uint32_t par
[])
1649 return 1 << (dc
->callinc
* 4);
1652 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1653 const uint32_t par
[])
1655 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1656 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1657 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1658 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1664 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1665 const uint32_t par
[])
1667 int maskimm
= (1 << arg
[3].imm
) - 1;
1669 TCGv_i32 tmp
= tcg_temp_new_i32();
1670 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1671 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1675 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1676 const uint32_t par
[])
1678 TCGv_i32 tmp
= tcg_temp_new_i32();
1680 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1681 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1682 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1686 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1687 const uint32_t par
[])
1689 #ifndef CONFIG_USER_ONLY
1690 TCGv_i32 addr
= tcg_temp_new_i32();
1692 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1693 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1694 gen_helper_itlb_hit_test(cpu_env
, addr
);
1695 tcg_temp_free(addr
);
1699 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1700 const uint32_t par
[])
1702 #ifndef CONFIG_USER_ONLY
1703 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1705 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1706 tcg_temp_free(dtlb
);
1710 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1711 const uint32_t par
[])
1713 gen_jumpi(dc
, arg
[0].imm
, 0);
1716 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1717 const uint32_t par
[])
1719 gen_jump(dc
, arg
[0].in
);
1722 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1723 const uint32_t par
[])
1725 TCGv_i32 addr
= tcg_temp_new_i32();
1727 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1728 gen_load_store_alignment(dc
, 2, addr
, false);
1729 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1730 tcg_temp_free(addr
);
1733 #ifdef CONFIG_USER_ONLY
1734 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1738 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1740 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1741 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1742 TCGv_i32 write
= tcg_const_i32(is_write
);
1744 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1746 tcg_temp_free(write
);
1751 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1752 const uint32_t par
[])
1754 TCGv_i32 addr
= tcg_temp_new_i32();
1756 tcg_gen_mov_i32(addr
, arg
[1].in
);
1757 gen_load_store_alignment(dc
, 2, addr
, true);
1758 gen_check_exclusive(dc
, addr
, false);
1759 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1760 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1761 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1762 tcg_temp_free(addr
);
1765 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1766 const uint32_t par
[])
1768 TCGv_i32 addr
= tcg_temp_new_i32();
1770 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1771 if (par
[0] & MO_SIZE
) {
1772 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1776 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1778 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, par
[0]);
1780 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, par
[0]);
1782 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1785 tcg_temp_free(addr
);
1788 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1789 const uint32_t par
[])
1793 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1794 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1795 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1797 tmp
= tcg_const_i32(arg
[1].imm
);
1799 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1803 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1804 const uint32_t par
[])
1806 uint32_t lend
= arg
[1].imm
;
1808 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1809 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1810 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1812 if (par
[0] != TCG_COND_NEVER
) {
1813 TCGLabel
*label
= gen_new_label();
1814 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1815 gen_jumpi(dc
, lend
, 1);
1816 gen_set_label(label
);
1819 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1840 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1841 const uint32_t par
[])
1844 unsigned half
= par
[1];
1845 uint32_t ld_offset
= par
[2];
1846 unsigned off
= ld_offset
? 2 : 0;
1847 TCGv_i32 vaddr
= tcg_temp_new_i32();
1848 TCGv_i32 mem32
= tcg_temp_new_i32();
1851 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1852 gen_load_store_alignment(dc
, 2, vaddr
, false);
1853 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1855 if (op
!= MAC16_NONE
) {
1856 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1857 half
& MAC16_HX
, op
== MAC16_UMUL
);
1858 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1859 half
& MAC16_XH
, op
== MAC16_UMUL
);
1861 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1862 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1863 if (op
== MAC16_UMUL
) {
1864 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1866 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1869 TCGv_i32 lo
= tcg_temp_new_i32();
1870 TCGv_i32 hi
= tcg_temp_new_i32();
1872 tcg_gen_mul_i32(lo
, m1
, m2
);
1873 tcg_gen_sari_i32(hi
, lo
, 31);
1874 if (op
== MAC16_MULA
) {
1875 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1876 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1879 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1880 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1883 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1885 tcg_temp_free_i32(lo
);
1886 tcg_temp_free_i32(hi
);
1892 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1893 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1895 tcg_temp_free(vaddr
);
1896 tcg_temp_free(mem32
);
1899 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1900 const uint32_t par
[])
1902 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1905 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1906 const uint32_t par
[])
1908 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1911 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1912 const uint32_t par
[])
1914 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1917 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1918 const uint32_t par
[])
1920 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1923 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1924 const uint32_t par
[])
1926 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1929 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1930 const uint32_t par
[])
1932 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1935 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1936 const uint32_t par
[])
1938 TCGv_i32 zero
= tcg_const_i32(0);
1940 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1941 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1942 tcg_temp_free(zero
);
1945 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1946 const uint32_t par
[])
1948 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1951 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1952 const uint32_t par
[])
1954 TCGv_i32 zero
= tcg_const_i32(0);
1955 TCGv_i32 tmp
= tcg_temp_new_i32();
1957 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1958 tcg_gen_movcond_i32(par
[0],
1959 arg
[0].out
, tmp
, zero
,
1960 arg
[1].in
, arg
[0].in
);
1962 tcg_temp_free(zero
);
1965 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1966 const uint32_t par
[])
1968 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1971 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1972 const uint32_t par
[])
1974 TCGv_i32 v1
= tcg_temp_new_i32();
1975 TCGv_i32 v2
= tcg_temp_new_i32();
1978 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1979 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1981 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1982 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1984 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1989 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1990 const uint32_t par
[])
1992 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1995 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1996 const uint32_t par
[])
1998 TCGv_i32 lo
= tcg_temp_new();
2001 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2003 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2008 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
2009 const uint32_t par
[])
2011 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2014 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2015 const uint32_t par
[])
2019 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2020 const uint32_t par
[])
2022 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2025 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2026 const uint32_t par
[])
2028 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2031 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2032 const uint32_t par
[])
2034 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2037 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2038 const uint32_t par
[])
2040 #ifndef CONFIG_USER_ONLY
2041 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2043 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2044 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2045 tcg_temp_free(dtlb
);
2049 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2050 const uint32_t par
[])
2052 #ifndef CONFIG_USER_ONLY
2053 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2054 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2058 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2059 const uint32_t par
[])
2061 TCGLabel
*label1
= gen_new_label();
2062 TCGLabel
*label2
= gen_new_label();
2064 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2066 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2068 tcg_gen_movi_i32(arg
[0].out
,
2069 par
[0] ? 0x80000000 : 0);
2071 gen_set_label(label1
);
2073 tcg_gen_div_i32(arg
[0].out
,
2074 arg
[1].in
, arg
[2].in
);
2076 tcg_gen_rem_i32(arg
[0].out
,
2077 arg
[1].in
, arg
[2].in
);
2079 gen_set_label(label2
);
2082 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2083 const uint32_t par
[])
2085 tcg_gen_divu_i32(arg
[0].out
,
2086 arg
[1].in
, arg
[2].in
);
2089 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2090 const uint32_t par
[])
2092 /* TODO: GPIO32 may be a part of coprocessor */
2093 tcg_gen_movi_i32(arg
[0].out
, 0);
2096 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2097 const uint32_t par
[])
2099 tcg_gen_remu_i32(arg
[0].out
,
2100 arg
[1].in
, arg
[2].in
);
2103 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2104 const uint32_t par
[])
2106 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2109 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2110 const uint32_t par
[])
2112 gen_jump(dc
, cpu_R
[0]);
2115 static bool test_ill_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2116 const uint32_t par
[])
2119 qemu_log_mask(LOG_GUEST_ERROR
,
2120 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2123 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2125 gen_helper_test_ill_retw(cpu_env
, tmp
);
2131 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2132 const uint32_t par
[])
2134 TCGv_i32 tmp
= tcg_const_i32(1);
2135 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2136 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2137 cpu_SR
[WINDOW_START
], tmp
);
2138 tcg_gen_movi_i32(tmp
, dc
->pc
);
2139 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2140 gen_helper_retw(cpu_env
, cpu_R
[0]);
2145 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2146 const uint32_t par
[])
2148 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2151 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2152 const uint32_t par
[])
2154 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2155 gen_jump(dc
, cpu_SR
[EPC1
]);
2158 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2159 const uint32_t par
[])
2161 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2162 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2165 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2166 const uint32_t par
[])
2168 TCGv_i32 tmp
= tcg_const_i32(1);
2170 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2171 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2174 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2175 cpu_SR
[WINDOW_START
], tmp
);
2177 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2178 cpu_SR
[WINDOW_START
], tmp
);
2182 gen_helper_restore_owb(cpu_env
);
2183 gen_jump(dc
, cpu_SR
[EPC1
]);
2186 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2187 const uint32_t par
[])
2189 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2192 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2193 const uint32_t par
[])
2195 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2196 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2197 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2200 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2201 const uint32_t par
[])
2203 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2206 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2207 const uint32_t par
[])
2209 #ifndef CONFIG_USER_ONLY
2210 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2213 gen_helper_update_ccount(cpu_env
);
2214 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2218 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2219 const uint32_t par
[])
2221 #ifndef CONFIG_USER_ONLY
2222 TCGv_i32 tmp
= tcg_temp_new_i32();
2224 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2225 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2226 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2231 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2232 const uint32_t par
[])
2234 #ifndef CONFIG_USER_ONLY
2235 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2240 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2242 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2243 tcg_temp_free(dtlb
);
2247 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2248 const uint32_t par
[])
2250 #ifndef CONFIG_USER_ONLY
2251 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2255 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2256 const uint32_t par
[])
2258 #ifndef CONFIG_USER_ONLY
2259 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2263 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2264 const uint32_t par
[])
2266 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2269 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2270 const uint32_t par
[])
2272 /* TODO: GPIO32 may be a part of coprocessor */
2273 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2276 #ifdef CONFIG_USER_ONLY
2277 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2281 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2283 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2285 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2290 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2291 const uint32_t par
[])
2293 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2294 TCGv_i32 addr
= tcg_temp_local_new_i32();
2296 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2297 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2298 gen_load_store_alignment(dc
, 2, addr
, true);
2299 gen_check_atomctl(dc
, addr
);
2300 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2301 tmp
, dc
->cring
, MO_TEUL
);
2302 tcg_temp_free(addr
);
2306 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2307 const uint32_t par
[])
2309 TCGv_i32 addr
= tcg_temp_new_i32();
2311 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2312 gen_load_store_alignment(dc
, 2, addr
, false);
2313 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, MO_TEUL
);
2314 tcg_temp_free(addr
);
2317 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2318 const uint32_t par
[])
2320 TCGv_i32 prev
= tcg_temp_new_i32();
2321 TCGv_i32 addr
= tcg_temp_local_new_i32();
2322 TCGv_i32 res
= tcg_temp_local_new_i32();
2323 TCGLabel
*label
= gen_new_label();
2325 tcg_gen_movi_i32(res
, 0);
2326 tcg_gen_mov_i32(addr
, arg
[1].in
);
2327 gen_load_store_alignment(dc
, 2, addr
, true);
2328 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2329 gen_check_exclusive(dc
, addr
, true);
2330 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2331 arg
[0].in
, dc
->cring
, MO_TEUL
);
2332 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2333 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2334 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2335 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2336 gen_set_label(label
);
2337 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2338 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2339 tcg_temp_free(prev
);
2340 tcg_temp_free(addr
);
2344 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2345 const uint32_t par
[])
2347 tcg_gen_setcond_i32(par
[0],
2349 arg
[1].in
, arg
[2].in
);
2352 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2353 const uint32_t par
[])
2355 int shift
= 31 - arg
[2].imm
;
2358 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2359 } else if (shift
== 16) {
2360 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2362 TCGv_i32 tmp
= tcg_temp_new_i32();
2363 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2364 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2369 static bool test_ill_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2370 const uint32_t par
[])
2372 #ifdef CONFIG_USER_ONLY
2375 bool ill
= !semihosting_enabled();
2378 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2383 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2384 const uint32_t par
[])
2386 #ifndef CONFIG_USER_ONLY
2387 gen_helper_simcall(cpu_env
);
2392 * Note: 64 bit ops are used here solely because SAR values
2395 #define gen_shift_reg(cmd, reg) do { \
2396 TCGv_i64 tmp = tcg_temp_new_i64(); \
2397 tcg_gen_extu_i32_i64(tmp, reg); \
2398 tcg_gen_##cmd##_i64(v, v, tmp); \
2399 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2400 tcg_temp_free_i64(v); \
2401 tcg_temp_free_i64(tmp); \
2404 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2406 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2407 const uint32_t par
[])
2409 if (dc
->sar_m32_5bit
) {
2410 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2412 TCGv_i64 v
= tcg_temp_new_i64();
2413 TCGv_i32 s
= tcg_const_i32(32);
2414 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2415 tcg_gen_andi_i32(s
, s
, 0x3f);
2416 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2417 gen_shift_reg(shl
, s
);
2422 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2423 const uint32_t par
[])
2425 if (arg
[2].imm
== 32) {
2426 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2427 arg
[0].imm
, arg
[1].imm
);
2429 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2432 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2433 const uint32_t par
[])
2435 if (dc
->sar_m32_5bit
) {
2436 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2438 TCGv_i64 v
= tcg_temp_new_i64();
2439 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2444 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2445 const uint32_t par
[])
2447 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2450 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2451 const uint32_t par
[])
2453 TCGv_i64 v
= tcg_temp_new_i64();
2454 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2458 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2459 const uint32_t par
[])
2461 if (dc
->sar_m32_5bit
) {
2462 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2464 TCGv_i64 v
= tcg_temp_new_i64();
2465 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2471 #undef gen_shift_reg
2473 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2474 const uint32_t par
[])
2476 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2479 static void translate_ssa8b(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_left_shift_sar(dc
, tmp
);
2488 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2489 const uint32_t par
[])
2491 TCGv_i32 tmp
= tcg_temp_new_i32();
2492 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2493 gen_right_shift_sar(dc
, tmp
);
2497 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2498 const uint32_t par
[])
2500 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2501 gen_right_shift_sar(dc
, tmp
);
2505 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2506 const uint32_t par
[])
2508 gen_left_shift_sar(dc
, arg
[0].in
);
2511 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2512 const uint32_t par
[])
2514 gen_right_shift_sar(dc
, arg
[0].in
);
2517 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2518 const uint32_t par
[])
2520 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2523 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2524 const uint32_t par
[])
2526 TCGv_i32 tmp
= tcg_temp_new_i32();
2527 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2528 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2532 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2533 const uint32_t par
[])
2535 #ifndef CONFIG_USER_ONLY
2536 gen_waiti(dc
, arg
[0].imm
);
2540 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2541 const uint32_t par
[])
2543 #ifndef CONFIG_USER_ONLY
2544 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2546 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2547 tcg_temp_free(dtlb
);
2551 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2552 const uint32_t par
[])
2554 #ifndef CONFIG_USER_ONLY
2555 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2559 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2560 const uint32_t par
[])
2562 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2565 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2566 const uint32_t par
[])
2568 /* TODO: GPIO32 may be a part of coprocessor */
2569 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2572 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2573 const uint32_t par
[])
2575 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2578 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2579 const uint32_t par
[])
2581 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2584 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2585 const uint32_t par
[])
2587 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2590 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2591 const uint32_t par
[])
2593 #ifndef CONFIG_USER_ONLY
2594 uint32_t id
= par
[0] - CCOMPARE
;
2595 TCGv_i32 tmp
= tcg_const_i32(id
);
2597 assert(id
< dc
->config
->nccompare
);
2598 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2601 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2602 gen_helper_update_ccompare(cpu_env
, tmp
);
2607 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2608 const uint32_t par
[])
2610 #ifndef CONFIG_USER_ONLY
2611 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2614 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2618 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2619 const uint32_t par
[])
2621 #ifndef CONFIG_USER_ONLY
2622 unsigned id
= par
[0] - DBREAKA
;
2623 TCGv_i32 tmp
= tcg_const_i32(id
);
2625 assert(id
< dc
->config
->ndbreak
);
2626 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2631 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2632 const uint32_t par
[])
2634 #ifndef CONFIG_USER_ONLY
2635 unsigned id
= par
[0] - DBREAKC
;
2636 TCGv_i32 tmp
= tcg_const_i32(id
);
2638 assert(id
< dc
->config
->ndbreak
);
2639 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2644 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2645 const uint32_t par
[])
2647 #ifndef CONFIG_USER_ONLY
2648 unsigned id
= par
[0] - IBREAKA
;
2649 TCGv_i32 tmp
= tcg_const_i32(id
);
2651 assert(id
< dc
->config
->nibreak
);
2652 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2657 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2658 const uint32_t par
[])
2660 #ifndef CONFIG_USER_ONLY
2661 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2665 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2666 const uint32_t par
[])
2668 #ifndef CONFIG_USER_ONLY
2670 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2672 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2677 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2678 const uint32_t par
[])
2680 #ifndef CONFIG_USER_ONLY
2681 gen_helper_intclear(cpu_env
, arg
[0].in
);
2685 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2686 const uint32_t par
[])
2688 #ifndef CONFIG_USER_ONLY
2689 gen_helper_intset(cpu_env
, arg
[0].in
);
2693 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2694 const uint32_t par
[])
2696 #ifndef CONFIG_USER_ONLY
2697 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2701 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2702 const uint32_t par
[])
2704 #ifndef CONFIG_USER_ONLY
2705 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2709 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2710 const uint32_t par
[])
2712 #ifndef CONFIG_USER_ONLY
2713 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2714 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2716 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2717 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2720 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2724 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2725 const uint32_t par
[])
2727 #ifndef CONFIG_USER_ONLY
2728 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2732 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2733 const uint32_t par
[])
2735 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2736 if (dc
->sar_m32_5bit
) {
2737 tcg_gen_discard_i32(dc
->sar_m32
);
2739 dc
->sar_5bit
= false;
2740 dc
->sar_m32_5bit
= false;
2743 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2744 const uint32_t par
[])
2746 #ifndef CONFIG_USER_ONLY
2747 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2751 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2752 const uint32_t par
[])
2754 #ifndef CONFIG_USER_ONLY
2755 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2756 (1 << dc
->config
->nareg
/ 4) - 1);
2760 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2761 const uint32_t par
[])
2763 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2766 static void translate_wur_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
2767 const uint32_t par
[])
2769 gen_helper_wur_fcr(cpu_env
, arg
[0].in
);
2772 static void translate_wur_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
2773 const uint32_t par
[])
2775 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
2778 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2779 const uint32_t par
[])
2781 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2784 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2785 const uint32_t par
[])
2787 TCGv_i32 tmp
= tcg_temp_new_i32();
2789 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2790 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2791 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2795 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2796 const uint32_t par
[])
2798 TCGv_i32 tmp
= tcg_temp_new_i32();
2800 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2801 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2802 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2806 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2807 const uint32_t par
[])
2809 #ifndef CONFIG_USER_ONLY
2810 TCGv_i32 tmp
= tcg_temp_new_i32();
2812 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2816 gen_helper_update_ccount(cpu_env
);
2817 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2818 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2819 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2825 #define gen_translate_xsr(name) \
2826 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2827 const uint32_t par[]) \
2829 TCGv_i32 tmp = tcg_temp_new_i32(); \
2831 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2832 translate_wsr_##name(dc, arg, par); \
2833 tcg_gen_mov_i32(arg[0].out, tmp); \
2834 tcg_temp_free(tmp); \
2837 gen_translate_xsr(acchi
)
2838 gen_translate_xsr(ccompare
)
2839 gen_translate_xsr(dbreaka
)
2840 gen_translate_xsr(dbreakc
)
2841 gen_translate_xsr(ibreaka
)
2842 gen_translate_xsr(ibreakenable
)
2843 gen_translate_xsr(icount
)
2844 gen_translate_xsr(memctl
)
2845 gen_translate_xsr(mpuenb
)
2846 gen_translate_xsr(ps
)
2847 gen_translate_xsr(rasid
)
2848 gen_translate_xsr(sar
)
2849 gen_translate_xsr(windowbase
)
2850 gen_translate_xsr(windowstart
)
2852 #undef gen_translate_xsr
2854 static const XtensaOpcodeOps core_ops
[] = {
2857 .translate
= translate_abs
,
2859 .name
= (const char * const[]) {
2860 "add", "add.n", NULL
,
2862 .translate
= translate_add
,
2863 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2865 .name
= (const char * const[]) {
2866 "addi", "addi.n", NULL
,
2868 .translate
= translate_addi
,
2869 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2872 .translate
= translate_addi
,
2875 .translate
= translate_addx
,
2876 .par
= (const uint32_t[]){1},
2879 .translate
= translate_addx
,
2880 .par
= (const uint32_t[]){2},
2883 .translate
= translate_addx
,
2884 .par
= (const uint32_t[]){3},
2887 .translate
= translate_all
,
2888 .par
= (const uint32_t[]){true, 4},
2891 .translate
= translate_all
,
2892 .par
= (const uint32_t[]){true, 8},
2895 .translate
= translate_and
,
2898 .translate
= translate_boolean
,
2899 .par
= (const uint32_t[]){BOOLEAN_AND
},
2902 .translate
= translate_boolean
,
2903 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2906 .translate
= translate_all
,
2907 .par
= (const uint32_t[]){false, 4},
2910 .translate
= translate_all
,
2911 .par
= (const uint32_t[]){false, 8},
2913 .name
= (const char * const[]) {
2914 "ball", "ball.w15", "ball.w18", NULL
,
2916 .translate
= translate_ball
,
2917 .par
= (const uint32_t[]){TCG_COND_EQ
},
2918 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2920 .name
= (const char * const[]) {
2921 "bany", "bany.w15", "bany.w18", NULL
,
2923 .translate
= translate_bany
,
2924 .par
= (const uint32_t[]){TCG_COND_NE
},
2925 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2927 .name
= (const char * const[]) {
2928 "bbc", "bbc.w15", "bbc.w18", NULL
,
2930 .translate
= translate_bb
,
2931 .par
= (const uint32_t[]){TCG_COND_EQ
},
2932 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2934 .name
= (const char * const[]) {
2935 "bbci", "bbci.w15", "bbci.w18", NULL
,
2937 .translate
= translate_bbi
,
2938 .par
= (const uint32_t[]){TCG_COND_EQ
},
2939 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2941 .name
= (const char * const[]) {
2942 "bbs", "bbs.w15", "bbs.w18", NULL
,
2944 .translate
= translate_bb
,
2945 .par
= (const uint32_t[]){TCG_COND_NE
},
2946 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2948 .name
= (const char * const[]) {
2949 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2951 .translate
= translate_bbi
,
2952 .par
= (const uint32_t[]){TCG_COND_NE
},
2953 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2955 .name
= (const char * const[]) {
2956 "beq", "beq.w15", "beq.w18", NULL
,
2958 .translate
= translate_b
,
2959 .par
= (const uint32_t[]){TCG_COND_EQ
},
2960 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2962 .name
= (const char * const[]) {
2963 "beqi", "beqi.w15", "beqi.w18", NULL
,
2965 .translate
= translate_bi
,
2966 .par
= (const uint32_t[]){TCG_COND_EQ
},
2967 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2969 .name
= (const char * const[]) {
2970 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2972 .translate
= translate_bz
,
2973 .par
= (const uint32_t[]){TCG_COND_EQ
},
2974 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2977 .translate
= translate_bp
,
2978 .par
= (const uint32_t[]){TCG_COND_EQ
},
2980 .name
= (const char * const[]) {
2981 "bge", "bge.w15", "bge.w18", NULL
,
2983 .translate
= translate_b
,
2984 .par
= (const uint32_t[]){TCG_COND_GE
},
2985 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2987 .name
= (const char * const[]) {
2988 "bgei", "bgei.w15", "bgei.w18", NULL
,
2990 .translate
= translate_bi
,
2991 .par
= (const uint32_t[]){TCG_COND_GE
},
2992 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2994 .name
= (const char * const[]) {
2995 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
2997 .translate
= translate_b
,
2998 .par
= (const uint32_t[]){TCG_COND_GEU
},
2999 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3001 .name
= (const char * const[]) {
3002 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
3004 .translate
= translate_bi
,
3005 .par
= (const uint32_t[]){TCG_COND_GEU
},
3006 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3008 .name
= (const char * const[]) {
3009 "bgez", "bgez.w15", "bgez.w18", NULL
,
3011 .translate
= translate_bz
,
3012 .par
= (const uint32_t[]){TCG_COND_GE
},
3013 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3015 .name
= (const char * const[]) {
3016 "blt", "blt.w15", "blt.w18", NULL
,
3018 .translate
= translate_b
,
3019 .par
= (const uint32_t[]){TCG_COND_LT
},
3020 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3022 .name
= (const char * const[]) {
3023 "blti", "blti.w15", "blti.w18", NULL
,
3025 .translate
= translate_bi
,
3026 .par
= (const uint32_t[]){TCG_COND_LT
},
3027 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3029 .name
= (const char * const[]) {
3030 "bltu", "bltu.w15", "bltu.w18", NULL
,
3032 .translate
= translate_b
,
3033 .par
= (const uint32_t[]){TCG_COND_LTU
},
3034 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3036 .name
= (const char * const[]) {
3037 "bltui", "bltui.w15", "bltui.w18", NULL
,
3039 .translate
= translate_bi
,
3040 .par
= (const uint32_t[]){TCG_COND_LTU
},
3041 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3043 .name
= (const char * const[]) {
3044 "bltz", "bltz.w15", "bltz.w18", NULL
,
3046 .translate
= translate_bz
,
3047 .par
= (const uint32_t[]){TCG_COND_LT
},
3048 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3050 .name
= (const char * const[]) {
3051 "bnall", "bnall.w15", "bnall.w18", NULL
,
3053 .translate
= translate_ball
,
3054 .par
= (const uint32_t[]){TCG_COND_NE
},
3055 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3057 .name
= (const char * const[]) {
3058 "bne", "bne.w15", "bne.w18", NULL
,
3060 .translate
= translate_b
,
3061 .par
= (const uint32_t[]){TCG_COND_NE
},
3062 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3064 .name
= (const char * const[]) {
3065 "bnei", "bnei.w15", "bnei.w18", NULL
,
3067 .translate
= translate_bi
,
3068 .par
= (const uint32_t[]){TCG_COND_NE
},
3069 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3071 .name
= (const char * const[]) {
3072 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3074 .translate
= translate_bz
,
3075 .par
= (const uint32_t[]){TCG_COND_NE
},
3076 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3078 .name
= (const char * const[]) {
3079 "bnone", "bnone.w15", "bnone.w18", NULL
,
3081 .translate
= translate_bany
,
3082 .par
= (const uint32_t[]){TCG_COND_EQ
},
3083 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3086 .translate
= translate_nop
,
3087 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3088 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3091 .translate
= translate_nop
,
3092 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3093 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3096 .translate
= translate_bp
,
3097 .par
= (const uint32_t[]){TCG_COND_NE
},
3100 .translate
= translate_call0
,
3103 .translate
= translate_callw
,
3104 .par
= (const uint32_t[]){3},
3107 .translate
= translate_callw
,
3108 .par
= (const uint32_t[]){1},
3111 .translate
= translate_callw
,
3112 .par
= (const uint32_t[]){2},
3115 .translate
= translate_callx0
,
3118 .translate
= translate_callxw
,
3119 .par
= (const uint32_t[]){3},
3122 .translate
= translate_callxw
,
3123 .par
= (const uint32_t[]){1},
3126 .translate
= translate_callxw
,
3127 .par
= (const uint32_t[]){2},
3130 .translate
= translate_clamps
,
3132 .name
= "clrb_expstate",
3133 .translate
= translate_clrb_expstate
,
3136 .translate
= translate_clrex
,
3139 .translate
= translate_const16
,
3142 .translate
= translate_depbits
,
3145 .translate
= translate_dcache
,
3146 .op_flags
= XTENSA_OP_PRIVILEGED
,
3149 .translate
= translate_nop
,
3152 .translate
= translate_dcache
,
3153 .op_flags
= XTENSA_OP_PRIVILEGED
,
3156 .translate
= translate_dcache
,
3159 .translate
= translate_nop
,
3162 .translate
= translate_dcache
,
3165 .translate
= translate_nop
,
3168 .translate
= translate_nop
,
3169 .op_flags
= XTENSA_OP_PRIVILEGED
,
3172 .translate
= translate_nop
,
3173 .op_flags
= XTENSA_OP_PRIVILEGED
,
3176 .translate
= translate_nop
,
3177 .op_flags
= XTENSA_OP_PRIVILEGED
,
3180 .translate
= translate_nop
,
3181 .op_flags
= XTENSA_OP_PRIVILEGED
,
3184 .translate
= translate_diwbuip
,
3185 .op_flags
= XTENSA_OP_PRIVILEGED
,
3188 .translate
= translate_dcache
,
3189 .op_flags
= XTENSA_OP_PRIVILEGED
,
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_nop
,
3219 .translate
= translate_nop
,
3222 .translate
= translate_nop
,
3225 .translate
= translate_entry
,
3226 .test_ill
= test_ill_entry
,
3227 .test_overflow
= test_overflow_entry
,
3228 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3229 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3232 .translate
= translate_nop
,
3235 .translate
= translate_nop
,
3238 .translate
= translate_extui
,
3241 .translate
= translate_memw
,
3244 .translate
= translate_getex
,
3247 .op_flags
= XTENSA_OP_ILL
,
3250 .op_flags
= XTENSA_OP_ILL
,
3253 .translate
= translate_itlb
,
3254 .par
= (const uint32_t[]){true},
3255 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3258 .translate
= translate_icache
,
3261 .translate
= translate_icache
,
3262 .op_flags
= XTENSA_OP_PRIVILEGED
,
3265 .translate
= translate_nop
,
3266 .op_flags
= XTENSA_OP_PRIVILEGED
,
3269 .translate
= translate_itlb
,
3270 .par
= (const uint32_t[]){false},
3271 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3274 .translate
= translate_nop
,
3275 .op_flags
= XTENSA_OP_PRIVILEGED
,
3277 .name
= (const char * const[]) {
3278 "ill", "ill.n", NULL
,
3280 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3283 .translate
= translate_nop
,
3286 .translate
= translate_icache
,
3287 .op_flags
= XTENSA_OP_PRIVILEGED
,
3290 .translate
= translate_nop
,
3293 .translate
= translate_j
,
3296 .translate
= translate_jx
,
3299 .translate
= translate_ldst
,
3300 .par
= (const uint32_t[]){MO_TESW
, false, false},
3301 .op_flags
= XTENSA_OP_LOAD
,
3304 .translate
= translate_ldst
,
3305 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3306 .op_flags
= XTENSA_OP_LOAD
,
3309 .translate
= translate_ldst
,
3310 .par
= (const uint32_t[]){MO_TEUL
, true, false},
3311 .op_flags
= XTENSA_OP_LOAD
,
3314 .translate
= translate_l32e
,
3315 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3318 .translate
= translate_l32ex
,
3319 .op_flags
= XTENSA_OP_LOAD
,
3321 .name
= (const char * const[]) {
3322 "l32i", "l32i.n", NULL
,
3324 .translate
= translate_ldst
,
3325 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3326 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3329 .translate
= translate_l32r
,
3330 .op_flags
= XTENSA_OP_LOAD
,
3333 .translate
= translate_ldst
,
3334 .par
= (const uint32_t[]){MO_UB
, false, false},
3335 .op_flags
= XTENSA_OP_LOAD
,
3338 .translate
= translate_mac16
,
3339 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3340 .op_flags
= XTENSA_OP_LOAD
,
3343 .translate
= translate_mac16
,
3344 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3345 .op_flags
= XTENSA_OP_LOAD
,
3348 .op_flags
= XTENSA_OP_ILL
,
3350 .name
= (const char * const[]) {
3351 "loop", "loop.w15", NULL
,
3353 .translate
= translate_loop
,
3354 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3355 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3357 .name
= (const char * const[]) {
3358 "loopgtz", "loopgtz.w15", NULL
,
3360 .translate
= translate_loop
,
3361 .par
= (const uint32_t[]){TCG_COND_GT
},
3362 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3364 .name
= (const char * const[]) {
3365 "loopnez", "loopnez.w15", NULL
,
3367 .translate
= translate_loop
,
3368 .par
= (const uint32_t[]){TCG_COND_NE
},
3369 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3372 .translate
= translate_smax
,
3375 .translate
= translate_umax
,
3378 .translate
= translate_memw
,
3381 .translate
= translate_smin
,
3384 .translate
= translate_umin
,
3386 .name
= (const char * const[]) {
3387 "mov", "mov.n", NULL
,
3389 .translate
= translate_mov
,
3390 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3393 .translate
= translate_movcond
,
3394 .par
= (const uint32_t[]){TCG_COND_EQ
},
3397 .translate
= translate_movp
,
3398 .par
= (const uint32_t[]){TCG_COND_EQ
},
3401 .translate
= translate_movcond
,
3402 .par
= (const uint32_t[]){TCG_COND_GE
},
3405 .translate
= translate_movi
,
3408 .translate
= translate_movi
,
3411 .translate
= translate_movcond
,
3412 .par
= (const uint32_t[]){TCG_COND_LT
},
3415 .translate
= translate_movcond
,
3416 .par
= (const uint32_t[]){TCG_COND_NE
},
3419 .translate
= translate_movsp
,
3420 .op_flags
= XTENSA_OP_ALLOCA
,
3423 .translate
= translate_movp
,
3424 .par
= (const uint32_t[]){TCG_COND_NE
},
3426 .name
= "mul.aa.hh",
3427 .translate
= translate_mac16
,
3428 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3430 .name
= "mul.aa.hl",
3431 .translate
= translate_mac16
,
3432 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3434 .name
= "mul.aa.lh",
3435 .translate
= translate_mac16
,
3436 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3438 .name
= "mul.aa.ll",
3439 .translate
= translate_mac16
,
3440 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3442 .name
= "mul.ad.hh",
3443 .translate
= translate_mac16
,
3444 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3446 .name
= "mul.ad.hl",
3447 .translate
= translate_mac16
,
3448 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3450 .name
= "mul.ad.lh",
3451 .translate
= translate_mac16
,
3452 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3454 .name
= "mul.ad.ll",
3455 .translate
= translate_mac16
,
3456 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3458 .name
= "mul.da.hh",
3459 .translate
= translate_mac16
,
3460 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3462 .name
= "mul.da.hl",
3463 .translate
= translate_mac16
,
3464 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3466 .name
= "mul.da.lh",
3467 .translate
= translate_mac16
,
3468 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3470 .name
= "mul.da.ll",
3471 .translate
= translate_mac16
,
3472 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3474 .name
= "mul.dd.hh",
3475 .translate
= translate_mac16
,
3476 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3478 .name
= "mul.dd.hl",
3479 .translate
= translate_mac16
,
3480 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3482 .name
= "mul.dd.lh",
3483 .translate
= translate_mac16
,
3484 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3486 .name
= "mul.dd.ll",
3487 .translate
= translate_mac16
,
3488 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3491 .translate
= translate_mul16
,
3492 .par
= (const uint32_t[]){true},
3495 .translate
= translate_mul16
,
3496 .par
= (const uint32_t[]){false},
3498 .name
= "mula.aa.hh",
3499 .translate
= translate_mac16
,
3500 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3502 .name
= "mula.aa.hl",
3503 .translate
= translate_mac16
,
3504 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3506 .name
= "mula.aa.lh",
3507 .translate
= translate_mac16
,
3508 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3510 .name
= "mula.aa.ll",
3511 .translate
= translate_mac16
,
3512 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3514 .name
= "mula.ad.hh",
3515 .translate
= translate_mac16
,
3516 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3518 .name
= "mula.ad.hl",
3519 .translate
= translate_mac16
,
3520 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3522 .name
= "mula.ad.lh",
3523 .translate
= translate_mac16
,
3524 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3526 .name
= "mula.ad.ll",
3527 .translate
= translate_mac16
,
3528 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3530 .name
= "mula.da.hh",
3531 .translate
= translate_mac16
,
3532 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3534 .name
= "mula.da.hh.lddec",
3535 .translate
= translate_mac16
,
3536 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3538 .name
= "mula.da.hh.ldinc",
3539 .translate
= translate_mac16
,
3540 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3542 .name
= "mula.da.hl",
3543 .translate
= translate_mac16
,
3544 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3546 .name
= "mula.da.hl.lddec",
3547 .translate
= translate_mac16
,
3548 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3550 .name
= "mula.da.hl.ldinc",
3551 .translate
= translate_mac16
,
3552 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3554 .name
= "mula.da.lh",
3555 .translate
= translate_mac16
,
3556 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3558 .name
= "mula.da.lh.lddec",
3559 .translate
= translate_mac16
,
3560 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3562 .name
= "mula.da.lh.ldinc",
3563 .translate
= translate_mac16
,
3564 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3566 .name
= "mula.da.ll",
3567 .translate
= translate_mac16
,
3568 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3570 .name
= "mula.da.ll.lddec",
3571 .translate
= translate_mac16
,
3572 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3574 .name
= "mula.da.ll.ldinc",
3575 .translate
= translate_mac16
,
3576 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3578 .name
= "mula.dd.hh",
3579 .translate
= translate_mac16
,
3580 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3582 .name
= "mula.dd.hh.lddec",
3583 .translate
= translate_mac16
,
3584 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3586 .name
= "mula.dd.hh.ldinc",
3587 .translate
= translate_mac16
,
3588 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3590 .name
= "mula.dd.hl",
3591 .translate
= translate_mac16
,
3592 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3594 .name
= "mula.dd.hl.lddec",
3595 .translate
= translate_mac16
,
3596 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3598 .name
= "mula.dd.hl.ldinc",
3599 .translate
= translate_mac16
,
3600 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3602 .name
= "mula.dd.lh",
3603 .translate
= translate_mac16
,
3604 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3606 .name
= "mula.dd.lh.lddec",
3607 .translate
= translate_mac16
,
3608 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3610 .name
= "mula.dd.lh.ldinc",
3611 .translate
= translate_mac16
,
3612 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3614 .name
= "mula.dd.ll",
3615 .translate
= translate_mac16
,
3616 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3618 .name
= "mula.dd.ll.lddec",
3619 .translate
= translate_mac16
,
3620 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3622 .name
= "mula.dd.ll.ldinc",
3623 .translate
= translate_mac16
,
3624 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3627 .translate
= translate_mull
,
3629 .name
= "muls.aa.hh",
3630 .translate
= translate_mac16
,
3631 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3633 .name
= "muls.aa.hl",
3634 .translate
= translate_mac16
,
3635 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3637 .name
= "muls.aa.lh",
3638 .translate
= translate_mac16
,
3639 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3641 .name
= "muls.aa.ll",
3642 .translate
= translate_mac16
,
3643 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3645 .name
= "muls.ad.hh",
3646 .translate
= translate_mac16
,
3647 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3649 .name
= "muls.ad.hl",
3650 .translate
= translate_mac16
,
3651 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3653 .name
= "muls.ad.lh",
3654 .translate
= translate_mac16
,
3655 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3657 .name
= "muls.ad.ll",
3658 .translate
= translate_mac16
,
3659 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3661 .name
= "muls.da.hh",
3662 .translate
= translate_mac16
,
3663 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3665 .name
= "muls.da.hl",
3666 .translate
= translate_mac16
,
3667 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3669 .name
= "muls.da.lh",
3670 .translate
= translate_mac16
,
3671 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3673 .name
= "muls.da.ll",
3674 .translate
= translate_mac16
,
3675 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3677 .name
= "muls.dd.hh",
3678 .translate
= translate_mac16
,
3679 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3681 .name
= "muls.dd.hl",
3682 .translate
= translate_mac16
,
3683 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3685 .name
= "muls.dd.lh",
3686 .translate
= translate_mac16
,
3687 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3689 .name
= "muls.dd.ll",
3690 .translate
= translate_mac16
,
3691 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3694 .translate
= translate_mulh
,
3695 .par
= (const uint32_t[]){true},
3698 .translate
= translate_mulh
,
3699 .par
= (const uint32_t[]){false},
3702 .translate
= translate_neg
,
3704 .name
= (const char * const[]) {
3705 "nop", "nop.n", NULL
,
3707 .translate
= translate_nop
,
3708 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3711 .translate
= translate_nsa
,
3714 .translate
= translate_nsau
,
3717 .translate
= translate_or
,
3720 .translate
= translate_boolean
,
3721 .par
= (const uint32_t[]){BOOLEAN_OR
},
3724 .translate
= translate_boolean
,
3725 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3728 .translate
= translate_ptlb
,
3729 .par
= (const uint32_t[]){true},
3730 .op_flags
= XTENSA_OP_PRIVILEGED
,
3733 .translate
= translate_nop
,
3736 .translate
= translate_nop
,
3739 .translate
= translate_nop
,
3742 .translate
= translate_nop
,
3745 .translate
= translate_nop
,
3748 .translate
= translate_ptlb
,
3749 .par
= (const uint32_t[]){false},
3750 .op_flags
= XTENSA_OP_PRIVILEGED
,
3753 .translate
= translate_pptlb
,
3754 .op_flags
= XTENSA_OP_PRIVILEGED
,
3757 .translate
= translate_quos
,
3758 .par
= (const uint32_t[]){true},
3759 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3762 .translate
= translate_quou
,
3763 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3766 .translate
= translate_rtlb
,
3767 .par
= (const uint32_t[]){true, 0},
3768 .op_flags
= XTENSA_OP_PRIVILEGED
,
3771 .translate
= translate_rtlb
,
3772 .par
= (const uint32_t[]){true, 1},
3773 .op_flags
= XTENSA_OP_PRIVILEGED
,
3775 .name
= "read_impwire",
3776 .translate
= translate_read_impwire
,
3779 .translate
= translate_quos
,
3780 .par
= (const uint32_t[]){false},
3781 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3784 .translate
= translate_remu
,
3785 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3788 .translate
= translate_rer
,
3789 .op_flags
= XTENSA_OP_PRIVILEGED
,
3791 .name
= (const char * const[]) {
3792 "ret", "ret.n", NULL
,
3794 .translate
= translate_ret
,
3795 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3797 .name
= (const char * const[]) {
3798 "retw", "retw.n", NULL
,
3800 .translate
= translate_retw
,
3801 .test_ill
= test_ill_retw
,
3802 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3805 .op_flags
= XTENSA_OP_ILL
,
3808 .translate
= translate_rfde
,
3809 .op_flags
= XTENSA_OP_PRIVILEGED
,
3812 .op_flags
= XTENSA_OP_ILL
,
3815 .translate
= translate_rfe
,
3816 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3819 .translate
= translate_rfi
,
3820 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3823 .translate
= translate_rfw
,
3824 .par
= (const uint32_t[]){true},
3825 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3828 .translate
= translate_rfw
,
3829 .par
= (const uint32_t[]){false},
3830 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3833 .translate
= translate_rtlb
,
3834 .par
= (const uint32_t[]){false, 0},
3835 .op_flags
= XTENSA_OP_PRIVILEGED
,
3838 .translate
= translate_rtlb
,
3839 .par
= (const uint32_t[]){false, 1},
3840 .op_flags
= XTENSA_OP_PRIVILEGED
,
3843 .translate
= translate_rptlb0
,
3844 .op_flags
= XTENSA_OP_PRIVILEGED
,
3847 .translate
= translate_rptlb1
,
3848 .op_flags
= XTENSA_OP_PRIVILEGED
,
3851 .translate
= translate_rotw
,
3852 .op_flags
= XTENSA_OP_PRIVILEGED
|
3853 XTENSA_OP_EXIT_TB_M1
|
3854 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3857 .translate
= translate_rsil
,
3859 XTENSA_OP_PRIVILEGED
|
3860 XTENSA_OP_EXIT_TB_0
|
3861 XTENSA_OP_CHECK_INTERRUPTS
,
3864 .translate
= translate_rsr
,
3865 .par
= (const uint32_t[]){176},
3866 .op_flags
= XTENSA_OP_PRIVILEGED
,
3869 .translate
= translate_rsr
,
3870 .par
= (const uint32_t[]){208},
3871 .op_flags
= XTENSA_OP_PRIVILEGED
,
3873 .name
= "rsr.acchi",
3874 .translate
= translate_rsr
,
3875 .test_ill
= test_ill_sr
,
3876 .par
= (const uint32_t[]){
3878 XTENSA_OPTION_MAC16
,
3881 .name
= "rsr.acclo",
3882 .translate
= translate_rsr
,
3883 .test_ill
= test_ill_sr
,
3884 .par
= (const uint32_t[]){
3886 XTENSA_OPTION_MAC16
,
3889 .name
= "rsr.atomctl",
3890 .translate
= translate_rsr
,
3891 .test_ill
= test_ill_sr
,
3892 .par
= (const uint32_t[]){
3894 XTENSA_OPTION_ATOMCTL
,
3896 .op_flags
= XTENSA_OP_PRIVILEGED
,
3899 .translate
= translate_rsr
,
3900 .test_ill
= test_ill_sr
,
3901 .par
= (const uint32_t[]){
3903 XTENSA_OPTION_BOOLEAN
,
3906 .name
= "rsr.cacheadrdis",
3907 .translate
= translate_rsr
,
3908 .test_ill
= test_ill_sr
,
3909 .par
= (const uint32_t[]){
3913 .op_flags
= XTENSA_OP_PRIVILEGED
,
3915 .name
= "rsr.cacheattr",
3916 .translate
= translate_rsr
,
3917 .test_ill
= test_ill_sr
,
3918 .par
= (const uint32_t[]){
3920 XTENSA_OPTION_CACHEATTR
,
3922 .op_flags
= XTENSA_OP_PRIVILEGED
,
3924 .name
= "rsr.ccompare0",
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.ccompare1",
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.ccompare2",
3943 .translate
= translate_rsr
,
3944 .test_ill
= test_ill_ccompare
,
3945 .par
= (const uint32_t[]){
3947 XTENSA_OPTION_TIMER_INTERRUPT
,
3949 .op_flags
= XTENSA_OP_PRIVILEGED
,
3951 .name
= "rsr.ccount",
3952 .translate
= translate_rsr_ccount
,
3953 .test_ill
= test_ill_sr
,
3954 .par
= (const uint32_t[]){
3956 XTENSA_OPTION_TIMER_INTERRUPT
,
3958 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3960 .name
= "rsr.configid0",
3961 .translate
= translate_rsr
,
3962 .par
= (const uint32_t[]){CONFIGID0
},
3963 .op_flags
= XTENSA_OP_PRIVILEGED
,
3965 .name
= "rsr.configid1",
3966 .translate
= translate_rsr
,
3967 .par
= (const uint32_t[]){CONFIGID1
},
3968 .op_flags
= XTENSA_OP_PRIVILEGED
,
3970 .name
= "rsr.cpenable",
3971 .translate
= translate_rsr
,
3972 .test_ill
= test_ill_sr
,
3973 .par
= (const uint32_t[]){
3975 XTENSA_OPTION_COPROCESSOR
,
3977 .op_flags
= XTENSA_OP_PRIVILEGED
,
3979 .name
= "rsr.dbreaka0",
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.dbreaka1",
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.dbreakc0",
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
,
4006 .name
= "rsr.dbreakc1",
4007 .translate
= translate_rsr
,
4008 .test_ill
= test_ill_dbreak
,
4009 .par
= (const uint32_t[]){
4011 XTENSA_OPTION_DEBUG
,
4013 .op_flags
= XTENSA_OP_PRIVILEGED
,
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
,
4024 .name
= "rsr.debugcause",
4025 .translate
= translate_rsr
,
4026 .test_ill
= test_ill_sr
,
4027 .par
= (const uint32_t[]){
4029 XTENSA_OPTION_DEBUG
,
4031 .op_flags
= XTENSA_OP_PRIVILEGED
,
4034 .translate
= translate_rsr
,
4035 .test_ill
= test_ill_sr
,
4036 .par
= (const uint32_t[]){
4038 XTENSA_OPTION_EXCEPTION
,
4040 .op_flags
= XTENSA_OP_PRIVILEGED
,
4042 .name
= "rsr.dtlbcfg",
4043 .translate
= translate_rsr
,
4044 .test_ill
= test_ill_sr
,
4045 .par
= (const uint32_t[]){
4049 .op_flags
= XTENSA_OP_PRIVILEGED
,
4052 .translate
= translate_rsr
,
4053 .test_ill
= test_ill_sr
,
4054 .par
= (const uint32_t[]){
4056 XTENSA_OPTION_EXCEPTION
,
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
,
4160 .translate
= translate_rsr
,
4161 .test_ill
= test_ill_hpi
,
4162 .par
= (const uint32_t[]){
4164 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4166 .op_flags
= XTENSA_OP_PRIVILEGED
,
4168 .name
= "rsr.eraccess",
4169 .translate
= translate_rsr
,
4170 .par
= (const uint32_t[]){ERACCESS
},
4171 .op_flags
= XTENSA_OP_PRIVILEGED
,
4173 .name
= "rsr.exccause",
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.excsave1",
4183 .translate
= translate_rsr
,
4184 .test_ill
= test_ill_sr
,
4185 .par
= (const uint32_t[]){
4187 XTENSA_OPTION_EXCEPTION
,
4189 .op_flags
= XTENSA_OP_PRIVILEGED
,
4191 .name
= "rsr.excsave2",
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.excsave3",
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.excsave4",
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.excsave5",
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.excsave6",
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.excsave7",
4237 .translate
= translate_rsr
,
4238 .test_ill
= test_ill_hpi
,
4239 .par
= (const uint32_t[]){
4241 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4243 .op_flags
= XTENSA_OP_PRIVILEGED
,
4245 .name
= "rsr.excvaddr",
4246 .translate
= translate_rsr
,
4247 .test_ill
= test_ill_sr
,
4248 .par
= (const uint32_t[]){
4250 XTENSA_OPTION_EXCEPTION
,
4252 .op_flags
= XTENSA_OP_PRIVILEGED
,
4254 .name
= "rsr.ibreaka0",
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.ibreaka1",
4264 .translate
= translate_rsr
,
4265 .test_ill
= test_ill_ibreak
,
4266 .par
= (const uint32_t[]){
4268 XTENSA_OPTION_DEBUG
,
4270 .op_flags
= XTENSA_OP_PRIVILEGED
,
4272 .name
= "rsr.ibreakenable",
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.icount",
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.icountlevel",
4291 .translate
= translate_rsr
,
4292 .test_ill
= test_ill_sr
,
4293 .par
= (const uint32_t[]){
4295 XTENSA_OPTION_DEBUG
,
4297 .op_flags
= XTENSA_OP_PRIVILEGED
,
4299 .name
= "rsr.intclear",
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.intenable",
4309 .translate
= translate_rsr
,
4310 .test_ill
= test_ill_sr
,
4311 .par
= (const uint32_t[]){
4313 XTENSA_OPTION_INTERRUPT
,
4315 .op_flags
= XTENSA_OP_PRIVILEGED
,
4317 .name
= "rsr.interrupt",
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.intset",
4327 .translate
= translate_rsr_ccount
,
4328 .test_ill
= test_ill_sr
,
4329 .par
= (const uint32_t[]){
4331 XTENSA_OPTION_INTERRUPT
,
4333 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4335 .name
= "rsr.itlbcfg",
4336 .translate
= translate_rsr
,
4337 .test_ill
= test_ill_sr
,
4338 .par
= (const uint32_t[]){
4342 .op_flags
= XTENSA_OP_PRIVILEGED
,
4345 .translate
= translate_rsr
,
4346 .test_ill
= test_ill_sr
,
4347 .par
= (const uint32_t[]){
4352 .name
= "rsr.lcount",
4353 .translate
= translate_rsr
,
4354 .test_ill
= test_ill_sr
,
4355 .par
= (const uint32_t[]){
4361 .translate
= translate_rsr
,
4362 .test_ill
= test_ill_sr
,
4363 .par
= (const uint32_t[]){
4368 .name
= "rsr.litbase",
4369 .translate
= translate_rsr
,
4370 .test_ill
= test_ill_sr
,
4371 .par
= (const uint32_t[]){
4373 XTENSA_OPTION_EXTENDED_L32R
,
4377 .translate
= translate_rsr
,
4378 .test_ill
= test_ill_sr
,
4379 .par
= (const uint32_t[]){
4381 XTENSA_OPTION_MAC16
,
4385 .translate
= translate_rsr
,
4386 .test_ill
= test_ill_sr
,
4387 .par
= (const uint32_t[]){
4389 XTENSA_OPTION_MAC16
,
4393 .translate
= translate_rsr
,
4394 .test_ill
= test_ill_sr
,
4395 .par
= (const uint32_t[]){
4397 XTENSA_OPTION_MAC16
,
4401 .translate
= translate_rsr
,
4402 .test_ill
= test_ill_sr
,
4403 .par
= (const uint32_t[]){
4405 XTENSA_OPTION_MAC16
,
4408 .name
= "rsr.memctl",
4409 .translate
= translate_rsr
,
4410 .par
= (const uint32_t[]){MEMCTL
},
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
,
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
,
4440 .name
= "rsr.mesave",
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
,
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.mevaddr",
4459 .translate
= translate_rsr
,
4460 .test_ill
= test_ill_sr
,
4461 .par
= (const uint32_t[]){
4463 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4465 .op_flags
= XTENSA_OP_PRIVILEGED
,
4467 .name
= "rsr.misc0",
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.misc1",
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.misc2",
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.misc3",
4495 .translate
= translate_rsr
,
4496 .test_ill
= test_ill_sr
,
4497 .par
= (const uint32_t[]){
4499 XTENSA_OPTION_MISC_SR
,
4501 .op_flags
= XTENSA_OP_PRIVILEGED
,
4503 .name
= "rsr.mpucfg",
4504 .translate
= translate_rsr
,
4505 .test_ill
= test_ill_sr
,
4506 .par
= (const uint32_t[]){
4510 .op_flags
= XTENSA_OP_PRIVILEGED
,
4512 .name
= "rsr.mpuenb",
4513 .translate
= translate_rsr
,
4514 .test_ill
= test_ill_sr
,
4515 .par
= (const uint32_t[]){
4519 .op_flags
= XTENSA_OP_PRIVILEGED
,
4521 .name
= "rsr.prefctl",
4522 .translate
= translate_rsr
,
4523 .par
= (const uint32_t[]){PREFCTL
},
4526 .translate
= translate_rsr
,
4527 .test_ill
= test_ill_sr
,
4528 .par
= (const uint32_t[]){
4530 XTENSA_OPTION_PROCESSOR_ID
,
4532 .op_flags
= XTENSA_OP_PRIVILEGED
,
4535 .translate
= translate_rsr
,
4536 .test_ill
= test_ill_sr
,
4537 .par
= (const uint32_t[]){
4539 XTENSA_OPTION_EXCEPTION
,
4541 .op_flags
= XTENSA_OP_PRIVILEGED
,
4543 .name
= "rsr.ptevaddr",
4544 .translate
= translate_rsr_ptevaddr
,
4545 .test_ill
= test_ill_sr
,
4546 .par
= (const uint32_t[]){
4550 .op_flags
= XTENSA_OP_PRIVILEGED
,
4552 .name
= "rsr.rasid",
4553 .translate
= translate_rsr
,
4554 .test_ill
= test_ill_sr
,
4555 .par
= (const uint32_t[]){
4559 .op_flags
= XTENSA_OP_PRIVILEGED
,
4562 .translate
= translate_rsr
,
4563 .par
= (const uint32_t[]){SAR
},
4565 .name
= "rsr.scompare1",
4566 .translate
= translate_rsr
,
4567 .test_ill
= test_ill_sr
,
4568 .par
= (const uint32_t[]){
4570 XTENSA_OPTION_CONDITIONAL_STORE
,
4573 .name
= "rsr.vecbase",
4574 .translate
= translate_rsr
,
4575 .test_ill
= test_ill_sr
,
4576 .par
= (const uint32_t[]){
4578 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4580 .op_flags
= XTENSA_OP_PRIVILEGED
,
4582 .name
= "rsr.windowbase",
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
,
4591 .name
= "rsr.windowstart",
4592 .translate
= translate_rsr
,
4593 .test_ill
= test_ill_sr
,
4594 .par
= (const uint32_t[]){
4596 XTENSA_OPTION_WINDOWED_REGISTER
,
4598 .op_flags
= XTENSA_OP_PRIVILEGED
,
4601 .translate
= translate_nop
,
4603 .name
= "rur.expstate",
4604 .translate
= translate_rur
,
4605 .par
= (const uint32_t[]){EXPSTATE
},
4608 .translate
= translate_rur
,
4609 .par
= (const uint32_t[]){FCR
},
4613 .translate
= translate_rur
,
4614 .par
= (const uint32_t[]){FSR
},
4617 .name
= "rur.threadptr",
4618 .translate
= translate_rur
,
4619 .par
= (const uint32_t[]){THREADPTR
},
4622 .translate
= translate_ldst
,
4623 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4624 .op_flags
= XTENSA_OP_STORE
,
4627 .translate
= translate_s32c1i
,
4628 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4631 .translate
= translate_s32e
,
4632 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4635 .translate
= translate_s32ex
,
4636 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4638 .name
= (const char * const[]) {
4639 "s32i", "s32i.n", "s32nb", NULL
,
4641 .translate
= translate_ldst
,
4642 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4643 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4646 .translate
= translate_ldst
,
4647 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4648 .op_flags
= XTENSA_OP_STORE
,
4651 .translate
= translate_ldst
,
4652 .par
= (const uint32_t[]){MO_UB
, false, true},
4653 .op_flags
= XTENSA_OP_STORE
,
4656 .translate
= translate_salt
,
4657 .par
= (const uint32_t[]){TCG_COND_LT
},
4660 .translate
= translate_salt
,
4661 .par
= (const uint32_t[]){TCG_COND_LTU
},
4663 .name
= "setb_expstate",
4664 .translate
= translate_setb_expstate
,
4667 .translate
= translate_sext
,
4670 .translate
= translate_simcall
,
4671 .test_ill
= test_ill_simcall
,
4672 .op_flags
= XTENSA_OP_PRIVILEGED
,
4675 .translate
= translate_sll
,
4678 .translate
= translate_slli
,
4681 .translate
= translate_sra
,
4684 .translate
= translate_srai
,
4687 .translate
= translate_src
,
4690 .translate
= translate_srl
,
4693 .translate
= translate_srli
,
4696 .translate
= translate_ssa8b
,
4699 .translate
= translate_ssa8l
,
4702 .translate
= translate_ssai
,
4705 .translate
= translate_ssl
,
4708 .translate
= translate_ssr
,
4711 .translate
= translate_sub
,
4714 .translate
= translate_subx
,
4715 .par
= (const uint32_t[]){1},
4718 .translate
= translate_subx
,
4719 .par
= (const uint32_t[]){2},
4722 .translate
= translate_subx
,
4723 .par
= (const uint32_t[]){3},
4726 .op_flags
= XTENSA_OP_SYSCALL
,
4728 .name
= "umul.aa.hh",
4729 .translate
= translate_mac16
,
4730 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4732 .name
= "umul.aa.hl",
4733 .translate
= translate_mac16
,
4734 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4736 .name
= "umul.aa.lh",
4737 .translate
= translate_mac16
,
4738 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4740 .name
= "umul.aa.ll",
4741 .translate
= translate_mac16
,
4742 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4745 .translate
= translate_waiti
,
4746 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4749 .translate
= translate_wtlb
,
4750 .par
= (const uint32_t[]){true},
4751 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4754 .translate
= translate_wer
,
4755 .op_flags
= XTENSA_OP_PRIVILEGED
,
4758 .translate
= translate_wtlb
,
4759 .par
= (const uint32_t[]){false},
4760 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4763 .translate
= translate_wptlb
,
4764 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4766 .name
= "wrmsk_expstate",
4767 .translate
= translate_wrmsk_expstate
,
4770 .op_flags
= XTENSA_OP_ILL
,
4773 .op_flags
= XTENSA_OP_ILL
,
4775 .name
= "wsr.acchi",
4776 .translate
= translate_wsr_acchi
,
4777 .test_ill
= test_ill_sr
,
4778 .par
= (const uint32_t[]){
4780 XTENSA_OPTION_MAC16
,
4783 .name
= "wsr.acclo",
4784 .translate
= translate_wsr
,
4785 .test_ill
= test_ill_sr
,
4786 .par
= (const uint32_t[]){
4788 XTENSA_OPTION_MAC16
,
4791 .name
= "wsr.atomctl",
4792 .translate
= translate_wsr_mask
,
4793 .test_ill
= test_ill_sr
,
4794 .par
= (const uint32_t[]){
4796 XTENSA_OPTION_ATOMCTL
,
4799 .op_flags
= XTENSA_OP_PRIVILEGED
,
4802 .translate
= translate_wsr_mask
,
4803 .test_ill
= test_ill_sr
,
4804 .par
= (const uint32_t[]){
4806 XTENSA_OPTION_BOOLEAN
,
4810 .name
= "wsr.cacheadrdis",
4811 .translate
= translate_wsr_mask
,
4812 .test_ill
= test_ill_sr
,
4813 .par
= (const uint32_t[]){
4818 .op_flags
= XTENSA_OP_PRIVILEGED
,
4820 .name
= "wsr.cacheattr",
4821 .translate
= translate_wsr
,
4822 .test_ill
= test_ill_sr
,
4823 .par
= (const uint32_t[]){
4825 XTENSA_OPTION_CACHEATTR
,
4827 .op_flags
= XTENSA_OP_PRIVILEGED
,
4829 .name
= "wsr.ccompare0",
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.ccompare1",
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.ccompare2",
4848 .translate
= translate_wsr_ccompare
,
4849 .test_ill
= test_ill_ccompare
,
4850 .par
= (const uint32_t[]){
4852 XTENSA_OPTION_TIMER_INTERRUPT
,
4854 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4856 .name
= "wsr.ccount",
4857 .translate
= translate_wsr_ccount
,
4858 .test_ill
= test_ill_sr
,
4859 .par
= (const uint32_t[]){
4861 XTENSA_OPTION_TIMER_INTERRUPT
,
4863 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4865 .name
= "wsr.configid0",
4866 .op_flags
= XTENSA_OP_ILL
,
4868 .name
= "wsr.configid1",
4869 .op_flags
= XTENSA_OP_ILL
,
4871 .name
= "wsr.cpenable",
4872 .translate
= translate_wsr_mask
,
4873 .test_ill
= test_ill_sr
,
4874 .par
= (const uint32_t[]){
4876 XTENSA_OPTION_COPROCESSOR
,
4879 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4881 .name
= "wsr.dbreaka0",
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.dbreaka1",
4891 .translate
= translate_wsr_dbreaka
,
4892 .test_ill
= test_ill_dbreak
,
4893 .par
= (const uint32_t[]){
4895 XTENSA_OPTION_DEBUG
,
4897 .op_flags
= XTENSA_OP_PRIVILEGED
,
4899 .name
= "wsr.dbreakc0",
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
,
4908 .name
= "wsr.dbreakc1",
4909 .translate
= translate_wsr_dbreakc
,
4910 .test_ill
= test_ill_dbreak
,
4911 .par
= (const uint32_t[]){
4913 XTENSA_OPTION_DEBUG
,
4915 .op_flags
= XTENSA_OP_PRIVILEGED
,
4918 .translate
= translate_wsr
,
4919 .test_ill
= test_ill_sr
,
4920 .par
= (const uint32_t[]){
4922 XTENSA_OPTION_DEBUG
,
4924 .op_flags
= XTENSA_OP_PRIVILEGED
,
4926 .name
= "wsr.debugcause",
4927 .op_flags
= XTENSA_OP_ILL
,
4930 .translate
= translate_wsr
,
4931 .test_ill
= test_ill_sr
,
4932 .par
= (const uint32_t[]){
4934 XTENSA_OPTION_EXCEPTION
,
4936 .op_flags
= XTENSA_OP_PRIVILEGED
,
4938 .name
= "wsr.dtlbcfg",
4939 .translate
= translate_wsr_mask
,
4940 .test_ill
= test_ill_sr
,
4941 .par
= (const uint32_t[]){
4946 .op_flags
= XTENSA_OP_PRIVILEGED
,
4949 .translate
= translate_wsr
,
4950 .test_ill
= test_ill_sr
,
4951 .par
= (const uint32_t[]){
4953 XTENSA_OPTION_EXCEPTION
,
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
,
5057 .translate
= translate_wsr
,
5058 .test_ill
= test_ill_hpi
,
5059 .par
= (const uint32_t[]){
5061 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5063 .op_flags
= XTENSA_OP_PRIVILEGED
,
5065 .name
= "wsr.eraccess",
5066 .translate
= translate_wsr_mask
,
5067 .par
= (const uint32_t[]){
5072 .op_flags
= XTENSA_OP_PRIVILEGED
,
5074 .name
= "wsr.exccause",
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.excsave1",
5084 .translate
= translate_wsr
,
5085 .test_ill
= test_ill_sr
,
5086 .par
= (const uint32_t[]){
5088 XTENSA_OPTION_EXCEPTION
,
5090 .op_flags
= XTENSA_OP_PRIVILEGED
,
5092 .name
= "wsr.excsave2",
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.excsave3",
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.excsave4",
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.excsave5",
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.excsave6",
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.excsave7",
5138 .translate
= translate_wsr
,
5139 .test_ill
= test_ill_hpi
,
5140 .par
= (const uint32_t[]){
5142 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5144 .op_flags
= XTENSA_OP_PRIVILEGED
,
5146 .name
= "wsr.excvaddr",
5147 .translate
= translate_wsr
,
5148 .test_ill
= test_ill_sr
,
5149 .par
= (const uint32_t[]){
5151 XTENSA_OPTION_EXCEPTION
,
5153 .op_flags
= XTENSA_OP_PRIVILEGED
,
5155 .name
= "wsr.ibreaka0",
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.ibreaka1",
5165 .translate
= translate_wsr_ibreaka
,
5166 .test_ill
= test_ill_ibreak
,
5167 .par
= (const uint32_t[]){
5169 XTENSA_OPTION_DEBUG
,
5171 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5173 .name
= "wsr.ibreakenable",
5174 .translate
= translate_wsr_ibreakenable
,
5175 .test_ill
= test_ill_sr
,
5176 .par
= (const uint32_t[]){
5178 XTENSA_OPTION_DEBUG
,
5180 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5182 .name
= "wsr.icount",
5183 .translate
= translate_wsr_icount
,
5184 .test_ill
= test_ill_sr
,
5185 .par
= (const uint32_t[]){
5187 XTENSA_OPTION_DEBUG
,
5189 .op_flags
= XTENSA_OP_PRIVILEGED
,
5191 .name
= "wsr.icountlevel",
5192 .translate
= translate_wsr_mask
,
5193 .test_ill
= test_ill_sr
,
5194 .par
= (const uint32_t[]){
5196 XTENSA_OPTION_DEBUG
,
5199 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5201 .name
= "wsr.intclear",
5202 .translate
= translate_wsr_intclear
,
5203 .test_ill
= test_ill_sr
,
5204 .par
= (const uint32_t[]){
5206 XTENSA_OPTION_INTERRUPT
,
5209 XTENSA_OP_PRIVILEGED
|
5210 XTENSA_OP_EXIT_TB_0
|
5211 XTENSA_OP_CHECK_INTERRUPTS
,
5213 .name
= "wsr.intenable",
5214 .translate
= translate_wsr
,
5215 .test_ill
= test_ill_sr
,
5216 .par
= (const uint32_t[]){
5218 XTENSA_OPTION_INTERRUPT
,
5221 XTENSA_OP_PRIVILEGED
|
5222 XTENSA_OP_EXIT_TB_0
|
5223 XTENSA_OP_CHECK_INTERRUPTS
,
5225 .name
= "wsr.interrupt",
5226 .translate
= translate_wsr
,
5227 .test_ill
= test_ill_sr
,
5228 .par
= (const uint32_t[]){
5230 XTENSA_OPTION_INTERRUPT
,
5233 XTENSA_OP_PRIVILEGED
|
5234 XTENSA_OP_EXIT_TB_0
|
5235 XTENSA_OP_CHECK_INTERRUPTS
,
5237 .name
= "wsr.intset",
5238 .translate
= translate_wsr_intset
,
5239 .test_ill
= test_ill_sr
,
5240 .par
= (const uint32_t[]){
5242 XTENSA_OPTION_INTERRUPT
,
5245 XTENSA_OP_PRIVILEGED
|
5246 XTENSA_OP_EXIT_TB_0
|
5247 XTENSA_OP_CHECK_INTERRUPTS
,
5249 .name
= "wsr.itlbcfg",
5250 .translate
= translate_wsr_mask
,
5251 .test_ill
= test_ill_sr
,
5252 .par
= (const uint32_t[]){
5257 .op_flags
= XTENSA_OP_PRIVILEGED
,
5260 .translate
= translate_wsr
,
5261 .test_ill
= test_ill_sr
,
5262 .par
= (const uint32_t[]){
5266 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5268 .name
= "wsr.lcount",
5269 .translate
= translate_wsr
,
5270 .test_ill
= test_ill_sr
,
5271 .par
= (const uint32_t[]){
5277 .translate
= translate_wsr
,
5278 .test_ill
= test_ill_sr
,
5279 .par
= (const uint32_t[]){
5283 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5285 .name
= "wsr.litbase",
5286 .translate
= translate_wsr_mask
,
5287 .test_ill
= test_ill_sr
,
5288 .par
= (const uint32_t[]){
5290 XTENSA_OPTION_EXTENDED_L32R
,
5293 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5296 .translate
= translate_wsr
,
5297 .test_ill
= test_ill_sr
,
5298 .par
= (const uint32_t[]){
5300 XTENSA_OPTION_MAC16
,
5304 .translate
= translate_wsr
,
5305 .test_ill
= test_ill_sr
,
5306 .par
= (const uint32_t[]){
5308 XTENSA_OPTION_MAC16
,
5312 .translate
= translate_wsr
,
5313 .test_ill
= test_ill_sr
,
5314 .par
= (const uint32_t[]){
5316 XTENSA_OPTION_MAC16
,
5320 .translate
= translate_wsr
,
5321 .test_ill
= test_ill_sr
,
5322 .par
= (const uint32_t[]){
5324 XTENSA_OPTION_MAC16
,
5327 .name
= "wsr.memctl",
5328 .translate
= translate_wsr_memctl
,
5329 .par
= (const uint32_t[]){MEMCTL
},
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
,
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
,
5359 .name
= "wsr.mesave",
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
,
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.mevaddr",
5378 .translate
= translate_wsr
,
5379 .test_ill
= test_ill_sr
,
5380 .par
= (const uint32_t[]){
5382 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5384 .op_flags
= XTENSA_OP_PRIVILEGED
,
5386 .name
= "wsr.misc0",
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.misc1",
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.misc2",
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
,
5413 .name
= "wsr.misc3",
5414 .translate
= translate_wsr
,
5415 .test_ill
= test_ill_sr
,
5416 .par
= (const uint32_t[]){
5418 XTENSA_OPTION_MISC_SR
,
5420 .op_flags
= XTENSA_OP_PRIVILEGED
,
5423 .translate
= translate_wsr
,
5424 .test_ill
= test_ill_sr
,
5425 .par
= (const uint32_t[]){
5427 XTENSA_OPTION_TRACE_PORT
,
5429 .op_flags
= XTENSA_OP_PRIVILEGED
,
5431 .name
= "wsr.mpuenb",
5432 .translate
= translate_wsr_mpuenb
,
5433 .test_ill
= test_ill_sr
,
5434 .par
= (const uint32_t[]){
5438 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5440 .name
= "wsr.prefctl",
5441 .translate
= translate_wsr
,
5442 .par
= (const uint32_t[]){PREFCTL
},
5445 .op_flags
= XTENSA_OP_ILL
,
5448 .translate
= translate_wsr_ps
,
5449 .test_ill
= test_ill_sr
,
5450 .par
= (const uint32_t[]){
5452 XTENSA_OPTION_EXCEPTION
,
5455 XTENSA_OP_PRIVILEGED
|
5456 XTENSA_OP_EXIT_TB_M1
|
5457 XTENSA_OP_CHECK_INTERRUPTS
,
5459 .name
= "wsr.ptevaddr",
5460 .translate
= translate_wsr_mask
,
5461 .test_ill
= test_ill_sr
,
5462 .par
= (const uint32_t[]){
5467 .op_flags
= XTENSA_OP_PRIVILEGED
,
5469 .name
= "wsr.rasid",
5470 .translate
= translate_wsr_rasid
,
5471 .test_ill
= test_ill_sr
,
5472 .par
= (const uint32_t[]){
5476 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5479 .translate
= translate_wsr_sar
,
5480 .par
= (const uint32_t[]){SAR
},
5482 .name
= "wsr.scompare1",
5483 .translate
= translate_wsr
,
5484 .test_ill
= test_ill_sr
,
5485 .par
= (const uint32_t[]){
5487 XTENSA_OPTION_CONDITIONAL_STORE
,
5490 .name
= "wsr.vecbase",
5491 .translate
= translate_wsr
,
5492 .test_ill
= test_ill_sr
,
5493 .par
= (const uint32_t[]){
5495 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5497 .op_flags
= XTENSA_OP_PRIVILEGED
,
5499 .name
= "wsr.windowbase",
5500 .translate
= translate_wsr_windowbase
,
5501 .test_ill
= test_ill_sr
,
5502 .par
= (const uint32_t[]){
5504 XTENSA_OPTION_WINDOWED_REGISTER
,
5506 .op_flags
= XTENSA_OP_PRIVILEGED
|
5507 XTENSA_OP_EXIT_TB_M1
|
5508 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5510 .name
= "wsr.windowstart",
5511 .translate
= translate_wsr_windowstart
,
5512 .test_ill
= test_ill_sr
,
5513 .par
= (const uint32_t[]){
5515 XTENSA_OPTION_WINDOWED_REGISTER
,
5517 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5519 .name
= "wur.expstate",
5520 .translate
= translate_wur
,
5521 .par
= (const uint32_t[]){EXPSTATE
},
5524 .translate
= translate_wur_fcr
,
5525 .par
= (const uint32_t[]){FCR
},
5529 .translate
= translate_wur_fsr
,
5530 .par
= (const uint32_t[]){FSR
},
5533 .name
= "wur.threadptr",
5534 .translate
= translate_wur
,
5535 .par
= (const uint32_t[]){THREADPTR
},
5538 .translate
= translate_xor
,
5541 .translate
= translate_boolean
,
5542 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5545 .op_flags
= XTENSA_OP_ILL
,
5548 .op_flags
= XTENSA_OP_ILL
,
5550 .name
= "xsr.acchi",
5551 .translate
= translate_xsr_acchi
,
5552 .test_ill
= test_ill_sr
,
5553 .par
= (const uint32_t[]){
5555 XTENSA_OPTION_MAC16
,
5558 .name
= "xsr.acclo",
5559 .translate
= translate_xsr
,
5560 .test_ill
= test_ill_sr
,
5561 .par
= (const uint32_t[]){
5563 XTENSA_OPTION_MAC16
,
5566 .name
= "xsr.atomctl",
5567 .translate
= translate_xsr_mask
,
5568 .test_ill
= test_ill_sr
,
5569 .par
= (const uint32_t[]){
5571 XTENSA_OPTION_ATOMCTL
,
5574 .op_flags
= XTENSA_OP_PRIVILEGED
,
5577 .translate
= translate_xsr_mask
,
5578 .test_ill
= test_ill_sr
,
5579 .par
= (const uint32_t[]){
5581 XTENSA_OPTION_BOOLEAN
,
5585 .name
= "xsr.cacheadrdis",
5586 .translate
= translate_xsr_mask
,
5587 .test_ill
= test_ill_sr
,
5588 .par
= (const uint32_t[]){
5593 .op_flags
= XTENSA_OP_PRIVILEGED
,
5595 .name
= "xsr.cacheattr",
5596 .translate
= translate_xsr
,
5597 .test_ill
= test_ill_sr
,
5598 .par
= (const uint32_t[]){
5600 XTENSA_OPTION_CACHEATTR
,
5602 .op_flags
= XTENSA_OP_PRIVILEGED
,
5604 .name
= "xsr.ccompare0",
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.ccompare1",
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.ccompare2",
5623 .translate
= translate_xsr_ccompare
,
5624 .test_ill
= test_ill_ccompare
,
5625 .par
= (const uint32_t[]){
5627 XTENSA_OPTION_TIMER_INTERRUPT
,
5629 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5631 .name
= "xsr.ccount",
5632 .translate
= translate_xsr_ccount
,
5633 .test_ill
= test_ill_sr
,
5634 .par
= (const uint32_t[]){
5636 XTENSA_OPTION_TIMER_INTERRUPT
,
5638 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5640 .name
= "xsr.configid0",
5641 .op_flags
= XTENSA_OP_ILL
,
5643 .name
= "xsr.configid1",
5644 .op_flags
= XTENSA_OP_ILL
,
5646 .name
= "xsr.cpenable",
5647 .translate
= translate_xsr_mask
,
5648 .test_ill
= test_ill_sr
,
5649 .par
= (const uint32_t[]){
5651 XTENSA_OPTION_COPROCESSOR
,
5654 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5656 .name
= "xsr.dbreaka0",
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.dbreaka1",
5666 .translate
= translate_xsr_dbreaka
,
5667 .test_ill
= test_ill_dbreak
,
5668 .par
= (const uint32_t[]){
5670 XTENSA_OPTION_DEBUG
,
5672 .op_flags
= XTENSA_OP_PRIVILEGED
,
5674 .name
= "xsr.dbreakc0",
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
,
5683 .name
= "xsr.dbreakc1",
5684 .translate
= translate_xsr_dbreakc
,
5685 .test_ill
= test_ill_dbreak
,
5686 .par
= (const uint32_t[]){
5688 XTENSA_OPTION_DEBUG
,
5690 .op_flags
= XTENSA_OP_PRIVILEGED
,
5693 .translate
= translate_xsr
,
5694 .test_ill
= test_ill_sr
,
5695 .par
= (const uint32_t[]){
5697 XTENSA_OPTION_DEBUG
,
5699 .op_flags
= XTENSA_OP_PRIVILEGED
,
5701 .name
= "xsr.debugcause",
5702 .op_flags
= XTENSA_OP_ILL
,
5705 .translate
= translate_xsr
,
5706 .test_ill
= test_ill_sr
,
5707 .par
= (const uint32_t[]){
5709 XTENSA_OPTION_EXCEPTION
,
5711 .op_flags
= XTENSA_OP_PRIVILEGED
,
5713 .name
= "xsr.dtlbcfg",
5714 .translate
= translate_xsr_mask
,
5715 .test_ill
= test_ill_sr
,
5716 .par
= (const uint32_t[]){
5721 .op_flags
= XTENSA_OP_PRIVILEGED
,
5724 .translate
= translate_xsr
,
5725 .test_ill
= test_ill_sr
,
5726 .par
= (const uint32_t[]){
5728 XTENSA_OPTION_EXCEPTION
,
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
,
5832 .translate
= translate_xsr
,
5833 .test_ill
= test_ill_hpi
,
5834 .par
= (const uint32_t[]){
5836 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5838 .op_flags
= XTENSA_OP_PRIVILEGED
,
5840 .name
= "xsr.eraccess",
5841 .translate
= translate_xsr_mask
,
5842 .par
= (const uint32_t[]){
5847 .op_flags
= XTENSA_OP_PRIVILEGED
,
5849 .name
= "xsr.exccause",
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.excsave1",
5859 .translate
= translate_xsr
,
5860 .test_ill
= test_ill_sr
,
5861 .par
= (const uint32_t[]){
5863 XTENSA_OPTION_EXCEPTION
,
5865 .op_flags
= XTENSA_OP_PRIVILEGED
,
5867 .name
= "xsr.excsave2",
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.excsave3",
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.excsave4",
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.excsave5",
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.excsave6",
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.excsave7",
5913 .translate
= translate_xsr
,
5914 .test_ill
= test_ill_hpi
,
5915 .par
= (const uint32_t[]){
5917 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5919 .op_flags
= XTENSA_OP_PRIVILEGED
,
5921 .name
= "xsr.excvaddr",
5922 .translate
= translate_xsr
,
5923 .test_ill
= test_ill_sr
,
5924 .par
= (const uint32_t[]){
5926 XTENSA_OPTION_EXCEPTION
,
5928 .op_flags
= XTENSA_OP_PRIVILEGED
,
5930 .name
= "xsr.ibreaka0",
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.ibreaka1",
5940 .translate
= translate_xsr_ibreaka
,
5941 .test_ill
= test_ill_ibreak
,
5942 .par
= (const uint32_t[]){
5944 XTENSA_OPTION_DEBUG
,
5946 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5948 .name
= "xsr.ibreakenable",
5949 .translate
= translate_xsr_ibreakenable
,
5950 .test_ill
= test_ill_sr
,
5951 .par
= (const uint32_t[]){
5953 XTENSA_OPTION_DEBUG
,
5955 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5957 .name
= "xsr.icount",
5958 .translate
= translate_xsr_icount
,
5959 .test_ill
= test_ill_sr
,
5960 .par
= (const uint32_t[]){
5962 XTENSA_OPTION_DEBUG
,
5964 .op_flags
= XTENSA_OP_PRIVILEGED
,
5966 .name
= "xsr.icountlevel",
5967 .translate
= translate_xsr_mask
,
5968 .test_ill
= test_ill_sr
,
5969 .par
= (const uint32_t[]){
5971 XTENSA_OPTION_DEBUG
,
5974 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5976 .name
= "xsr.intclear",
5977 .op_flags
= XTENSA_OP_ILL
,
5979 .name
= "xsr.intenable",
5980 .translate
= translate_xsr
,
5981 .test_ill
= test_ill_sr
,
5982 .par
= (const uint32_t[]){
5984 XTENSA_OPTION_INTERRUPT
,
5987 XTENSA_OP_PRIVILEGED
|
5988 XTENSA_OP_EXIT_TB_0
|
5989 XTENSA_OP_CHECK_INTERRUPTS
,
5991 .name
= "xsr.interrupt",
5992 .op_flags
= XTENSA_OP_ILL
,
5994 .name
= "xsr.intset",
5995 .op_flags
= XTENSA_OP_ILL
,
5997 .name
= "xsr.itlbcfg",
5998 .translate
= translate_xsr_mask
,
5999 .test_ill
= test_ill_sr
,
6000 .par
= (const uint32_t[]){
6005 .op_flags
= XTENSA_OP_PRIVILEGED
,
6008 .translate
= translate_xsr
,
6009 .test_ill
= test_ill_sr
,
6010 .par
= (const uint32_t[]){
6014 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6016 .name
= "xsr.lcount",
6017 .translate
= translate_xsr
,
6018 .test_ill
= test_ill_sr
,
6019 .par
= (const uint32_t[]){
6025 .translate
= translate_xsr
,
6026 .test_ill
= test_ill_sr
,
6027 .par
= (const uint32_t[]){
6031 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6033 .name
= "xsr.litbase",
6034 .translate
= translate_xsr_mask
,
6035 .test_ill
= test_ill_sr
,
6036 .par
= (const uint32_t[]){
6038 XTENSA_OPTION_EXTENDED_L32R
,
6041 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6044 .translate
= translate_xsr
,
6045 .test_ill
= test_ill_sr
,
6046 .par
= (const uint32_t[]){
6048 XTENSA_OPTION_MAC16
,
6052 .translate
= translate_xsr
,
6053 .test_ill
= test_ill_sr
,
6054 .par
= (const uint32_t[]){
6056 XTENSA_OPTION_MAC16
,
6060 .translate
= translate_xsr
,
6061 .test_ill
= test_ill_sr
,
6062 .par
= (const uint32_t[]){
6064 XTENSA_OPTION_MAC16
,
6068 .translate
= translate_xsr
,
6069 .test_ill
= test_ill_sr
,
6070 .par
= (const uint32_t[]){
6072 XTENSA_OPTION_MAC16
,
6075 .name
= "xsr.memctl",
6076 .translate
= translate_xsr_memctl
,
6077 .par
= (const uint32_t[]){MEMCTL
},
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
,
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
,
6107 .name
= "xsr.mesave",
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
,
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.mevaddr",
6126 .translate
= translate_xsr
,
6127 .test_ill
= test_ill_sr
,
6128 .par
= (const uint32_t[]){
6130 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6132 .op_flags
= XTENSA_OP_PRIVILEGED
,
6134 .name
= "xsr.misc0",
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.misc1",
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.misc2",
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.misc3",
6162 .translate
= translate_xsr
,
6163 .test_ill
= test_ill_sr
,
6164 .par
= (const uint32_t[]){
6166 XTENSA_OPTION_MISC_SR
,
6168 .op_flags
= XTENSA_OP_PRIVILEGED
,
6170 .name
= "xsr.mpuenb",
6171 .translate
= translate_xsr_mpuenb
,
6172 .test_ill
= test_ill_sr
,
6173 .par
= (const uint32_t[]){
6177 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6179 .name
= "xsr.prefctl",
6180 .translate
= translate_xsr
,
6181 .par
= (const uint32_t[]){PREFCTL
},
6184 .op_flags
= XTENSA_OP_ILL
,
6187 .translate
= translate_xsr_ps
,
6188 .test_ill
= test_ill_sr
,
6189 .par
= (const uint32_t[]){
6191 XTENSA_OPTION_EXCEPTION
,
6194 XTENSA_OP_PRIVILEGED
|
6195 XTENSA_OP_EXIT_TB_M1
|
6196 XTENSA_OP_CHECK_INTERRUPTS
,
6198 .name
= "xsr.ptevaddr",
6199 .translate
= translate_xsr_mask
,
6200 .test_ill
= test_ill_sr
,
6201 .par
= (const uint32_t[]){
6206 .op_flags
= XTENSA_OP_PRIVILEGED
,
6208 .name
= "xsr.rasid",
6209 .translate
= translate_xsr_rasid
,
6210 .test_ill
= test_ill_sr
,
6211 .par
= (const uint32_t[]){
6215 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6218 .translate
= translate_xsr_sar
,
6219 .par
= (const uint32_t[]){SAR
},
6221 .name
= "xsr.scompare1",
6222 .translate
= translate_xsr
,
6223 .test_ill
= test_ill_sr
,
6224 .par
= (const uint32_t[]){
6226 XTENSA_OPTION_CONDITIONAL_STORE
,
6229 .name
= "xsr.vecbase",
6230 .translate
= translate_xsr
,
6231 .test_ill
= test_ill_sr
,
6232 .par
= (const uint32_t[]){
6234 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6236 .op_flags
= XTENSA_OP_PRIVILEGED
,
6238 .name
= "xsr.windowbase",
6239 .translate
= translate_xsr_windowbase
,
6240 .test_ill
= test_ill_sr
,
6241 .par
= (const uint32_t[]){
6243 XTENSA_OPTION_WINDOWED_REGISTER
,
6245 .op_flags
= XTENSA_OP_PRIVILEGED
|
6246 XTENSA_OP_EXIT_TB_M1
|
6247 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6249 .name
= "xsr.windowstart",
6250 .translate
= translate_xsr_windowstart
,
6251 .test_ill
= test_ill_sr
,
6252 .par
= (const uint32_t[]){
6254 XTENSA_OPTION_WINDOWED_REGISTER
,
6256 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6260 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6261 .num_opcodes
= ARRAY_SIZE(core_ops
),
6266 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6267 const uint32_t par
[])
6269 gen_helper_abs_s(arg
[0].out
, arg
[1].in
);
6272 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6273 const uint32_t par
[])
6275 gen_helper_add_s(arg
[0].out
, cpu_env
,
6276 arg
[1].in
, arg
[2].in
);
6289 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6290 const uint32_t par
[])
6292 static void (* const helper
[])(TCGv_env env
, TCGv_i32 bit
,
6293 TCGv_i32 s
, TCGv_i32 t
) = {
6294 [COMPARE_UN
] = gen_helper_un_s
,
6295 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6296 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6297 [COMPARE_OLT
] = gen_helper_olt_s
,
6298 [COMPARE_ULT
] = gen_helper_ult_s
,
6299 [COMPARE_OLE
] = gen_helper_ole_s
,
6300 [COMPARE_ULE
] = gen_helper_ule_s
,
6302 TCGv_i32 bit
= tcg_const_i32(1 << arg
[0].imm
);
6304 helper
[par
[0]](cpu_env
, bit
, arg
[1].in
, arg
[2].in
);
6308 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6309 const uint32_t par
[])
6311 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6314 gen_helper_uitof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6316 gen_helper_itof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6318 tcg_temp_free(scale
);
6321 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6322 const uint32_t par
[])
6324 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6325 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6328 gen_helper_ftoui(arg
[0].out
, arg
[1].in
,
6329 rounding_mode
, scale
);
6331 gen_helper_ftoi(arg
[0].out
, arg
[1].in
,
6332 rounding_mode
, scale
);
6334 tcg_temp_free(rounding_mode
);
6335 tcg_temp_free(scale
);
6338 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6339 const uint32_t par
[])
6341 TCGv_i32 addr
= tcg_temp_new_i32();
6343 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6344 gen_load_store_alignment(dc
, 2, addr
, false);
6346 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6348 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6351 tcg_gen_mov_i32(arg
[1].out
, addr
);
6353 tcg_temp_free(addr
);
6356 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6357 const uint32_t par
[])
6359 TCGv_i32 addr
= tcg_temp_new_i32();
6361 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6362 gen_load_store_alignment(dc
, 2, addr
, false);
6364 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6366 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6369 tcg_gen_mov_i32(arg
[1].out
, addr
);
6371 tcg_temp_free(addr
);
6374 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6375 const uint32_t par
[])
6377 gen_helper_madd_s(arg
[0].out
, cpu_env
,
6378 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6381 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6382 const uint32_t par
[])
6384 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6387 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6388 const uint32_t par
[])
6390 TCGv_i32 zero
= tcg_const_i32(0);
6392 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6394 arg
[1].in
, arg
[0].in
);
6395 tcg_temp_free(zero
);
6398 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6399 const uint32_t par
[])
6401 TCGv_i32 zero
= tcg_const_i32(0);
6402 TCGv_i32 tmp
= tcg_temp_new_i32();
6404 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6405 tcg_gen_movcond_i32(par
[0],
6406 arg
[0].out
, tmp
, zero
,
6407 arg
[1].in
, arg
[0].in
);
6409 tcg_temp_free(zero
);
6412 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6413 const uint32_t par
[])
6415 gen_helper_mul_s(arg
[0].out
, cpu_env
,
6416 arg
[1].in
, arg
[2].in
);
6419 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6420 const uint32_t par
[])
6422 gen_helper_msub_s(arg
[0].out
, cpu_env
,
6423 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6426 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6427 const uint32_t par
[])
6429 gen_helper_neg_s(arg
[0].out
, arg
[1].in
);
6432 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6433 const uint32_t par
[])
6435 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6438 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6439 const uint32_t par
[])
6441 gen_helper_sub_s(arg
[0].out
, cpu_env
,
6442 arg
[1].in
, arg
[2].in
);
6445 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6446 const uint32_t par
[])
6448 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6451 static const XtensaOpcodeOps fpu2000_ops
[] = {
6454 .translate
= translate_abs_s
,
6458 .translate
= translate_add_s
,
6462 .translate
= translate_ftoi_s
,
6463 .par
= (const uint32_t[]){float_round_up
, false},
6467 .translate
= translate_float_s
,
6468 .par
= (const uint32_t[]){false},
6472 .translate
= translate_ftoi_s
,
6473 .par
= (const uint32_t[]){float_round_down
, false},
6477 .translate
= translate_ldsti
,
6478 .par
= (const uint32_t[]){false, false},
6479 .op_flags
= XTENSA_OP_LOAD
,
6483 .translate
= translate_ldsti
,
6484 .par
= (const uint32_t[]){false, true},
6485 .op_flags
= XTENSA_OP_LOAD
,
6489 .translate
= translate_ldstx
,
6490 .par
= (const uint32_t[]){false, false},
6491 .op_flags
= XTENSA_OP_LOAD
,
6495 .translate
= translate_ldstx
,
6496 .par
= (const uint32_t[]){false, true},
6497 .op_flags
= XTENSA_OP_LOAD
,
6501 .translate
= translate_madd_s
,
6505 .translate
= translate_mov_s
,
6509 .translate
= translate_movcond_s
,
6510 .par
= (const uint32_t[]){TCG_COND_EQ
},
6514 .translate
= translate_movp_s
,
6515 .par
= (const uint32_t[]){TCG_COND_EQ
},
6519 .translate
= translate_movcond_s
,
6520 .par
= (const uint32_t[]){TCG_COND_GE
},
6524 .translate
= translate_movcond_s
,
6525 .par
= (const uint32_t[]){TCG_COND_LT
},
6529 .translate
= translate_movcond_s
,
6530 .par
= (const uint32_t[]){TCG_COND_NE
},
6534 .translate
= translate_movp_s
,
6535 .par
= (const uint32_t[]){TCG_COND_NE
},
6539 .translate
= translate_msub_s
,
6543 .translate
= translate_mul_s
,
6547 .translate
= translate_neg_s
,
6551 .translate
= translate_compare_s
,
6552 .par
= (const uint32_t[]){COMPARE_OEQ
},
6556 .translate
= translate_compare_s
,
6557 .par
= (const uint32_t[]){COMPARE_OLE
},
6561 .translate
= translate_compare_s
,
6562 .par
= (const uint32_t[]){COMPARE_OLT
},
6566 .translate
= translate_rfr_s
,
6570 .translate
= translate_ftoi_s
,
6571 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6575 .translate
= translate_ldsti
,
6576 .par
= (const uint32_t[]){true, false},
6577 .op_flags
= XTENSA_OP_STORE
,
6581 .translate
= translate_ldsti
,
6582 .par
= (const uint32_t[]){true, true},
6583 .op_flags
= XTENSA_OP_STORE
,
6587 .translate
= translate_ldstx
,
6588 .par
= (const uint32_t[]){true, false},
6589 .op_flags
= XTENSA_OP_STORE
,
6593 .translate
= translate_ldstx
,
6594 .par
= (const uint32_t[]){true, true},
6595 .op_flags
= XTENSA_OP_STORE
,
6599 .translate
= translate_sub_s
,
6603 .translate
= translate_ftoi_s
,
6604 .par
= (const uint32_t[]){float_round_to_zero
, false},
6608 .translate
= translate_compare_s
,
6609 .par
= (const uint32_t[]){COMPARE_UEQ
},
6613 .translate
= translate_float_s
,
6614 .par
= (const uint32_t[]){true},
6618 .translate
= translate_compare_s
,
6619 .par
= (const uint32_t[]){COMPARE_ULE
},
6623 .translate
= translate_compare_s
,
6624 .par
= (const uint32_t[]){COMPARE_ULT
},
6628 .translate
= translate_compare_s
,
6629 .par
= (const uint32_t[]){COMPARE_UN
},
6633 .translate
= translate_ftoi_s
,
6634 .par
= (const uint32_t[]){float_round_to_zero
, true},
6638 .translate
= translate_wfr_s
,
6643 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6644 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6645 .opcode
= fpu2000_ops
,