3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm
5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Open Source and Linux Lab nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "qemu/osdep.h"
34 #include "exec/exec-all.h"
35 #include "disas/disas.h"
36 #include "tcg/tcg-op.h"
38 #include "qemu/qemu-print.h"
39 #include "exec/cpu_ldst.h"
40 #include "hw/semihosting/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
46 #include "trace-tcg.h"
51 DisasContextBase base
;
52 const XtensaConfig
*config
;
61 bool sar_m32_allocated
;
75 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
76 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i32 cpu_MR
[4];
83 static TCGv_i32 cpu_BR
[16];
84 static TCGv_i32 cpu_BR4
[4];
85 static TCGv_i32 cpu_BR8
[2];
86 static TCGv_i32 cpu_SR
[256];
87 static TCGv_i32 cpu_UR
[256];
88 static TCGv_i32 cpu_windowbase_next
;
89 static TCGv_i32 cpu_exclusive_addr
;
90 static TCGv_i32 cpu_exclusive_val
;
92 static GHashTable
*xtensa_regfile_table
;
94 #include "exec/gen-icount.h"
96 static char *sr_name
[256];
97 static char *ur_name
[256];
99 void xtensa_collect_sr_names(const XtensaConfig
*config
)
101 xtensa_isa isa
= config
->isa
;
102 int n
= xtensa_isa_num_sysregs(isa
);
105 for (i
= 0; i
< n
; ++i
) {
106 int sr
= xtensa_sysreg_number(isa
, i
);
108 if (sr
>= 0 && sr
< 256) {
109 const char *name
= xtensa_sysreg_name(isa
, i
);
111 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
114 if (strstr(*pname
, name
) == NULL
) {
116 malloc(strlen(*pname
) + strlen(name
) + 2);
118 strcpy(new_name
, *pname
);
119 strcat(new_name
, "/");
120 strcat(new_name
, name
);
125 *pname
= strdup(name
);
131 void xtensa_translate_init(void)
133 static const char * const regnames
[] = {
134 "ar0", "ar1", "ar2", "ar3",
135 "ar4", "ar5", "ar6", "ar7",
136 "ar8", "ar9", "ar10", "ar11",
137 "ar12", "ar13", "ar14", "ar15",
139 static const char * const fregnames
[] = {
140 "f0", "f1", "f2", "f3",
141 "f4", "f5", "f6", "f7",
142 "f8", "f9", "f10", "f11",
143 "f12", "f13", "f14", "f15",
145 static const char * const mregnames
[] = {
146 "m0", "m1", "m2", "m3",
148 static const char * const bregnames
[] = {
149 "b0", "b1", "b2", "b3",
150 "b4", "b5", "b6", "b7",
151 "b8", "b9", "b10", "b11",
152 "b12", "b13", "b14", "b15",
156 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
157 offsetof(CPUXtensaState
, pc
), "pc");
159 for (i
= 0; i
< 16; i
++) {
160 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
161 offsetof(CPUXtensaState
, regs
[i
]),
165 for (i
= 0; i
< 16; i
++) {
166 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
167 offsetof(CPUXtensaState
,
168 fregs
[i
].f32
[FP_F32_LOW
]),
172 for (i
= 0; i
< 4; i
++) {
173 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
174 offsetof(CPUXtensaState
,
179 for (i
= 0; i
< 16; i
++) {
180 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
181 offsetof(CPUXtensaState
,
185 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
186 offsetof(CPUXtensaState
,
191 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
192 offsetof(CPUXtensaState
,
198 for (i
= 0; i
< 256; ++i
) {
200 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
201 offsetof(CPUXtensaState
,
207 for (i
= 0; i
< 256; ++i
) {
209 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
210 offsetof(CPUXtensaState
,
216 cpu_windowbase_next
=
217 tcg_global_mem_new_i32(cpu_env
,
218 offsetof(CPUXtensaState
, windowbase_next
),
221 tcg_global_mem_new_i32(cpu_env
,
222 offsetof(CPUXtensaState
, exclusive_addr
),
225 tcg_global_mem_new_i32(cpu_env
,
226 offsetof(CPUXtensaState
, exclusive_val
),
230 void **xtensa_get_regfile_by_name(const char *name
)
232 if (xtensa_regfile_table
== NULL
) {
233 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
234 g_hash_table_insert(xtensa_regfile_table
,
235 (void *)"AR", (void *)cpu_R
);
236 g_hash_table_insert(xtensa_regfile_table
,
237 (void *)"MR", (void *)cpu_MR
);
238 g_hash_table_insert(xtensa_regfile_table
,
239 (void *)"FR", (void *)cpu_FR
);
240 g_hash_table_insert(xtensa_regfile_table
,
241 (void *)"BR", (void *)cpu_BR
);
242 g_hash_table_insert(xtensa_regfile_table
,
243 (void *)"BR4", (void *)cpu_BR4
);
244 g_hash_table_insert(xtensa_regfile_table
,
245 (void *)"BR8", (void *)cpu_BR8
);
247 return (void **)g_hash_table_lookup(xtensa_regfile_table
, (void *)name
);
250 static inline bool option_enabled(DisasContext
*dc
, int opt
)
252 return xtensa_option_enabled(dc
->config
, opt
);
255 static void init_sar_tracker(DisasContext
*dc
)
257 dc
->sar_5bit
= false;
258 dc
->sar_m32_5bit
= false;
259 dc
->sar_m32_allocated
= false;
262 static void reset_sar_tracker(DisasContext
*dc
)
264 if (dc
->sar_m32_allocated
) {
265 tcg_temp_free(dc
->sar_m32
);
269 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
271 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
272 if (dc
->sar_m32_5bit
) {
273 tcg_gen_discard_i32(dc
->sar_m32
);
276 dc
->sar_m32_5bit
= false;
279 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
281 TCGv_i32 tmp
= tcg_const_i32(32);
282 if (!dc
->sar_m32_allocated
) {
283 dc
->sar_m32
= tcg_temp_local_new_i32();
284 dc
->sar_m32_allocated
= true;
286 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
287 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
288 dc
->sar_5bit
= false;
289 dc
->sar_m32_5bit
= true;
293 static void gen_exception(DisasContext
*dc
, int excp
)
295 TCGv_i32 tmp
= tcg_const_i32(excp
);
296 gen_helper_exception(cpu_env
, tmp
);
300 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
302 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
303 TCGv_i32 tcause
= tcg_const_i32(cause
);
304 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
306 tcg_temp_free(tcause
);
307 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
308 cause
== SYSCALL_CAUSE
) {
309 dc
->base
.is_jmp
= DISAS_NORETURN
;
313 static void gen_exception_cause_vaddr(DisasContext
*dc
, uint32_t cause
,
316 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
317 TCGv_i32 tcause
= tcg_const_i32(cause
);
318 gen_helper_exception_cause_vaddr(cpu_env
, tpc
, tcause
, vaddr
);
320 tcg_temp_free(tcause
);
323 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
325 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
326 TCGv_i32 tcause
= tcg_const_i32(cause
);
327 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
329 tcg_temp_free(tcause
);
330 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
331 dc
->base
.is_jmp
= DISAS_NORETURN
;
335 static bool gen_check_privilege(DisasContext
*dc
)
337 #ifndef CONFIG_USER_ONLY
342 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
343 dc
->base
.is_jmp
= DISAS_NORETURN
;
347 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
349 cp_mask
&= ~dc
->cpenable
;
351 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
352 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
353 dc
->base
.is_jmp
= DISAS_NORETURN
;
359 static int gen_postprocess(DisasContext
*dc
, int slot
);
361 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
363 tcg_gen_mov_i32(cpu_pc
, dest
);
365 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
367 if (dc
->base
.singlestep_enabled
) {
368 gen_exception(dc
, EXCP_DEBUG
);
370 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
371 slot
= gen_postprocess(dc
, slot
);
374 tcg_gen_goto_tb(slot
);
375 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
377 tcg_gen_exit_tb(NULL
, 0);
380 dc
->base
.is_jmp
= DISAS_NORETURN
;
383 static void gen_jump(DisasContext
*dc
, TCGv dest
)
385 gen_jump_slot(dc
, dest
, -1);
388 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
390 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
397 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
399 TCGv_i32 tmp
= tcg_const_i32(dest
);
400 gen_jump_slot(dc
, tmp
, adjust_jump_slot(dc
, dest
, slot
));
404 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
407 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
409 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
410 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
411 tcg_temp_free(tcallinc
);
412 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
413 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
414 gen_jump_slot(dc
, dest
, slot
);
417 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
419 if (dc
->base
.pc_next
== dc
->lend
) {
420 TCGLabel
*label
= gen_new_label();
422 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
423 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
425 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
427 gen_jump(dc
, cpu_SR
[LBEG
]);
429 gen_set_label(label
);
430 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
436 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
438 if (!gen_check_loop_end(dc
, slot
)) {
439 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
443 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
444 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
446 TCGLabel
*label
= gen_new_label();
448 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
449 gen_jumpi_check_loop_end(dc
, 0);
450 gen_set_label(label
);
451 gen_jumpi(dc
, addr
, 1);
454 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
455 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
457 TCGv_i32 tmp
= tcg_const_i32(t1
);
458 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
462 static bool test_ill_sr(DisasContext
*dc
, const OpcodeArg arg
[],
463 const uint32_t par
[])
465 return !xtensa_option_enabled(dc
->config
, par
[1]);
468 static bool test_ill_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
469 const uint32_t par
[])
471 unsigned n
= par
[0] - CCOMPARE
;
473 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->nccompare
;
476 static bool test_ill_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
477 const uint32_t par
[])
479 unsigned n
= MAX_NDBREAK
;
481 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
482 n
= par
[0] - DBREAKA
;
484 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
485 n
= par
[0] - DBREAKC
;
487 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->ndbreak
;
490 static bool test_ill_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
491 const uint32_t par
[])
493 unsigned n
= par
[0] - IBREAKA
;
495 return test_ill_sr(dc
, arg
, par
) || n
>= dc
->config
->nibreak
;
498 static bool test_ill_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
499 const uint32_t par
[])
501 unsigned n
= MAX_NLEVEL
+ 1;
503 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
504 n
= par
[0] - EXCSAVE1
+ 1;
506 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
507 n
= par
[0] - EPC1
+ 1;
509 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
510 n
= par
[0] - EPS2
+ 2;
512 return test_ill_sr(dc
, arg
, par
) || n
> dc
->config
->nlevel
;
515 static void gen_load_store_alignment(DisasContext
*dc
, int shift
,
516 TCGv_i32 addr
, bool no_hw_alignment
)
518 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
519 tcg_gen_andi_i32(addr
, addr
, ~0 << shift
);
520 } else if (option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
) &&
522 TCGLabel
*label
= gen_new_label();
523 TCGv_i32 tmp
= tcg_temp_new_i32();
524 tcg_gen_andi_i32(tmp
, addr
, ~(~0 << shift
));
525 tcg_gen_brcondi_i32(TCG_COND_EQ
, tmp
, 0, label
);
526 gen_exception_cause_vaddr(dc
, LOAD_STORE_ALIGNMENT_CAUSE
, addr
);
527 gen_set_label(label
);
532 #ifndef CONFIG_USER_ONLY
533 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
535 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
536 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
538 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
541 gen_helper_waiti(cpu_env
, pc
, intlevel
);
543 tcg_temp_free(intlevel
);
547 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
549 unsigned r
= 31 - clz32(mask
);
551 if (r
/ 4 > dc
->window
) {
552 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
553 TCGv_i32 w
= tcg_const_i32(r
/ 4);
555 gen_helper_window_check(cpu_env
, pc
, w
);
556 dc
->base
.is_jmp
= DISAS_NORETURN
;
562 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
564 TCGv_i32 m
= tcg_temp_new_i32();
567 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
569 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
574 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
576 TCGLabel
*label
= gen_new_label();
578 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
579 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
580 gen_set_label(label
);
583 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
585 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
588 static int gen_postprocess(DisasContext
*dc
, int slot
)
590 uint32_t op_flags
= dc
->op_flags
;
592 #ifndef CONFIG_USER_ONLY
593 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
594 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
597 gen_helper_check_interrupts(cpu_env
);
600 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
601 gen_helper_sync_windowbase(cpu_env
);
603 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
609 struct opcode_arg_copy
{
615 struct opcode_arg_info
{
621 XtensaOpcodeOps
*ops
;
622 OpcodeArg arg
[MAX_OPCODE_ARGS
];
623 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
624 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
636 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
638 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
639 return (r
<< 24) | (g
<< 16) | n
;
642 static enum resource_type
get_resource_type(uint32_t resource
)
644 return resource
>> 24;
648 * a depends on b if b must be executed before a,
649 * because a's side effects will destroy b's inputs.
651 static bool op_depends_on(const struct slot_prop
*a
,
652 const struct slot_prop
*b
)
657 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
660 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
661 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
664 while (i
< a
->n_out
&& j
< b
->n_in
) {
665 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
667 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
677 * Try to break a dependency on b, append temporary register copy records
678 * to the end of copy and update n_copy in case of success.
679 * This is not always possible: e.g. control flow must always be the last,
680 * load/store must be first and state dependencies are not supported yet.
682 static bool break_dependency(struct slot_prop
*a
,
684 struct opcode_arg_copy
*copy
,
689 unsigned n
= *n_copy
;
692 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
695 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
696 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
699 while (i
< a
->n_out
&& j
< b
->n_in
) {
700 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
702 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
705 int index
= b
->in
[j
].index
;
707 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
711 copy
[n
].resource
= b
->in
[j
].resource
;
712 copy
[n
].arg
= b
->arg
+ index
;
723 * Calculate evaluation order for slot opcodes.
724 * Build opcode order graph and output its nodes in topological sort order.
725 * An edge a -> b in the graph means that opcode a must be followed by
728 static bool tsort(struct slot_prop
*slot
,
729 struct slot_prop
*sorted
[],
731 struct opcode_arg_copy
*copy
,
737 unsigned out_edge
[MAX_INSN_SLOTS
];
738 } node
[MAX_INSN_SLOTS
];
740 unsigned in
[MAX_INSN_SLOTS
];
746 unsigned node_idx
= 0;
748 for (i
= 0; i
< n
; ++i
) {
749 node
[i
].n_in_edge
= 0;
750 node
[i
].n_out_edge
= 0;
753 for (i
= 0; i
< n
; ++i
) {
754 unsigned n_out_edge
= 0;
756 for (j
= 0; j
< n
; ++j
) {
757 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
758 node
[i
].out_edge
[n_out_edge
] = j
;
764 node
[i
].n_out_edge
= n_out_edge
;
767 for (i
= 0; i
< n
; ++i
) {
768 if (!node
[i
].n_in_edge
) {
775 for (; in_idx
< n_in
; ++in_idx
) {
777 sorted
[n_out
] = slot
+ i
;
779 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
781 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
782 in
[n_in
] = node
[i
].out_edge
[j
];
788 for (; node_idx
< n
; ++node_idx
) {
789 struct tsnode
*cnode
= node
+ node_idx
;
791 if (cnode
->n_in_edge
) {
792 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
793 unsigned k
= cnode
->out_edge
[j
];
795 if (break_dependency(slot
+ k
, slot
+ node_idx
,
797 --node
[k
].n_in_edge
== 0) {
802 cnode
->out_edge
[cnode
->n_out_edge
- 1];
813 static void opcode_add_resource(struct slot_prop
*op
,
814 uint32_t resource
, char direction
,
820 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
821 op
->in
[op
->n_in
].resource
= resource
;
822 op
->in
[op
->n_in
].index
= index
;
826 if (direction
== 'm' || direction
== 'o') {
827 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
828 op
->out
[op
->n_out
].resource
= resource
;
829 op
->out
[op
->n_out
].index
= index
;
834 g_assert_not_reached();
838 static int resource_compare(const void *a
, const void *b
)
840 const struct opcode_arg_info
*pa
= a
;
841 const struct opcode_arg_info
*pb
= b
;
843 return pa
->resource
< pb
->resource
?
844 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
847 static int arg_copy_compare(const void *a
, const void *b
)
849 const struct opcode_arg_copy
*pa
= a
;
850 const struct opcode_arg_copy
*pb
= b
;
852 return pa
->resource
< pb
->resource
?
853 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
856 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
858 xtensa_isa isa
= dc
->config
->isa
;
859 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, dc
->pc
)};
860 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
864 uint32_t op_flags
= 0;
865 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
866 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
867 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
868 unsigned n_arg_copy
= 0;
869 uint32_t debug_cause
= 0;
870 uint32_t windowed_register
= 0;
871 uint32_t coprocessor
= 0;
873 if (len
== XTENSA_UNDEFINED
) {
874 qemu_log_mask(LOG_GUEST_ERROR
,
875 "unknown instruction length (pc = %08x)\n",
877 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
881 dc
->base
.pc_next
= dc
->pc
+ len
;
882 for (i
= 1; i
< len
; ++i
) {
883 b
[i
] = translator_ldub(env
, dc
->pc
+ i
);
885 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
886 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
887 if (fmt
== XTENSA_UNDEFINED
) {
888 qemu_log_mask(LOG_GUEST_ERROR
,
889 "unrecognized instruction format (pc = %08x)\n",
891 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
894 slots
= xtensa_format_num_slots(isa
, fmt
);
895 for (slot
= 0; slot
< slots
; ++slot
) {
897 int opnd
, vopnd
, opnds
;
898 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
899 XtensaOpcodeOps
*ops
;
901 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
902 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
903 if (opc
== XTENSA_UNDEFINED
) {
904 qemu_log_mask(LOG_GUEST_ERROR
,
905 "unrecognized opcode in slot %d (pc = %08x)\n",
907 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
910 opnds
= xtensa_opcode_num_operands(isa
, opc
);
912 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
913 void **register_file
= NULL
;
915 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
916 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
918 register_file
= dc
->config
->regfile
[rf
];
920 if (rf
== dc
->config
->a_regfile
) {
923 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
925 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
926 windowed_register
|= 1u << v
;
929 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
932 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
934 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
935 arg
[vopnd
].raw_imm
= v
;
936 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
937 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
941 arg
[vopnd
].in
= register_file
[v
];
942 arg
[vopnd
].out
= register_file
[v
];
947 ops
= dc
->config
->opcode_ops
[opc
];
948 slot_prop
[slot
].ops
= ops
;
951 op_flags
|= ops
->op_flags
;
953 qemu_log_mask(LOG_UNIMP
,
954 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
955 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
956 op_flags
|= XTENSA_OP_ILL
;
958 if ((op_flags
& XTENSA_OP_ILL
) ||
959 (ops
&& ops
->test_ill
&& ops
->test_ill(dc
, arg
, ops
->par
))) {
960 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
963 if (ops
->op_flags
& XTENSA_OP_DEBUG_BREAK
) {
964 debug_cause
|= ops
->par
[0];
966 if (ops
->test_overflow
) {
967 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
969 coprocessor
|= ops
->coprocessor
;
972 slot_prop
[slot
].n_in
= 0;
973 slot_prop
[slot
].n_out
= 0;
974 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
976 opnds
= xtensa_opcode_num_operands(isa
, opc
);
978 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
979 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
981 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
982 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
985 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
987 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
988 opcode_add_resource(slot_prop
+ slot
,
989 encode_resource(RES_REGFILE
, rf
, v
),
990 xtensa_operand_inout(isa
, opc
, opnd
),
991 visible
? vopnd
: -1);
998 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
1000 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
1001 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
1003 opcode_add_resource(slot_prop
+ slot
,
1004 encode_resource(RES_STATE
, 0, state
),
1005 xtensa_stateOperand_inout(isa
, opc
, opnd
),
1008 if (xtensa_opcode_is_branch(isa
, opc
) ||
1009 xtensa_opcode_is_jump(isa
, opc
) ||
1010 xtensa_opcode_is_loop(isa
, opc
) ||
1011 xtensa_opcode_is_call(isa
, opc
)) {
1012 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1015 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1016 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1017 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1018 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1023 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1024 qemu_log_mask(LOG_UNIMP
,
1025 "Circular resource dependencies (pc = %08x)\n",
1027 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1031 ordered
[0] = slot_prop
+ 0;
1034 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1035 !gen_check_privilege(dc
)) {
1039 if (op_flags
& XTENSA_OP_SYSCALL
) {
1040 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1044 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1045 gen_debug_exception(dc
, debug_cause
);
1049 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1053 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1054 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1056 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1060 if (op_flags
& XTENSA_OP_ALLOCA
) {
1061 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1063 gen_helper_movsp(cpu_env
, tmp
);
1067 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1076 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1077 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1078 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1079 resource
= arg_copy
[i
].resource
;
1080 temp
= tcg_temp_local_new();
1081 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1082 arg_copy
[i
].temp
= temp
;
1085 arg_copy
[j
] = arg_copy
[i
];
1089 arg_copy
[i
].arg
->in
= temp
;
1094 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1095 for (slot
= 0; slot
< slots
; ++slot
) {
1096 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1097 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1102 dc
->op_flags
= op_flags
;
1104 for (slot
= 0; slot
< slots
; ++slot
) {
1105 struct slot_prop
*pslot
= ordered
[slot
];
1106 XtensaOpcodeOps
*ops
= pslot
->ops
;
1108 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1111 for (i
= 0; i
< n_arg_copy
; ++i
) {
1112 tcg_temp_free(arg_copy
[i
].temp
);
1115 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1116 gen_postprocess(dc
, 0);
1118 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1119 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1120 gen_jumpi_check_loop_end(dc
, -1);
1121 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1122 gen_jumpi_check_loop_end(dc
, 0);
1124 gen_check_loop_end(dc
, 0);
1127 dc
->pc
= dc
->base
.pc_next
;
1130 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1132 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1133 return xtensa_op0_insn_len(dc
, b0
);
1136 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1140 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1141 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1142 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1143 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1149 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1152 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1153 CPUXtensaState
*env
= cpu
->env_ptr
;
1154 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1156 dc
->config
= env
->config
;
1157 dc
->pc
= dc
->base
.pc_first
;
1158 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1159 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1160 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1161 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1162 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1163 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1164 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1165 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1166 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1167 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1168 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1169 XTENSA_TBFLAG_WINDOW_SHIFT
);
1170 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1171 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1172 XTENSA_TBFLAG_CALLINC_SHIFT
);
1173 init_sar_tracker(dc
);
1176 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1178 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1181 dc
->next_icount
= tcg_temp_local_new_i32();
1185 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1187 tcg_gen_insn_start(dcbase
->pc_next
);
1190 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1191 const CPUBreakpoint
*bp
)
1193 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1195 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1196 gen_exception(dc
, EXCP_DEBUG
);
1197 dc
->base
.is_jmp
= DISAS_NORETURN
;
1198 /* The address covered by the breakpoint must be included in
1199 [tb->pc, tb->pc + tb->size) in order to for it to be
1200 properly cleared -- thus we increment the PC here so that
1201 the logic setting tb->size below does the right thing. */
1202 dc
->base
.pc_next
+= 2;
1206 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1208 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1209 CPUXtensaState
*env
= cpu
->env_ptr
;
1210 target_ulong page_start
;
1212 /* These two conditions only apply to the first insn in the TB,
1213 but this is the first TranslateOps hook that allows exiting. */
1214 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1215 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1216 gen_exception(dc
, EXCP_YIELD
);
1217 dc
->base
.is_jmp
= DISAS_NORETURN
;
1220 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1221 gen_exception(dc
, EXCP_DEBUG
);
1222 dc
->base
.is_jmp
= DISAS_NORETURN
;
1227 TCGLabel
*label
= gen_new_label();
1229 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1230 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1231 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1233 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1235 gen_set_label(label
);
1239 gen_ibreak_check(env
, dc
);
1242 disas_xtensa_insn(env
, dc
);
1245 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1248 /* End the TB if the next insn will cross into the next page. */
1249 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1250 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1251 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1252 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1253 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1257 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1259 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1261 reset_sar_tracker(dc
);
1263 tcg_temp_free(dc
->next_icount
);
1266 switch (dc
->base
.is_jmp
) {
1267 case DISAS_NORETURN
:
1269 case DISAS_TOO_MANY
:
1270 if (dc
->base
.singlestep_enabled
) {
1271 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1272 gen_exception(dc
, EXCP_DEBUG
);
1274 gen_jumpi(dc
, dc
->pc
, 0);
1278 g_assert_not_reached();
1282 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1284 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1285 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1288 static const TranslatorOps xtensa_translator_ops
= {
1289 .init_disas_context
= xtensa_tr_init_disas_context
,
1290 .tb_start
= xtensa_tr_tb_start
,
1291 .insn_start
= xtensa_tr_insn_start
,
1292 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1293 .translate_insn
= xtensa_tr_translate_insn
,
1294 .tb_stop
= xtensa_tr_tb_stop
,
1295 .disas_log
= xtensa_tr_disas_log
,
1298 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1300 DisasContext dc
= {};
1301 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1304 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1306 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1307 CPUXtensaState
*env
= &cpu
->env
;
1308 xtensa_isa isa
= env
->config
->isa
;
1311 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1313 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1314 const uint32_t *reg
=
1315 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1316 int regno
= xtensa_sysreg_number(isa
, i
);
1319 qemu_fprintf(f
, "%12s=%08x%c",
1320 xtensa_sysreg_name(isa
, i
),
1322 (j
++ % 4) == 3 ? '\n' : ' ');
1326 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1328 for (i
= 0; i
< 16; ++i
) {
1329 qemu_fprintf(f
, " A%02d=%08x%c",
1330 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1333 xtensa_sync_phys_from_window(env
);
1334 qemu_fprintf(f
, "\n");
1336 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1337 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1339 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1340 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1342 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1346 if ((flags
& CPU_DUMP_FPU
) &&
1347 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1348 qemu_fprintf(f
, "\n");
1350 for (i
= 0; i
< 16; ++i
) {
1351 qemu_fprintf(f
, "F%02d=%08x (%+10.8e)%c", i
,
1352 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1353 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1354 (i
% 2) == 1 ? '\n' : ' ');
1359 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1365 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1366 const uint32_t par
[])
1368 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1371 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1372 const uint32_t par
[])
1374 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1377 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1378 const uint32_t par
[])
1380 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1383 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1384 const uint32_t par
[])
1386 TCGv_i32 tmp
= tcg_temp_new_i32();
1387 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1388 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1392 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1393 const uint32_t par
[])
1395 uint32_t shift
= par
[1];
1396 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1397 TCGv_i32 tmp
= tcg_temp_new_i32();
1399 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1401 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1403 tcg_gen_add_i32(tmp
, tmp
, mask
);
1405 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1406 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1407 tmp
, arg
[0].imm
, 1);
1408 tcg_temp_free(mask
);
1412 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1413 const uint32_t par
[])
1415 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1418 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1419 const uint32_t par
[])
1421 TCGv_i32 tmp
= tcg_temp_new_i32();
1422 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1423 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1427 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1428 const uint32_t par
[])
1430 TCGv_i32 tmp
= tcg_temp_new_i32();
1431 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1432 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1436 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1437 const uint32_t par
[])
1439 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1442 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1443 const uint32_t par
[])
1445 #ifdef TARGET_WORDS_BIGENDIAN
1446 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1448 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1450 TCGv_i32 tmp
= tcg_temp_new_i32();
1451 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1452 #ifdef TARGET_WORDS_BIGENDIAN
1453 tcg_gen_shr_i32(bit
, bit
, tmp
);
1455 tcg_gen_shl_i32(bit
, bit
, tmp
);
1457 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1458 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1463 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1464 const uint32_t par
[])
1466 TCGv_i32 tmp
= tcg_temp_new_i32();
1467 #ifdef TARGET_WORDS_BIGENDIAN
1468 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1470 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1472 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1476 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1477 const uint32_t par
[])
1479 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1482 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1483 const uint32_t par
[])
1485 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1496 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1497 const uint32_t par
[])
1499 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1500 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1501 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1502 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1503 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1504 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1507 TCGv_i32 tmp1
= tcg_temp_new_i32();
1508 TCGv_i32 tmp2
= tcg_temp_new_i32();
1510 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1511 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1512 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1513 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1514 tcg_temp_free(tmp1
);
1515 tcg_temp_free(tmp2
);
1518 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1519 const uint32_t par
[])
1521 TCGv_i32 tmp
= tcg_temp_new_i32();
1523 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1524 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1528 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1529 const uint32_t par
[])
1531 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1532 gen_jumpi(dc
, arg
[0].imm
, 0);
1535 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1536 const uint32_t par
[])
1538 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1539 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1543 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1544 const uint32_t par
[])
1546 TCGv_i32 tmp
= tcg_temp_new_i32();
1547 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1548 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1553 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1554 const uint32_t par
[])
1556 TCGv_i32 tmp
= tcg_temp_new_i32();
1558 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1559 gen_callw_slot(dc
, par
[0], tmp
, -1);
1563 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1564 const uint32_t par
[])
1566 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1567 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1569 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1570 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1571 tcg_temp_free(tmp1
);
1572 tcg_temp_free(tmp2
);
1575 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1576 const uint32_t par
[])
1578 /* TODO: GPIO32 may be a part of coprocessor */
1579 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1582 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1583 const uint32_t par
[])
1585 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1588 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1589 const uint32_t par
[])
1591 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1593 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1597 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1598 const uint32_t par
[])
1600 TCGv_i32 addr
= tcg_temp_new_i32();
1601 TCGv_i32 res
= tcg_temp_new_i32();
1603 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1604 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1605 tcg_temp_free(addr
);
1609 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1610 const uint32_t par
[])
1612 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1613 arg
[2].imm
, arg
[3].imm
);
1616 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1617 const uint32_t par
[])
1619 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1622 static bool test_ill_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1623 const uint32_t par
[])
1625 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1626 qemu_log_mask(LOG_GUEST_ERROR
,
1627 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1634 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1635 const uint32_t par
[])
1637 return 1 << (dc
->callinc
* 4);
1640 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1641 const uint32_t par
[])
1643 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1644 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1645 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1646 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1652 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1653 const uint32_t par
[])
1655 int maskimm
= (1 << arg
[3].imm
) - 1;
1657 TCGv_i32 tmp
= tcg_temp_new_i32();
1658 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1659 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1663 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1664 const uint32_t par
[])
1666 TCGv_i32 tmp
= tcg_temp_new_i32();
1668 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1669 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1670 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1674 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1675 const uint32_t par
[])
1677 #ifndef CONFIG_USER_ONLY
1678 TCGv_i32 addr
= tcg_temp_new_i32();
1680 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1681 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1682 gen_helper_itlb_hit_test(cpu_env
, addr
);
1683 tcg_temp_free(addr
);
1687 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1688 const uint32_t par
[])
1690 #ifndef CONFIG_USER_ONLY
1691 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1693 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1694 tcg_temp_free(dtlb
);
1698 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1699 const uint32_t par
[])
1701 gen_jumpi(dc
, arg
[0].imm
, 0);
1704 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1705 const uint32_t par
[])
1707 gen_jump(dc
, arg
[0].in
);
1710 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1711 const uint32_t par
[])
1713 TCGv_i32 addr
= tcg_temp_new_i32();
1715 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1716 gen_load_store_alignment(dc
, 2, addr
, false);
1717 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1718 tcg_temp_free(addr
);
1721 #ifdef CONFIG_USER_ONLY
1722 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1726 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1728 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1729 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1730 TCGv_i32 write
= tcg_const_i32(is_write
);
1732 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1734 tcg_temp_free(write
);
1739 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1740 const uint32_t par
[])
1742 TCGv_i32 addr
= tcg_temp_new_i32();
1744 tcg_gen_mov_i32(addr
, arg
[1].in
);
1745 gen_load_store_alignment(dc
, 2, addr
, true);
1746 gen_check_exclusive(dc
, addr
, false);
1747 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1748 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1749 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1750 tcg_temp_free(addr
);
1753 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1754 const uint32_t par
[])
1756 TCGv_i32 addr
= tcg_temp_new_i32();
1758 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1759 if (par
[0] & MO_SIZE
) {
1760 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1764 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1766 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, par
[0]);
1768 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, par
[0]);
1770 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1773 tcg_temp_free(addr
);
1776 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1777 const uint32_t par
[])
1781 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1782 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1783 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1785 tmp
= tcg_const_i32(arg
[1].imm
);
1787 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1791 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1792 const uint32_t par
[])
1794 uint32_t lend
= arg
[1].imm
;
1796 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1797 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1798 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1800 if (par
[0] != TCG_COND_NEVER
) {
1801 TCGLabel
*label
= gen_new_label();
1802 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1803 gen_jumpi(dc
, lend
, 1);
1804 gen_set_label(label
);
1807 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1828 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1829 const uint32_t par
[])
1832 unsigned half
= par
[1];
1833 uint32_t ld_offset
= par
[2];
1834 unsigned off
= ld_offset
? 2 : 0;
1835 TCGv_i32 vaddr
= tcg_temp_new_i32();
1836 TCGv_i32 mem32
= tcg_temp_new_i32();
1839 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1840 gen_load_store_alignment(dc
, 2, vaddr
, false);
1841 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1843 if (op
!= MAC16_NONE
) {
1844 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1845 half
& MAC16_HX
, op
== MAC16_UMUL
);
1846 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1847 half
& MAC16_XH
, op
== MAC16_UMUL
);
1849 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1850 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1851 if (op
== MAC16_UMUL
) {
1852 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1854 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1857 TCGv_i32 lo
= tcg_temp_new_i32();
1858 TCGv_i32 hi
= tcg_temp_new_i32();
1860 tcg_gen_mul_i32(lo
, m1
, m2
);
1861 tcg_gen_sari_i32(hi
, lo
, 31);
1862 if (op
== MAC16_MULA
) {
1863 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1864 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1867 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1868 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1871 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1873 tcg_temp_free_i32(lo
);
1874 tcg_temp_free_i32(hi
);
1880 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1881 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1883 tcg_temp_free(vaddr
);
1884 tcg_temp_free(mem32
);
1887 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1888 const uint32_t par
[])
1890 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1893 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1894 const uint32_t par
[])
1896 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1899 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1900 const uint32_t par
[])
1902 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1905 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1906 const uint32_t par
[])
1908 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1911 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1912 const uint32_t par
[])
1914 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1917 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1918 const uint32_t par
[])
1920 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1923 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1924 const uint32_t par
[])
1926 TCGv_i32 zero
= tcg_const_i32(0);
1928 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1929 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1930 tcg_temp_free(zero
);
1933 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1934 const uint32_t par
[])
1936 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1939 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1940 const uint32_t par
[])
1942 TCGv_i32 zero
= tcg_const_i32(0);
1943 TCGv_i32 tmp
= tcg_temp_new_i32();
1945 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1946 tcg_gen_movcond_i32(par
[0],
1947 arg
[0].out
, tmp
, zero
,
1948 arg
[1].in
, arg
[0].in
);
1950 tcg_temp_free(zero
);
1953 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1954 const uint32_t par
[])
1956 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1959 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1960 const uint32_t par
[])
1962 TCGv_i32 v1
= tcg_temp_new_i32();
1963 TCGv_i32 v2
= tcg_temp_new_i32();
1966 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1967 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1969 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1970 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1972 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1977 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1978 const uint32_t par
[])
1980 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1983 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1984 const uint32_t par
[])
1986 TCGv_i32 lo
= tcg_temp_new();
1989 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1991 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1996 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
1997 const uint32_t par
[])
1999 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2002 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2003 const uint32_t par
[])
2007 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2008 const uint32_t par
[])
2010 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2013 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2014 const uint32_t par
[])
2016 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2019 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2020 const uint32_t par
[])
2022 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2025 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2026 const uint32_t par
[])
2028 #ifndef CONFIG_USER_ONLY
2029 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2031 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2032 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2033 tcg_temp_free(dtlb
);
2037 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2038 const uint32_t par
[])
2040 #ifndef CONFIG_USER_ONLY
2041 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2042 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2046 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2047 const uint32_t par
[])
2049 TCGLabel
*label1
= gen_new_label();
2050 TCGLabel
*label2
= gen_new_label();
2052 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2054 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2056 tcg_gen_movi_i32(arg
[0].out
,
2057 par
[0] ? 0x80000000 : 0);
2059 gen_set_label(label1
);
2061 tcg_gen_div_i32(arg
[0].out
,
2062 arg
[1].in
, arg
[2].in
);
2064 tcg_gen_rem_i32(arg
[0].out
,
2065 arg
[1].in
, arg
[2].in
);
2067 gen_set_label(label2
);
2070 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2071 const uint32_t par
[])
2073 tcg_gen_divu_i32(arg
[0].out
,
2074 arg
[1].in
, arg
[2].in
);
2077 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2078 const uint32_t par
[])
2080 /* TODO: GPIO32 may be a part of coprocessor */
2081 tcg_gen_movi_i32(arg
[0].out
, 0);
2084 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2085 const uint32_t par
[])
2087 tcg_gen_remu_i32(arg
[0].out
,
2088 arg
[1].in
, arg
[2].in
);
2091 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2092 const uint32_t par
[])
2094 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2097 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2098 const uint32_t par
[])
2100 gen_jump(dc
, cpu_R
[0]);
2103 static bool test_ill_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2104 const uint32_t par
[])
2107 qemu_log_mask(LOG_GUEST_ERROR
,
2108 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2111 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2113 gen_helper_test_ill_retw(cpu_env
, tmp
);
2119 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2120 const uint32_t par
[])
2122 TCGv_i32 tmp
= tcg_const_i32(1);
2123 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2124 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2125 cpu_SR
[WINDOW_START
], tmp
);
2126 tcg_gen_movi_i32(tmp
, dc
->pc
);
2127 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2128 gen_helper_retw(cpu_env
, cpu_R
[0]);
2133 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2134 const uint32_t par
[])
2136 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2139 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2140 const uint32_t par
[])
2142 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2143 gen_jump(dc
, cpu_SR
[EPC1
]);
2146 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2147 const uint32_t par
[])
2149 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2150 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2153 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2154 const uint32_t par
[])
2156 TCGv_i32 tmp
= tcg_const_i32(1);
2158 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2159 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2162 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2163 cpu_SR
[WINDOW_START
], tmp
);
2165 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2166 cpu_SR
[WINDOW_START
], tmp
);
2170 gen_helper_restore_owb(cpu_env
);
2171 gen_jump(dc
, cpu_SR
[EPC1
]);
2174 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2175 const uint32_t par
[])
2177 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2180 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2181 const uint32_t par
[])
2183 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2184 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2185 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2188 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2189 const uint32_t par
[])
2191 if (sr_name
[par
[0]]) {
2192 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2194 tcg_gen_movi_i32(arg
[0].out
, 0);
2198 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2199 const uint32_t par
[])
2201 #ifndef CONFIG_USER_ONLY
2202 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2205 gen_helper_update_ccount(cpu_env
);
2206 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2210 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2211 const uint32_t par
[])
2213 #ifndef CONFIG_USER_ONLY
2214 TCGv_i32 tmp
= tcg_temp_new_i32();
2216 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2217 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2218 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2223 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2224 const uint32_t par
[])
2226 #ifndef CONFIG_USER_ONLY
2227 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2232 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2234 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2235 tcg_temp_free(dtlb
);
2239 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2240 const uint32_t par
[])
2242 #ifndef CONFIG_USER_ONLY
2243 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2247 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2248 const uint32_t par
[])
2250 #ifndef CONFIG_USER_ONLY
2251 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2255 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2256 const uint32_t par
[])
2258 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2261 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2262 const uint32_t par
[])
2264 /* TODO: GPIO32 may be a part of coprocessor */
2265 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2268 #ifdef CONFIG_USER_ONLY
2269 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2273 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2275 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2277 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2282 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2283 const uint32_t par
[])
2285 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2286 TCGv_i32 addr
= tcg_temp_local_new_i32();
2288 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2289 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2290 gen_load_store_alignment(dc
, 2, addr
, true);
2291 gen_check_atomctl(dc
, addr
);
2292 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2293 tmp
, dc
->cring
, MO_TEUL
);
2294 tcg_temp_free(addr
);
2298 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2299 const uint32_t par
[])
2301 TCGv_i32 addr
= tcg_temp_new_i32();
2303 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2304 gen_load_store_alignment(dc
, 2, addr
, false);
2305 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, MO_TEUL
);
2306 tcg_temp_free(addr
);
2309 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2310 const uint32_t par
[])
2312 TCGv_i32 prev
= tcg_temp_new_i32();
2313 TCGv_i32 addr
= tcg_temp_local_new_i32();
2314 TCGv_i32 res
= tcg_temp_local_new_i32();
2315 TCGLabel
*label
= gen_new_label();
2317 tcg_gen_movi_i32(res
, 0);
2318 tcg_gen_mov_i32(addr
, arg
[1].in
);
2319 gen_load_store_alignment(dc
, 2, addr
, true);
2320 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2321 gen_check_exclusive(dc
, addr
, true);
2322 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2323 arg
[0].in
, dc
->cring
, MO_TEUL
);
2324 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2325 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2326 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2327 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2328 gen_set_label(label
);
2329 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2330 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2331 tcg_temp_free(prev
);
2332 tcg_temp_free(addr
);
2336 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2337 const uint32_t par
[])
2339 tcg_gen_setcond_i32(par
[0],
2341 arg
[1].in
, arg
[2].in
);
2344 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2345 const uint32_t par
[])
2347 int shift
= 31 - arg
[2].imm
;
2350 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2351 } else if (shift
== 16) {
2352 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2354 TCGv_i32 tmp
= tcg_temp_new_i32();
2355 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2356 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2361 static bool test_ill_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2362 const uint32_t par
[])
2364 #ifdef CONFIG_USER_ONLY
2367 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2368 bool ill
= dc
->config
->hw_version
<= 250002 && !semihosting_enabled();
2370 if (ill
|| !semihosting_enabled()) {
2371 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2376 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2377 const uint32_t par
[])
2379 #ifndef CONFIG_USER_ONLY
2380 if (semihosting_enabled()) {
2381 gen_helper_simcall(cpu_env
);
2387 * Note: 64 bit ops are used here solely because SAR values
2390 #define gen_shift_reg(cmd, reg) do { \
2391 TCGv_i64 tmp = tcg_temp_new_i64(); \
2392 tcg_gen_extu_i32_i64(tmp, reg); \
2393 tcg_gen_##cmd##_i64(v, v, tmp); \
2394 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2395 tcg_temp_free_i64(v); \
2396 tcg_temp_free_i64(tmp); \
2399 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2401 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2402 const uint32_t par
[])
2404 if (dc
->sar_m32_5bit
) {
2405 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2407 TCGv_i64 v
= tcg_temp_new_i64();
2408 TCGv_i32 s
= tcg_const_i32(32);
2409 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2410 tcg_gen_andi_i32(s
, s
, 0x3f);
2411 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2412 gen_shift_reg(shl
, s
);
2417 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2418 const uint32_t par
[])
2420 if (arg
[2].imm
== 32) {
2421 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2422 arg
[0].imm
, arg
[1].imm
);
2424 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2427 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2428 const uint32_t par
[])
2430 if (dc
->sar_m32_5bit
) {
2431 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2433 TCGv_i64 v
= tcg_temp_new_i64();
2434 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2439 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2440 const uint32_t par
[])
2442 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2445 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2446 const uint32_t par
[])
2448 TCGv_i64 v
= tcg_temp_new_i64();
2449 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2453 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2454 const uint32_t par
[])
2456 if (dc
->sar_m32_5bit
) {
2457 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2459 TCGv_i64 v
= tcg_temp_new_i64();
2460 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2466 #undef gen_shift_reg
2468 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2469 const uint32_t par
[])
2471 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2474 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2475 const uint32_t par
[])
2477 TCGv_i32 tmp
= tcg_temp_new_i32();
2478 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2479 gen_left_shift_sar(dc
, tmp
);
2483 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2484 const uint32_t par
[])
2486 TCGv_i32 tmp
= tcg_temp_new_i32();
2487 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2488 gen_right_shift_sar(dc
, tmp
);
2492 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2493 const uint32_t par
[])
2495 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2496 gen_right_shift_sar(dc
, tmp
);
2500 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2501 const uint32_t par
[])
2503 gen_left_shift_sar(dc
, arg
[0].in
);
2506 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2507 const uint32_t par
[])
2509 gen_right_shift_sar(dc
, arg
[0].in
);
2512 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2513 const uint32_t par
[])
2515 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2518 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2519 const uint32_t par
[])
2521 TCGv_i32 tmp
= tcg_temp_new_i32();
2522 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2523 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2527 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2528 const uint32_t par
[])
2530 #ifndef CONFIG_USER_ONLY
2531 gen_waiti(dc
, arg
[0].imm
);
2535 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2536 const uint32_t par
[])
2538 #ifndef CONFIG_USER_ONLY
2539 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2541 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2542 tcg_temp_free(dtlb
);
2546 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2547 const uint32_t par
[])
2549 #ifndef CONFIG_USER_ONLY
2550 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2554 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2555 const uint32_t par
[])
2557 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2560 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2561 const uint32_t par
[])
2563 /* TODO: GPIO32 may be a part of coprocessor */
2564 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2567 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2568 const uint32_t par
[])
2570 if (sr_name
[par
[0]]) {
2571 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2575 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2576 const uint32_t par
[])
2578 if (sr_name
[par
[0]]) {
2579 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2583 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2584 const uint32_t par
[])
2586 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2589 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2590 const uint32_t par
[])
2592 #ifndef CONFIG_USER_ONLY
2593 uint32_t id
= par
[0] - CCOMPARE
;
2594 TCGv_i32 tmp
= tcg_const_i32(id
);
2596 assert(id
< dc
->config
->nccompare
);
2597 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2600 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2601 gen_helper_update_ccompare(cpu_env
, tmp
);
2606 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2607 const uint32_t par
[])
2609 #ifndef CONFIG_USER_ONLY
2610 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2613 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2617 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2618 const uint32_t par
[])
2620 #ifndef CONFIG_USER_ONLY
2621 unsigned id
= par
[0] - DBREAKA
;
2622 TCGv_i32 tmp
= tcg_const_i32(id
);
2624 assert(id
< dc
->config
->ndbreak
);
2625 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2630 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2631 const uint32_t par
[])
2633 #ifndef CONFIG_USER_ONLY
2634 unsigned id
= par
[0] - DBREAKC
;
2635 TCGv_i32 tmp
= tcg_const_i32(id
);
2637 assert(id
< dc
->config
->ndbreak
);
2638 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2643 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2644 const uint32_t par
[])
2646 #ifndef CONFIG_USER_ONLY
2647 unsigned id
= par
[0] - IBREAKA
;
2648 TCGv_i32 tmp
= tcg_const_i32(id
);
2650 assert(id
< dc
->config
->nibreak
);
2651 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2656 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2657 const uint32_t par
[])
2659 #ifndef CONFIG_USER_ONLY
2660 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2664 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2665 const uint32_t par
[])
2667 #ifndef CONFIG_USER_ONLY
2669 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2671 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2676 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2677 const uint32_t par
[])
2679 #ifndef CONFIG_USER_ONLY
2680 gen_helper_intclear(cpu_env
, arg
[0].in
);
2684 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2685 const uint32_t par
[])
2687 #ifndef CONFIG_USER_ONLY
2688 gen_helper_intset(cpu_env
, arg
[0].in
);
2692 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2693 const uint32_t par
[])
2695 #ifndef CONFIG_USER_ONLY
2696 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2700 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2701 const uint32_t par
[])
2703 #ifndef CONFIG_USER_ONLY
2704 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2708 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2709 const uint32_t par
[])
2711 #ifndef CONFIG_USER_ONLY
2712 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2713 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2715 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2716 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2719 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2723 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2724 const uint32_t par
[])
2726 #ifndef CONFIG_USER_ONLY
2727 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2731 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2732 const uint32_t par
[])
2734 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2735 if (dc
->sar_m32_5bit
) {
2736 tcg_gen_discard_i32(dc
->sar_m32
);
2738 dc
->sar_5bit
= false;
2739 dc
->sar_m32_5bit
= false;
2742 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2743 const uint32_t par
[])
2745 #ifndef CONFIG_USER_ONLY
2746 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2750 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2751 const uint32_t par
[])
2753 #ifndef CONFIG_USER_ONLY
2754 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2755 (1 << dc
->config
->nareg
/ 4) - 1);
2759 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2760 const uint32_t par
[])
2762 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2765 static void translate_wur_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
2766 const uint32_t par
[])
2768 gen_helper_wur_fcr(cpu_env
, arg
[0].in
);
2771 static void translate_wur_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
2772 const uint32_t par
[])
2774 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
2777 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2778 const uint32_t par
[])
2780 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2783 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2784 const uint32_t par
[])
2786 if (sr_name
[par
[0]]) {
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
);
2794 tcg_gen_movi_i32(arg
[0].out
, 0);
2798 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2799 const uint32_t par
[])
2801 if (sr_name
[par
[0]]) {
2802 TCGv_i32 tmp
= tcg_temp_new_i32();
2804 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2805 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2806 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2809 tcg_gen_movi_i32(arg
[0].out
, 0);
2813 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2814 const uint32_t par
[])
2816 #ifndef CONFIG_USER_ONLY
2817 TCGv_i32 tmp
= tcg_temp_new_i32();
2819 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2823 gen_helper_update_ccount(cpu_env
);
2824 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2825 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2826 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2832 #define gen_translate_xsr(name) \
2833 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2834 const uint32_t par[]) \
2836 TCGv_i32 tmp = tcg_temp_new_i32(); \
2838 if (sr_name[par[0]]) { \
2839 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2841 tcg_gen_movi_i32(tmp, 0); \
2843 translate_wsr_##name(dc, arg, par); \
2844 tcg_gen_mov_i32(arg[0].out, tmp); \
2845 tcg_temp_free(tmp); \
2848 gen_translate_xsr(acchi
)
2849 gen_translate_xsr(ccompare
)
2850 gen_translate_xsr(dbreaka
)
2851 gen_translate_xsr(dbreakc
)
2852 gen_translate_xsr(ibreaka
)
2853 gen_translate_xsr(ibreakenable
)
2854 gen_translate_xsr(icount
)
2855 gen_translate_xsr(memctl
)
2856 gen_translate_xsr(mpuenb
)
2857 gen_translate_xsr(ps
)
2858 gen_translate_xsr(rasid
)
2859 gen_translate_xsr(sar
)
2860 gen_translate_xsr(windowbase
)
2861 gen_translate_xsr(windowstart
)
2863 #undef gen_translate_xsr
2865 static const XtensaOpcodeOps core_ops
[] = {
2868 .translate
= translate_abs
,
2870 .name
= (const char * const[]) {
2871 "add", "add.n", NULL
,
2873 .translate
= translate_add
,
2874 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2876 .name
= (const char * const[]) {
2877 "addi", "addi.n", NULL
,
2879 .translate
= translate_addi
,
2880 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2883 .translate
= translate_addi
,
2886 .translate
= translate_addx
,
2887 .par
= (const uint32_t[]){1},
2890 .translate
= translate_addx
,
2891 .par
= (const uint32_t[]){2},
2894 .translate
= translate_addx
,
2895 .par
= (const uint32_t[]){3},
2898 .translate
= translate_all
,
2899 .par
= (const uint32_t[]){true, 4},
2902 .translate
= translate_all
,
2903 .par
= (const uint32_t[]){true, 8},
2906 .translate
= translate_and
,
2909 .translate
= translate_boolean
,
2910 .par
= (const uint32_t[]){BOOLEAN_AND
},
2913 .translate
= translate_boolean
,
2914 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2917 .translate
= translate_all
,
2918 .par
= (const uint32_t[]){false, 4},
2921 .translate
= translate_all
,
2922 .par
= (const uint32_t[]){false, 8},
2924 .name
= (const char * const[]) {
2925 "ball", "ball.w15", "ball.w18", NULL
,
2927 .translate
= translate_ball
,
2928 .par
= (const uint32_t[]){TCG_COND_EQ
},
2929 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2931 .name
= (const char * const[]) {
2932 "bany", "bany.w15", "bany.w18", NULL
,
2934 .translate
= translate_bany
,
2935 .par
= (const uint32_t[]){TCG_COND_NE
},
2936 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2938 .name
= (const char * const[]) {
2939 "bbc", "bbc.w15", "bbc.w18", NULL
,
2941 .translate
= translate_bb
,
2942 .par
= (const uint32_t[]){TCG_COND_EQ
},
2943 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2945 .name
= (const char * const[]) {
2946 "bbci", "bbci.w15", "bbci.w18", NULL
,
2948 .translate
= translate_bbi
,
2949 .par
= (const uint32_t[]){TCG_COND_EQ
},
2950 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2952 .name
= (const char * const[]) {
2953 "bbs", "bbs.w15", "bbs.w18", NULL
,
2955 .translate
= translate_bb
,
2956 .par
= (const uint32_t[]){TCG_COND_NE
},
2957 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2959 .name
= (const char * const[]) {
2960 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2962 .translate
= translate_bbi
,
2963 .par
= (const uint32_t[]){TCG_COND_NE
},
2964 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2966 .name
= (const char * const[]) {
2967 "beq", "beq.w15", "beq.w18", NULL
,
2969 .translate
= translate_b
,
2970 .par
= (const uint32_t[]){TCG_COND_EQ
},
2971 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2973 .name
= (const char * const[]) {
2974 "beqi", "beqi.w15", "beqi.w18", NULL
,
2976 .translate
= translate_bi
,
2977 .par
= (const uint32_t[]){TCG_COND_EQ
},
2978 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2980 .name
= (const char * const[]) {
2981 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2983 .translate
= translate_bz
,
2984 .par
= (const uint32_t[]){TCG_COND_EQ
},
2985 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2988 .translate
= translate_bp
,
2989 .par
= (const uint32_t[]){TCG_COND_EQ
},
2991 .name
= (const char * const[]) {
2992 "bge", "bge.w15", "bge.w18", NULL
,
2994 .translate
= translate_b
,
2995 .par
= (const uint32_t[]){TCG_COND_GE
},
2996 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2998 .name
= (const char * const[]) {
2999 "bgei", "bgei.w15", "bgei.w18", NULL
,
3001 .translate
= translate_bi
,
3002 .par
= (const uint32_t[]){TCG_COND_GE
},
3003 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3005 .name
= (const char * const[]) {
3006 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
3008 .translate
= translate_b
,
3009 .par
= (const uint32_t[]){TCG_COND_GEU
},
3010 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3012 .name
= (const char * const[]) {
3013 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
3015 .translate
= translate_bi
,
3016 .par
= (const uint32_t[]){TCG_COND_GEU
},
3017 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3019 .name
= (const char * const[]) {
3020 "bgez", "bgez.w15", "bgez.w18", NULL
,
3022 .translate
= translate_bz
,
3023 .par
= (const uint32_t[]){TCG_COND_GE
},
3024 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3026 .name
= (const char * const[]) {
3027 "blt", "blt.w15", "blt.w18", NULL
,
3029 .translate
= translate_b
,
3030 .par
= (const uint32_t[]){TCG_COND_LT
},
3031 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3033 .name
= (const char * const[]) {
3034 "blti", "blti.w15", "blti.w18", NULL
,
3036 .translate
= translate_bi
,
3037 .par
= (const uint32_t[]){TCG_COND_LT
},
3038 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3040 .name
= (const char * const[]) {
3041 "bltu", "bltu.w15", "bltu.w18", NULL
,
3043 .translate
= translate_b
,
3044 .par
= (const uint32_t[]){TCG_COND_LTU
},
3045 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3047 .name
= (const char * const[]) {
3048 "bltui", "bltui.w15", "bltui.w18", NULL
,
3050 .translate
= translate_bi
,
3051 .par
= (const uint32_t[]){TCG_COND_LTU
},
3052 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3054 .name
= (const char * const[]) {
3055 "bltz", "bltz.w15", "bltz.w18", NULL
,
3057 .translate
= translate_bz
,
3058 .par
= (const uint32_t[]){TCG_COND_LT
},
3059 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3061 .name
= (const char * const[]) {
3062 "bnall", "bnall.w15", "bnall.w18", NULL
,
3064 .translate
= translate_ball
,
3065 .par
= (const uint32_t[]){TCG_COND_NE
},
3066 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3068 .name
= (const char * const[]) {
3069 "bne", "bne.w15", "bne.w18", NULL
,
3071 .translate
= translate_b
,
3072 .par
= (const uint32_t[]){TCG_COND_NE
},
3073 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3075 .name
= (const char * const[]) {
3076 "bnei", "bnei.w15", "bnei.w18", NULL
,
3078 .translate
= translate_bi
,
3079 .par
= (const uint32_t[]){TCG_COND_NE
},
3080 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3082 .name
= (const char * const[]) {
3083 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3085 .translate
= translate_bz
,
3086 .par
= (const uint32_t[]){TCG_COND_NE
},
3087 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3089 .name
= (const char * const[]) {
3090 "bnone", "bnone.w15", "bnone.w18", NULL
,
3092 .translate
= translate_bany
,
3093 .par
= (const uint32_t[]){TCG_COND_EQ
},
3094 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3097 .translate
= translate_nop
,
3098 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3099 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3102 .translate
= translate_nop
,
3103 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3104 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3107 .translate
= translate_bp
,
3108 .par
= (const uint32_t[]){TCG_COND_NE
},
3111 .translate
= translate_call0
,
3114 .translate
= translate_callw
,
3115 .par
= (const uint32_t[]){3},
3118 .translate
= translate_callw
,
3119 .par
= (const uint32_t[]){1},
3122 .translate
= translate_callw
,
3123 .par
= (const uint32_t[]){2},
3126 .translate
= translate_callx0
,
3129 .translate
= translate_callxw
,
3130 .par
= (const uint32_t[]){3},
3133 .translate
= translate_callxw
,
3134 .par
= (const uint32_t[]){1},
3137 .translate
= translate_callxw
,
3138 .par
= (const uint32_t[]){2},
3141 .translate
= translate_clamps
,
3143 .name
= "clrb_expstate",
3144 .translate
= translate_clrb_expstate
,
3147 .translate
= translate_clrex
,
3150 .translate
= translate_const16
,
3153 .translate
= translate_depbits
,
3156 .translate
= translate_dcache
,
3157 .op_flags
= XTENSA_OP_PRIVILEGED
,
3160 .translate
= translate_nop
,
3163 .translate
= translate_dcache
,
3164 .op_flags
= XTENSA_OP_PRIVILEGED
,
3167 .translate
= translate_dcache
,
3170 .translate
= translate_nop
,
3173 .translate
= translate_dcache
,
3176 .translate
= translate_nop
,
3179 .translate
= translate_nop
,
3180 .op_flags
= XTENSA_OP_PRIVILEGED
,
3183 .translate
= translate_nop
,
3184 .op_flags
= XTENSA_OP_PRIVILEGED
,
3187 .translate
= translate_nop
,
3188 .op_flags
= XTENSA_OP_PRIVILEGED
,
3191 .translate
= translate_nop
,
3192 .op_flags
= XTENSA_OP_PRIVILEGED
,
3195 .translate
= translate_diwbuip
,
3196 .op_flags
= XTENSA_OP_PRIVILEGED
,
3199 .translate
= translate_dcache
,
3200 .op_flags
= XTENSA_OP_PRIVILEGED
,
3203 .translate
= translate_nop
,
3206 .translate
= translate_nop
,
3209 .translate
= translate_nop
,
3212 .translate
= translate_nop
,
3215 .translate
= translate_nop
,
3218 .translate
= translate_nop
,
3221 .translate
= translate_nop
,
3224 .translate
= translate_nop
,
3227 .translate
= translate_nop
,
3230 .translate
= translate_nop
,
3233 .translate
= translate_nop
,
3236 .translate
= translate_entry
,
3237 .test_ill
= test_ill_entry
,
3238 .test_overflow
= test_overflow_entry
,
3239 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3240 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3243 .translate
= translate_nop
,
3246 .translate
= translate_nop
,
3249 .translate
= translate_extui
,
3252 .translate
= translate_memw
,
3255 .translate
= translate_getex
,
3258 .op_flags
= XTENSA_OP_ILL
,
3261 .op_flags
= XTENSA_OP_ILL
,
3264 .translate
= translate_itlb
,
3265 .par
= (const uint32_t[]){true},
3266 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3269 .translate
= translate_icache
,
3272 .translate
= translate_icache
,
3273 .op_flags
= XTENSA_OP_PRIVILEGED
,
3276 .translate
= translate_nop
,
3277 .op_flags
= XTENSA_OP_PRIVILEGED
,
3280 .translate
= translate_itlb
,
3281 .par
= (const uint32_t[]){false},
3282 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3285 .translate
= translate_nop
,
3286 .op_flags
= XTENSA_OP_PRIVILEGED
,
3288 .name
= (const char * const[]) {
3289 "ill", "ill.n", NULL
,
3291 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3294 .translate
= translate_nop
,
3297 .translate
= translate_icache
,
3298 .op_flags
= XTENSA_OP_PRIVILEGED
,
3301 .translate
= translate_nop
,
3304 .translate
= translate_j
,
3307 .translate
= translate_jx
,
3310 .translate
= translate_ldst
,
3311 .par
= (const uint32_t[]){MO_TESW
, false, false},
3312 .op_flags
= XTENSA_OP_LOAD
,
3315 .translate
= translate_ldst
,
3316 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3317 .op_flags
= XTENSA_OP_LOAD
,
3320 .translate
= translate_ldst
,
3321 .par
= (const uint32_t[]){MO_TEUL
, true, false},
3322 .op_flags
= XTENSA_OP_LOAD
,
3325 .translate
= translate_l32e
,
3326 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3329 .translate
= translate_l32ex
,
3330 .op_flags
= XTENSA_OP_LOAD
,
3332 .name
= (const char * const[]) {
3333 "l32i", "l32i.n", NULL
,
3335 .translate
= translate_ldst
,
3336 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3337 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3340 .translate
= translate_l32r
,
3341 .op_flags
= XTENSA_OP_LOAD
,
3344 .translate
= translate_ldst
,
3345 .par
= (const uint32_t[]){MO_UB
, false, false},
3346 .op_flags
= XTENSA_OP_LOAD
,
3349 .translate
= translate_mac16
,
3350 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3351 .op_flags
= XTENSA_OP_LOAD
,
3354 .translate
= translate_mac16
,
3355 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3356 .op_flags
= XTENSA_OP_LOAD
,
3359 .op_flags
= XTENSA_OP_ILL
,
3361 .name
= (const char * const[]) {
3362 "loop", "loop.w15", NULL
,
3364 .translate
= translate_loop
,
3365 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3366 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3368 .name
= (const char * const[]) {
3369 "loopgtz", "loopgtz.w15", NULL
,
3371 .translate
= translate_loop
,
3372 .par
= (const uint32_t[]){TCG_COND_GT
},
3373 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3375 .name
= (const char * const[]) {
3376 "loopnez", "loopnez.w15", NULL
,
3378 .translate
= translate_loop
,
3379 .par
= (const uint32_t[]){TCG_COND_NE
},
3380 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3383 .translate
= translate_smax
,
3386 .translate
= translate_umax
,
3389 .translate
= translate_memw
,
3392 .translate
= translate_smin
,
3395 .translate
= translate_umin
,
3397 .name
= (const char * const[]) {
3398 "mov", "mov.n", NULL
,
3400 .translate
= translate_mov
,
3401 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3404 .translate
= translate_movcond
,
3405 .par
= (const uint32_t[]){TCG_COND_EQ
},
3408 .translate
= translate_movp
,
3409 .par
= (const uint32_t[]){TCG_COND_EQ
},
3412 .translate
= translate_movcond
,
3413 .par
= (const uint32_t[]){TCG_COND_GE
},
3416 .translate
= translate_movi
,
3419 .translate
= translate_movi
,
3422 .translate
= translate_movcond
,
3423 .par
= (const uint32_t[]){TCG_COND_LT
},
3426 .translate
= translate_movcond
,
3427 .par
= (const uint32_t[]){TCG_COND_NE
},
3430 .translate
= translate_movsp
,
3431 .op_flags
= XTENSA_OP_ALLOCA
,
3434 .translate
= translate_movp
,
3435 .par
= (const uint32_t[]){TCG_COND_NE
},
3437 .name
= "mul.aa.hh",
3438 .translate
= translate_mac16
,
3439 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3441 .name
= "mul.aa.hl",
3442 .translate
= translate_mac16
,
3443 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3445 .name
= "mul.aa.lh",
3446 .translate
= translate_mac16
,
3447 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3449 .name
= "mul.aa.ll",
3450 .translate
= translate_mac16
,
3451 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3453 .name
= "mul.ad.hh",
3454 .translate
= translate_mac16
,
3455 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3457 .name
= "mul.ad.hl",
3458 .translate
= translate_mac16
,
3459 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3461 .name
= "mul.ad.lh",
3462 .translate
= translate_mac16
,
3463 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3465 .name
= "mul.ad.ll",
3466 .translate
= translate_mac16
,
3467 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3469 .name
= "mul.da.hh",
3470 .translate
= translate_mac16
,
3471 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3473 .name
= "mul.da.hl",
3474 .translate
= translate_mac16
,
3475 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3477 .name
= "mul.da.lh",
3478 .translate
= translate_mac16
,
3479 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3481 .name
= "mul.da.ll",
3482 .translate
= translate_mac16
,
3483 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3485 .name
= "mul.dd.hh",
3486 .translate
= translate_mac16
,
3487 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3489 .name
= "mul.dd.hl",
3490 .translate
= translate_mac16
,
3491 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3493 .name
= "mul.dd.lh",
3494 .translate
= translate_mac16
,
3495 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3497 .name
= "mul.dd.ll",
3498 .translate
= translate_mac16
,
3499 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3502 .translate
= translate_mul16
,
3503 .par
= (const uint32_t[]){true},
3506 .translate
= translate_mul16
,
3507 .par
= (const uint32_t[]){false},
3509 .name
= "mula.aa.hh",
3510 .translate
= translate_mac16
,
3511 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3513 .name
= "mula.aa.hl",
3514 .translate
= translate_mac16
,
3515 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3517 .name
= "mula.aa.lh",
3518 .translate
= translate_mac16
,
3519 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3521 .name
= "mula.aa.ll",
3522 .translate
= translate_mac16
,
3523 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3525 .name
= "mula.ad.hh",
3526 .translate
= translate_mac16
,
3527 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3529 .name
= "mula.ad.hl",
3530 .translate
= translate_mac16
,
3531 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3533 .name
= "mula.ad.lh",
3534 .translate
= translate_mac16
,
3535 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3537 .name
= "mula.ad.ll",
3538 .translate
= translate_mac16
,
3539 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3541 .name
= "mula.da.hh",
3542 .translate
= translate_mac16
,
3543 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3545 .name
= "mula.da.hh.lddec",
3546 .translate
= translate_mac16
,
3547 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3549 .name
= "mula.da.hh.ldinc",
3550 .translate
= translate_mac16
,
3551 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3553 .name
= "mula.da.hl",
3554 .translate
= translate_mac16
,
3555 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3557 .name
= "mula.da.hl.lddec",
3558 .translate
= translate_mac16
,
3559 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3561 .name
= "mula.da.hl.ldinc",
3562 .translate
= translate_mac16
,
3563 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3565 .name
= "mula.da.lh",
3566 .translate
= translate_mac16
,
3567 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3569 .name
= "mula.da.lh.lddec",
3570 .translate
= translate_mac16
,
3571 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3573 .name
= "mula.da.lh.ldinc",
3574 .translate
= translate_mac16
,
3575 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3577 .name
= "mula.da.ll",
3578 .translate
= translate_mac16
,
3579 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3581 .name
= "mula.da.ll.lddec",
3582 .translate
= translate_mac16
,
3583 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3585 .name
= "mula.da.ll.ldinc",
3586 .translate
= translate_mac16
,
3587 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3589 .name
= "mula.dd.hh",
3590 .translate
= translate_mac16
,
3591 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3593 .name
= "mula.dd.hh.lddec",
3594 .translate
= translate_mac16
,
3595 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3597 .name
= "mula.dd.hh.ldinc",
3598 .translate
= translate_mac16
,
3599 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3601 .name
= "mula.dd.hl",
3602 .translate
= translate_mac16
,
3603 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3605 .name
= "mula.dd.hl.lddec",
3606 .translate
= translate_mac16
,
3607 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3609 .name
= "mula.dd.hl.ldinc",
3610 .translate
= translate_mac16
,
3611 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3613 .name
= "mula.dd.lh",
3614 .translate
= translate_mac16
,
3615 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3617 .name
= "mula.dd.lh.lddec",
3618 .translate
= translate_mac16
,
3619 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3621 .name
= "mula.dd.lh.ldinc",
3622 .translate
= translate_mac16
,
3623 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3625 .name
= "mula.dd.ll",
3626 .translate
= translate_mac16
,
3627 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3629 .name
= "mula.dd.ll.lddec",
3630 .translate
= translate_mac16
,
3631 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3633 .name
= "mula.dd.ll.ldinc",
3634 .translate
= translate_mac16
,
3635 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3638 .translate
= translate_mull
,
3640 .name
= "muls.aa.hh",
3641 .translate
= translate_mac16
,
3642 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3644 .name
= "muls.aa.hl",
3645 .translate
= translate_mac16
,
3646 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3648 .name
= "muls.aa.lh",
3649 .translate
= translate_mac16
,
3650 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3652 .name
= "muls.aa.ll",
3653 .translate
= translate_mac16
,
3654 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3656 .name
= "muls.ad.hh",
3657 .translate
= translate_mac16
,
3658 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3660 .name
= "muls.ad.hl",
3661 .translate
= translate_mac16
,
3662 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3664 .name
= "muls.ad.lh",
3665 .translate
= translate_mac16
,
3666 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3668 .name
= "muls.ad.ll",
3669 .translate
= translate_mac16
,
3670 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3672 .name
= "muls.da.hh",
3673 .translate
= translate_mac16
,
3674 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3676 .name
= "muls.da.hl",
3677 .translate
= translate_mac16
,
3678 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3680 .name
= "muls.da.lh",
3681 .translate
= translate_mac16
,
3682 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3684 .name
= "muls.da.ll",
3685 .translate
= translate_mac16
,
3686 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3688 .name
= "muls.dd.hh",
3689 .translate
= translate_mac16
,
3690 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3692 .name
= "muls.dd.hl",
3693 .translate
= translate_mac16
,
3694 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3696 .name
= "muls.dd.lh",
3697 .translate
= translate_mac16
,
3698 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3700 .name
= "muls.dd.ll",
3701 .translate
= translate_mac16
,
3702 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3705 .translate
= translate_mulh
,
3706 .par
= (const uint32_t[]){true},
3709 .translate
= translate_mulh
,
3710 .par
= (const uint32_t[]){false},
3713 .translate
= translate_neg
,
3715 .name
= (const char * const[]) {
3716 "nop", "nop.n", NULL
,
3718 .translate
= translate_nop
,
3719 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3722 .translate
= translate_nsa
,
3725 .translate
= translate_nsau
,
3728 .translate
= translate_or
,
3731 .translate
= translate_boolean
,
3732 .par
= (const uint32_t[]){BOOLEAN_OR
},
3735 .translate
= translate_boolean
,
3736 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3739 .translate
= translate_ptlb
,
3740 .par
= (const uint32_t[]){true},
3741 .op_flags
= XTENSA_OP_PRIVILEGED
,
3744 .translate
= translate_nop
,
3747 .translate
= translate_nop
,
3750 .translate
= translate_nop
,
3753 .translate
= translate_nop
,
3756 .translate
= translate_nop
,
3759 .translate
= translate_ptlb
,
3760 .par
= (const uint32_t[]){false},
3761 .op_flags
= XTENSA_OP_PRIVILEGED
,
3764 .translate
= translate_pptlb
,
3765 .op_flags
= XTENSA_OP_PRIVILEGED
,
3768 .translate
= translate_quos
,
3769 .par
= (const uint32_t[]){true},
3770 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3773 .translate
= translate_quou
,
3774 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3777 .translate
= translate_rtlb
,
3778 .par
= (const uint32_t[]){true, 0},
3779 .op_flags
= XTENSA_OP_PRIVILEGED
,
3782 .translate
= translate_rtlb
,
3783 .par
= (const uint32_t[]){true, 1},
3784 .op_flags
= XTENSA_OP_PRIVILEGED
,
3786 .name
= "read_impwire",
3787 .translate
= translate_read_impwire
,
3790 .translate
= translate_quos
,
3791 .par
= (const uint32_t[]){false},
3792 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3795 .translate
= translate_remu
,
3796 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3799 .translate
= translate_rer
,
3800 .op_flags
= XTENSA_OP_PRIVILEGED
,
3802 .name
= (const char * const[]) {
3803 "ret", "ret.n", NULL
,
3805 .translate
= translate_ret
,
3806 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3808 .name
= (const char * const[]) {
3809 "retw", "retw.n", NULL
,
3811 .translate
= translate_retw
,
3812 .test_ill
= test_ill_retw
,
3813 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3816 .op_flags
= XTENSA_OP_ILL
,
3819 .translate
= translate_rfde
,
3820 .op_flags
= XTENSA_OP_PRIVILEGED
,
3823 .op_flags
= XTENSA_OP_ILL
,
3826 .translate
= translate_rfe
,
3827 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3830 .translate
= translate_rfi
,
3831 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3834 .translate
= translate_rfw
,
3835 .par
= (const uint32_t[]){true},
3836 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3839 .translate
= translate_rfw
,
3840 .par
= (const uint32_t[]){false},
3841 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3844 .translate
= translate_rtlb
,
3845 .par
= (const uint32_t[]){false, 0},
3846 .op_flags
= XTENSA_OP_PRIVILEGED
,
3849 .translate
= translate_rtlb
,
3850 .par
= (const uint32_t[]){false, 1},
3851 .op_flags
= XTENSA_OP_PRIVILEGED
,
3854 .translate
= translate_rptlb0
,
3855 .op_flags
= XTENSA_OP_PRIVILEGED
,
3858 .translate
= translate_rptlb1
,
3859 .op_flags
= XTENSA_OP_PRIVILEGED
,
3862 .translate
= translate_rotw
,
3863 .op_flags
= XTENSA_OP_PRIVILEGED
|
3864 XTENSA_OP_EXIT_TB_M1
|
3865 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3868 .translate
= translate_rsil
,
3870 XTENSA_OP_PRIVILEGED
|
3871 XTENSA_OP_EXIT_TB_0
|
3872 XTENSA_OP_CHECK_INTERRUPTS
,
3875 .translate
= translate_rsr
,
3876 .par
= (const uint32_t[]){176},
3877 .op_flags
= XTENSA_OP_PRIVILEGED
,
3880 .translate
= translate_rsr
,
3881 .par
= (const uint32_t[]){208},
3882 .op_flags
= XTENSA_OP_PRIVILEGED
,
3884 .name
= "rsr.acchi",
3885 .translate
= translate_rsr
,
3886 .test_ill
= test_ill_sr
,
3887 .par
= (const uint32_t[]){
3889 XTENSA_OPTION_MAC16
,
3892 .name
= "rsr.acclo",
3893 .translate
= translate_rsr
,
3894 .test_ill
= test_ill_sr
,
3895 .par
= (const uint32_t[]){
3897 XTENSA_OPTION_MAC16
,
3900 .name
= "rsr.atomctl",
3901 .translate
= translate_rsr
,
3902 .test_ill
= test_ill_sr
,
3903 .par
= (const uint32_t[]){
3905 XTENSA_OPTION_ATOMCTL
,
3907 .op_flags
= XTENSA_OP_PRIVILEGED
,
3910 .translate
= translate_rsr
,
3911 .test_ill
= test_ill_sr
,
3912 .par
= (const uint32_t[]){
3914 XTENSA_OPTION_BOOLEAN
,
3917 .name
= "rsr.cacheadrdis",
3918 .translate
= translate_rsr
,
3919 .test_ill
= test_ill_sr
,
3920 .par
= (const uint32_t[]){
3924 .op_flags
= XTENSA_OP_PRIVILEGED
,
3926 .name
= "rsr.cacheattr",
3927 .translate
= translate_rsr
,
3928 .test_ill
= test_ill_sr
,
3929 .par
= (const uint32_t[]){
3931 XTENSA_OPTION_CACHEATTR
,
3933 .op_flags
= XTENSA_OP_PRIVILEGED
,
3935 .name
= "rsr.ccompare0",
3936 .translate
= translate_rsr
,
3937 .test_ill
= test_ill_ccompare
,
3938 .par
= (const uint32_t[]){
3940 XTENSA_OPTION_TIMER_INTERRUPT
,
3942 .op_flags
= XTENSA_OP_PRIVILEGED
,
3944 .name
= "rsr.ccompare1",
3945 .translate
= translate_rsr
,
3946 .test_ill
= test_ill_ccompare
,
3947 .par
= (const uint32_t[]){
3949 XTENSA_OPTION_TIMER_INTERRUPT
,
3951 .op_flags
= XTENSA_OP_PRIVILEGED
,
3953 .name
= "rsr.ccompare2",
3954 .translate
= translate_rsr
,
3955 .test_ill
= test_ill_ccompare
,
3956 .par
= (const uint32_t[]){
3958 XTENSA_OPTION_TIMER_INTERRUPT
,
3960 .op_flags
= XTENSA_OP_PRIVILEGED
,
3962 .name
= "rsr.ccount",
3963 .translate
= translate_rsr_ccount
,
3964 .test_ill
= test_ill_sr
,
3965 .par
= (const uint32_t[]){
3967 XTENSA_OPTION_TIMER_INTERRUPT
,
3969 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3971 .name
= "rsr.configid0",
3972 .translate
= translate_rsr
,
3973 .par
= (const uint32_t[]){CONFIGID0
},
3974 .op_flags
= XTENSA_OP_PRIVILEGED
,
3976 .name
= "rsr.configid1",
3977 .translate
= translate_rsr
,
3978 .par
= (const uint32_t[]){CONFIGID1
},
3979 .op_flags
= XTENSA_OP_PRIVILEGED
,
3981 .name
= "rsr.cpenable",
3982 .translate
= translate_rsr
,
3983 .test_ill
= test_ill_sr
,
3984 .par
= (const uint32_t[]){
3986 XTENSA_OPTION_COPROCESSOR
,
3988 .op_flags
= XTENSA_OP_PRIVILEGED
,
3990 .name
= "rsr.dbreaka0",
3991 .translate
= translate_rsr
,
3992 .test_ill
= test_ill_dbreak
,
3993 .par
= (const uint32_t[]){
3995 XTENSA_OPTION_DEBUG
,
3997 .op_flags
= XTENSA_OP_PRIVILEGED
,
3999 .name
= "rsr.dbreaka1",
4000 .translate
= translate_rsr
,
4001 .test_ill
= test_ill_dbreak
,
4002 .par
= (const uint32_t[]){
4004 XTENSA_OPTION_DEBUG
,
4006 .op_flags
= XTENSA_OP_PRIVILEGED
,
4008 .name
= "rsr.dbreakc0",
4009 .translate
= translate_rsr
,
4010 .test_ill
= test_ill_dbreak
,
4011 .par
= (const uint32_t[]){
4013 XTENSA_OPTION_DEBUG
,
4015 .op_flags
= XTENSA_OP_PRIVILEGED
,
4017 .name
= "rsr.dbreakc1",
4018 .translate
= translate_rsr
,
4019 .test_ill
= test_ill_dbreak
,
4020 .par
= (const uint32_t[]){
4022 XTENSA_OPTION_DEBUG
,
4024 .op_flags
= XTENSA_OP_PRIVILEGED
,
4027 .translate
= translate_rsr
,
4028 .test_ill
= test_ill_sr
,
4029 .par
= (const uint32_t[]){
4031 XTENSA_OPTION_DEBUG
,
4033 .op_flags
= XTENSA_OP_PRIVILEGED
,
4035 .name
= "rsr.debugcause",
4036 .translate
= translate_rsr
,
4037 .test_ill
= test_ill_sr
,
4038 .par
= (const uint32_t[]){
4040 XTENSA_OPTION_DEBUG
,
4042 .op_flags
= XTENSA_OP_PRIVILEGED
,
4045 .translate
= translate_rsr
,
4046 .test_ill
= test_ill_sr
,
4047 .par
= (const uint32_t[]){
4049 XTENSA_OPTION_EXCEPTION
,
4051 .op_flags
= XTENSA_OP_PRIVILEGED
,
4053 .name
= "rsr.dtlbcfg",
4054 .translate
= translate_rsr
,
4055 .test_ill
= test_ill_sr
,
4056 .par
= (const uint32_t[]){
4060 .op_flags
= XTENSA_OP_PRIVILEGED
,
4063 .translate
= translate_rsr
,
4064 .test_ill
= test_ill_sr
,
4065 .par
= (const uint32_t[]){
4067 XTENSA_OPTION_EXCEPTION
,
4069 .op_flags
= XTENSA_OP_PRIVILEGED
,
4072 .translate
= translate_rsr
,
4073 .test_ill
= test_ill_hpi
,
4074 .par
= (const uint32_t[]){
4076 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4078 .op_flags
= XTENSA_OP_PRIVILEGED
,
4081 .translate
= translate_rsr
,
4082 .test_ill
= test_ill_hpi
,
4083 .par
= (const uint32_t[]){
4085 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4087 .op_flags
= XTENSA_OP_PRIVILEGED
,
4090 .translate
= translate_rsr
,
4091 .test_ill
= test_ill_hpi
,
4092 .par
= (const uint32_t[]){
4094 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4096 .op_flags
= XTENSA_OP_PRIVILEGED
,
4099 .translate
= translate_rsr
,
4100 .test_ill
= test_ill_hpi
,
4101 .par
= (const uint32_t[]){
4103 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4105 .op_flags
= XTENSA_OP_PRIVILEGED
,
4108 .translate
= translate_rsr
,
4109 .test_ill
= test_ill_hpi
,
4110 .par
= (const uint32_t[]){
4112 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4114 .op_flags
= XTENSA_OP_PRIVILEGED
,
4117 .translate
= translate_rsr
,
4118 .test_ill
= test_ill_hpi
,
4119 .par
= (const uint32_t[]){
4121 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4123 .op_flags
= XTENSA_OP_PRIVILEGED
,
4126 .translate
= translate_rsr
,
4127 .test_ill
= test_ill_hpi
,
4128 .par
= (const uint32_t[]){
4130 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4132 .op_flags
= XTENSA_OP_PRIVILEGED
,
4135 .translate
= translate_rsr
,
4136 .test_ill
= test_ill_hpi
,
4137 .par
= (const uint32_t[]){
4139 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4141 .op_flags
= XTENSA_OP_PRIVILEGED
,
4144 .translate
= translate_rsr
,
4145 .test_ill
= test_ill_hpi
,
4146 .par
= (const uint32_t[]){
4148 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4150 .op_flags
= XTENSA_OP_PRIVILEGED
,
4153 .translate
= translate_rsr
,
4154 .test_ill
= test_ill_hpi
,
4155 .par
= (const uint32_t[]){
4157 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4159 .op_flags
= XTENSA_OP_PRIVILEGED
,
4162 .translate
= translate_rsr
,
4163 .test_ill
= test_ill_hpi
,
4164 .par
= (const uint32_t[]){
4166 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4168 .op_flags
= XTENSA_OP_PRIVILEGED
,
4171 .translate
= translate_rsr
,
4172 .test_ill
= test_ill_hpi
,
4173 .par
= (const uint32_t[]){
4175 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4177 .op_flags
= XTENSA_OP_PRIVILEGED
,
4179 .name
= "rsr.eraccess",
4180 .translate
= translate_rsr
,
4181 .par
= (const uint32_t[]){ERACCESS
},
4182 .op_flags
= XTENSA_OP_PRIVILEGED
,
4184 .name
= "rsr.exccause",
4185 .translate
= translate_rsr
,
4186 .test_ill
= test_ill_sr
,
4187 .par
= (const uint32_t[]){
4189 XTENSA_OPTION_EXCEPTION
,
4191 .op_flags
= XTENSA_OP_PRIVILEGED
,
4193 .name
= "rsr.excsave1",
4194 .translate
= translate_rsr
,
4195 .test_ill
= test_ill_sr
,
4196 .par
= (const uint32_t[]){
4198 XTENSA_OPTION_EXCEPTION
,
4200 .op_flags
= XTENSA_OP_PRIVILEGED
,
4202 .name
= "rsr.excsave2",
4203 .translate
= translate_rsr
,
4204 .test_ill
= test_ill_hpi
,
4205 .par
= (const uint32_t[]){
4207 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4209 .op_flags
= XTENSA_OP_PRIVILEGED
,
4211 .name
= "rsr.excsave3",
4212 .translate
= translate_rsr
,
4213 .test_ill
= test_ill_hpi
,
4214 .par
= (const uint32_t[]){
4216 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4218 .op_flags
= XTENSA_OP_PRIVILEGED
,
4220 .name
= "rsr.excsave4",
4221 .translate
= translate_rsr
,
4222 .test_ill
= test_ill_hpi
,
4223 .par
= (const uint32_t[]){
4225 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4227 .op_flags
= XTENSA_OP_PRIVILEGED
,
4229 .name
= "rsr.excsave5",
4230 .translate
= translate_rsr
,
4231 .test_ill
= test_ill_hpi
,
4232 .par
= (const uint32_t[]){
4234 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4236 .op_flags
= XTENSA_OP_PRIVILEGED
,
4238 .name
= "rsr.excsave6",
4239 .translate
= translate_rsr
,
4240 .test_ill
= test_ill_hpi
,
4241 .par
= (const uint32_t[]){
4243 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4245 .op_flags
= XTENSA_OP_PRIVILEGED
,
4247 .name
= "rsr.excsave7",
4248 .translate
= translate_rsr
,
4249 .test_ill
= test_ill_hpi
,
4250 .par
= (const uint32_t[]){
4252 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4254 .op_flags
= XTENSA_OP_PRIVILEGED
,
4256 .name
= "rsr.excvaddr",
4257 .translate
= translate_rsr
,
4258 .test_ill
= test_ill_sr
,
4259 .par
= (const uint32_t[]){
4261 XTENSA_OPTION_EXCEPTION
,
4263 .op_flags
= XTENSA_OP_PRIVILEGED
,
4265 .name
= "rsr.ibreaka0",
4266 .translate
= translate_rsr
,
4267 .test_ill
= test_ill_ibreak
,
4268 .par
= (const uint32_t[]){
4270 XTENSA_OPTION_DEBUG
,
4272 .op_flags
= XTENSA_OP_PRIVILEGED
,
4274 .name
= "rsr.ibreaka1",
4275 .translate
= translate_rsr
,
4276 .test_ill
= test_ill_ibreak
,
4277 .par
= (const uint32_t[]){
4279 XTENSA_OPTION_DEBUG
,
4281 .op_flags
= XTENSA_OP_PRIVILEGED
,
4283 .name
= "rsr.ibreakenable",
4284 .translate
= translate_rsr
,
4285 .test_ill
= test_ill_sr
,
4286 .par
= (const uint32_t[]){
4288 XTENSA_OPTION_DEBUG
,
4290 .op_flags
= XTENSA_OP_PRIVILEGED
,
4292 .name
= "rsr.icount",
4293 .translate
= translate_rsr
,
4294 .test_ill
= test_ill_sr
,
4295 .par
= (const uint32_t[]){
4297 XTENSA_OPTION_DEBUG
,
4299 .op_flags
= XTENSA_OP_PRIVILEGED
,
4301 .name
= "rsr.icountlevel",
4302 .translate
= translate_rsr
,
4303 .test_ill
= test_ill_sr
,
4304 .par
= (const uint32_t[]){
4306 XTENSA_OPTION_DEBUG
,
4308 .op_flags
= XTENSA_OP_PRIVILEGED
,
4310 .name
= "rsr.intclear",
4311 .translate
= translate_rsr
,
4312 .test_ill
= test_ill_sr
,
4313 .par
= (const uint32_t[]){
4315 XTENSA_OPTION_INTERRUPT
,
4317 .op_flags
= XTENSA_OP_PRIVILEGED
,
4319 .name
= "rsr.intenable",
4320 .translate
= translate_rsr
,
4321 .test_ill
= test_ill_sr
,
4322 .par
= (const uint32_t[]){
4324 XTENSA_OPTION_INTERRUPT
,
4326 .op_flags
= XTENSA_OP_PRIVILEGED
,
4328 .name
= "rsr.interrupt",
4329 .translate
= translate_rsr_ccount
,
4330 .test_ill
= test_ill_sr
,
4331 .par
= (const uint32_t[]){
4333 XTENSA_OPTION_INTERRUPT
,
4335 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4337 .name
= "rsr.intset",
4338 .translate
= translate_rsr_ccount
,
4339 .test_ill
= test_ill_sr
,
4340 .par
= (const uint32_t[]){
4342 XTENSA_OPTION_INTERRUPT
,
4344 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4346 .name
= "rsr.itlbcfg",
4347 .translate
= translate_rsr
,
4348 .test_ill
= test_ill_sr
,
4349 .par
= (const uint32_t[]){
4353 .op_flags
= XTENSA_OP_PRIVILEGED
,
4356 .translate
= translate_rsr
,
4357 .test_ill
= test_ill_sr
,
4358 .par
= (const uint32_t[]){
4363 .name
= "rsr.lcount",
4364 .translate
= translate_rsr
,
4365 .test_ill
= test_ill_sr
,
4366 .par
= (const uint32_t[]){
4372 .translate
= translate_rsr
,
4373 .test_ill
= test_ill_sr
,
4374 .par
= (const uint32_t[]){
4379 .name
= "rsr.litbase",
4380 .translate
= translate_rsr
,
4381 .test_ill
= test_ill_sr
,
4382 .par
= (const uint32_t[]){
4384 XTENSA_OPTION_EXTENDED_L32R
,
4388 .translate
= translate_rsr
,
4389 .test_ill
= test_ill_sr
,
4390 .par
= (const uint32_t[]){
4392 XTENSA_OPTION_MAC16
,
4396 .translate
= translate_rsr
,
4397 .test_ill
= test_ill_sr
,
4398 .par
= (const uint32_t[]){
4400 XTENSA_OPTION_MAC16
,
4404 .translate
= translate_rsr
,
4405 .test_ill
= test_ill_sr
,
4406 .par
= (const uint32_t[]){
4408 XTENSA_OPTION_MAC16
,
4412 .translate
= translate_rsr
,
4413 .test_ill
= test_ill_sr
,
4414 .par
= (const uint32_t[]){
4416 XTENSA_OPTION_MAC16
,
4419 .name
= "rsr.memctl",
4420 .translate
= translate_rsr
,
4421 .par
= (const uint32_t[]){MEMCTL
},
4422 .op_flags
= XTENSA_OP_PRIVILEGED
,
4425 .translate
= translate_rsr
,
4426 .test_ill
= test_ill_sr
,
4427 .par
= (const uint32_t[]){
4429 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4431 .op_flags
= XTENSA_OP_PRIVILEGED
,
4434 .translate
= translate_rsr
,
4435 .test_ill
= test_ill_sr
,
4436 .par
= (const uint32_t[]){
4438 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4440 .op_flags
= XTENSA_OP_PRIVILEGED
,
4443 .translate
= translate_rsr
,
4444 .test_ill
= test_ill_sr
,
4445 .par
= (const uint32_t[]){
4447 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4449 .op_flags
= XTENSA_OP_PRIVILEGED
,
4451 .name
= "rsr.mesave",
4452 .translate
= translate_rsr
,
4453 .test_ill
= test_ill_sr
,
4454 .par
= (const uint32_t[]){
4456 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4458 .op_flags
= XTENSA_OP_PRIVILEGED
,
4461 .translate
= translate_rsr
,
4462 .test_ill
= test_ill_sr
,
4463 .par
= (const uint32_t[]){
4465 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4467 .op_flags
= XTENSA_OP_PRIVILEGED
,
4469 .name
= "rsr.mevaddr",
4470 .translate
= translate_rsr
,
4471 .test_ill
= test_ill_sr
,
4472 .par
= (const uint32_t[]){
4474 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4476 .op_flags
= XTENSA_OP_PRIVILEGED
,
4478 .name
= "rsr.misc0",
4479 .translate
= translate_rsr
,
4480 .test_ill
= test_ill_sr
,
4481 .par
= (const uint32_t[]){
4483 XTENSA_OPTION_MISC_SR
,
4485 .op_flags
= XTENSA_OP_PRIVILEGED
,
4487 .name
= "rsr.misc1",
4488 .translate
= translate_rsr
,
4489 .test_ill
= test_ill_sr
,
4490 .par
= (const uint32_t[]){
4492 XTENSA_OPTION_MISC_SR
,
4494 .op_flags
= XTENSA_OP_PRIVILEGED
,
4496 .name
= "rsr.misc2",
4497 .translate
= translate_rsr
,
4498 .test_ill
= test_ill_sr
,
4499 .par
= (const uint32_t[]){
4501 XTENSA_OPTION_MISC_SR
,
4503 .op_flags
= XTENSA_OP_PRIVILEGED
,
4505 .name
= "rsr.misc3",
4506 .translate
= translate_rsr
,
4507 .test_ill
= test_ill_sr
,
4508 .par
= (const uint32_t[]){
4510 XTENSA_OPTION_MISC_SR
,
4512 .op_flags
= XTENSA_OP_PRIVILEGED
,
4514 .name
= "rsr.mpucfg",
4515 .translate
= translate_rsr
,
4516 .test_ill
= test_ill_sr
,
4517 .par
= (const uint32_t[]){
4521 .op_flags
= XTENSA_OP_PRIVILEGED
,
4523 .name
= "rsr.mpuenb",
4524 .translate
= translate_rsr
,
4525 .test_ill
= test_ill_sr
,
4526 .par
= (const uint32_t[]){
4530 .op_flags
= XTENSA_OP_PRIVILEGED
,
4532 .name
= "rsr.prefctl",
4533 .translate
= translate_rsr
,
4534 .par
= (const uint32_t[]){PREFCTL
},
4537 .translate
= translate_rsr
,
4538 .test_ill
= test_ill_sr
,
4539 .par
= (const uint32_t[]){
4541 XTENSA_OPTION_PROCESSOR_ID
,
4543 .op_flags
= XTENSA_OP_PRIVILEGED
,
4546 .translate
= translate_rsr
,
4547 .test_ill
= test_ill_sr
,
4548 .par
= (const uint32_t[]){
4550 XTENSA_OPTION_EXCEPTION
,
4552 .op_flags
= XTENSA_OP_PRIVILEGED
,
4554 .name
= "rsr.ptevaddr",
4555 .translate
= translate_rsr_ptevaddr
,
4556 .test_ill
= test_ill_sr
,
4557 .par
= (const uint32_t[]){
4561 .op_flags
= XTENSA_OP_PRIVILEGED
,
4563 .name
= "rsr.rasid",
4564 .translate
= translate_rsr
,
4565 .test_ill
= test_ill_sr
,
4566 .par
= (const uint32_t[]){
4570 .op_flags
= XTENSA_OP_PRIVILEGED
,
4573 .translate
= translate_rsr
,
4574 .par
= (const uint32_t[]){SAR
},
4576 .name
= "rsr.scompare1",
4577 .translate
= translate_rsr
,
4578 .test_ill
= test_ill_sr
,
4579 .par
= (const uint32_t[]){
4581 XTENSA_OPTION_CONDITIONAL_STORE
,
4584 .name
= "rsr.vecbase",
4585 .translate
= translate_rsr
,
4586 .test_ill
= test_ill_sr
,
4587 .par
= (const uint32_t[]){
4589 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4591 .op_flags
= XTENSA_OP_PRIVILEGED
,
4593 .name
= "rsr.windowbase",
4594 .translate
= translate_rsr
,
4595 .test_ill
= test_ill_sr
,
4596 .par
= (const uint32_t[]){
4598 XTENSA_OPTION_WINDOWED_REGISTER
,
4600 .op_flags
= XTENSA_OP_PRIVILEGED
,
4602 .name
= "rsr.windowstart",
4603 .translate
= translate_rsr
,
4604 .test_ill
= test_ill_sr
,
4605 .par
= (const uint32_t[]){
4607 XTENSA_OPTION_WINDOWED_REGISTER
,
4609 .op_flags
= XTENSA_OP_PRIVILEGED
,
4612 .translate
= translate_nop
,
4614 .name
= "rur.expstate",
4615 .translate
= translate_rur
,
4616 .par
= (const uint32_t[]){EXPSTATE
},
4619 .translate
= translate_rur
,
4620 .par
= (const uint32_t[]){FCR
},
4624 .translate
= translate_rur
,
4625 .par
= (const uint32_t[]){FSR
},
4628 .name
= "rur.threadptr",
4629 .translate
= translate_rur
,
4630 .par
= (const uint32_t[]){THREADPTR
},
4633 .translate
= translate_ldst
,
4634 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4635 .op_flags
= XTENSA_OP_STORE
,
4638 .translate
= translate_s32c1i
,
4639 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4642 .translate
= translate_s32e
,
4643 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4646 .translate
= translate_s32ex
,
4647 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4649 .name
= (const char * const[]) {
4650 "s32i", "s32i.n", "s32nb", NULL
,
4652 .translate
= translate_ldst
,
4653 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4654 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4657 .translate
= translate_ldst
,
4658 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4659 .op_flags
= XTENSA_OP_STORE
,
4662 .translate
= translate_ldst
,
4663 .par
= (const uint32_t[]){MO_UB
, false, true},
4664 .op_flags
= XTENSA_OP_STORE
,
4667 .translate
= translate_salt
,
4668 .par
= (const uint32_t[]){TCG_COND_LT
},
4671 .translate
= translate_salt
,
4672 .par
= (const uint32_t[]){TCG_COND_LTU
},
4674 .name
= "setb_expstate",
4675 .translate
= translate_setb_expstate
,
4678 .translate
= translate_sext
,
4681 .translate
= translate_simcall
,
4682 .test_ill
= test_ill_simcall
,
4683 .op_flags
= XTENSA_OP_PRIVILEGED
,
4686 .translate
= translate_sll
,
4689 .translate
= translate_slli
,
4692 .translate
= translate_sra
,
4695 .translate
= translate_srai
,
4698 .translate
= translate_src
,
4701 .translate
= translate_srl
,
4704 .translate
= translate_srli
,
4707 .translate
= translate_ssa8b
,
4710 .translate
= translate_ssa8l
,
4713 .translate
= translate_ssai
,
4716 .translate
= translate_ssl
,
4719 .translate
= translate_ssr
,
4722 .translate
= translate_sub
,
4725 .translate
= translate_subx
,
4726 .par
= (const uint32_t[]){1},
4729 .translate
= translate_subx
,
4730 .par
= (const uint32_t[]){2},
4733 .translate
= translate_subx
,
4734 .par
= (const uint32_t[]){3},
4737 .op_flags
= XTENSA_OP_SYSCALL
,
4739 .name
= "umul.aa.hh",
4740 .translate
= translate_mac16
,
4741 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4743 .name
= "umul.aa.hl",
4744 .translate
= translate_mac16
,
4745 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4747 .name
= "umul.aa.lh",
4748 .translate
= translate_mac16
,
4749 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4751 .name
= "umul.aa.ll",
4752 .translate
= translate_mac16
,
4753 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4756 .translate
= translate_waiti
,
4757 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4760 .translate
= translate_wtlb
,
4761 .par
= (const uint32_t[]){true},
4762 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4765 .translate
= translate_wer
,
4766 .op_flags
= XTENSA_OP_PRIVILEGED
,
4769 .translate
= translate_wtlb
,
4770 .par
= (const uint32_t[]){false},
4771 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4774 .translate
= translate_wptlb
,
4775 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4777 .name
= "wrmsk_expstate",
4778 .translate
= translate_wrmsk_expstate
,
4781 .op_flags
= XTENSA_OP_ILL
,
4784 .op_flags
= XTENSA_OP_ILL
,
4786 .name
= "wsr.acchi",
4787 .translate
= translate_wsr_acchi
,
4788 .test_ill
= test_ill_sr
,
4789 .par
= (const uint32_t[]){
4791 XTENSA_OPTION_MAC16
,
4794 .name
= "wsr.acclo",
4795 .translate
= translate_wsr
,
4796 .test_ill
= test_ill_sr
,
4797 .par
= (const uint32_t[]){
4799 XTENSA_OPTION_MAC16
,
4802 .name
= "wsr.atomctl",
4803 .translate
= translate_wsr_mask
,
4804 .test_ill
= test_ill_sr
,
4805 .par
= (const uint32_t[]){
4807 XTENSA_OPTION_ATOMCTL
,
4810 .op_flags
= XTENSA_OP_PRIVILEGED
,
4813 .translate
= translate_wsr_mask
,
4814 .test_ill
= test_ill_sr
,
4815 .par
= (const uint32_t[]){
4817 XTENSA_OPTION_BOOLEAN
,
4821 .name
= "wsr.cacheadrdis",
4822 .translate
= translate_wsr_mask
,
4823 .test_ill
= test_ill_sr
,
4824 .par
= (const uint32_t[]){
4829 .op_flags
= XTENSA_OP_PRIVILEGED
,
4831 .name
= "wsr.cacheattr",
4832 .translate
= translate_wsr
,
4833 .test_ill
= test_ill_sr
,
4834 .par
= (const uint32_t[]){
4836 XTENSA_OPTION_CACHEATTR
,
4838 .op_flags
= XTENSA_OP_PRIVILEGED
,
4840 .name
= "wsr.ccompare0",
4841 .translate
= translate_wsr_ccompare
,
4842 .test_ill
= test_ill_ccompare
,
4843 .par
= (const uint32_t[]){
4845 XTENSA_OPTION_TIMER_INTERRUPT
,
4847 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4849 .name
= "wsr.ccompare1",
4850 .translate
= translate_wsr_ccompare
,
4851 .test_ill
= test_ill_ccompare
,
4852 .par
= (const uint32_t[]){
4854 XTENSA_OPTION_TIMER_INTERRUPT
,
4856 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4858 .name
= "wsr.ccompare2",
4859 .translate
= translate_wsr_ccompare
,
4860 .test_ill
= test_ill_ccompare
,
4861 .par
= (const uint32_t[]){
4863 XTENSA_OPTION_TIMER_INTERRUPT
,
4865 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4867 .name
= "wsr.ccount",
4868 .translate
= translate_wsr_ccount
,
4869 .test_ill
= test_ill_sr
,
4870 .par
= (const uint32_t[]){
4872 XTENSA_OPTION_TIMER_INTERRUPT
,
4874 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4876 .name
= "wsr.configid0",
4877 .op_flags
= XTENSA_OP_ILL
,
4879 .name
= "wsr.configid1",
4880 .op_flags
= XTENSA_OP_ILL
,
4882 .name
= "wsr.cpenable",
4883 .translate
= translate_wsr_mask
,
4884 .test_ill
= test_ill_sr
,
4885 .par
= (const uint32_t[]){
4887 XTENSA_OPTION_COPROCESSOR
,
4890 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4892 .name
= "wsr.dbreaka0",
4893 .translate
= translate_wsr_dbreaka
,
4894 .test_ill
= test_ill_dbreak
,
4895 .par
= (const uint32_t[]){
4897 XTENSA_OPTION_DEBUG
,
4899 .op_flags
= XTENSA_OP_PRIVILEGED
,
4901 .name
= "wsr.dbreaka1",
4902 .translate
= translate_wsr_dbreaka
,
4903 .test_ill
= test_ill_dbreak
,
4904 .par
= (const uint32_t[]){
4906 XTENSA_OPTION_DEBUG
,
4908 .op_flags
= XTENSA_OP_PRIVILEGED
,
4910 .name
= "wsr.dbreakc0",
4911 .translate
= translate_wsr_dbreakc
,
4912 .test_ill
= test_ill_dbreak
,
4913 .par
= (const uint32_t[]){
4915 XTENSA_OPTION_DEBUG
,
4917 .op_flags
= XTENSA_OP_PRIVILEGED
,
4919 .name
= "wsr.dbreakc1",
4920 .translate
= translate_wsr_dbreakc
,
4921 .test_ill
= test_ill_dbreak
,
4922 .par
= (const uint32_t[]){
4924 XTENSA_OPTION_DEBUG
,
4926 .op_flags
= XTENSA_OP_PRIVILEGED
,
4929 .translate
= translate_wsr
,
4930 .test_ill
= test_ill_sr
,
4931 .par
= (const uint32_t[]){
4933 XTENSA_OPTION_DEBUG
,
4935 .op_flags
= XTENSA_OP_PRIVILEGED
,
4937 .name
= "wsr.debugcause",
4938 .op_flags
= XTENSA_OP_ILL
,
4941 .translate
= translate_wsr
,
4942 .test_ill
= test_ill_sr
,
4943 .par
= (const uint32_t[]){
4945 XTENSA_OPTION_EXCEPTION
,
4947 .op_flags
= XTENSA_OP_PRIVILEGED
,
4949 .name
= "wsr.dtlbcfg",
4950 .translate
= translate_wsr_mask
,
4951 .test_ill
= test_ill_sr
,
4952 .par
= (const uint32_t[]){
4957 .op_flags
= XTENSA_OP_PRIVILEGED
,
4960 .translate
= translate_wsr
,
4961 .test_ill
= test_ill_sr
,
4962 .par
= (const uint32_t[]){
4964 XTENSA_OPTION_EXCEPTION
,
4966 .op_flags
= XTENSA_OP_PRIVILEGED
,
4969 .translate
= translate_wsr
,
4970 .test_ill
= test_ill_hpi
,
4971 .par
= (const uint32_t[]){
4973 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4975 .op_flags
= XTENSA_OP_PRIVILEGED
,
4978 .translate
= translate_wsr
,
4979 .test_ill
= test_ill_hpi
,
4980 .par
= (const uint32_t[]){
4982 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4984 .op_flags
= XTENSA_OP_PRIVILEGED
,
4987 .translate
= translate_wsr
,
4988 .test_ill
= test_ill_hpi
,
4989 .par
= (const uint32_t[]){
4991 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4993 .op_flags
= XTENSA_OP_PRIVILEGED
,
4996 .translate
= translate_wsr
,
4997 .test_ill
= test_ill_hpi
,
4998 .par
= (const uint32_t[]){
5000 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5002 .op_flags
= XTENSA_OP_PRIVILEGED
,
5005 .translate
= translate_wsr
,
5006 .test_ill
= test_ill_hpi
,
5007 .par
= (const uint32_t[]){
5009 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5011 .op_flags
= XTENSA_OP_PRIVILEGED
,
5014 .translate
= translate_wsr
,
5015 .test_ill
= test_ill_hpi
,
5016 .par
= (const uint32_t[]){
5018 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5020 .op_flags
= XTENSA_OP_PRIVILEGED
,
5023 .translate
= translate_wsr
,
5024 .test_ill
= test_ill_hpi
,
5025 .par
= (const uint32_t[]){
5027 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5029 .op_flags
= XTENSA_OP_PRIVILEGED
,
5032 .translate
= translate_wsr
,
5033 .test_ill
= test_ill_hpi
,
5034 .par
= (const uint32_t[]){
5036 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5038 .op_flags
= XTENSA_OP_PRIVILEGED
,
5041 .translate
= translate_wsr
,
5042 .test_ill
= test_ill_hpi
,
5043 .par
= (const uint32_t[]){
5045 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5047 .op_flags
= XTENSA_OP_PRIVILEGED
,
5050 .translate
= translate_wsr
,
5051 .test_ill
= test_ill_hpi
,
5052 .par
= (const uint32_t[]){
5054 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5056 .op_flags
= XTENSA_OP_PRIVILEGED
,
5059 .translate
= translate_wsr
,
5060 .test_ill
= test_ill_hpi
,
5061 .par
= (const uint32_t[]){
5063 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5065 .op_flags
= XTENSA_OP_PRIVILEGED
,
5068 .translate
= translate_wsr
,
5069 .test_ill
= test_ill_hpi
,
5070 .par
= (const uint32_t[]){
5072 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5074 .op_flags
= XTENSA_OP_PRIVILEGED
,
5076 .name
= "wsr.eraccess",
5077 .translate
= translate_wsr_mask
,
5078 .par
= (const uint32_t[]){
5083 .op_flags
= XTENSA_OP_PRIVILEGED
,
5085 .name
= "wsr.exccause",
5086 .translate
= translate_wsr
,
5087 .test_ill
= test_ill_sr
,
5088 .par
= (const uint32_t[]){
5090 XTENSA_OPTION_EXCEPTION
,
5092 .op_flags
= XTENSA_OP_PRIVILEGED
,
5094 .name
= "wsr.excsave1",
5095 .translate
= translate_wsr
,
5096 .test_ill
= test_ill_sr
,
5097 .par
= (const uint32_t[]){
5099 XTENSA_OPTION_EXCEPTION
,
5101 .op_flags
= XTENSA_OP_PRIVILEGED
,
5103 .name
= "wsr.excsave2",
5104 .translate
= translate_wsr
,
5105 .test_ill
= test_ill_hpi
,
5106 .par
= (const uint32_t[]){
5108 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5110 .op_flags
= XTENSA_OP_PRIVILEGED
,
5112 .name
= "wsr.excsave3",
5113 .translate
= translate_wsr
,
5114 .test_ill
= test_ill_hpi
,
5115 .par
= (const uint32_t[]){
5117 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5119 .op_flags
= XTENSA_OP_PRIVILEGED
,
5121 .name
= "wsr.excsave4",
5122 .translate
= translate_wsr
,
5123 .test_ill
= test_ill_hpi
,
5124 .par
= (const uint32_t[]){
5126 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5128 .op_flags
= XTENSA_OP_PRIVILEGED
,
5130 .name
= "wsr.excsave5",
5131 .translate
= translate_wsr
,
5132 .test_ill
= test_ill_hpi
,
5133 .par
= (const uint32_t[]){
5135 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5137 .op_flags
= XTENSA_OP_PRIVILEGED
,
5139 .name
= "wsr.excsave6",
5140 .translate
= translate_wsr
,
5141 .test_ill
= test_ill_hpi
,
5142 .par
= (const uint32_t[]){
5144 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5146 .op_flags
= XTENSA_OP_PRIVILEGED
,
5148 .name
= "wsr.excsave7",
5149 .translate
= translate_wsr
,
5150 .test_ill
= test_ill_hpi
,
5151 .par
= (const uint32_t[]){
5153 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5155 .op_flags
= XTENSA_OP_PRIVILEGED
,
5157 .name
= "wsr.excvaddr",
5158 .translate
= translate_wsr
,
5159 .test_ill
= test_ill_sr
,
5160 .par
= (const uint32_t[]){
5162 XTENSA_OPTION_EXCEPTION
,
5164 .op_flags
= XTENSA_OP_PRIVILEGED
,
5166 .name
= "wsr.ibreaka0",
5167 .translate
= translate_wsr_ibreaka
,
5168 .test_ill
= test_ill_ibreak
,
5169 .par
= (const uint32_t[]){
5171 XTENSA_OPTION_DEBUG
,
5173 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5175 .name
= "wsr.ibreaka1",
5176 .translate
= translate_wsr_ibreaka
,
5177 .test_ill
= test_ill_ibreak
,
5178 .par
= (const uint32_t[]){
5180 XTENSA_OPTION_DEBUG
,
5182 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5184 .name
= "wsr.ibreakenable",
5185 .translate
= translate_wsr_ibreakenable
,
5186 .test_ill
= test_ill_sr
,
5187 .par
= (const uint32_t[]){
5189 XTENSA_OPTION_DEBUG
,
5191 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5193 .name
= "wsr.icount",
5194 .translate
= translate_wsr_icount
,
5195 .test_ill
= test_ill_sr
,
5196 .par
= (const uint32_t[]){
5198 XTENSA_OPTION_DEBUG
,
5200 .op_flags
= XTENSA_OP_PRIVILEGED
,
5202 .name
= "wsr.icountlevel",
5203 .translate
= translate_wsr_mask
,
5204 .test_ill
= test_ill_sr
,
5205 .par
= (const uint32_t[]){
5207 XTENSA_OPTION_DEBUG
,
5210 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5212 .name
= "wsr.intclear",
5213 .translate
= translate_wsr_intclear
,
5214 .test_ill
= test_ill_sr
,
5215 .par
= (const uint32_t[]){
5217 XTENSA_OPTION_INTERRUPT
,
5220 XTENSA_OP_PRIVILEGED
|
5221 XTENSA_OP_EXIT_TB_0
|
5222 XTENSA_OP_CHECK_INTERRUPTS
,
5224 .name
= "wsr.intenable",
5225 .translate
= translate_wsr
,
5226 .test_ill
= test_ill_sr
,
5227 .par
= (const uint32_t[]){
5229 XTENSA_OPTION_INTERRUPT
,
5232 XTENSA_OP_PRIVILEGED
|
5233 XTENSA_OP_EXIT_TB_0
|
5234 XTENSA_OP_CHECK_INTERRUPTS
,
5236 .name
= "wsr.interrupt",
5237 .translate
= translate_wsr
,
5238 .test_ill
= test_ill_sr
,
5239 .par
= (const uint32_t[]){
5241 XTENSA_OPTION_INTERRUPT
,
5244 XTENSA_OP_PRIVILEGED
|
5245 XTENSA_OP_EXIT_TB_0
|
5246 XTENSA_OP_CHECK_INTERRUPTS
,
5248 .name
= "wsr.intset",
5249 .translate
= translate_wsr_intset
,
5250 .test_ill
= test_ill_sr
,
5251 .par
= (const uint32_t[]){
5253 XTENSA_OPTION_INTERRUPT
,
5256 XTENSA_OP_PRIVILEGED
|
5257 XTENSA_OP_EXIT_TB_0
|
5258 XTENSA_OP_CHECK_INTERRUPTS
,
5260 .name
= "wsr.itlbcfg",
5261 .translate
= translate_wsr_mask
,
5262 .test_ill
= test_ill_sr
,
5263 .par
= (const uint32_t[]){
5268 .op_flags
= XTENSA_OP_PRIVILEGED
,
5271 .translate
= translate_wsr
,
5272 .test_ill
= test_ill_sr
,
5273 .par
= (const uint32_t[]){
5277 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5279 .name
= "wsr.lcount",
5280 .translate
= translate_wsr
,
5281 .test_ill
= test_ill_sr
,
5282 .par
= (const uint32_t[]){
5288 .translate
= translate_wsr
,
5289 .test_ill
= test_ill_sr
,
5290 .par
= (const uint32_t[]){
5294 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5296 .name
= "wsr.litbase",
5297 .translate
= translate_wsr_mask
,
5298 .test_ill
= test_ill_sr
,
5299 .par
= (const uint32_t[]){
5301 XTENSA_OPTION_EXTENDED_L32R
,
5304 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5307 .translate
= translate_wsr
,
5308 .test_ill
= test_ill_sr
,
5309 .par
= (const uint32_t[]){
5311 XTENSA_OPTION_MAC16
,
5315 .translate
= translate_wsr
,
5316 .test_ill
= test_ill_sr
,
5317 .par
= (const uint32_t[]){
5319 XTENSA_OPTION_MAC16
,
5323 .translate
= translate_wsr
,
5324 .test_ill
= test_ill_sr
,
5325 .par
= (const uint32_t[]){
5327 XTENSA_OPTION_MAC16
,
5331 .translate
= translate_wsr
,
5332 .test_ill
= test_ill_sr
,
5333 .par
= (const uint32_t[]){
5335 XTENSA_OPTION_MAC16
,
5338 .name
= "wsr.memctl",
5339 .translate
= translate_wsr_memctl
,
5340 .par
= (const uint32_t[]){MEMCTL
},
5341 .op_flags
= XTENSA_OP_PRIVILEGED
,
5344 .translate
= translate_wsr
,
5345 .test_ill
= test_ill_sr
,
5346 .par
= (const uint32_t[]){
5348 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5350 .op_flags
= XTENSA_OP_PRIVILEGED
,
5353 .translate
= translate_wsr
,
5354 .test_ill
= test_ill_sr
,
5355 .par
= (const uint32_t[]){
5357 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5359 .op_flags
= XTENSA_OP_PRIVILEGED
,
5362 .translate
= translate_wsr
,
5363 .test_ill
= test_ill_sr
,
5364 .par
= (const uint32_t[]){
5366 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5368 .op_flags
= XTENSA_OP_PRIVILEGED
,
5370 .name
= "wsr.mesave",
5371 .translate
= translate_wsr
,
5372 .test_ill
= test_ill_sr
,
5373 .par
= (const uint32_t[]){
5375 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5377 .op_flags
= XTENSA_OP_PRIVILEGED
,
5380 .translate
= translate_wsr
,
5381 .test_ill
= test_ill_sr
,
5382 .par
= (const uint32_t[]){
5384 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5386 .op_flags
= XTENSA_OP_PRIVILEGED
,
5388 .name
= "wsr.mevaddr",
5389 .translate
= translate_wsr
,
5390 .test_ill
= test_ill_sr
,
5391 .par
= (const uint32_t[]){
5393 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5395 .op_flags
= XTENSA_OP_PRIVILEGED
,
5397 .name
= "wsr.misc0",
5398 .translate
= translate_wsr
,
5399 .test_ill
= test_ill_sr
,
5400 .par
= (const uint32_t[]){
5402 XTENSA_OPTION_MISC_SR
,
5404 .op_flags
= XTENSA_OP_PRIVILEGED
,
5406 .name
= "wsr.misc1",
5407 .translate
= translate_wsr
,
5408 .test_ill
= test_ill_sr
,
5409 .par
= (const uint32_t[]){
5411 XTENSA_OPTION_MISC_SR
,
5413 .op_flags
= XTENSA_OP_PRIVILEGED
,
5415 .name
= "wsr.misc2",
5416 .translate
= translate_wsr
,
5417 .test_ill
= test_ill_sr
,
5418 .par
= (const uint32_t[]){
5420 XTENSA_OPTION_MISC_SR
,
5422 .op_flags
= XTENSA_OP_PRIVILEGED
,
5424 .name
= "wsr.misc3",
5425 .translate
= translate_wsr
,
5426 .test_ill
= test_ill_sr
,
5427 .par
= (const uint32_t[]){
5429 XTENSA_OPTION_MISC_SR
,
5431 .op_flags
= XTENSA_OP_PRIVILEGED
,
5434 .translate
= translate_wsr
,
5435 .test_ill
= test_ill_sr
,
5436 .par
= (const uint32_t[]){
5438 XTENSA_OPTION_TRACE_PORT
,
5440 .op_flags
= XTENSA_OP_PRIVILEGED
,
5442 .name
= "wsr.mpuenb",
5443 .translate
= translate_wsr_mpuenb
,
5444 .test_ill
= test_ill_sr
,
5445 .par
= (const uint32_t[]){
5449 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5451 .name
= "wsr.prefctl",
5452 .translate
= translate_wsr
,
5453 .par
= (const uint32_t[]){PREFCTL
},
5456 .op_flags
= XTENSA_OP_ILL
,
5459 .translate
= translate_wsr_ps
,
5460 .test_ill
= test_ill_sr
,
5461 .par
= (const uint32_t[]){
5463 XTENSA_OPTION_EXCEPTION
,
5466 XTENSA_OP_PRIVILEGED
|
5467 XTENSA_OP_EXIT_TB_M1
|
5468 XTENSA_OP_CHECK_INTERRUPTS
,
5470 .name
= "wsr.ptevaddr",
5471 .translate
= translate_wsr_mask
,
5472 .test_ill
= test_ill_sr
,
5473 .par
= (const uint32_t[]){
5478 .op_flags
= XTENSA_OP_PRIVILEGED
,
5480 .name
= "wsr.rasid",
5481 .translate
= translate_wsr_rasid
,
5482 .test_ill
= test_ill_sr
,
5483 .par
= (const uint32_t[]){
5487 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5490 .translate
= translate_wsr_sar
,
5491 .par
= (const uint32_t[]){SAR
},
5493 .name
= "wsr.scompare1",
5494 .translate
= translate_wsr
,
5495 .test_ill
= test_ill_sr
,
5496 .par
= (const uint32_t[]){
5498 XTENSA_OPTION_CONDITIONAL_STORE
,
5501 .name
= "wsr.vecbase",
5502 .translate
= translate_wsr
,
5503 .test_ill
= test_ill_sr
,
5504 .par
= (const uint32_t[]){
5506 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5508 .op_flags
= XTENSA_OP_PRIVILEGED
,
5510 .name
= "wsr.windowbase",
5511 .translate
= translate_wsr_windowbase
,
5512 .test_ill
= test_ill_sr
,
5513 .par
= (const uint32_t[]){
5515 XTENSA_OPTION_WINDOWED_REGISTER
,
5517 .op_flags
= XTENSA_OP_PRIVILEGED
|
5518 XTENSA_OP_EXIT_TB_M1
|
5519 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5521 .name
= "wsr.windowstart",
5522 .translate
= translate_wsr_windowstart
,
5523 .test_ill
= test_ill_sr
,
5524 .par
= (const uint32_t[]){
5526 XTENSA_OPTION_WINDOWED_REGISTER
,
5528 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5530 .name
= "wur.expstate",
5531 .translate
= translate_wur
,
5532 .par
= (const uint32_t[]){EXPSTATE
},
5535 .translate
= translate_wur_fcr
,
5536 .par
= (const uint32_t[]){FCR
},
5540 .translate
= translate_wur_fsr
,
5541 .par
= (const uint32_t[]){FSR
},
5544 .name
= "wur.threadptr",
5545 .translate
= translate_wur
,
5546 .par
= (const uint32_t[]){THREADPTR
},
5549 .translate
= translate_xor
,
5552 .translate
= translate_boolean
,
5553 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5556 .op_flags
= XTENSA_OP_ILL
,
5559 .op_flags
= XTENSA_OP_ILL
,
5561 .name
= "xsr.acchi",
5562 .translate
= translate_xsr_acchi
,
5563 .test_ill
= test_ill_sr
,
5564 .par
= (const uint32_t[]){
5566 XTENSA_OPTION_MAC16
,
5569 .name
= "xsr.acclo",
5570 .translate
= translate_xsr
,
5571 .test_ill
= test_ill_sr
,
5572 .par
= (const uint32_t[]){
5574 XTENSA_OPTION_MAC16
,
5577 .name
= "xsr.atomctl",
5578 .translate
= translate_xsr_mask
,
5579 .test_ill
= test_ill_sr
,
5580 .par
= (const uint32_t[]){
5582 XTENSA_OPTION_ATOMCTL
,
5585 .op_flags
= XTENSA_OP_PRIVILEGED
,
5588 .translate
= translate_xsr_mask
,
5589 .test_ill
= test_ill_sr
,
5590 .par
= (const uint32_t[]){
5592 XTENSA_OPTION_BOOLEAN
,
5596 .name
= "xsr.cacheadrdis",
5597 .translate
= translate_xsr_mask
,
5598 .test_ill
= test_ill_sr
,
5599 .par
= (const uint32_t[]){
5604 .op_flags
= XTENSA_OP_PRIVILEGED
,
5606 .name
= "xsr.cacheattr",
5607 .translate
= translate_xsr
,
5608 .test_ill
= test_ill_sr
,
5609 .par
= (const uint32_t[]){
5611 XTENSA_OPTION_CACHEATTR
,
5613 .op_flags
= XTENSA_OP_PRIVILEGED
,
5615 .name
= "xsr.ccompare0",
5616 .translate
= translate_xsr_ccompare
,
5617 .test_ill
= test_ill_ccompare
,
5618 .par
= (const uint32_t[]){
5620 XTENSA_OPTION_TIMER_INTERRUPT
,
5622 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5624 .name
= "xsr.ccompare1",
5625 .translate
= translate_xsr_ccompare
,
5626 .test_ill
= test_ill_ccompare
,
5627 .par
= (const uint32_t[]){
5629 XTENSA_OPTION_TIMER_INTERRUPT
,
5631 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5633 .name
= "xsr.ccompare2",
5634 .translate
= translate_xsr_ccompare
,
5635 .test_ill
= test_ill_ccompare
,
5636 .par
= (const uint32_t[]){
5638 XTENSA_OPTION_TIMER_INTERRUPT
,
5640 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5642 .name
= "xsr.ccount",
5643 .translate
= translate_xsr_ccount
,
5644 .test_ill
= test_ill_sr
,
5645 .par
= (const uint32_t[]){
5647 XTENSA_OPTION_TIMER_INTERRUPT
,
5649 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5651 .name
= "xsr.configid0",
5652 .op_flags
= XTENSA_OP_ILL
,
5654 .name
= "xsr.configid1",
5655 .op_flags
= XTENSA_OP_ILL
,
5657 .name
= "xsr.cpenable",
5658 .translate
= translate_xsr_mask
,
5659 .test_ill
= test_ill_sr
,
5660 .par
= (const uint32_t[]){
5662 XTENSA_OPTION_COPROCESSOR
,
5665 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5667 .name
= "xsr.dbreaka0",
5668 .translate
= translate_xsr_dbreaka
,
5669 .test_ill
= test_ill_dbreak
,
5670 .par
= (const uint32_t[]){
5672 XTENSA_OPTION_DEBUG
,
5674 .op_flags
= XTENSA_OP_PRIVILEGED
,
5676 .name
= "xsr.dbreaka1",
5677 .translate
= translate_xsr_dbreaka
,
5678 .test_ill
= test_ill_dbreak
,
5679 .par
= (const uint32_t[]){
5681 XTENSA_OPTION_DEBUG
,
5683 .op_flags
= XTENSA_OP_PRIVILEGED
,
5685 .name
= "xsr.dbreakc0",
5686 .translate
= translate_xsr_dbreakc
,
5687 .test_ill
= test_ill_dbreak
,
5688 .par
= (const uint32_t[]){
5690 XTENSA_OPTION_DEBUG
,
5692 .op_flags
= XTENSA_OP_PRIVILEGED
,
5694 .name
= "xsr.dbreakc1",
5695 .translate
= translate_xsr_dbreakc
,
5696 .test_ill
= test_ill_dbreak
,
5697 .par
= (const uint32_t[]){
5699 XTENSA_OPTION_DEBUG
,
5701 .op_flags
= XTENSA_OP_PRIVILEGED
,
5704 .translate
= translate_xsr
,
5705 .test_ill
= test_ill_sr
,
5706 .par
= (const uint32_t[]){
5708 XTENSA_OPTION_DEBUG
,
5710 .op_flags
= XTENSA_OP_PRIVILEGED
,
5712 .name
= "xsr.debugcause",
5713 .op_flags
= XTENSA_OP_ILL
,
5716 .translate
= translate_xsr
,
5717 .test_ill
= test_ill_sr
,
5718 .par
= (const uint32_t[]){
5720 XTENSA_OPTION_EXCEPTION
,
5722 .op_flags
= XTENSA_OP_PRIVILEGED
,
5724 .name
= "xsr.dtlbcfg",
5725 .translate
= translate_xsr_mask
,
5726 .test_ill
= test_ill_sr
,
5727 .par
= (const uint32_t[]){
5732 .op_flags
= XTENSA_OP_PRIVILEGED
,
5735 .translate
= translate_xsr
,
5736 .test_ill
= test_ill_sr
,
5737 .par
= (const uint32_t[]){
5739 XTENSA_OPTION_EXCEPTION
,
5741 .op_flags
= XTENSA_OP_PRIVILEGED
,
5744 .translate
= translate_xsr
,
5745 .test_ill
= test_ill_hpi
,
5746 .par
= (const uint32_t[]){
5748 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5750 .op_flags
= XTENSA_OP_PRIVILEGED
,
5753 .translate
= translate_xsr
,
5754 .test_ill
= test_ill_hpi
,
5755 .par
= (const uint32_t[]){
5757 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5759 .op_flags
= XTENSA_OP_PRIVILEGED
,
5762 .translate
= translate_xsr
,
5763 .test_ill
= test_ill_hpi
,
5764 .par
= (const uint32_t[]){
5766 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5768 .op_flags
= XTENSA_OP_PRIVILEGED
,
5771 .translate
= translate_xsr
,
5772 .test_ill
= test_ill_hpi
,
5773 .par
= (const uint32_t[]){
5775 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5777 .op_flags
= XTENSA_OP_PRIVILEGED
,
5780 .translate
= translate_xsr
,
5781 .test_ill
= test_ill_hpi
,
5782 .par
= (const uint32_t[]){
5784 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5786 .op_flags
= XTENSA_OP_PRIVILEGED
,
5789 .translate
= translate_xsr
,
5790 .test_ill
= test_ill_hpi
,
5791 .par
= (const uint32_t[]){
5793 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5795 .op_flags
= XTENSA_OP_PRIVILEGED
,
5798 .translate
= translate_xsr
,
5799 .test_ill
= test_ill_hpi
,
5800 .par
= (const uint32_t[]){
5802 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5804 .op_flags
= XTENSA_OP_PRIVILEGED
,
5807 .translate
= translate_xsr
,
5808 .test_ill
= test_ill_hpi
,
5809 .par
= (const uint32_t[]){
5811 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5813 .op_flags
= XTENSA_OP_PRIVILEGED
,
5816 .translate
= translate_xsr
,
5817 .test_ill
= test_ill_hpi
,
5818 .par
= (const uint32_t[]){
5820 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5822 .op_flags
= XTENSA_OP_PRIVILEGED
,
5825 .translate
= translate_xsr
,
5826 .test_ill
= test_ill_hpi
,
5827 .par
= (const uint32_t[]){
5829 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5831 .op_flags
= XTENSA_OP_PRIVILEGED
,
5834 .translate
= translate_xsr
,
5835 .test_ill
= test_ill_hpi
,
5836 .par
= (const uint32_t[]){
5838 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5840 .op_flags
= XTENSA_OP_PRIVILEGED
,
5843 .translate
= translate_xsr
,
5844 .test_ill
= test_ill_hpi
,
5845 .par
= (const uint32_t[]){
5847 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5849 .op_flags
= XTENSA_OP_PRIVILEGED
,
5851 .name
= "xsr.eraccess",
5852 .translate
= translate_xsr_mask
,
5853 .par
= (const uint32_t[]){
5858 .op_flags
= XTENSA_OP_PRIVILEGED
,
5860 .name
= "xsr.exccause",
5861 .translate
= translate_xsr
,
5862 .test_ill
= test_ill_sr
,
5863 .par
= (const uint32_t[]){
5865 XTENSA_OPTION_EXCEPTION
,
5867 .op_flags
= XTENSA_OP_PRIVILEGED
,
5869 .name
= "xsr.excsave1",
5870 .translate
= translate_xsr
,
5871 .test_ill
= test_ill_sr
,
5872 .par
= (const uint32_t[]){
5874 XTENSA_OPTION_EXCEPTION
,
5876 .op_flags
= XTENSA_OP_PRIVILEGED
,
5878 .name
= "xsr.excsave2",
5879 .translate
= translate_xsr
,
5880 .test_ill
= test_ill_hpi
,
5881 .par
= (const uint32_t[]){
5883 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5885 .op_flags
= XTENSA_OP_PRIVILEGED
,
5887 .name
= "xsr.excsave3",
5888 .translate
= translate_xsr
,
5889 .test_ill
= test_ill_hpi
,
5890 .par
= (const uint32_t[]){
5892 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5894 .op_flags
= XTENSA_OP_PRIVILEGED
,
5896 .name
= "xsr.excsave4",
5897 .translate
= translate_xsr
,
5898 .test_ill
= test_ill_hpi
,
5899 .par
= (const uint32_t[]){
5901 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5903 .op_flags
= XTENSA_OP_PRIVILEGED
,
5905 .name
= "xsr.excsave5",
5906 .translate
= translate_xsr
,
5907 .test_ill
= test_ill_hpi
,
5908 .par
= (const uint32_t[]){
5910 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5912 .op_flags
= XTENSA_OP_PRIVILEGED
,
5914 .name
= "xsr.excsave6",
5915 .translate
= translate_xsr
,
5916 .test_ill
= test_ill_hpi
,
5917 .par
= (const uint32_t[]){
5919 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5921 .op_flags
= XTENSA_OP_PRIVILEGED
,
5923 .name
= "xsr.excsave7",
5924 .translate
= translate_xsr
,
5925 .test_ill
= test_ill_hpi
,
5926 .par
= (const uint32_t[]){
5928 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5930 .op_flags
= XTENSA_OP_PRIVILEGED
,
5932 .name
= "xsr.excvaddr",
5933 .translate
= translate_xsr
,
5934 .test_ill
= test_ill_sr
,
5935 .par
= (const uint32_t[]){
5937 XTENSA_OPTION_EXCEPTION
,
5939 .op_flags
= XTENSA_OP_PRIVILEGED
,
5941 .name
= "xsr.ibreaka0",
5942 .translate
= translate_xsr_ibreaka
,
5943 .test_ill
= test_ill_ibreak
,
5944 .par
= (const uint32_t[]){
5946 XTENSA_OPTION_DEBUG
,
5948 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5950 .name
= "xsr.ibreaka1",
5951 .translate
= translate_xsr_ibreaka
,
5952 .test_ill
= test_ill_ibreak
,
5953 .par
= (const uint32_t[]){
5955 XTENSA_OPTION_DEBUG
,
5957 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5959 .name
= "xsr.ibreakenable",
5960 .translate
= translate_xsr_ibreakenable
,
5961 .test_ill
= test_ill_sr
,
5962 .par
= (const uint32_t[]){
5964 XTENSA_OPTION_DEBUG
,
5966 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5968 .name
= "xsr.icount",
5969 .translate
= translate_xsr_icount
,
5970 .test_ill
= test_ill_sr
,
5971 .par
= (const uint32_t[]){
5973 XTENSA_OPTION_DEBUG
,
5975 .op_flags
= XTENSA_OP_PRIVILEGED
,
5977 .name
= "xsr.icountlevel",
5978 .translate
= translate_xsr_mask
,
5979 .test_ill
= test_ill_sr
,
5980 .par
= (const uint32_t[]){
5982 XTENSA_OPTION_DEBUG
,
5985 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5987 .name
= "xsr.intclear",
5988 .op_flags
= XTENSA_OP_ILL
,
5990 .name
= "xsr.intenable",
5991 .translate
= translate_xsr
,
5992 .test_ill
= test_ill_sr
,
5993 .par
= (const uint32_t[]){
5995 XTENSA_OPTION_INTERRUPT
,
5998 XTENSA_OP_PRIVILEGED
|
5999 XTENSA_OP_EXIT_TB_0
|
6000 XTENSA_OP_CHECK_INTERRUPTS
,
6002 .name
= "xsr.interrupt",
6003 .op_flags
= XTENSA_OP_ILL
,
6005 .name
= "xsr.intset",
6006 .op_flags
= XTENSA_OP_ILL
,
6008 .name
= "xsr.itlbcfg",
6009 .translate
= translate_xsr_mask
,
6010 .test_ill
= test_ill_sr
,
6011 .par
= (const uint32_t[]){
6016 .op_flags
= XTENSA_OP_PRIVILEGED
,
6019 .translate
= translate_xsr
,
6020 .test_ill
= test_ill_sr
,
6021 .par
= (const uint32_t[]){
6025 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6027 .name
= "xsr.lcount",
6028 .translate
= translate_xsr
,
6029 .test_ill
= test_ill_sr
,
6030 .par
= (const uint32_t[]){
6036 .translate
= translate_xsr
,
6037 .test_ill
= test_ill_sr
,
6038 .par
= (const uint32_t[]){
6042 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6044 .name
= "xsr.litbase",
6045 .translate
= translate_xsr_mask
,
6046 .test_ill
= test_ill_sr
,
6047 .par
= (const uint32_t[]){
6049 XTENSA_OPTION_EXTENDED_L32R
,
6052 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6055 .translate
= translate_xsr
,
6056 .test_ill
= test_ill_sr
,
6057 .par
= (const uint32_t[]){
6059 XTENSA_OPTION_MAC16
,
6063 .translate
= translate_xsr
,
6064 .test_ill
= test_ill_sr
,
6065 .par
= (const uint32_t[]){
6067 XTENSA_OPTION_MAC16
,
6071 .translate
= translate_xsr
,
6072 .test_ill
= test_ill_sr
,
6073 .par
= (const uint32_t[]){
6075 XTENSA_OPTION_MAC16
,
6079 .translate
= translate_xsr
,
6080 .test_ill
= test_ill_sr
,
6081 .par
= (const uint32_t[]){
6083 XTENSA_OPTION_MAC16
,
6086 .name
= "xsr.memctl",
6087 .translate
= translate_xsr_memctl
,
6088 .par
= (const uint32_t[]){MEMCTL
},
6089 .op_flags
= XTENSA_OP_PRIVILEGED
,
6092 .translate
= translate_xsr
,
6093 .test_ill
= test_ill_sr
,
6094 .par
= (const uint32_t[]){
6096 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6098 .op_flags
= XTENSA_OP_PRIVILEGED
,
6101 .translate
= translate_xsr
,
6102 .test_ill
= test_ill_sr
,
6103 .par
= (const uint32_t[]){
6105 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6107 .op_flags
= XTENSA_OP_PRIVILEGED
,
6110 .translate
= translate_xsr
,
6111 .test_ill
= test_ill_sr
,
6112 .par
= (const uint32_t[]){
6114 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6116 .op_flags
= XTENSA_OP_PRIVILEGED
,
6118 .name
= "xsr.mesave",
6119 .translate
= translate_xsr
,
6120 .test_ill
= test_ill_sr
,
6121 .par
= (const uint32_t[]){
6123 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6125 .op_flags
= XTENSA_OP_PRIVILEGED
,
6128 .translate
= translate_xsr
,
6129 .test_ill
= test_ill_sr
,
6130 .par
= (const uint32_t[]){
6132 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6134 .op_flags
= XTENSA_OP_PRIVILEGED
,
6136 .name
= "xsr.mevaddr",
6137 .translate
= translate_xsr
,
6138 .test_ill
= test_ill_sr
,
6139 .par
= (const uint32_t[]){
6141 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6143 .op_flags
= XTENSA_OP_PRIVILEGED
,
6145 .name
= "xsr.misc0",
6146 .translate
= translate_xsr
,
6147 .test_ill
= test_ill_sr
,
6148 .par
= (const uint32_t[]){
6150 XTENSA_OPTION_MISC_SR
,
6152 .op_flags
= XTENSA_OP_PRIVILEGED
,
6154 .name
= "xsr.misc1",
6155 .translate
= translate_xsr
,
6156 .test_ill
= test_ill_sr
,
6157 .par
= (const uint32_t[]){
6159 XTENSA_OPTION_MISC_SR
,
6161 .op_flags
= XTENSA_OP_PRIVILEGED
,
6163 .name
= "xsr.misc2",
6164 .translate
= translate_xsr
,
6165 .test_ill
= test_ill_sr
,
6166 .par
= (const uint32_t[]){
6168 XTENSA_OPTION_MISC_SR
,
6170 .op_flags
= XTENSA_OP_PRIVILEGED
,
6172 .name
= "xsr.misc3",
6173 .translate
= translate_xsr
,
6174 .test_ill
= test_ill_sr
,
6175 .par
= (const uint32_t[]){
6177 XTENSA_OPTION_MISC_SR
,
6179 .op_flags
= XTENSA_OP_PRIVILEGED
,
6181 .name
= "xsr.mpuenb",
6182 .translate
= translate_xsr_mpuenb
,
6183 .test_ill
= test_ill_sr
,
6184 .par
= (const uint32_t[]){
6188 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6190 .name
= "xsr.prefctl",
6191 .translate
= translate_xsr
,
6192 .par
= (const uint32_t[]){PREFCTL
},
6195 .op_flags
= XTENSA_OP_ILL
,
6198 .translate
= translate_xsr_ps
,
6199 .test_ill
= test_ill_sr
,
6200 .par
= (const uint32_t[]){
6202 XTENSA_OPTION_EXCEPTION
,
6205 XTENSA_OP_PRIVILEGED
|
6206 XTENSA_OP_EXIT_TB_M1
|
6207 XTENSA_OP_CHECK_INTERRUPTS
,
6209 .name
= "xsr.ptevaddr",
6210 .translate
= translate_xsr_mask
,
6211 .test_ill
= test_ill_sr
,
6212 .par
= (const uint32_t[]){
6217 .op_flags
= XTENSA_OP_PRIVILEGED
,
6219 .name
= "xsr.rasid",
6220 .translate
= translate_xsr_rasid
,
6221 .test_ill
= test_ill_sr
,
6222 .par
= (const uint32_t[]){
6226 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6229 .translate
= translate_xsr_sar
,
6230 .par
= (const uint32_t[]){SAR
},
6232 .name
= "xsr.scompare1",
6233 .translate
= translate_xsr
,
6234 .test_ill
= test_ill_sr
,
6235 .par
= (const uint32_t[]){
6237 XTENSA_OPTION_CONDITIONAL_STORE
,
6240 .name
= "xsr.vecbase",
6241 .translate
= translate_xsr
,
6242 .test_ill
= test_ill_sr
,
6243 .par
= (const uint32_t[]){
6245 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6247 .op_flags
= XTENSA_OP_PRIVILEGED
,
6249 .name
= "xsr.windowbase",
6250 .translate
= translate_xsr_windowbase
,
6251 .test_ill
= test_ill_sr
,
6252 .par
= (const uint32_t[]){
6254 XTENSA_OPTION_WINDOWED_REGISTER
,
6256 .op_flags
= XTENSA_OP_PRIVILEGED
|
6257 XTENSA_OP_EXIT_TB_M1
|
6258 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6260 .name
= "xsr.windowstart",
6261 .translate
= translate_xsr_windowstart
,
6262 .test_ill
= test_ill_sr
,
6263 .par
= (const uint32_t[]){
6265 XTENSA_OPTION_WINDOWED_REGISTER
,
6267 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6271 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6272 .num_opcodes
= ARRAY_SIZE(core_ops
),
6277 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6278 const uint32_t par
[])
6280 gen_helper_abs_s(arg
[0].out
, arg
[1].in
);
6283 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6284 const uint32_t par
[])
6286 gen_helper_add_s(arg
[0].out
, cpu_env
,
6287 arg
[1].in
, arg
[2].in
);
6300 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6301 const uint32_t par
[])
6303 static void (* const helper
[])(TCGv_env env
, TCGv_i32 bit
,
6304 TCGv_i32 s
, TCGv_i32 t
) = {
6305 [COMPARE_UN
] = gen_helper_un_s
,
6306 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6307 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6308 [COMPARE_OLT
] = gen_helper_olt_s
,
6309 [COMPARE_ULT
] = gen_helper_ult_s
,
6310 [COMPARE_OLE
] = gen_helper_ole_s
,
6311 [COMPARE_ULE
] = gen_helper_ule_s
,
6313 TCGv_i32 bit
= tcg_const_i32(1 << arg
[0].imm
);
6315 helper
[par
[0]](cpu_env
, bit
, arg
[1].in
, arg
[2].in
);
6319 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6320 const uint32_t par
[])
6322 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6325 gen_helper_uitof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6327 gen_helper_itof(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6329 tcg_temp_free(scale
);
6332 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6333 const uint32_t par
[])
6335 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6336 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6339 gen_helper_ftoui(arg
[0].out
, arg
[1].in
,
6340 rounding_mode
, scale
);
6342 gen_helper_ftoi(arg
[0].out
, arg
[1].in
,
6343 rounding_mode
, scale
);
6345 tcg_temp_free(rounding_mode
);
6346 tcg_temp_free(scale
);
6349 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6350 const uint32_t par
[])
6352 TCGv_i32 addr
= tcg_temp_new_i32();
6354 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6355 gen_load_store_alignment(dc
, 2, addr
, false);
6357 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6359 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6362 tcg_gen_mov_i32(arg
[1].out
, addr
);
6364 tcg_temp_free(addr
);
6367 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6368 const uint32_t par
[])
6370 TCGv_i32 addr
= tcg_temp_new_i32();
6372 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6373 gen_load_store_alignment(dc
, 2, addr
, false);
6375 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6377 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6380 tcg_gen_mov_i32(arg
[1].out
, addr
);
6382 tcg_temp_free(addr
);
6385 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6386 const uint32_t par
[])
6388 gen_helper_madd_s(arg
[0].out
, cpu_env
,
6389 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6392 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6393 const uint32_t par
[])
6395 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6398 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6399 const uint32_t par
[])
6401 TCGv_i32 zero
= tcg_const_i32(0);
6403 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6405 arg
[1].in
, arg
[0].in
);
6406 tcg_temp_free(zero
);
6409 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6410 const uint32_t par
[])
6412 TCGv_i32 zero
= tcg_const_i32(0);
6413 TCGv_i32 tmp
= tcg_temp_new_i32();
6415 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6416 tcg_gen_movcond_i32(par
[0],
6417 arg
[0].out
, tmp
, zero
,
6418 arg
[1].in
, arg
[0].in
);
6420 tcg_temp_free(zero
);
6423 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6424 const uint32_t par
[])
6426 gen_helper_mul_s(arg
[0].out
, cpu_env
,
6427 arg
[1].in
, arg
[2].in
);
6430 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6431 const uint32_t par
[])
6433 gen_helper_msub_s(arg
[0].out
, cpu_env
,
6434 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6437 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6438 const uint32_t par
[])
6440 gen_helper_neg_s(arg
[0].out
, arg
[1].in
);
6443 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6444 const uint32_t par
[])
6446 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6449 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6450 const uint32_t par
[])
6452 gen_helper_sub_s(arg
[0].out
, cpu_env
,
6453 arg
[1].in
, arg
[2].in
);
6456 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6457 const uint32_t par
[])
6459 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6462 static const XtensaOpcodeOps fpu2000_ops
[] = {
6465 .translate
= translate_abs_s
,
6469 .translate
= translate_add_s
,
6473 .translate
= translate_ftoi_s
,
6474 .par
= (const uint32_t[]){float_round_up
, false},
6478 .translate
= translate_float_s
,
6479 .par
= (const uint32_t[]){false},
6483 .translate
= translate_ftoi_s
,
6484 .par
= (const uint32_t[]){float_round_down
, false},
6488 .translate
= translate_ldsti
,
6489 .par
= (const uint32_t[]){false, false},
6490 .op_flags
= XTENSA_OP_LOAD
,
6494 .translate
= translate_ldsti
,
6495 .par
= (const uint32_t[]){false, true},
6496 .op_flags
= XTENSA_OP_LOAD
,
6500 .translate
= translate_ldstx
,
6501 .par
= (const uint32_t[]){false, false},
6502 .op_flags
= XTENSA_OP_LOAD
,
6506 .translate
= translate_ldstx
,
6507 .par
= (const uint32_t[]){false, true},
6508 .op_flags
= XTENSA_OP_LOAD
,
6512 .translate
= translate_madd_s
,
6516 .translate
= translate_mov_s
,
6520 .translate
= translate_movcond_s
,
6521 .par
= (const uint32_t[]){TCG_COND_EQ
},
6525 .translate
= translate_movp_s
,
6526 .par
= (const uint32_t[]){TCG_COND_EQ
},
6530 .translate
= translate_movcond_s
,
6531 .par
= (const uint32_t[]){TCG_COND_GE
},
6535 .translate
= translate_movcond_s
,
6536 .par
= (const uint32_t[]){TCG_COND_LT
},
6540 .translate
= translate_movcond_s
,
6541 .par
= (const uint32_t[]){TCG_COND_NE
},
6545 .translate
= translate_movp_s
,
6546 .par
= (const uint32_t[]){TCG_COND_NE
},
6550 .translate
= translate_msub_s
,
6554 .translate
= translate_mul_s
,
6558 .translate
= translate_neg_s
,
6562 .translate
= translate_compare_s
,
6563 .par
= (const uint32_t[]){COMPARE_OEQ
},
6567 .translate
= translate_compare_s
,
6568 .par
= (const uint32_t[]){COMPARE_OLE
},
6572 .translate
= translate_compare_s
,
6573 .par
= (const uint32_t[]){COMPARE_OLT
},
6577 .translate
= translate_rfr_s
,
6581 .translate
= translate_ftoi_s
,
6582 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6586 .translate
= translate_ldsti
,
6587 .par
= (const uint32_t[]){true, false},
6588 .op_flags
= XTENSA_OP_STORE
,
6592 .translate
= translate_ldsti
,
6593 .par
= (const uint32_t[]){true, true},
6594 .op_flags
= XTENSA_OP_STORE
,
6598 .translate
= translate_ldstx
,
6599 .par
= (const uint32_t[]){true, false},
6600 .op_flags
= XTENSA_OP_STORE
,
6604 .translate
= translate_ldstx
,
6605 .par
= (const uint32_t[]){true, true},
6606 .op_flags
= XTENSA_OP_STORE
,
6610 .translate
= translate_sub_s
,
6614 .translate
= translate_ftoi_s
,
6615 .par
= (const uint32_t[]){float_round_to_zero
, false},
6619 .translate
= translate_compare_s
,
6620 .par
= (const uint32_t[]){COMPARE_UEQ
},
6624 .translate
= translate_float_s
,
6625 .par
= (const uint32_t[]){true},
6629 .translate
= translate_compare_s
,
6630 .par
= (const uint32_t[]){COMPARE_ULE
},
6634 .translate
= translate_compare_s
,
6635 .par
= (const uint32_t[]){COMPARE_ULT
},
6639 .translate
= translate_compare_s
,
6640 .par
= (const uint32_t[]){COMPARE_UN
},
6644 .translate
= translate_ftoi_s
,
6645 .par
= (const uint32_t[]){float_round_to_zero
, true},
6649 .translate
= translate_wfr_s
,
6654 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6655 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6656 .opcode
= fpu2000_ops
,