3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm
5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Open Source and Linux Lab nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "qemu/osdep.h"
34 #include "exec/exec-all.h"
35 #include "disas/disas.h"
36 #include "tcg/tcg-op.h"
38 #include "qemu/qemu-print.h"
39 #include "exec/cpu_ldst.h"
40 #include "semihosting/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
50 DisasContextBase base
;
51 const XtensaConfig
*config
;
73 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
74 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
77 static TCGv_i32 cpu_pc
;
78 static TCGv_i32 cpu_R
[16];
79 static TCGv_i32 cpu_FR
[16];
80 static TCGv_i64 cpu_FRD
[16];
81 static TCGv_i32 cpu_MR
[4];
82 static TCGv_i32 cpu_BR
[16];
83 static TCGv_i32 cpu_BR4
[4];
84 static TCGv_i32 cpu_BR8
[2];
85 static TCGv_i32 cpu_SR
[256];
86 static TCGv_i32 cpu_UR
[256];
87 static TCGv_i32 cpu_windowbase_next
;
88 static TCGv_i32 cpu_exclusive_addr
;
89 static TCGv_i32 cpu_exclusive_val
;
91 static GHashTable
*xtensa_regfile_table
;
93 #include "exec/gen-icount.h"
95 static char *sr_name
[256];
96 static char *ur_name
[256];
98 void xtensa_collect_sr_names(const XtensaConfig
*config
)
100 xtensa_isa isa
= config
->isa
;
101 int n
= xtensa_isa_num_sysregs(isa
);
104 for (i
= 0; i
< n
; ++i
) {
105 int sr
= xtensa_sysreg_number(isa
, i
);
107 if (sr
>= 0 && sr
< 256) {
108 const char *name
= xtensa_sysreg_name(isa
, i
);
110 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
113 if (strstr(*pname
, name
) == NULL
) {
115 malloc(strlen(*pname
) + strlen(name
) + 2);
117 strcpy(new_name
, *pname
);
118 strcat(new_name
, "/");
119 strcat(new_name
, name
);
124 *pname
= strdup(name
);
130 void xtensa_translate_init(void)
132 static const char * const regnames
[] = {
133 "ar0", "ar1", "ar2", "ar3",
134 "ar4", "ar5", "ar6", "ar7",
135 "ar8", "ar9", "ar10", "ar11",
136 "ar12", "ar13", "ar14", "ar15",
138 static const char * const fregnames
[] = {
139 "f0", "f1", "f2", "f3",
140 "f4", "f5", "f6", "f7",
141 "f8", "f9", "f10", "f11",
142 "f12", "f13", "f14", "f15",
144 static const char * const mregnames
[] = {
145 "m0", "m1", "m2", "m3",
147 static const char * const bregnames
[] = {
148 "b0", "b1", "b2", "b3",
149 "b4", "b5", "b6", "b7",
150 "b8", "b9", "b10", "b11",
151 "b12", "b13", "b14", "b15",
155 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
156 offsetof(CPUXtensaState
, pc
), "pc");
158 for (i
= 0; i
< 16; i
++) {
159 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
160 offsetof(CPUXtensaState
, regs
[i
]),
164 for (i
= 0; i
< 16; i
++) {
165 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
166 offsetof(CPUXtensaState
,
167 fregs
[i
].f32
[FP_F32_LOW
]),
171 for (i
= 0; i
< 16; i
++) {
172 cpu_FRD
[i
] = tcg_global_mem_new_i64(cpu_env
,
173 offsetof(CPUXtensaState
,
178 for (i
= 0; i
< 4; i
++) {
179 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
180 offsetof(CPUXtensaState
,
185 for (i
= 0; i
< 16; i
++) {
186 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
187 offsetof(CPUXtensaState
,
191 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
192 offsetof(CPUXtensaState
,
197 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
198 offsetof(CPUXtensaState
,
204 for (i
= 0; i
< 256; ++i
) {
206 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
207 offsetof(CPUXtensaState
,
213 for (i
= 0; i
< 256; ++i
) {
215 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
216 offsetof(CPUXtensaState
,
222 cpu_windowbase_next
=
223 tcg_global_mem_new_i32(cpu_env
,
224 offsetof(CPUXtensaState
, windowbase_next
),
227 tcg_global_mem_new_i32(cpu_env
,
228 offsetof(CPUXtensaState
, exclusive_addr
),
231 tcg_global_mem_new_i32(cpu_env
,
232 offsetof(CPUXtensaState
, exclusive_val
),
236 void **xtensa_get_regfile_by_name(const char *name
, int entries
, int bits
)
241 if (xtensa_regfile_table
== NULL
) {
242 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
244 * AR is special. Xtensa translator uses it as a current register
245 * window, but configuration overlays represent it as a complete
246 * physical register file.
248 g_hash_table_insert(xtensa_regfile_table
,
249 (void *)"AR 16x32", (void *)cpu_R
);
250 g_hash_table_insert(xtensa_regfile_table
,
251 (void *)"AR 32x32", (void *)cpu_R
);
252 g_hash_table_insert(xtensa_regfile_table
,
253 (void *)"AR 64x32", (void *)cpu_R
);
255 g_hash_table_insert(xtensa_regfile_table
,
256 (void *)"MR 4x32", (void *)cpu_MR
);
258 g_hash_table_insert(xtensa_regfile_table
,
259 (void *)"FR 16x32", (void *)cpu_FR
);
260 g_hash_table_insert(xtensa_regfile_table
,
261 (void *)"FR 16x64", (void *)cpu_FRD
);
263 g_hash_table_insert(xtensa_regfile_table
,
264 (void *)"BR 16x1", (void *)cpu_BR
);
265 g_hash_table_insert(xtensa_regfile_table
,
266 (void *)"BR4 4x4", (void *)cpu_BR4
);
267 g_hash_table_insert(xtensa_regfile_table
,
268 (void *)"BR8 2x8", (void *)cpu_BR8
);
271 geometry_name
= g_strdup_printf("%s %dx%d", name
, entries
, bits
);
272 res
= (void **)g_hash_table_lookup(xtensa_regfile_table
, geometry_name
);
273 g_free(geometry_name
);
277 static inline bool option_enabled(DisasContext
*dc
, int opt
)
279 return xtensa_option_enabled(dc
->config
, opt
);
282 static void init_sar_tracker(DisasContext
*dc
)
284 dc
->sar_5bit
= false;
285 dc
->sar_m32_5bit
= false;
289 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
291 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
292 if (dc
->sar_m32_5bit
) {
293 tcg_gen_discard_i32(dc
->sar_m32
);
296 dc
->sar_m32_5bit
= false;
299 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
302 dc
->sar_m32
= tcg_temp_new_i32();
304 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
305 tcg_gen_sub_i32(cpu_SR
[SAR
], tcg_constant_i32(32), dc
->sar_m32
);
306 dc
->sar_5bit
= false;
307 dc
->sar_m32_5bit
= true;
310 static void gen_exception(DisasContext
*dc
, int excp
)
312 gen_helper_exception(cpu_env
, tcg_constant_i32(excp
));
315 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
317 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
318 gen_helper_exception_cause(cpu_env
, pc
, tcg_constant_i32(cause
));
319 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
320 cause
== SYSCALL_CAUSE
) {
321 dc
->base
.is_jmp
= DISAS_NORETURN
;
325 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
327 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
328 gen_helper_debug_exception(cpu_env
, pc
, tcg_constant_i32(cause
));
329 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
330 dc
->base
.is_jmp
= DISAS_NORETURN
;
334 static bool gen_check_privilege(DisasContext
*dc
)
336 #ifndef CONFIG_USER_ONLY
341 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
342 dc
->base
.is_jmp
= DISAS_NORETURN
;
346 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
348 cp_mask
&= ~dc
->cpenable
;
350 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
351 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
352 dc
->base
.is_jmp
= DISAS_NORETURN
;
358 static int gen_postprocess(DisasContext
*dc
, int slot
);
360 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
362 tcg_gen_mov_i32(cpu_pc
, dest
);
364 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
366 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
367 slot
= gen_postprocess(dc
, slot
);
370 tcg_gen_goto_tb(slot
);
371 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
373 tcg_gen_exit_tb(NULL
, 0);
375 dc
->base
.is_jmp
= DISAS_NORETURN
;
378 static void gen_jump(DisasContext
*dc
, TCGv dest
)
380 gen_jump_slot(dc
, dest
, -1);
383 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
385 return translator_use_goto_tb(&dc
->base
, dest
) ? slot
: -1;
388 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
390 gen_jump_slot(dc
, tcg_constant_i32(dest
),
391 adjust_jump_slot(dc
, dest
, slot
));
394 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
397 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
398 tcg_constant_i32(callinc
), PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
399 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
400 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
401 gen_jump_slot(dc
, dest
, slot
);
404 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
406 if (dc
->base
.pc_next
== dc
->lend
) {
407 TCGLabel
*label
= gen_new_label();
409 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
410 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
412 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
414 gen_jump(dc
, cpu_SR
[LBEG
]);
416 gen_set_label(label
);
417 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
423 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
425 if (!gen_check_loop_end(dc
, slot
)) {
426 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
430 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
431 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
433 TCGLabel
*label
= gen_new_label();
435 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
436 gen_jumpi_check_loop_end(dc
, 0);
437 gen_set_label(label
);
438 gen_jumpi(dc
, addr
, 1);
441 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
442 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
444 gen_brcond(dc
, cond
, t0
, tcg_constant_i32(t1
), addr
);
447 static uint32_t test_exceptions_sr(DisasContext
*dc
, const OpcodeArg arg
[],
448 const uint32_t par
[])
450 return xtensa_option_enabled(dc
->config
, par
[1]) ? 0 : XTENSA_OP_ILL
;
453 static uint32_t test_exceptions_ccompare(DisasContext
*dc
,
454 const OpcodeArg arg
[],
455 const uint32_t par
[])
457 unsigned n
= par
[0] - CCOMPARE
;
459 if (n
>= dc
->config
->nccompare
) {
460 return XTENSA_OP_ILL
;
462 return test_exceptions_sr(dc
, arg
, par
);
465 static uint32_t test_exceptions_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
466 const uint32_t par
[])
468 unsigned n
= MAX_NDBREAK
;
470 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
471 n
= par
[0] - DBREAKA
;
473 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
474 n
= par
[0] - DBREAKC
;
476 if (n
>= dc
->config
->ndbreak
) {
477 return XTENSA_OP_ILL
;
479 return test_exceptions_sr(dc
, arg
, par
);
482 static uint32_t test_exceptions_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
483 const uint32_t par
[])
485 unsigned n
= par
[0] - IBREAKA
;
487 if (n
>= dc
->config
->nibreak
) {
488 return XTENSA_OP_ILL
;
490 return test_exceptions_sr(dc
, arg
, par
);
493 static uint32_t test_exceptions_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
494 const uint32_t par
[])
496 unsigned n
= MAX_NLEVEL
+ 1;
498 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
499 n
= par
[0] - EXCSAVE1
+ 1;
501 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
502 n
= par
[0] - EPC1
+ 1;
504 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
505 n
= par
[0] - EPS2
+ 2;
507 if (n
> dc
->config
->nlevel
) {
508 return XTENSA_OP_ILL
;
510 return test_exceptions_sr(dc
, arg
, par
);
513 static MemOp
gen_load_store_alignment(DisasContext
*dc
, MemOp mop
,
516 if ((mop
& MO_SIZE
) == MO_8
) {
519 if ((mop
& MO_AMASK
) == MO_UNALN
&&
520 !option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
)) {
523 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
524 tcg_gen_andi_i32(addr
, addr
, ~0 << get_alignment_bits(mop
));
529 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
531 unsigned r
= 31 - clz32(mask
);
533 if (r
/ 4 > dc
->window
) {
534 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
535 TCGv_i32 w
= tcg_constant_i32(r
/ 4);
537 gen_helper_window_check(cpu_env
, pc
, w
);
538 dc
->base
.is_jmp
= DISAS_NORETURN
;
544 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
546 TCGv_i32 m
= tcg_temp_new_i32();
549 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
551 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
556 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
558 TCGLabel
*label
= gen_new_label();
560 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
561 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
562 gen_set_label(label
);
565 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
567 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
570 static int gen_postprocess(DisasContext
*dc
, int slot
)
572 uint32_t op_flags
= dc
->op_flags
;
574 #ifndef CONFIG_USER_ONLY
575 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
576 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
579 gen_helper_check_interrupts(cpu_env
);
582 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
583 gen_helper_sync_windowbase(cpu_env
);
585 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
591 struct opcode_arg_copy
{
597 struct opcode_arg_info
{
603 XtensaOpcodeOps
*ops
;
604 OpcodeArg arg
[MAX_OPCODE_ARGS
];
605 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
606 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
618 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
620 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
621 return (r
<< 24) | (g
<< 16) | n
;
624 static enum resource_type
get_resource_type(uint32_t resource
)
626 return resource
>> 24;
630 * a depends on b if b must be executed before a,
631 * because a's side effects will destroy b's inputs.
633 static bool op_depends_on(const struct slot_prop
*a
,
634 const struct slot_prop
*b
)
639 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
642 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
643 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
646 while (i
< a
->n_out
&& j
< b
->n_in
) {
647 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
649 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
659 * Try to break a dependency on b, append temporary register copy records
660 * to the end of copy and update n_copy in case of success.
661 * This is not always possible: e.g. control flow must always be the last,
662 * load/store must be first and state dependencies are not supported yet.
664 static bool break_dependency(struct slot_prop
*a
,
666 struct opcode_arg_copy
*copy
,
671 unsigned n
= *n_copy
;
674 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
677 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
678 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
681 while (i
< a
->n_out
&& j
< b
->n_in
) {
682 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
684 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
687 int index
= b
->in
[j
].index
;
689 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
693 copy
[n
].resource
= b
->in
[j
].resource
;
694 copy
[n
].arg
= b
->arg
+ index
;
705 * Calculate evaluation order for slot opcodes.
706 * Build opcode order graph and output its nodes in topological sort order.
707 * An edge a -> b in the graph means that opcode a must be followed by
710 static bool tsort(struct slot_prop
*slot
,
711 struct slot_prop
*sorted
[],
713 struct opcode_arg_copy
*copy
,
719 unsigned out_edge
[MAX_INSN_SLOTS
];
720 } node
[MAX_INSN_SLOTS
];
722 unsigned in
[MAX_INSN_SLOTS
];
728 unsigned node_idx
= 0;
730 for (i
= 0; i
< n
; ++i
) {
731 node
[i
].n_in_edge
= 0;
732 node
[i
].n_out_edge
= 0;
735 for (i
= 0; i
< n
; ++i
) {
736 unsigned n_out_edge
= 0;
738 for (j
= 0; j
< n
; ++j
) {
739 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
740 node
[i
].out_edge
[n_out_edge
] = j
;
746 node
[i
].n_out_edge
= n_out_edge
;
749 for (i
= 0; i
< n
; ++i
) {
750 if (!node
[i
].n_in_edge
) {
757 for (; in_idx
< n_in
; ++in_idx
) {
759 sorted
[n_out
] = slot
+ i
;
761 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
763 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
764 in
[n_in
] = node
[i
].out_edge
[j
];
770 for (; node_idx
< n
; ++node_idx
) {
771 struct tsnode
*cnode
= node
+ node_idx
;
773 if (cnode
->n_in_edge
) {
774 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
775 unsigned k
= cnode
->out_edge
[j
];
777 if (break_dependency(slot
+ k
, slot
+ node_idx
,
779 --node
[k
].n_in_edge
== 0) {
784 cnode
->out_edge
[cnode
->n_out_edge
- 1];
795 static void opcode_add_resource(struct slot_prop
*op
,
796 uint32_t resource
, char direction
,
802 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
803 op
->in
[op
->n_in
].resource
= resource
;
804 op
->in
[op
->n_in
].index
= index
;
808 if (direction
== 'm' || direction
== 'o') {
809 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
810 op
->out
[op
->n_out
].resource
= resource
;
811 op
->out
[op
->n_out
].index
= index
;
816 g_assert_not_reached();
820 static int resource_compare(const void *a
, const void *b
)
822 const struct opcode_arg_info
*pa
= a
;
823 const struct opcode_arg_info
*pb
= b
;
825 return pa
->resource
< pb
->resource
?
826 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
829 static int arg_copy_compare(const void *a
, const void *b
)
831 const struct opcode_arg_copy
*pa
= a
;
832 const struct opcode_arg_copy
*pb
= b
;
834 return pa
->resource
< pb
->resource
?
835 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
838 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
840 xtensa_isa isa
= dc
->config
->isa
;
841 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, &dc
->base
,
843 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
847 uint32_t op_flags
= 0;
848 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
849 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
850 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
851 unsigned n_arg_copy
= 0;
852 uint32_t debug_cause
= 0;
853 uint32_t windowed_register
= 0;
854 uint32_t coprocessor
= 0;
856 if (len
== XTENSA_UNDEFINED
) {
857 qemu_log_mask(LOG_GUEST_ERROR
,
858 "unknown instruction length (pc = %08x)\n",
860 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
861 dc
->base
.pc_next
= dc
->pc
+ 1;
865 dc
->base
.pc_next
= dc
->pc
+ len
;
866 for (i
= 1; i
< len
; ++i
) {
867 b
[i
] = translator_ldub(env
, &dc
->base
, dc
->pc
+ i
);
869 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
870 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
871 if (fmt
== XTENSA_UNDEFINED
) {
872 qemu_log_mask(LOG_GUEST_ERROR
,
873 "unrecognized instruction format (pc = %08x)\n",
875 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
878 slots
= xtensa_format_num_slots(isa
, fmt
);
879 for (slot
= 0; slot
< slots
; ++slot
) {
881 int opnd
, vopnd
, opnds
;
882 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
883 XtensaOpcodeOps
*ops
;
885 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
886 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
887 if (opc
== XTENSA_UNDEFINED
) {
888 qemu_log_mask(LOG_GUEST_ERROR
,
889 "unrecognized opcode in slot %d (pc = %08x)\n",
891 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
894 opnds
= xtensa_opcode_num_operands(isa
, opc
);
896 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
897 void **register_file
= NULL
;
900 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
901 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
902 register_file
= dc
->config
->regfile
[rf
];
904 if (rf
== dc
->config
->a_regfile
) {
907 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
909 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
910 windowed_register
|= 1u << v
;
913 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
916 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
918 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
919 arg
[vopnd
].raw_imm
= v
;
920 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
921 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
925 arg
[vopnd
].in
= register_file
[v
];
926 arg
[vopnd
].out
= register_file
[v
];
927 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
929 arg
[vopnd
].num_bits
= 32;
934 ops
= dc
->config
->opcode_ops
[opc
];
935 slot_prop
[slot
].ops
= ops
;
938 op_flags
|= ops
->op_flags
;
939 if (ops
->test_exceptions
) {
940 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
943 qemu_log_mask(LOG_UNIMP
,
944 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
945 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
946 op_flags
|= XTENSA_OP_ILL
;
948 if (op_flags
& XTENSA_OP_ILL
) {
949 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
952 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
953 debug_cause
|= ops
->par
[0];
955 if (ops
->test_overflow
) {
956 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
958 coprocessor
|= ops
->coprocessor
;
961 slot_prop
[slot
].n_in
= 0;
962 slot_prop
[slot
].n_out
= 0;
963 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
965 opnds
= xtensa_opcode_num_operands(isa
, opc
);
967 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
968 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
970 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
971 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
974 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
976 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
977 opcode_add_resource(slot_prop
+ slot
,
978 encode_resource(RES_REGFILE
, rf
, v
),
979 xtensa_operand_inout(isa
, opc
, opnd
),
980 visible
? vopnd
: -1);
987 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
989 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
990 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
992 opcode_add_resource(slot_prop
+ slot
,
993 encode_resource(RES_STATE
, 0, state
),
994 xtensa_stateOperand_inout(isa
, opc
, opnd
),
997 if (xtensa_opcode_is_branch(isa
, opc
) ||
998 xtensa_opcode_is_jump(isa
, opc
) ||
999 xtensa_opcode_is_loop(isa
, opc
) ||
1000 xtensa_opcode_is_call(isa
, opc
)) {
1001 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1004 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1005 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1006 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1007 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1012 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1013 qemu_log_mask(LOG_UNIMP
,
1014 "Circular resource dependencies (pc = %08x)\n",
1016 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1020 ordered
[0] = slot_prop
+ 0;
1023 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1024 !gen_check_privilege(dc
)) {
1028 if (op_flags
& XTENSA_OP_SYSCALL
) {
1029 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1033 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1034 gen_debug_exception(dc
, debug_cause
);
1038 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1042 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1043 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1045 gen_helper_test_underflow_retw(cpu_env
, pc
);
1048 if (op_flags
& XTENSA_OP_ALLOCA
) {
1049 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1051 gen_helper_movsp(cpu_env
, pc
);
1054 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1063 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1064 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1065 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1066 resource
= arg_copy
[i
].resource
;
1067 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1068 temp
= tcg_temp_new_i32();
1069 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1070 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1071 temp
= tcg_temp_new_i64();
1072 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1074 g_assert_not_reached();
1076 arg_copy
[i
].temp
= temp
;
1079 arg_copy
[j
] = arg_copy
[i
];
1083 arg_copy
[i
].arg
->in
= temp
;
1088 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1089 for (slot
= 0; slot
< slots
; ++slot
) {
1090 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1091 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1096 dc
->op_flags
= op_flags
;
1098 for (slot
= 0; slot
< slots
; ++slot
) {
1099 struct slot_prop
*pslot
= ordered
[slot
];
1100 XtensaOpcodeOps
*ops
= pslot
->ops
;
1102 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1105 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1106 gen_postprocess(dc
, 0);
1108 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1109 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1110 gen_jumpi_check_loop_end(dc
, -1);
1111 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1112 gen_jumpi_check_loop_end(dc
, 0);
1114 gen_check_loop_end(dc
, 0);
1117 dc
->pc
= dc
->base
.pc_next
;
1120 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1122 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1123 return xtensa_op0_insn_len(dc
, b0
);
1126 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1130 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1131 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1132 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1133 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1139 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1142 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1143 CPUXtensaState
*env
= cpu
->env_ptr
;
1144 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1146 dc
->config
= env
->config
;
1147 dc
->pc
= dc
->base
.pc_first
;
1148 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1149 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1150 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1151 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1152 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1153 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1154 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1155 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1156 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1157 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1158 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1159 XTENSA_TBFLAG_WINDOW_SHIFT
);
1160 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1161 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1162 XTENSA_TBFLAG_CALLINC_SHIFT
);
1163 init_sar_tracker(dc
);
1166 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1168 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1171 dc
->next_icount
= tcg_temp_new_i32();
1175 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1177 tcg_gen_insn_start(dcbase
->pc_next
);
1180 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1182 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1183 CPUXtensaState
*env
= cpu
->env_ptr
;
1184 target_ulong page_start
;
1186 /* These two conditions only apply to the first insn in the TB,
1187 but this is the first TranslateOps hook that allows exiting. */
1188 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1189 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1190 gen_exception(dc
, EXCP_YIELD
);
1191 dc
->base
.pc_next
= dc
->pc
+ 1;
1192 dc
->base
.is_jmp
= DISAS_NORETURN
;
1197 TCGLabel
*label
= gen_new_label();
1199 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1200 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1201 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1203 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1205 gen_set_label(label
);
1209 gen_ibreak_check(env
, dc
);
1212 disas_xtensa_insn(env
, dc
);
1215 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1218 /* End the TB if the next insn will cross into the next page. */
1219 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1220 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1221 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1222 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1223 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1227 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1229 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1231 switch (dc
->base
.is_jmp
) {
1232 case DISAS_NORETURN
:
1234 case DISAS_TOO_MANY
:
1235 gen_jumpi(dc
, dc
->pc
, 0);
1238 g_assert_not_reached();
1242 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
,
1243 CPUState
*cpu
, FILE *logfile
)
1245 fprintf(logfile
, "IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1246 target_disas(logfile
, cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1249 static const TranslatorOps xtensa_translator_ops
= {
1250 .init_disas_context
= xtensa_tr_init_disas_context
,
1251 .tb_start
= xtensa_tr_tb_start
,
1252 .insn_start
= xtensa_tr_insn_start
,
1253 .translate_insn
= xtensa_tr_translate_insn
,
1254 .tb_stop
= xtensa_tr_tb_stop
,
1255 .disas_log
= xtensa_tr_disas_log
,
1258 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int *max_insns
,
1259 target_ulong pc
, void *host_pc
)
1261 DisasContext dc
= {};
1262 translator_loop(cpu
, tb
, max_insns
, pc
, host_pc
,
1263 &xtensa_translator_ops
, &dc
.base
);
1266 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1268 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1269 CPUXtensaState
*env
= &cpu
->env
;
1270 xtensa_isa isa
= env
->config
->isa
;
1273 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1275 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1276 const uint32_t *reg
=
1277 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1278 int regno
= xtensa_sysreg_number(isa
, i
);
1281 qemu_fprintf(f
, "%12s=%08x%c",
1282 xtensa_sysreg_name(isa
, i
),
1284 (j
++ % 4) == 3 ? '\n' : ' ');
1288 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1290 for (i
= 0; i
< 16; ++i
) {
1291 qemu_fprintf(f
, " A%02d=%08x%c",
1292 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1295 xtensa_sync_phys_from_window(env
);
1296 qemu_fprintf(f
, "\n");
1298 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1299 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1301 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1302 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1304 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1308 if ((flags
& CPU_DUMP_FPU
) &&
1309 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1310 qemu_fprintf(f
, "\n");
1312 for (i
= 0; i
< 16; ++i
) {
1313 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1314 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1315 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1316 (i
% 2) == 1 ? '\n' : ' ');
1320 if ((flags
& CPU_DUMP_FPU
) &&
1321 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1322 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1323 qemu_fprintf(f
, "\n");
1325 for (i
= 0; i
< 16; ++i
) {
1326 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1327 float64_val(env
->fregs
[i
].f64
),
1328 *(double *)(&env
->fregs
[i
].f64
),
1329 (i
% 2) == 1 ? '\n' : ' ');
1334 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1335 const uint32_t par
[])
1337 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1340 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1341 const uint32_t par
[])
1343 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1346 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1347 const uint32_t par
[])
1349 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1352 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1353 const uint32_t par
[])
1355 TCGv_i32 tmp
= tcg_temp_new_i32();
1356 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1357 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1360 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1361 const uint32_t par
[])
1363 uint32_t shift
= par
[1];
1364 TCGv_i32 mask
= tcg_constant_i32(((1 << shift
) - 1) << arg
[1].imm
);
1365 TCGv_i32 tmp
= tcg_temp_new_i32();
1367 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1369 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1371 tcg_gen_add_i32(tmp
, tmp
, mask
);
1373 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1374 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1375 tmp
, arg
[0].imm
, 1);
1378 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1379 const uint32_t par
[])
1381 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1384 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1385 const uint32_t par
[])
1387 TCGv_i32 tmp
= tcg_temp_new_i32();
1388 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1389 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1392 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1393 const uint32_t par
[])
1395 TCGv_i32 tmp
= tcg_temp_new_i32();
1396 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1397 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1400 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1401 const uint32_t par
[])
1403 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1406 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1407 const uint32_t par
[])
1409 TCGv_i32 tmp
= tcg_temp_new_i32();
1411 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1412 if (TARGET_BIG_ENDIAN
) {
1413 tcg_gen_shr_i32(tmp
, tcg_constant_i32(0x80000000u
), tmp
);
1415 tcg_gen_shl_i32(tmp
, tcg_constant_i32(0x00000001u
), tmp
);
1417 tcg_gen_and_i32(tmp
, arg
[0].in
, tmp
);
1418 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1421 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1422 const uint32_t par
[])
1424 TCGv_i32 tmp
= tcg_temp_new_i32();
1425 #if TARGET_BIG_ENDIAN
1426 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1428 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1430 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1433 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1434 const uint32_t par
[])
1436 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1439 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1440 const uint32_t par
[])
1442 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1453 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1454 const uint32_t par
[])
1456 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1457 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1458 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1459 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1460 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1461 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1464 TCGv_i32 tmp1
= tcg_temp_new_i32();
1465 TCGv_i32 tmp2
= tcg_temp_new_i32();
1467 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1468 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1469 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1470 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1473 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1474 const uint32_t par
[])
1476 TCGv_i32 tmp
= tcg_temp_new_i32();
1478 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1479 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1482 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1483 const uint32_t par
[])
1485 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1486 gen_jumpi(dc
, arg
[0].imm
, 0);
1489 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1490 const uint32_t par
[])
1492 TCGv_i32 tmp
= tcg_constant_i32(arg
[0].imm
);
1493 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1496 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1497 const uint32_t par
[])
1499 TCGv_i32 tmp
= tcg_temp_new_i32();
1500 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1501 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1505 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1506 const uint32_t par
[])
1508 TCGv_i32 tmp
= tcg_temp_new_i32();
1510 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1511 gen_callw_slot(dc
, par
[0], tmp
, -1);
1514 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1515 const uint32_t par
[])
1517 TCGv_i32 tmp1
= tcg_constant_i32(-1u << arg
[2].imm
);
1518 TCGv_i32 tmp2
= tcg_constant_i32((1 << arg
[2].imm
) - 1);
1520 tcg_gen_smax_i32(arg
[0].out
, tmp1
, arg
[1].in
);
1521 tcg_gen_smin_i32(arg
[0].out
, arg
[0].out
, tmp2
);
1524 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1525 const uint32_t par
[])
1527 /* TODO: GPIO32 may be a part of coprocessor */
1528 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1531 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1532 const uint32_t par
[])
1534 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1537 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1538 const uint32_t par
[])
1540 TCGv_i32 c
= tcg_constant_i32(arg
[1].imm
);
1542 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1545 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1546 const uint32_t par
[])
1548 TCGv_i32 addr
= tcg_temp_new_i32();
1549 TCGv_i32 res
= tcg_temp_new_i32();
1551 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1552 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1555 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1556 const uint32_t par
[])
1558 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1559 arg
[2].imm
, arg
[3].imm
);
1562 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1563 const uint32_t par
[])
1565 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1568 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1569 const uint32_t par
[])
1571 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1572 qemu_log_mask(LOG_GUEST_ERROR
,
1573 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1574 return XTENSA_OP_ILL
;
1580 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1581 const uint32_t par
[])
1583 return 1 << (dc
->callinc
* 4);
1586 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1587 const uint32_t par
[])
1589 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1590 TCGv_i32 s
= tcg_constant_i32(arg
[0].imm
);
1591 TCGv_i32 imm
= tcg_constant_i32(arg
[1].imm
);
1592 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1595 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1596 const uint32_t par
[])
1598 int maskimm
= (1 << arg
[3].imm
) - 1;
1600 TCGv_i32 tmp
= tcg_temp_new_i32();
1601 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1602 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1605 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1606 const uint32_t par
[])
1608 TCGv_i32 tmp
= tcg_temp_new_i32();
1610 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1611 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1612 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1615 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1616 const uint32_t par
[])
1618 #ifndef CONFIG_USER_ONLY
1619 TCGv_i32 addr
= tcg_temp_new_i32();
1621 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1622 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1623 gen_helper_itlb_hit_test(cpu_env
, addr
);
1627 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1628 const uint32_t par
[])
1630 #ifndef CONFIG_USER_ONLY
1631 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1633 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1637 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1638 const uint32_t par
[])
1640 gen_jumpi(dc
, arg
[0].imm
, 0);
1643 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1644 const uint32_t par
[])
1646 gen_jump(dc
, arg
[0].in
);
1649 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1650 const uint32_t par
[])
1652 TCGv_i32 addr
= tcg_temp_new_i32();
1655 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1656 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
1657 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, mop
);
1660 #ifdef CONFIG_USER_ONLY
1661 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1665 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1667 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1668 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1670 gen_helper_check_exclusive(cpu_env
, pc
, addr
,
1671 tcg_constant_i32(is_write
));
1676 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1677 const uint32_t par
[])
1679 TCGv_i32 addr
= tcg_temp_new_i32();
1682 tcg_gen_mov_i32(addr
, arg
[1].in
);
1683 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
1684 gen_check_exclusive(dc
, addr
, false);
1685 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->cring
, mop
);
1686 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1687 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1690 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1691 const uint32_t par
[])
1693 TCGv_i32 addr
= tcg_temp_new_i32();
1696 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1697 mop
= gen_load_store_alignment(dc
, par
[0], addr
);
1701 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1703 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
1705 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
1707 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1712 static void translate_lct(DisasContext
*dc
, const OpcodeArg arg
[],
1713 const uint32_t par
[])
1715 tcg_gen_movi_i32(arg
[0].out
, 0);
1718 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1719 const uint32_t par
[])
1723 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1724 tmp
= tcg_temp_new();
1725 tcg_gen_addi_i32(tmp
, cpu_SR
[LITBASE
], arg
[1].raw_imm
- 1);
1727 tmp
= tcg_constant_i32(arg
[1].imm
);
1729 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1732 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1733 const uint32_t par
[])
1735 uint32_t lend
= arg
[1].imm
;
1737 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1738 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1739 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1741 if (par
[0] != TCG_COND_NEVER
) {
1742 TCGLabel
*label
= gen_new_label();
1743 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1744 gen_jumpi(dc
, lend
, 1);
1745 gen_set_label(label
);
1748 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1769 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1770 const uint32_t par
[])
1773 unsigned half
= par
[1];
1774 uint32_t ld_offset
= par
[2];
1775 unsigned off
= ld_offset
? 2 : 0;
1776 TCGv_i32 vaddr
= tcg_temp_new_i32();
1777 TCGv_i32 mem32
= tcg_temp_new_i32();
1782 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1783 mop
= gen_load_store_alignment(dc
, MO_TEUL
, vaddr
);
1784 tcg_gen_qemu_ld_tl(mem32
, vaddr
, dc
->cring
, mop
);
1786 if (op
!= MAC16_NONE
) {
1787 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1788 half
& MAC16_HX
, op
== MAC16_UMUL
);
1789 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1790 half
& MAC16_XH
, op
== MAC16_UMUL
);
1792 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1793 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1794 if (op
== MAC16_UMUL
) {
1795 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1797 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1800 TCGv_i32 lo
= tcg_temp_new_i32();
1801 TCGv_i32 hi
= tcg_temp_new_i32();
1803 tcg_gen_mul_i32(lo
, m1
, m2
);
1804 tcg_gen_sari_i32(hi
, lo
, 31);
1805 if (op
== MAC16_MULA
) {
1806 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1807 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1810 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1811 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1814 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1818 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1819 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1823 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1824 const uint32_t par
[])
1826 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1829 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1830 const uint32_t par
[])
1832 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1835 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1836 const uint32_t par
[])
1838 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1841 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1842 const uint32_t par
[])
1844 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1847 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1848 const uint32_t par
[])
1850 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1853 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1854 const uint32_t par
[])
1856 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1859 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1860 const uint32_t par
[])
1862 TCGv_i32 zero
= tcg_constant_i32(0);
1864 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1865 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1868 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1869 const uint32_t par
[])
1871 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1874 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1875 const uint32_t par
[])
1877 TCGv_i32 zero
= tcg_constant_i32(0);
1878 TCGv_i32 tmp
= tcg_temp_new_i32();
1880 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1881 tcg_gen_movcond_i32(par
[0],
1882 arg
[0].out
, tmp
, zero
,
1883 arg
[1].in
, arg
[0].in
);
1886 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1887 const uint32_t par
[])
1889 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1892 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1893 const uint32_t par
[])
1895 TCGv_i32 v1
= tcg_temp_new_i32();
1896 TCGv_i32 v2
= tcg_temp_new_i32();
1899 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1900 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1902 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1903 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1905 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1908 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1909 const uint32_t par
[])
1911 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1914 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1915 const uint32_t par
[])
1917 TCGv_i32 lo
= tcg_temp_new();
1920 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1922 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1926 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
1927 const uint32_t par
[])
1929 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
1932 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
1933 const uint32_t par
[])
1937 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
1938 const uint32_t par
[])
1940 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
1943 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
1944 const uint32_t par
[])
1946 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
1949 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
1950 const uint32_t par
[])
1952 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1955 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1956 const uint32_t par
[])
1958 #ifndef CONFIG_USER_ONLY
1959 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1961 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1962 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
1966 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1967 const uint32_t par
[])
1969 #ifndef CONFIG_USER_ONLY
1970 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1971 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
1975 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
1976 const uint32_t par
[])
1978 TCGLabel
*label1
= gen_new_label();
1979 TCGLabel
*label2
= gen_new_label();
1981 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
1983 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
1985 tcg_gen_movi_i32(arg
[0].out
,
1986 par
[0] ? 0x80000000 : 0);
1988 gen_set_label(label1
);
1990 tcg_gen_div_i32(arg
[0].out
,
1991 arg
[1].in
, arg
[2].in
);
1993 tcg_gen_rem_i32(arg
[0].out
,
1994 arg
[1].in
, arg
[2].in
);
1996 gen_set_label(label2
);
1999 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2000 const uint32_t par
[])
2002 tcg_gen_divu_i32(arg
[0].out
,
2003 arg
[1].in
, arg
[2].in
);
2006 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2007 const uint32_t par
[])
2009 /* TODO: GPIO32 may be a part of coprocessor */
2010 tcg_gen_movi_i32(arg
[0].out
, 0);
2013 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2014 const uint32_t par
[])
2016 tcg_gen_remu_i32(arg
[0].out
,
2017 arg
[1].in
, arg
[2].in
);
2020 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2021 const uint32_t par
[])
2023 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2026 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2027 const uint32_t par
[])
2029 gen_jump(dc
, cpu_R
[0]);
2032 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2033 const uint32_t par
[])
2036 qemu_log_mask(LOG_GUEST_ERROR
,
2037 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2038 return XTENSA_OP_ILL
;
2040 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2042 gen_helper_test_ill_retw(cpu_env
, pc
);
2047 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2048 const uint32_t par
[])
2050 TCGv_i32 tmp
= tcg_temp_new();
2051 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2052 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2053 cpu_SR
[WINDOW_START
], tmp
);
2054 tcg_gen_movi_i32(tmp
, dc
->pc
);
2055 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2056 gen_helper_retw(cpu_env
, cpu_R
[0]);
2060 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2061 const uint32_t par
[])
2063 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2066 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2067 const uint32_t par
[])
2069 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2070 gen_jump(dc
, cpu_SR
[EPC1
]);
2073 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2074 const uint32_t par
[])
2076 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2077 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2080 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2081 const uint32_t par
[])
2083 TCGv_i32 tmp
= tcg_temp_new();
2085 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2086 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2089 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2090 cpu_SR
[WINDOW_START
], tmp
);
2092 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2093 cpu_SR
[WINDOW_START
], tmp
);
2096 gen_helper_restore_owb(cpu_env
);
2097 gen_jump(dc
, cpu_SR
[EPC1
]);
2100 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2101 const uint32_t par
[])
2103 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2106 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2107 const uint32_t par
[])
2109 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2110 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2111 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2114 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2115 const uint32_t par
[])
2117 if (sr_name
[par
[0]]) {
2118 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2120 tcg_gen_movi_i32(arg
[0].out
, 0);
2124 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2125 const uint32_t par
[])
2127 #ifndef CONFIG_USER_ONLY
2128 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2131 gen_helper_update_ccount(cpu_env
);
2132 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2136 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2137 const uint32_t par
[])
2139 #ifndef CONFIG_USER_ONLY
2140 TCGv_i32 tmp
= tcg_temp_new_i32();
2142 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2143 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2144 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2148 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2149 const uint32_t par
[])
2151 #ifndef CONFIG_USER_ONLY
2152 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2157 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2159 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2163 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2164 const uint32_t par
[])
2166 #ifndef CONFIG_USER_ONLY
2167 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2171 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2172 const uint32_t par
[])
2174 #ifndef CONFIG_USER_ONLY
2175 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2179 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2180 const uint32_t par
[])
2182 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2185 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2186 const uint32_t par
[])
2188 /* TODO: GPIO32 may be a part of coprocessor */
2189 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2192 #ifdef CONFIG_USER_ONLY
2193 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2197 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2199 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2201 gen_helper_check_atomctl(cpu_env
, pc
, addr
);
2205 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2206 const uint32_t par
[])
2208 TCGv_i32 tmp
= tcg_temp_new_i32();
2209 TCGv_i32 addr
= tcg_temp_new_i32();
2212 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2213 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2214 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2215 gen_check_atomctl(dc
, addr
);
2216 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2217 tmp
, dc
->cring
, mop
);
2220 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2221 const uint32_t par
[])
2223 TCGv_i32 addr
= tcg_temp_new_i32();
2226 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2227 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
2228 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, mop
);
2231 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2232 const uint32_t par
[])
2234 TCGv_i32 prev
= tcg_temp_new_i32();
2235 TCGv_i32 addr
= tcg_temp_new_i32();
2236 TCGv_i32 res
= tcg_temp_new_i32();
2237 TCGLabel
*label
= gen_new_label();
2240 tcg_gen_movi_i32(res
, 0);
2241 tcg_gen_mov_i32(addr
, arg
[1].in
);
2242 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2243 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2244 gen_check_exclusive(dc
, addr
, true);
2245 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2246 arg
[0].in
, dc
->cring
, mop
);
2247 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2248 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2249 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2250 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2251 gen_set_label(label
);
2252 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2253 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2256 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2257 const uint32_t par
[])
2259 tcg_gen_setcond_i32(par
[0],
2261 arg
[1].in
, arg
[2].in
);
2264 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2265 const uint32_t par
[])
2267 int shift
= 31 - arg
[2].imm
;
2270 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2271 } else if (shift
== 16) {
2272 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2274 TCGv_i32 tmp
= tcg_temp_new_i32();
2275 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2276 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2280 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2281 const OpcodeArg arg
[],
2282 const uint32_t par
[])
2284 bool is_semi
= semihosting_enabled(dc
->cring
!= 0);
2285 #ifdef CONFIG_USER_ONLY
2288 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2289 bool ill
= dc
->config
->hw_version
<= 250002 && !is_semi
;
2291 if (ill
|| !is_semi
) {
2292 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2294 return ill
? XTENSA_OP_ILL
: 0;
2297 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2298 const uint32_t par
[])
2300 #ifndef CONFIG_USER_ONLY
2301 if (semihosting_enabled(dc
->cring
!= 0)) {
2302 gen_helper_simcall(cpu_env
);
2308 * Note: 64 bit ops are used here solely because SAR values
2311 #define gen_shift_reg(cmd, reg) do { \
2312 TCGv_i64 tmp = tcg_temp_new_i64(); \
2313 tcg_gen_extu_i32_i64(tmp, reg); \
2314 tcg_gen_##cmd##_i64(v, v, tmp); \
2315 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2318 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2320 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2321 const uint32_t par
[])
2323 if (dc
->sar_m32_5bit
) {
2324 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2326 TCGv_i64 v
= tcg_temp_new_i64();
2327 TCGv_i32 s
= tcg_temp_new();
2328 tcg_gen_subfi_i32(s
, 32, cpu_SR
[SAR
]);
2329 tcg_gen_andi_i32(s
, s
, 0x3f);
2330 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2331 gen_shift_reg(shl
, s
);
2335 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2336 const uint32_t par
[])
2338 if (arg
[2].imm
== 32) {
2339 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2340 arg
[0].imm
, arg
[1].imm
);
2342 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2345 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2346 const uint32_t par
[])
2348 if (dc
->sar_m32_5bit
) {
2349 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2351 TCGv_i64 v
= tcg_temp_new_i64();
2352 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2357 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2358 const uint32_t par
[])
2360 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2363 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2364 const uint32_t par
[])
2366 TCGv_i64 v
= tcg_temp_new_i64();
2367 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2371 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2372 const uint32_t par
[])
2374 if (dc
->sar_m32_5bit
) {
2375 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2377 TCGv_i64 v
= tcg_temp_new_i64();
2378 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2384 #undef gen_shift_reg
2386 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2387 const uint32_t par
[])
2389 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2392 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2393 const uint32_t par
[])
2395 TCGv_i32 tmp
= tcg_temp_new_i32();
2396 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2397 gen_left_shift_sar(dc
, tmp
);
2400 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2401 const uint32_t par
[])
2403 TCGv_i32 tmp
= tcg_temp_new_i32();
2404 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2405 gen_right_shift_sar(dc
, tmp
);
2408 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2409 const uint32_t par
[])
2411 gen_right_shift_sar(dc
, tcg_constant_i32(arg
[0].imm
));
2414 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2415 const uint32_t par
[])
2417 gen_left_shift_sar(dc
, arg
[0].in
);
2420 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2421 const uint32_t par
[])
2423 gen_right_shift_sar(dc
, arg
[0].in
);
2426 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2427 const uint32_t par
[])
2429 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2432 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2433 const uint32_t par
[])
2435 TCGv_i32 tmp
= tcg_temp_new_i32();
2436 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2437 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2440 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2441 const uint32_t par
[])
2443 #ifndef CONFIG_USER_ONLY
2444 TCGv_i32 pc
= tcg_constant_i32(dc
->base
.pc_next
);
2446 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2449 gen_helper_waiti(cpu_env
, pc
, tcg_constant_i32(arg
[0].imm
));
2453 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2454 const uint32_t par
[])
2456 #ifndef CONFIG_USER_ONLY
2457 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2459 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2463 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2464 const uint32_t par
[])
2466 #ifndef CONFIG_USER_ONLY
2467 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2471 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2472 const uint32_t par
[])
2474 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2477 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2478 const uint32_t par
[])
2480 /* TODO: GPIO32 may be a part of coprocessor */
2481 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2484 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2485 const uint32_t par
[])
2487 if (sr_name
[par
[0]]) {
2488 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2492 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2493 const uint32_t par
[])
2495 if (sr_name
[par
[0]]) {
2496 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2500 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2501 const uint32_t par
[])
2503 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2506 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2507 const uint32_t par
[])
2509 #ifndef CONFIG_USER_ONLY
2510 uint32_t id
= par
[0] - CCOMPARE
;
2512 assert(id
< dc
->config
->nccompare
);
2513 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2516 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2517 gen_helper_update_ccompare(cpu_env
, tcg_constant_i32(id
));
2521 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2522 const uint32_t par
[])
2524 #ifndef CONFIG_USER_ONLY
2525 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2528 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2532 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2533 const uint32_t par
[])
2535 #ifndef CONFIG_USER_ONLY
2536 unsigned id
= par
[0] - DBREAKA
;
2538 assert(id
< dc
->config
->ndbreak
);
2539 gen_helper_wsr_dbreaka(cpu_env
, tcg_constant_i32(id
), arg
[0].in
);
2543 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2544 const uint32_t par
[])
2546 #ifndef CONFIG_USER_ONLY
2547 unsigned id
= par
[0] - DBREAKC
;
2549 assert(id
< dc
->config
->ndbreak
);
2550 gen_helper_wsr_dbreakc(cpu_env
, tcg_constant_i32(id
), arg
[0].in
);
2554 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2555 const uint32_t par
[])
2557 #ifndef CONFIG_USER_ONLY
2558 unsigned id
= par
[0] - IBREAKA
;
2560 assert(id
< dc
->config
->nibreak
);
2561 gen_helper_wsr_ibreaka(cpu_env
, tcg_constant_i32(id
), arg
[0].in
);
2565 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2566 const uint32_t par
[])
2568 #ifndef CONFIG_USER_ONLY
2569 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2573 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2574 const uint32_t par
[])
2576 #ifndef CONFIG_USER_ONLY
2578 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2580 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2585 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2586 const uint32_t par
[])
2588 #ifndef CONFIG_USER_ONLY
2589 gen_helper_intclear(cpu_env
, arg
[0].in
);
2593 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2594 const uint32_t par
[])
2596 #ifndef CONFIG_USER_ONLY
2597 gen_helper_intset(cpu_env
, arg
[0].in
);
2601 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2602 const uint32_t par
[])
2604 #ifndef CONFIG_USER_ONLY
2605 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2609 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2610 const uint32_t par
[])
2612 #ifndef CONFIG_USER_ONLY
2613 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2617 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2618 const uint32_t par
[])
2620 #ifndef CONFIG_USER_ONLY
2621 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2622 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2624 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2625 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2628 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2632 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2633 const uint32_t par
[])
2635 #ifndef CONFIG_USER_ONLY
2636 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2640 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2641 const uint32_t par
[])
2643 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2644 if (dc
->sar_m32_5bit
) {
2645 tcg_gen_discard_i32(dc
->sar_m32
);
2647 dc
->sar_5bit
= false;
2648 dc
->sar_m32_5bit
= false;
2651 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2652 const uint32_t par
[])
2654 #ifndef CONFIG_USER_ONLY
2655 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2659 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2660 const uint32_t par
[])
2662 #ifndef CONFIG_USER_ONLY
2663 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2664 (1 << dc
->config
->nareg
/ 4) - 1);
2668 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2669 const uint32_t par
[])
2671 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2674 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2675 const uint32_t par
[])
2677 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2680 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2681 const uint32_t par
[])
2683 if (sr_name
[par
[0]]) {
2684 TCGv_i32 tmp
= tcg_temp_new_i32();
2686 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2687 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2688 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2690 tcg_gen_movi_i32(arg
[0].out
, 0);
2694 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2695 const uint32_t par
[])
2697 if (sr_name
[par
[0]]) {
2698 TCGv_i32 tmp
= tcg_temp_new_i32();
2700 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2701 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2702 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2704 tcg_gen_movi_i32(arg
[0].out
, 0);
2708 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2709 const uint32_t par
[])
2711 #ifndef CONFIG_USER_ONLY
2712 TCGv_i32 tmp
= tcg_temp_new_i32();
2714 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2718 gen_helper_update_ccount(cpu_env
);
2719 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2720 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2721 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2726 #define gen_translate_xsr(name) \
2727 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2728 const uint32_t par[]) \
2730 TCGv_i32 tmp = tcg_temp_new_i32(); \
2732 if (sr_name[par[0]]) { \
2733 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2735 tcg_gen_movi_i32(tmp, 0); \
2737 translate_wsr_##name(dc, arg, par); \
2738 tcg_gen_mov_i32(arg[0].out, tmp); \
2741 gen_translate_xsr(acchi
)
2742 gen_translate_xsr(ccompare
)
2743 gen_translate_xsr(dbreaka
)
2744 gen_translate_xsr(dbreakc
)
2745 gen_translate_xsr(ibreaka
)
2746 gen_translate_xsr(ibreakenable
)
2747 gen_translate_xsr(icount
)
2748 gen_translate_xsr(memctl
)
2749 gen_translate_xsr(mpuenb
)
2750 gen_translate_xsr(ps
)
2751 gen_translate_xsr(rasid
)
2752 gen_translate_xsr(sar
)
2753 gen_translate_xsr(windowbase
)
2754 gen_translate_xsr(windowstart
)
2756 #undef gen_translate_xsr
2758 static const XtensaOpcodeOps core_ops
[] = {
2761 .translate
= translate_abs
,
2763 .name
= (const char * const[]) {
2764 "add", "add.n", NULL
,
2766 .translate
= translate_add
,
2767 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2769 .name
= (const char * const[]) {
2770 "addi", "addi.n", NULL
,
2772 .translate
= translate_addi
,
2773 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2776 .translate
= translate_addi
,
2779 .translate
= translate_addx
,
2780 .par
= (const uint32_t[]){1},
2783 .translate
= translate_addx
,
2784 .par
= (const uint32_t[]){2},
2787 .translate
= translate_addx
,
2788 .par
= (const uint32_t[]){3},
2791 .translate
= translate_all
,
2792 .par
= (const uint32_t[]){true, 4},
2795 .translate
= translate_all
,
2796 .par
= (const uint32_t[]){true, 8},
2799 .translate
= translate_and
,
2802 .translate
= translate_boolean
,
2803 .par
= (const uint32_t[]){BOOLEAN_AND
},
2806 .translate
= translate_boolean
,
2807 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2810 .translate
= translate_all
,
2811 .par
= (const uint32_t[]){false, 4},
2814 .translate
= translate_all
,
2815 .par
= (const uint32_t[]){false, 8},
2817 .name
= (const char * const[]) {
2818 "ball", "ball.w15", "ball.w18", NULL
,
2820 .translate
= translate_ball
,
2821 .par
= (const uint32_t[]){TCG_COND_EQ
},
2822 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2824 .name
= (const char * const[]) {
2825 "bany", "bany.w15", "bany.w18", NULL
,
2827 .translate
= translate_bany
,
2828 .par
= (const uint32_t[]){TCG_COND_NE
},
2829 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2831 .name
= (const char * const[]) {
2832 "bbc", "bbc.w15", "bbc.w18", NULL
,
2834 .translate
= translate_bb
,
2835 .par
= (const uint32_t[]){TCG_COND_EQ
},
2836 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2838 .name
= (const char * const[]) {
2839 "bbci", "bbci.w15", "bbci.w18", NULL
,
2841 .translate
= translate_bbi
,
2842 .par
= (const uint32_t[]){TCG_COND_EQ
},
2843 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2845 .name
= (const char * const[]) {
2846 "bbs", "bbs.w15", "bbs.w18", NULL
,
2848 .translate
= translate_bb
,
2849 .par
= (const uint32_t[]){TCG_COND_NE
},
2850 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2852 .name
= (const char * const[]) {
2853 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2855 .translate
= translate_bbi
,
2856 .par
= (const uint32_t[]){TCG_COND_NE
},
2857 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2859 .name
= (const char * const[]) {
2860 "beq", "beq.w15", "beq.w18", NULL
,
2862 .translate
= translate_b
,
2863 .par
= (const uint32_t[]){TCG_COND_EQ
},
2864 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2866 .name
= (const char * const[]) {
2867 "beqi", "beqi.w15", "beqi.w18", NULL
,
2869 .translate
= translate_bi
,
2870 .par
= (const uint32_t[]){TCG_COND_EQ
},
2871 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2873 .name
= (const char * const[]) {
2874 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2876 .translate
= translate_bz
,
2877 .par
= (const uint32_t[]){TCG_COND_EQ
},
2878 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2881 .translate
= translate_bp
,
2882 .par
= (const uint32_t[]){TCG_COND_EQ
},
2884 .name
= (const char * const[]) {
2885 "bge", "bge.w15", "bge.w18", NULL
,
2887 .translate
= translate_b
,
2888 .par
= (const uint32_t[]){TCG_COND_GE
},
2889 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2891 .name
= (const char * const[]) {
2892 "bgei", "bgei.w15", "bgei.w18", NULL
,
2894 .translate
= translate_bi
,
2895 .par
= (const uint32_t[]){TCG_COND_GE
},
2896 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2898 .name
= (const char * const[]) {
2899 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
2901 .translate
= translate_b
,
2902 .par
= (const uint32_t[]){TCG_COND_GEU
},
2903 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2905 .name
= (const char * const[]) {
2906 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
2908 .translate
= translate_bi
,
2909 .par
= (const uint32_t[]){TCG_COND_GEU
},
2910 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2912 .name
= (const char * const[]) {
2913 "bgez", "bgez.w15", "bgez.w18", NULL
,
2915 .translate
= translate_bz
,
2916 .par
= (const uint32_t[]){TCG_COND_GE
},
2917 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2919 .name
= (const char * const[]) {
2920 "blt", "blt.w15", "blt.w18", NULL
,
2922 .translate
= translate_b
,
2923 .par
= (const uint32_t[]){TCG_COND_LT
},
2924 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2926 .name
= (const char * const[]) {
2927 "blti", "blti.w15", "blti.w18", NULL
,
2929 .translate
= translate_bi
,
2930 .par
= (const uint32_t[]){TCG_COND_LT
},
2931 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2933 .name
= (const char * const[]) {
2934 "bltu", "bltu.w15", "bltu.w18", NULL
,
2936 .translate
= translate_b
,
2937 .par
= (const uint32_t[]){TCG_COND_LTU
},
2938 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2940 .name
= (const char * const[]) {
2941 "bltui", "bltui.w15", "bltui.w18", NULL
,
2943 .translate
= translate_bi
,
2944 .par
= (const uint32_t[]){TCG_COND_LTU
},
2945 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2947 .name
= (const char * const[]) {
2948 "bltz", "bltz.w15", "bltz.w18", NULL
,
2950 .translate
= translate_bz
,
2951 .par
= (const uint32_t[]){TCG_COND_LT
},
2952 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2954 .name
= (const char * const[]) {
2955 "bnall", "bnall.w15", "bnall.w18", NULL
,
2957 .translate
= translate_ball
,
2958 .par
= (const uint32_t[]){TCG_COND_NE
},
2959 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2961 .name
= (const char * const[]) {
2962 "bne", "bne.w15", "bne.w18", NULL
,
2964 .translate
= translate_b
,
2965 .par
= (const uint32_t[]){TCG_COND_NE
},
2966 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2968 .name
= (const char * const[]) {
2969 "bnei", "bnei.w15", "bnei.w18", NULL
,
2971 .translate
= translate_bi
,
2972 .par
= (const uint32_t[]){TCG_COND_NE
},
2973 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2975 .name
= (const char * const[]) {
2976 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
2978 .translate
= translate_bz
,
2979 .par
= (const uint32_t[]){TCG_COND_NE
},
2980 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2982 .name
= (const char * const[]) {
2983 "bnone", "bnone.w15", "bnone.w18", NULL
,
2985 .translate
= translate_bany
,
2986 .par
= (const uint32_t[]){TCG_COND_EQ
},
2987 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2990 .translate
= translate_nop
,
2991 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
2992 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2995 .translate
= translate_nop
,
2996 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
2997 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3000 .translate
= translate_bp
,
3001 .par
= (const uint32_t[]){TCG_COND_NE
},
3004 .translate
= translate_call0
,
3007 .translate
= translate_callw
,
3008 .par
= (const uint32_t[]){3},
3011 .translate
= translate_callw
,
3012 .par
= (const uint32_t[]){1},
3015 .translate
= translate_callw
,
3016 .par
= (const uint32_t[]){2},
3019 .translate
= translate_callx0
,
3022 .translate
= translate_callxw
,
3023 .par
= (const uint32_t[]){3},
3026 .translate
= translate_callxw
,
3027 .par
= (const uint32_t[]){1},
3030 .translate
= translate_callxw
,
3031 .par
= (const uint32_t[]){2},
3034 .translate
= translate_clamps
,
3036 .name
= "clrb_expstate",
3037 .translate
= translate_clrb_expstate
,
3040 .translate
= translate_clrex
,
3043 .translate
= translate_const16
,
3046 .translate
= translate_depbits
,
3049 .translate
= translate_dcache
,
3050 .op_flags
= XTENSA_OP_PRIVILEGED
,
3053 .translate
= translate_nop
,
3056 .translate
= translate_dcache
,
3057 .op_flags
= XTENSA_OP_PRIVILEGED
,
3060 .translate
= translate_dcache
,
3063 .translate
= translate_nop
,
3066 .translate
= translate_dcache
,
3069 .translate
= translate_nop
,
3072 .translate
= translate_nop
,
3073 .op_flags
= XTENSA_OP_PRIVILEGED
,
3076 .translate
= translate_nop
,
3077 .op_flags
= XTENSA_OP_PRIVILEGED
,
3080 .translate
= translate_nop
,
3081 .op_flags
= XTENSA_OP_PRIVILEGED
,
3084 .translate
= translate_nop
,
3085 .op_flags
= XTENSA_OP_PRIVILEGED
,
3088 .translate
= translate_diwbuip
,
3089 .op_flags
= XTENSA_OP_PRIVILEGED
,
3092 .translate
= translate_dcache
,
3093 .op_flags
= XTENSA_OP_PRIVILEGED
,
3096 .translate
= translate_nop
,
3099 .translate
= translate_nop
,
3102 .translate
= translate_nop
,
3105 .translate
= translate_nop
,
3108 .translate
= translate_nop
,
3111 .translate
= translate_nop
,
3114 .translate
= translate_nop
,
3117 .translate
= translate_nop
,
3120 .translate
= translate_nop
,
3123 .translate
= translate_nop
,
3126 .translate
= translate_nop
,
3129 .translate
= translate_entry
,
3130 .test_exceptions
= test_exceptions_entry
,
3131 .test_overflow
= test_overflow_entry
,
3132 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3133 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3136 .translate
= translate_nop
,
3139 .translate
= translate_nop
,
3142 .translate
= translate_extui
,
3145 .translate
= translate_memw
,
3148 .translate
= translate_getex
,
3151 .op_flags
= XTENSA_OP_ILL
,
3154 .op_flags
= XTENSA_OP_ILL
,
3157 .translate
= translate_itlb
,
3158 .par
= (const uint32_t[]){true},
3159 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3162 .translate
= translate_icache
,
3165 .translate
= translate_icache
,
3166 .op_flags
= XTENSA_OP_PRIVILEGED
,
3169 .translate
= translate_nop
,
3170 .op_flags
= XTENSA_OP_PRIVILEGED
,
3173 .translate
= translate_itlb
,
3174 .par
= (const uint32_t[]){false},
3175 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3178 .translate
= translate_nop
,
3179 .op_flags
= XTENSA_OP_PRIVILEGED
,
3181 .name
= (const char * const[]) {
3182 "ill", "ill.n", NULL
,
3184 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3187 .translate
= translate_nop
,
3190 .translate
= translate_icache
,
3191 .op_flags
= XTENSA_OP_PRIVILEGED
,
3194 .translate
= translate_nop
,
3197 .translate
= translate_j
,
3200 .translate
= translate_jx
,
3203 .translate
= translate_ldst
,
3204 .par
= (const uint32_t[]){MO_TESW
, false, false},
3205 .op_flags
= XTENSA_OP_LOAD
,
3208 .translate
= translate_ldst
,
3209 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3210 .op_flags
= XTENSA_OP_LOAD
,
3213 .translate
= translate_ldst
,
3214 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, false},
3215 .op_flags
= XTENSA_OP_LOAD
,
3218 .translate
= translate_l32e
,
3219 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3222 .translate
= translate_l32ex
,
3223 .op_flags
= XTENSA_OP_LOAD
,
3225 .name
= (const char * const[]) {
3226 "l32i", "l32i.n", NULL
,
3228 .translate
= translate_ldst
,
3229 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3230 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3233 .translate
= translate_l32r
,
3234 .op_flags
= XTENSA_OP_LOAD
,
3237 .translate
= translate_ldst
,
3238 .par
= (const uint32_t[]){MO_UB
, false, false},
3239 .op_flags
= XTENSA_OP_LOAD
,
3242 .translate
= translate_lct
,
3243 .op_flags
= XTENSA_OP_PRIVILEGED
,
3246 .translate
= translate_nop
,
3247 .op_flags
= XTENSA_OP_PRIVILEGED
,
3250 .translate
= translate_mac16
,
3251 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3252 .op_flags
= XTENSA_OP_LOAD
,
3255 .translate
= translate_mac16
,
3256 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3257 .op_flags
= XTENSA_OP_LOAD
,
3260 .op_flags
= XTENSA_OP_ILL
,
3263 .translate
= translate_lct
,
3264 .op_flags
= XTENSA_OP_PRIVILEGED
,
3267 .translate
= translate_nop
,
3268 .op_flags
= XTENSA_OP_PRIVILEGED
,
3270 .name
= (const char * const[]) {
3271 "loop", "loop.w15", NULL
,
3273 .translate
= translate_loop
,
3274 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3275 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3277 .name
= (const char * const[]) {
3278 "loopgtz", "loopgtz.w15", NULL
,
3280 .translate
= translate_loop
,
3281 .par
= (const uint32_t[]){TCG_COND_GT
},
3282 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3284 .name
= (const char * const[]) {
3285 "loopnez", "loopnez.w15", NULL
,
3287 .translate
= translate_loop
,
3288 .par
= (const uint32_t[]){TCG_COND_NE
},
3289 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3292 .translate
= translate_smax
,
3295 .translate
= translate_umax
,
3298 .translate
= translate_memw
,
3301 .translate
= translate_smin
,
3304 .translate
= translate_umin
,
3306 .name
= (const char * const[]) {
3307 "mov", "mov.n", NULL
,
3309 .translate
= translate_mov
,
3310 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3313 .translate
= translate_movcond
,
3314 .par
= (const uint32_t[]){TCG_COND_EQ
},
3317 .translate
= translate_movp
,
3318 .par
= (const uint32_t[]){TCG_COND_EQ
},
3321 .translate
= translate_movcond
,
3322 .par
= (const uint32_t[]){TCG_COND_GE
},
3325 .translate
= translate_movi
,
3328 .translate
= translate_movi
,
3331 .translate
= translate_movcond
,
3332 .par
= (const uint32_t[]){TCG_COND_LT
},
3335 .translate
= translate_movcond
,
3336 .par
= (const uint32_t[]){TCG_COND_NE
},
3339 .translate
= translate_movsp
,
3340 .op_flags
= XTENSA_OP_ALLOCA
,
3343 .translate
= translate_movp
,
3344 .par
= (const uint32_t[]){TCG_COND_NE
},
3346 .name
= "mul.aa.hh",
3347 .translate
= translate_mac16
,
3348 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3350 .name
= "mul.aa.hl",
3351 .translate
= translate_mac16
,
3352 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3354 .name
= "mul.aa.lh",
3355 .translate
= translate_mac16
,
3356 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3358 .name
= "mul.aa.ll",
3359 .translate
= translate_mac16
,
3360 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3362 .name
= "mul.ad.hh",
3363 .translate
= translate_mac16
,
3364 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3366 .name
= "mul.ad.hl",
3367 .translate
= translate_mac16
,
3368 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3370 .name
= "mul.ad.lh",
3371 .translate
= translate_mac16
,
3372 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3374 .name
= "mul.ad.ll",
3375 .translate
= translate_mac16
,
3376 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3378 .name
= "mul.da.hh",
3379 .translate
= translate_mac16
,
3380 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3382 .name
= "mul.da.hl",
3383 .translate
= translate_mac16
,
3384 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3386 .name
= "mul.da.lh",
3387 .translate
= translate_mac16
,
3388 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3390 .name
= "mul.da.ll",
3391 .translate
= translate_mac16
,
3392 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3394 .name
= "mul.dd.hh",
3395 .translate
= translate_mac16
,
3396 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3398 .name
= "mul.dd.hl",
3399 .translate
= translate_mac16
,
3400 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3402 .name
= "mul.dd.lh",
3403 .translate
= translate_mac16
,
3404 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3406 .name
= "mul.dd.ll",
3407 .translate
= translate_mac16
,
3408 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3411 .translate
= translate_mul16
,
3412 .par
= (const uint32_t[]){true},
3415 .translate
= translate_mul16
,
3416 .par
= (const uint32_t[]){false},
3418 .name
= "mula.aa.hh",
3419 .translate
= translate_mac16
,
3420 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3422 .name
= "mula.aa.hl",
3423 .translate
= translate_mac16
,
3424 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3426 .name
= "mula.aa.lh",
3427 .translate
= translate_mac16
,
3428 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3430 .name
= "mula.aa.ll",
3431 .translate
= translate_mac16
,
3432 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3434 .name
= "mula.ad.hh",
3435 .translate
= translate_mac16
,
3436 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3438 .name
= "mula.ad.hl",
3439 .translate
= translate_mac16
,
3440 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3442 .name
= "mula.ad.lh",
3443 .translate
= translate_mac16
,
3444 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3446 .name
= "mula.ad.ll",
3447 .translate
= translate_mac16
,
3448 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3450 .name
= "mula.da.hh",
3451 .translate
= translate_mac16
,
3452 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3454 .name
= "mula.da.hh.lddec",
3455 .translate
= translate_mac16
,
3456 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3458 .name
= "mula.da.hh.ldinc",
3459 .translate
= translate_mac16
,
3460 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3462 .name
= "mula.da.hl",
3463 .translate
= translate_mac16
,
3464 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3466 .name
= "mula.da.hl.lddec",
3467 .translate
= translate_mac16
,
3468 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3470 .name
= "mula.da.hl.ldinc",
3471 .translate
= translate_mac16
,
3472 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3474 .name
= "mula.da.lh",
3475 .translate
= translate_mac16
,
3476 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3478 .name
= "mula.da.lh.lddec",
3479 .translate
= translate_mac16
,
3480 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3482 .name
= "mula.da.lh.ldinc",
3483 .translate
= translate_mac16
,
3484 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3486 .name
= "mula.da.ll",
3487 .translate
= translate_mac16
,
3488 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3490 .name
= "mula.da.ll.lddec",
3491 .translate
= translate_mac16
,
3492 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3494 .name
= "mula.da.ll.ldinc",
3495 .translate
= translate_mac16
,
3496 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3498 .name
= "mula.dd.hh",
3499 .translate
= translate_mac16
,
3500 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3502 .name
= "mula.dd.hh.lddec",
3503 .translate
= translate_mac16
,
3504 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3506 .name
= "mula.dd.hh.ldinc",
3507 .translate
= translate_mac16
,
3508 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3510 .name
= "mula.dd.hl",
3511 .translate
= translate_mac16
,
3512 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3514 .name
= "mula.dd.hl.lddec",
3515 .translate
= translate_mac16
,
3516 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3518 .name
= "mula.dd.hl.ldinc",
3519 .translate
= translate_mac16
,
3520 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3522 .name
= "mula.dd.lh",
3523 .translate
= translate_mac16
,
3524 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3526 .name
= "mula.dd.lh.lddec",
3527 .translate
= translate_mac16
,
3528 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3530 .name
= "mula.dd.lh.ldinc",
3531 .translate
= translate_mac16
,
3532 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3534 .name
= "mula.dd.ll",
3535 .translate
= translate_mac16
,
3536 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3538 .name
= "mula.dd.ll.lddec",
3539 .translate
= translate_mac16
,
3540 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3542 .name
= "mula.dd.ll.ldinc",
3543 .translate
= translate_mac16
,
3544 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3547 .translate
= translate_mull
,
3549 .name
= "muls.aa.hh",
3550 .translate
= translate_mac16
,
3551 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3553 .name
= "muls.aa.hl",
3554 .translate
= translate_mac16
,
3555 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3557 .name
= "muls.aa.lh",
3558 .translate
= translate_mac16
,
3559 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3561 .name
= "muls.aa.ll",
3562 .translate
= translate_mac16
,
3563 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3565 .name
= "muls.ad.hh",
3566 .translate
= translate_mac16
,
3567 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3569 .name
= "muls.ad.hl",
3570 .translate
= translate_mac16
,
3571 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3573 .name
= "muls.ad.lh",
3574 .translate
= translate_mac16
,
3575 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3577 .name
= "muls.ad.ll",
3578 .translate
= translate_mac16
,
3579 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3581 .name
= "muls.da.hh",
3582 .translate
= translate_mac16
,
3583 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3585 .name
= "muls.da.hl",
3586 .translate
= translate_mac16
,
3587 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3589 .name
= "muls.da.lh",
3590 .translate
= translate_mac16
,
3591 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3593 .name
= "muls.da.ll",
3594 .translate
= translate_mac16
,
3595 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3597 .name
= "muls.dd.hh",
3598 .translate
= translate_mac16
,
3599 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3601 .name
= "muls.dd.hl",
3602 .translate
= translate_mac16
,
3603 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3605 .name
= "muls.dd.lh",
3606 .translate
= translate_mac16
,
3607 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3609 .name
= "muls.dd.ll",
3610 .translate
= translate_mac16
,
3611 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3614 .translate
= translate_mulh
,
3615 .par
= (const uint32_t[]){true},
3618 .translate
= translate_mulh
,
3619 .par
= (const uint32_t[]){false},
3622 .translate
= translate_neg
,
3624 .name
= (const char * const[]) {
3625 "nop", "nop.n", NULL
,
3627 .translate
= translate_nop
,
3628 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3631 .translate
= translate_nsa
,
3634 .translate
= translate_nsau
,
3637 .translate
= translate_or
,
3640 .translate
= translate_boolean
,
3641 .par
= (const uint32_t[]){BOOLEAN_OR
},
3644 .translate
= translate_boolean
,
3645 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3648 .translate
= translate_ptlb
,
3649 .par
= (const uint32_t[]){true},
3650 .op_flags
= XTENSA_OP_PRIVILEGED
,
3653 .translate
= translate_nop
,
3656 .translate
= translate_nop
,
3659 .translate
= translate_nop
,
3662 .translate
= translate_nop
,
3665 .translate
= translate_nop
,
3668 .translate
= translate_ptlb
,
3669 .par
= (const uint32_t[]){false},
3670 .op_flags
= XTENSA_OP_PRIVILEGED
,
3673 .translate
= translate_pptlb
,
3674 .op_flags
= XTENSA_OP_PRIVILEGED
,
3677 .translate
= translate_quos
,
3678 .par
= (const uint32_t[]){true},
3679 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3682 .translate
= translate_quou
,
3683 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3686 .translate
= translate_rtlb
,
3687 .par
= (const uint32_t[]){true, 0},
3688 .op_flags
= XTENSA_OP_PRIVILEGED
,
3691 .translate
= translate_rtlb
,
3692 .par
= (const uint32_t[]){true, 1},
3693 .op_flags
= XTENSA_OP_PRIVILEGED
,
3695 .name
= "read_impwire",
3696 .translate
= translate_read_impwire
,
3699 .translate
= translate_quos
,
3700 .par
= (const uint32_t[]){false},
3701 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3704 .translate
= translate_remu
,
3705 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3708 .translate
= translate_rer
,
3709 .op_flags
= XTENSA_OP_PRIVILEGED
,
3711 .name
= (const char * const[]) {
3712 "ret", "ret.n", NULL
,
3714 .translate
= translate_ret
,
3715 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3717 .name
= (const char * const[]) {
3718 "retw", "retw.n", NULL
,
3720 .translate
= translate_retw
,
3721 .test_exceptions
= test_exceptions_retw
,
3722 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3725 .op_flags
= XTENSA_OP_ILL
,
3728 .translate
= translate_rfde
,
3729 .op_flags
= XTENSA_OP_PRIVILEGED
,
3732 .op_flags
= XTENSA_OP_ILL
,
3735 .translate
= translate_rfe
,
3736 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3739 .translate
= translate_rfi
,
3740 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3743 .translate
= translate_rfw
,
3744 .par
= (const uint32_t[]){true},
3745 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3748 .translate
= translate_rfw
,
3749 .par
= (const uint32_t[]){false},
3750 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3753 .translate
= translate_rtlb
,
3754 .par
= (const uint32_t[]){false, 0},
3755 .op_flags
= XTENSA_OP_PRIVILEGED
,
3758 .translate
= translate_rtlb
,
3759 .par
= (const uint32_t[]){false, 1},
3760 .op_flags
= XTENSA_OP_PRIVILEGED
,
3763 .translate
= translate_rptlb0
,
3764 .op_flags
= XTENSA_OP_PRIVILEGED
,
3767 .translate
= translate_rptlb1
,
3768 .op_flags
= XTENSA_OP_PRIVILEGED
,
3771 .translate
= translate_rotw
,
3772 .op_flags
= XTENSA_OP_PRIVILEGED
|
3773 XTENSA_OP_EXIT_TB_M1
|
3774 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3777 .translate
= translate_rsil
,
3779 XTENSA_OP_PRIVILEGED
|
3780 XTENSA_OP_EXIT_TB_0
|
3781 XTENSA_OP_CHECK_INTERRUPTS
,
3784 .translate
= translate_rsr
,
3785 .par
= (const uint32_t[]){176},
3786 .op_flags
= XTENSA_OP_PRIVILEGED
,
3789 .translate
= translate_rsr
,
3790 .par
= (const uint32_t[]){208},
3791 .op_flags
= XTENSA_OP_PRIVILEGED
,
3793 .name
= "rsr.acchi",
3794 .translate
= translate_rsr
,
3795 .test_exceptions
= test_exceptions_sr
,
3796 .par
= (const uint32_t[]){
3798 XTENSA_OPTION_MAC16
,
3801 .name
= "rsr.acclo",
3802 .translate
= translate_rsr
,
3803 .test_exceptions
= test_exceptions_sr
,
3804 .par
= (const uint32_t[]){
3806 XTENSA_OPTION_MAC16
,
3809 .name
= "rsr.atomctl",
3810 .translate
= translate_rsr
,
3811 .test_exceptions
= test_exceptions_sr
,
3812 .par
= (const uint32_t[]){
3814 XTENSA_OPTION_ATOMCTL
,
3816 .op_flags
= XTENSA_OP_PRIVILEGED
,
3819 .translate
= translate_rsr
,
3820 .test_exceptions
= test_exceptions_sr
,
3821 .par
= (const uint32_t[]){
3823 XTENSA_OPTION_BOOLEAN
,
3826 .name
= "rsr.cacheadrdis",
3827 .translate
= translate_rsr
,
3828 .test_exceptions
= test_exceptions_sr
,
3829 .par
= (const uint32_t[]){
3833 .op_flags
= XTENSA_OP_PRIVILEGED
,
3835 .name
= "rsr.cacheattr",
3836 .translate
= translate_rsr
,
3837 .test_exceptions
= test_exceptions_sr
,
3838 .par
= (const uint32_t[]){
3840 XTENSA_OPTION_CACHEATTR
,
3842 .op_flags
= XTENSA_OP_PRIVILEGED
,
3844 .name
= "rsr.ccompare0",
3845 .translate
= translate_rsr
,
3846 .test_exceptions
= test_exceptions_ccompare
,
3847 .par
= (const uint32_t[]){
3849 XTENSA_OPTION_TIMER_INTERRUPT
,
3851 .op_flags
= XTENSA_OP_PRIVILEGED
,
3853 .name
= "rsr.ccompare1",
3854 .translate
= translate_rsr
,
3855 .test_exceptions
= test_exceptions_ccompare
,
3856 .par
= (const uint32_t[]){
3858 XTENSA_OPTION_TIMER_INTERRUPT
,
3860 .op_flags
= XTENSA_OP_PRIVILEGED
,
3862 .name
= "rsr.ccompare2",
3863 .translate
= translate_rsr
,
3864 .test_exceptions
= test_exceptions_ccompare
,
3865 .par
= (const uint32_t[]){
3867 XTENSA_OPTION_TIMER_INTERRUPT
,
3869 .op_flags
= XTENSA_OP_PRIVILEGED
,
3871 .name
= "rsr.ccount",
3872 .translate
= translate_rsr_ccount
,
3873 .test_exceptions
= test_exceptions_sr
,
3874 .par
= (const uint32_t[]){
3876 XTENSA_OPTION_TIMER_INTERRUPT
,
3878 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3880 .name
= "rsr.configid0",
3881 .translate
= translate_rsr
,
3882 .par
= (const uint32_t[]){CONFIGID0
},
3883 .op_flags
= XTENSA_OP_PRIVILEGED
,
3885 .name
= "rsr.configid1",
3886 .translate
= translate_rsr
,
3887 .par
= (const uint32_t[]){CONFIGID1
},
3888 .op_flags
= XTENSA_OP_PRIVILEGED
,
3890 .name
= "rsr.cpenable",
3891 .translate
= translate_rsr
,
3892 .test_exceptions
= test_exceptions_sr
,
3893 .par
= (const uint32_t[]){
3895 XTENSA_OPTION_COPROCESSOR
,
3897 .op_flags
= XTENSA_OP_PRIVILEGED
,
3899 .name
= "rsr.dbreaka0",
3900 .translate
= translate_rsr
,
3901 .test_exceptions
= test_exceptions_dbreak
,
3902 .par
= (const uint32_t[]){
3904 XTENSA_OPTION_DEBUG
,
3906 .op_flags
= XTENSA_OP_PRIVILEGED
,
3908 .name
= "rsr.dbreaka1",
3909 .translate
= translate_rsr
,
3910 .test_exceptions
= test_exceptions_dbreak
,
3911 .par
= (const uint32_t[]){
3913 XTENSA_OPTION_DEBUG
,
3915 .op_flags
= XTENSA_OP_PRIVILEGED
,
3917 .name
= "rsr.dbreakc0",
3918 .translate
= translate_rsr
,
3919 .test_exceptions
= test_exceptions_dbreak
,
3920 .par
= (const uint32_t[]){
3922 XTENSA_OPTION_DEBUG
,
3924 .op_flags
= XTENSA_OP_PRIVILEGED
,
3926 .name
= "rsr.dbreakc1",
3927 .translate
= translate_rsr
,
3928 .test_exceptions
= test_exceptions_dbreak
,
3929 .par
= (const uint32_t[]){
3931 XTENSA_OPTION_DEBUG
,
3933 .op_flags
= XTENSA_OP_PRIVILEGED
,
3936 .translate
= translate_rsr
,
3937 .test_exceptions
= test_exceptions_sr
,
3938 .par
= (const uint32_t[]){
3940 XTENSA_OPTION_DEBUG
,
3942 .op_flags
= XTENSA_OP_PRIVILEGED
,
3944 .name
= "rsr.debugcause",
3945 .translate
= translate_rsr
,
3946 .test_exceptions
= test_exceptions_sr
,
3947 .par
= (const uint32_t[]){
3949 XTENSA_OPTION_DEBUG
,
3951 .op_flags
= XTENSA_OP_PRIVILEGED
,
3954 .translate
= translate_rsr
,
3955 .test_exceptions
= test_exceptions_sr
,
3956 .par
= (const uint32_t[]){
3958 XTENSA_OPTION_EXCEPTION
,
3960 .op_flags
= XTENSA_OP_PRIVILEGED
,
3962 .name
= "rsr.dtlbcfg",
3963 .translate
= translate_rsr
,
3964 .test_exceptions
= test_exceptions_sr
,
3965 .par
= (const uint32_t[]){
3969 .op_flags
= XTENSA_OP_PRIVILEGED
,
3972 .translate
= translate_rsr
,
3973 .test_exceptions
= test_exceptions_sr
,
3974 .par
= (const uint32_t[]){
3976 XTENSA_OPTION_EXCEPTION
,
3978 .op_flags
= XTENSA_OP_PRIVILEGED
,
3981 .translate
= translate_rsr
,
3982 .test_exceptions
= test_exceptions_hpi
,
3983 .par
= (const uint32_t[]){
3985 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3987 .op_flags
= XTENSA_OP_PRIVILEGED
,
3990 .translate
= translate_rsr
,
3991 .test_exceptions
= test_exceptions_hpi
,
3992 .par
= (const uint32_t[]){
3994 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3996 .op_flags
= XTENSA_OP_PRIVILEGED
,
3999 .translate
= translate_rsr
,
4000 .test_exceptions
= test_exceptions_hpi
,
4001 .par
= (const uint32_t[]){
4003 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4005 .op_flags
= XTENSA_OP_PRIVILEGED
,
4008 .translate
= translate_rsr
,
4009 .test_exceptions
= test_exceptions_hpi
,
4010 .par
= (const uint32_t[]){
4012 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4014 .op_flags
= XTENSA_OP_PRIVILEGED
,
4017 .translate
= translate_rsr
,
4018 .test_exceptions
= test_exceptions_hpi
,
4019 .par
= (const uint32_t[]){
4021 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4023 .op_flags
= XTENSA_OP_PRIVILEGED
,
4026 .translate
= translate_rsr
,
4027 .test_exceptions
= test_exceptions_hpi
,
4028 .par
= (const uint32_t[]){
4030 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4032 .op_flags
= XTENSA_OP_PRIVILEGED
,
4035 .translate
= translate_rsr
,
4036 .test_exceptions
= test_exceptions_hpi
,
4037 .par
= (const uint32_t[]){
4039 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4041 .op_flags
= XTENSA_OP_PRIVILEGED
,
4044 .translate
= translate_rsr
,
4045 .test_exceptions
= test_exceptions_hpi
,
4046 .par
= (const uint32_t[]){
4048 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4050 .op_flags
= XTENSA_OP_PRIVILEGED
,
4053 .translate
= translate_rsr
,
4054 .test_exceptions
= test_exceptions_hpi
,
4055 .par
= (const uint32_t[]){
4057 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4059 .op_flags
= XTENSA_OP_PRIVILEGED
,
4062 .translate
= translate_rsr
,
4063 .test_exceptions
= test_exceptions_hpi
,
4064 .par
= (const uint32_t[]){
4066 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4068 .op_flags
= XTENSA_OP_PRIVILEGED
,
4071 .translate
= translate_rsr
,
4072 .test_exceptions
= test_exceptions_hpi
,
4073 .par
= (const uint32_t[]){
4075 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4077 .op_flags
= XTENSA_OP_PRIVILEGED
,
4080 .translate
= translate_rsr
,
4081 .test_exceptions
= test_exceptions_hpi
,
4082 .par
= (const uint32_t[]){
4084 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4086 .op_flags
= XTENSA_OP_PRIVILEGED
,
4088 .name
= "rsr.eraccess",
4089 .translate
= translate_rsr
,
4090 .par
= (const uint32_t[]){ERACCESS
},
4091 .op_flags
= XTENSA_OP_PRIVILEGED
,
4093 .name
= "rsr.exccause",
4094 .translate
= translate_rsr
,
4095 .test_exceptions
= test_exceptions_sr
,
4096 .par
= (const uint32_t[]){
4098 XTENSA_OPTION_EXCEPTION
,
4100 .op_flags
= XTENSA_OP_PRIVILEGED
,
4102 .name
= "rsr.excsave1",
4103 .translate
= translate_rsr
,
4104 .test_exceptions
= test_exceptions_sr
,
4105 .par
= (const uint32_t[]){
4107 XTENSA_OPTION_EXCEPTION
,
4109 .op_flags
= XTENSA_OP_PRIVILEGED
,
4111 .name
= "rsr.excsave2",
4112 .translate
= translate_rsr
,
4113 .test_exceptions
= test_exceptions_hpi
,
4114 .par
= (const uint32_t[]){
4116 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4118 .op_flags
= XTENSA_OP_PRIVILEGED
,
4120 .name
= "rsr.excsave3",
4121 .translate
= translate_rsr
,
4122 .test_exceptions
= test_exceptions_hpi
,
4123 .par
= (const uint32_t[]){
4125 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4127 .op_flags
= XTENSA_OP_PRIVILEGED
,
4129 .name
= "rsr.excsave4",
4130 .translate
= translate_rsr
,
4131 .test_exceptions
= test_exceptions_hpi
,
4132 .par
= (const uint32_t[]){
4134 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4136 .op_flags
= XTENSA_OP_PRIVILEGED
,
4138 .name
= "rsr.excsave5",
4139 .translate
= translate_rsr
,
4140 .test_exceptions
= test_exceptions_hpi
,
4141 .par
= (const uint32_t[]){
4143 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4145 .op_flags
= XTENSA_OP_PRIVILEGED
,
4147 .name
= "rsr.excsave6",
4148 .translate
= translate_rsr
,
4149 .test_exceptions
= test_exceptions_hpi
,
4150 .par
= (const uint32_t[]){
4152 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4154 .op_flags
= XTENSA_OP_PRIVILEGED
,
4156 .name
= "rsr.excsave7",
4157 .translate
= translate_rsr
,
4158 .test_exceptions
= test_exceptions_hpi
,
4159 .par
= (const uint32_t[]){
4161 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4163 .op_flags
= XTENSA_OP_PRIVILEGED
,
4165 .name
= "rsr.excvaddr",
4166 .translate
= translate_rsr
,
4167 .test_exceptions
= test_exceptions_sr
,
4168 .par
= (const uint32_t[]){
4170 XTENSA_OPTION_EXCEPTION
,
4172 .op_flags
= XTENSA_OP_PRIVILEGED
,
4174 .name
= "rsr.ibreaka0",
4175 .translate
= translate_rsr
,
4176 .test_exceptions
= test_exceptions_ibreak
,
4177 .par
= (const uint32_t[]){
4179 XTENSA_OPTION_DEBUG
,
4181 .op_flags
= XTENSA_OP_PRIVILEGED
,
4183 .name
= "rsr.ibreaka1",
4184 .translate
= translate_rsr
,
4185 .test_exceptions
= test_exceptions_ibreak
,
4186 .par
= (const uint32_t[]){
4188 XTENSA_OPTION_DEBUG
,
4190 .op_flags
= XTENSA_OP_PRIVILEGED
,
4192 .name
= "rsr.ibreakenable",
4193 .translate
= translate_rsr
,
4194 .test_exceptions
= test_exceptions_sr
,
4195 .par
= (const uint32_t[]){
4197 XTENSA_OPTION_DEBUG
,
4199 .op_flags
= XTENSA_OP_PRIVILEGED
,
4201 .name
= "rsr.icount",
4202 .translate
= translate_rsr
,
4203 .test_exceptions
= test_exceptions_sr
,
4204 .par
= (const uint32_t[]){
4206 XTENSA_OPTION_DEBUG
,
4208 .op_flags
= XTENSA_OP_PRIVILEGED
,
4210 .name
= "rsr.icountlevel",
4211 .translate
= translate_rsr
,
4212 .test_exceptions
= test_exceptions_sr
,
4213 .par
= (const uint32_t[]){
4215 XTENSA_OPTION_DEBUG
,
4217 .op_flags
= XTENSA_OP_PRIVILEGED
,
4219 .name
= "rsr.intclear",
4220 .translate
= translate_rsr
,
4221 .test_exceptions
= test_exceptions_sr
,
4222 .par
= (const uint32_t[]){
4224 XTENSA_OPTION_INTERRUPT
,
4226 .op_flags
= XTENSA_OP_PRIVILEGED
,
4228 .name
= "rsr.intenable",
4229 .translate
= translate_rsr
,
4230 .test_exceptions
= test_exceptions_sr
,
4231 .par
= (const uint32_t[]){
4233 XTENSA_OPTION_INTERRUPT
,
4235 .op_flags
= XTENSA_OP_PRIVILEGED
,
4237 .name
= "rsr.interrupt",
4238 .translate
= translate_rsr_ccount
,
4239 .test_exceptions
= test_exceptions_sr
,
4240 .par
= (const uint32_t[]){
4242 XTENSA_OPTION_INTERRUPT
,
4244 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4246 .name
= "rsr.intset",
4247 .translate
= translate_rsr_ccount
,
4248 .test_exceptions
= test_exceptions_sr
,
4249 .par
= (const uint32_t[]){
4251 XTENSA_OPTION_INTERRUPT
,
4253 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4255 .name
= "rsr.itlbcfg",
4256 .translate
= translate_rsr
,
4257 .test_exceptions
= test_exceptions_sr
,
4258 .par
= (const uint32_t[]){
4262 .op_flags
= XTENSA_OP_PRIVILEGED
,
4265 .translate
= translate_rsr
,
4266 .test_exceptions
= test_exceptions_sr
,
4267 .par
= (const uint32_t[]){
4272 .name
= "rsr.lcount",
4273 .translate
= translate_rsr
,
4274 .test_exceptions
= test_exceptions_sr
,
4275 .par
= (const uint32_t[]){
4281 .translate
= translate_rsr
,
4282 .test_exceptions
= test_exceptions_sr
,
4283 .par
= (const uint32_t[]){
4288 .name
= "rsr.litbase",
4289 .translate
= translate_rsr
,
4290 .test_exceptions
= test_exceptions_sr
,
4291 .par
= (const uint32_t[]){
4293 XTENSA_OPTION_EXTENDED_L32R
,
4297 .translate
= translate_rsr
,
4298 .test_exceptions
= test_exceptions_sr
,
4299 .par
= (const uint32_t[]){
4301 XTENSA_OPTION_MAC16
,
4305 .translate
= translate_rsr
,
4306 .test_exceptions
= test_exceptions_sr
,
4307 .par
= (const uint32_t[]){
4309 XTENSA_OPTION_MAC16
,
4313 .translate
= translate_rsr
,
4314 .test_exceptions
= test_exceptions_sr
,
4315 .par
= (const uint32_t[]){
4317 XTENSA_OPTION_MAC16
,
4321 .translate
= translate_rsr
,
4322 .test_exceptions
= test_exceptions_sr
,
4323 .par
= (const uint32_t[]){
4325 XTENSA_OPTION_MAC16
,
4328 .name
= "rsr.memctl",
4329 .translate
= translate_rsr
,
4330 .par
= (const uint32_t[]){MEMCTL
},
4331 .op_flags
= XTENSA_OP_PRIVILEGED
,
4334 .translate
= translate_rsr
,
4335 .test_exceptions
= test_exceptions_sr
,
4336 .par
= (const uint32_t[]){
4338 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4340 .op_flags
= XTENSA_OP_PRIVILEGED
,
4343 .translate
= translate_rsr
,
4344 .test_exceptions
= test_exceptions_sr
,
4345 .par
= (const uint32_t[]){
4347 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4349 .op_flags
= XTENSA_OP_PRIVILEGED
,
4352 .translate
= translate_rsr
,
4353 .test_exceptions
= test_exceptions_sr
,
4354 .par
= (const uint32_t[]){
4356 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4358 .op_flags
= XTENSA_OP_PRIVILEGED
,
4360 .name
= "rsr.mesave",
4361 .translate
= translate_rsr
,
4362 .test_exceptions
= test_exceptions_sr
,
4363 .par
= (const uint32_t[]){
4365 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4367 .op_flags
= XTENSA_OP_PRIVILEGED
,
4370 .translate
= translate_rsr
,
4371 .test_exceptions
= test_exceptions_sr
,
4372 .par
= (const uint32_t[]){
4374 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4376 .op_flags
= XTENSA_OP_PRIVILEGED
,
4378 .name
= "rsr.mevaddr",
4379 .translate
= translate_rsr
,
4380 .test_exceptions
= test_exceptions_sr
,
4381 .par
= (const uint32_t[]){
4383 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4385 .op_flags
= XTENSA_OP_PRIVILEGED
,
4387 .name
= "rsr.misc0",
4388 .translate
= translate_rsr
,
4389 .test_exceptions
= test_exceptions_sr
,
4390 .par
= (const uint32_t[]){
4392 XTENSA_OPTION_MISC_SR
,
4394 .op_flags
= XTENSA_OP_PRIVILEGED
,
4396 .name
= "rsr.misc1",
4397 .translate
= translate_rsr
,
4398 .test_exceptions
= test_exceptions_sr
,
4399 .par
= (const uint32_t[]){
4401 XTENSA_OPTION_MISC_SR
,
4403 .op_flags
= XTENSA_OP_PRIVILEGED
,
4405 .name
= "rsr.misc2",
4406 .translate
= translate_rsr
,
4407 .test_exceptions
= test_exceptions_sr
,
4408 .par
= (const uint32_t[]){
4410 XTENSA_OPTION_MISC_SR
,
4412 .op_flags
= XTENSA_OP_PRIVILEGED
,
4414 .name
= "rsr.misc3",
4415 .translate
= translate_rsr
,
4416 .test_exceptions
= test_exceptions_sr
,
4417 .par
= (const uint32_t[]){
4419 XTENSA_OPTION_MISC_SR
,
4421 .op_flags
= XTENSA_OP_PRIVILEGED
,
4423 .name
= "rsr.mpucfg",
4424 .translate
= translate_rsr
,
4425 .test_exceptions
= test_exceptions_sr
,
4426 .par
= (const uint32_t[]){
4430 .op_flags
= XTENSA_OP_PRIVILEGED
,
4432 .name
= "rsr.mpuenb",
4433 .translate
= translate_rsr
,
4434 .test_exceptions
= test_exceptions_sr
,
4435 .par
= (const uint32_t[]){
4439 .op_flags
= XTENSA_OP_PRIVILEGED
,
4441 .name
= "rsr.prefctl",
4442 .translate
= translate_rsr
,
4443 .par
= (const uint32_t[]){PREFCTL
},
4446 .translate
= translate_rsr
,
4447 .test_exceptions
= test_exceptions_sr
,
4448 .par
= (const uint32_t[]){
4450 XTENSA_OPTION_PROCESSOR_ID
,
4452 .op_flags
= XTENSA_OP_PRIVILEGED
,
4455 .translate
= translate_rsr
,
4456 .test_exceptions
= test_exceptions_sr
,
4457 .par
= (const uint32_t[]){
4459 XTENSA_OPTION_EXCEPTION
,
4461 .op_flags
= XTENSA_OP_PRIVILEGED
,
4463 .name
= "rsr.ptevaddr",
4464 .translate
= translate_rsr_ptevaddr
,
4465 .test_exceptions
= test_exceptions_sr
,
4466 .par
= (const uint32_t[]){
4470 .op_flags
= XTENSA_OP_PRIVILEGED
,
4472 .name
= "rsr.rasid",
4473 .translate
= translate_rsr
,
4474 .test_exceptions
= test_exceptions_sr
,
4475 .par
= (const uint32_t[]){
4479 .op_flags
= XTENSA_OP_PRIVILEGED
,
4482 .translate
= translate_rsr
,
4483 .par
= (const uint32_t[]){SAR
},
4485 .name
= "rsr.scompare1",
4486 .translate
= translate_rsr
,
4487 .test_exceptions
= test_exceptions_sr
,
4488 .par
= (const uint32_t[]){
4490 XTENSA_OPTION_CONDITIONAL_STORE
,
4493 .name
= "rsr.vecbase",
4494 .translate
= translate_rsr
,
4495 .test_exceptions
= test_exceptions_sr
,
4496 .par
= (const uint32_t[]){
4498 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4500 .op_flags
= XTENSA_OP_PRIVILEGED
,
4502 .name
= "rsr.windowbase",
4503 .translate
= translate_rsr
,
4504 .test_exceptions
= test_exceptions_sr
,
4505 .par
= (const uint32_t[]){
4507 XTENSA_OPTION_WINDOWED_REGISTER
,
4509 .op_flags
= XTENSA_OP_PRIVILEGED
,
4511 .name
= "rsr.windowstart",
4512 .translate
= translate_rsr
,
4513 .test_exceptions
= test_exceptions_sr
,
4514 .par
= (const uint32_t[]){
4516 XTENSA_OPTION_WINDOWED_REGISTER
,
4518 .op_flags
= XTENSA_OP_PRIVILEGED
,
4521 .translate
= translate_nop
,
4523 .name
= "rur.expstate",
4524 .translate
= translate_rur
,
4525 .par
= (const uint32_t[]){EXPSTATE
},
4527 .name
= "rur.threadptr",
4528 .translate
= translate_rur
,
4529 .par
= (const uint32_t[]){THREADPTR
},
4532 .translate
= translate_ldst
,
4533 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4534 .op_flags
= XTENSA_OP_STORE
,
4537 .translate
= translate_s32c1i
,
4538 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4541 .translate
= translate_s32e
,
4542 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4545 .translate
= translate_s32ex
,
4546 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4548 .name
= (const char * const[]) {
4549 "s32i", "s32i.n", "s32nb", NULL
,
4551 .translate
= translate_ldst
,
4552 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4553 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4556 .translate
= translate_ldst
,
4557 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, true},
4558 .op_flags
= XTENSA_OP_STORE
,
4561 .translate
= translate_ldst
,
4562 .par
= (const uint32_t[]){MO_UB
, false, true},
4563 .op_flags
= XTENSA_OP_STORE
,
4566 .translate
= translate_salt
,
4567 .par
= (const uint32_t[]){TCG_COND_LT
},
4570 .translate
= translate_salt
,
4571 .par
= (const uint32_t[]){TCG_COND_LTU
},
4574 .translate
= translate_nop
,
4575 .op_flags
= XTENSA_OP_PRIVILEGED
,
4578 .translate
= translate_nop
,
4579 .op_flags
= XTENSA_OP_PRIVILEGED
,
4581 .name
= "setb_expstate",
4582 .translate
= translate_setb_expstate
,
4585 .translate
= translate_sext
,
4588 .translate
= translate_nop
,
4589 .op_flags
= XTENSA_OP_PRIVILEGED
,
4592 .translate
= translate_nop
,
4593 .op_flags
= XTENSA_OP_PRIVILEGED
,
4596 .translate
= translate_simcall
,
4597 .test_exceptions
= test_exceptions_simcall
,
4598 .op_flags
= XTENSA_OP_PRIVILEGED
,
4601 .translate
= translate_sll
,
4604 .translate
= translate_slli
,
4607 .translate
= translate_sra
,
4610 .translate
= translate_srai
,
4613 .translate
= translate_src
,
4616 .translate
= translate_srl
,
4619 .translate
= translate_srli
,
4622 .translate
= translate_ssa8b
,
4625 .translate
= translate_ssa8l
,
4628 .translate
= translate_ssai
,
4631 .translate
= translate_ssl
,
4634 .translate
= translate_ssr
,
4637 .translate
= translate_sub
,
4640 .translate
= translate_subx
,
4641 .par
= (const uint32_t[]){1},
4644 .translate
= translate_subx
,
4645 .par
= (const uint32_t[]){2},
4648 .translate
= translate_subx
,
4649 .par
= (const uint32_t[]){3},
4652 .op_flags
= XTENSA_OP_SYSCALL
,
4654 .name
= "umul.aa.hh",
4655 .translate
= translate_mac16
,
4656 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4658 .name
= "umul.aa.hl",
4659 .translate
= translate_mac16
,
4660 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4662 .name
= "umul.aa.lh",
4663 .translate
= translate_mac16
,
4664 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4666 .name
= "umul.aa.ll",
4667 .translate
= translate_mac16
,
4668 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4671 .translate
= translate_waiti
,
4672 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4675 .translate
= translate_wtlb
,
4676 .par
= (const uint32_t[]){true},
4677 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4680 .translate
= translate_wer
,
4681 .op_flags
= XTENSA_OP_PRIVILEGED
,
4684 .translate
= translate_wtlb
,
4685 .par
= (const uint32_t[]){false},
4686 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4689 .translate
= translate_wptlb
,
4690 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4692 .name
= "wrmsk_expstate",
4693 .translate
= translate_wrmsk_expstate
,
4696 .op_flags
= XTENSA_OP_ILL
,
4699 .op_flags
= XTENSA_OP_ILL
,
4701 .name
= "wsr.acchi",
4702 .translate
= translate_wsr_acchi
,
4703 .test_exceptions
= test_exceptions_sr
,
4704 .par
= (const uint32_t[]){
4706 XTENSA_OPTION_MAC16
,
4709 .name
= "wsr.acclo",
4710 .translate
= translate_wsr
,
4711 .test_exceptions
= test_exceptions_sr
,
4712 .par
= (const uint32_t[]){
4714 XTENSA_OPTION_MAC16
,
4717 .name
= "wsr.atomctl",
4718 .translate
= translate_wsr_mask
,
4719 .test_exceptions
= test_exceptions_sr
,
4720 .par
= (const uint32_t[]){
4722 XTENSA_OPTION_ATOMCTL
,
4725 .op_flags
= XTENSA_OP_PRIVILEGED
,
4728 .translate
= translate_wsr_mask
,
4729 .test_exceptions
= test_exceptions_sr
,
4730 .par
= (const uint32_t[]){
4732 XTENSA_OPTION_BOOLEAN
,
4736 .name
= "wsr.cacheadrdis",
4737 .translate
= translate_wsr_mask
,
4738 .test_exceptions
= test_exceptions_sr
,
4739 .par
= (const uint32_t[]){
4744 .op_flags
= XTENSA_OP_PRIVILEGED
,
4746 .name
= "wsr.cacheattr",
4747 .translate
= translate_wsr
,
4748 .test_exceptions
= test_exceptions_sr
,
4749 .par
= (const uint32_t[]){
4751 XTENSA_OPTION_CACHEATTR
,
4753 .op_flags
= XTENSA_OP_PRIVILEGED
,
4755 .name
= "wsr.ccompare0",
4756 .translate
= translate_wsr_ccompare
,
4757 .test_exceptions
= test_exceptions_ccompare
,
4758 .par
= (const uint32_t[]){
4760 XTENSA_OPTION_TIMER_INTERRUPT
,
4762 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4764 .name
= "wsr.ccompare1",
4765 .translate
= translate_wsr_ccompare
,
4766 .test_exceptions
= test_exceptions_ccompare
,
4767 .par
= (const uint32_t[]){
4769 XTENSA_OPTION_TIMER_INTERRUPT
,
4771 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4773 .name
= "wsr.ccompare2",
4774 .translate
= translate_wsr_ccompare
,
4775 .test_exceptions
= test_exceptions_ccompare
,
4776 .par
= (const uint32_t[]){
4778 XTENSA_OPTION_TIMER_INTERRUPT
,
4780 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4782 .name
= "wsr.ccount",
4783 .translate
= translate_wsr_ccount
,
4784 .test_exceptions
= test_exceptions_sr
,
4785 .par
= (const uint32_t[]){
4787 XTENSA_OPTION_TIMER_INTERRUPT
,
4789 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4791 .name
= "wsr.configid0",
4792 .op_flags
= XTENSA_OP_ILL
,
4794 .name
= "wsr.configid1",
4795 .op_flags
= XTENSA_OP_ILL
,
4797 .name
= "wsr.cpenable",
4798 .translate
= translate_wsr_mask
,
4799 .test_exceptions
= test_exceptions_sr
,
4800 .par
= (const uint32_t[]){
4802 XTENSA_OPTION_COPROCESSOR
,
4805 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4807 .name
= "wsr.dbreaka0",
4808 .translate
= translate_wsr_dbreaka
,
4809 .test_exceptions
= test_exceptions_dbreak
,
4810 .par
= (const uint32_t[]){
4812 XTENSA_OPTION_DEBUG
,
4814 .op_flags
= XTENSA_OP_PRIVILEGED
,
4816 .name
= "wsr.dbreaka1",
4817 .translate
= translate_wsr_dbreaka
,
4818 .test_exceptions
= test_exceptions_dbreak
,
4819 .par
= (const uint32_t[]){
4821 XTENSA_OPTION_DEBUG
,
4823 .op_flags
= XTENSA_OP_PRIVILEGED
,
4825 .name
= "wsr.dbreakc0",
4826 .translate
= translate_wsr_dbreakc
,
4827 .test_exceptions
= test_exceptions_dbreak
,
4828 .par
= (const uint32_t[]){
4830 XTENSA_OPTION_DEBUG
,
4832 .op_flags
= XTENSA_OP_PRIVILEGED
,
4834 .name
= "wsr.dbreakc1",
4835 .translate
= translate_wsr_dbreakc
,
4836 .test_exceptions
= test_exceptions_dbreak
,
4837 .par
= (const uint32_t[]){
4839 XTENSA_OPTION_DEBUG
,
4841 .op_flags
= XTENSA_OP_PRIVILEGED
,
4844 .translate
= translate_wsr
,
4845 .test_exceptions
= test_exceptions_sr
,
4846 .par
= (const uint32_t[]){
4848 XTENSA_OPTION_DEBUG
,
4850 .op_flags
= XTENSA_OP_PRIVILEGED
,
4852 .name
= "wsr.debugcause",
4853 .op_flags
= XTENSA_OP_ILL
,
4856 .translate
= translate_wsr
,
4857 .test_exceptions
= test_exceptions_sr
,
4858 .par
= (const uint32_t[]){
4860 XTENSA_OPTION_EXCEPTION
,
4862 .op_flags
= XTENSA_OP_PRIVILEGED
,
4864 .name
= "wsr.dtlbcfg",
4865 .translate
= translate_wsr_mask
,
4866 .test_exceptions
= test_exceptions_sr
,
4867 .par
= (const uint32_t[]){
4872 .op_flags
= XTENSA_OP_PRIVILEGED
,
4875 .translate
= translate_wsr
,
4876 .test_exceptions
= test_exceptions_sr
,
4877 .par
= (const uint32_t[]){
4879 XTENSA_OPTION_EXCEPTION
,
4881 .op_flags
= XTENSA_OP_PRIVILEGED
,
4884 .translate
= translate_wsr
,
4885 .test_exceptions
= test_exceptions_hpi
,
4886 .par
= (const uint32_t[]){
4888 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4890 .op_flags
= XTENSA_OP_PRIVILEGED
,
4893 .translate
= translate_wsr
,
4894 .test_exceptions
= test_exceptions_hpi
,
4895 .par
= (const uint32_t[]){
4897 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4899 .op_flags
= XTENSA_OP_PRIVILEGED
,
4902 .translate
= translate_wsr
,
4903 .test_exceptions
= test_exceptions_hpi
,
4904 .par
= (const uint32_t[]){
4906 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4908 .op_flags
= XTENSA_OP_PRIVILEGED
,
4911 .translate
= translate_wsr
,
4912 .test_exceptions
= test_exceptions_hpi
,
4913 .par
= (const uint32_t[]){
4915 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4917 .op_flags
= XTENSA_OP_PRIVILEGED
,
4920 .translate
= translate_wsr
,
4921 .test_exceptions
= test_exceptions_hpi
,
4922 .par
= (const uint32_t[]){
4924 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4926 .op_flags
= XTENSA_OP_PRIVILEGED
,
4929 .translate
= translate_wsr
,
4930 .test_exceptions
= test_exceptions_hpi
,
4931 .par
= (const uint32_t[]){
4933 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4935 .op_flags
= XTENSA_OP_PRIVILEGED
,
4938 .translate
= translate_wsr
,
4939 .test_exceptions
= test_exceptions_hpi
,
4940 .par
= (const uint32_t[]){
4942 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4944 .op_flags
= XTENSA_OP_PRIVILEGED
,
4947 .translate
= translate_wsr
,
4948 .test_exceptions
= test_exceptions_hpi
,
4949 .par
= (const uint32_t[]){
4951 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4953 .op_flags
= XTENSA_OP_PRIVILEGED
,
4956 .translate
= translate_wsr
,
4957 .test_exceptions
= test_exceptions_hpi
,
4958 .par
= (const uint32_t[]){
4960 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4962 .op_flags
= XTENSA_OP_PRIVILEGED
,
4965 .translate
= translate_wsr
,
4966 .test_exceptions
= test_exceptions_hpi
,
4967 .par
= (const uint32_t[]){
4969 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4971 .op_flags
= XTENSA_OP_PRIVILEGED
,
4974 .translate
= translate_wsr
,
4975 .test_exceptions
= test_exceptions_hpi
,
4976 .par
= (const uint32_t[]){
4978 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4980 .op_flags
= XTENSA_OP_PRIVILEGED
,
4983 .translate
= translate_wsr
,
4984 .test_exceptions
= test_exceptions_hpi
,
4985 .par
= (const uint32_t[]){
4987 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4989 .op_flags
= XTENSA_OP_PRIVILEGED
,
4991 .name
= "wsr.eraccess",
4992 .translate
= translate_wsr_mask
,
4993 .par
= (const uint32_t[]){
4998 .op_flags
= XTENSA_OP_PRIVILEGED
,
5000 .name
= "wsr.exccause",
5001 .translate
= translate_wsr
,
5002 .test_exceptions
= test_exceptions_sr
,
5003 .par
= (const uint32_t[]){
5005 XTENSA_OPTION_EXCEPTION
,
5007 .op_flags
= XTENSA_OP_PRIVILEGED
,
5009 .name
= "wsr.excsave1",
5010 .translate
= translate_wsr
,
5011 .test_exceptions
= test_exceptions_sr
,
5012 .par
= (const uint32_t[]){
5014 XTENSA_OPTION_EXCEPTION
,
5016 .op_flags
= XTENSA_OP_PRIVILEGED
,
5018 .name
= "wsr.excsave2",
5019 .translate
= translate_wsr
,
5020 .test_exceptions
= test_exceptions_hpi
,
5021 .par
= (const uint32_t[]){
5023 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5025 .op_flags
= XTENSA_OP_PRIVILEGED
,
5027 .name
= "wsr.excsave3",
5028 .translate
= translate_wsr
,
5029 .test_exceptions
= test_exceptions_hpi
,
5030 .par
= (const uint32_t[]){
5032 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5034 .op_flags
= XTENSA_OP_PRIVILEGED
,
5036 .name
= "wsr.excsave4",
5037 .translate
= translate_wsr
,
5038 .test_exceptions
= test_exceptions_hpi
,
5039 .par
= (const uint32_t[]){
5041 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5043 .op_flags
= XTENSA_OP_PRIVILEGED
,
5045 .name
= "wsr.excsave5",
5046 .translate
= translate_wsr
,
5047 .test_exceptions
= test_exceptions_hpi
,
5048 .par
= (const uint32_t[]){
5050 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5052 .op_flags
= XTENSA_OP_PRIVILEGED
,
5054 .name
= "wsr.excsave6",
5055 .translate
= translate_wsr
,
5056 .test_exceptions
= test_exceptions_hpi
,
5057 .par
= (const uint32_t[]){
5059 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5061 .op_flags
= XTENSA_OP_PRIVILEGED
,
5063 .name
= "wsr.excsave7",
5064 .translate
= translate_wsr
,
5065 .test_exceptions
= test_exceptions_hpi
,
5066 .par
= (const uint32_t[]){
5068 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5070 .op_flags
= XTENSA_OP_PRIVILEGED
,
5072 .name
= "wsr.excvaddr",
5073 .translate
= translate_wsr
,
5074 .test_exceptions
= test_exceptions_sr
,
5075 .par
= (const uint32_t[]){
5077 XTENSA_OPTION_EXCEPTION
,
5079 .op_flags
= XTENSA_OP_PRIVILEGED
,
5081 .name
= "wsr.ibreaka0",
5082 .translate
= translate_wsr_ibreaka
,
5083 .test_exceptions
= test_exceptions_ibreak
,
5084 .par
= (const uint32_t[]){
5086 XTENSA_OPTION_DEBUG
,
5088 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5090 .name
= "wsr.ibreaka1",
5091 .translate
= translate_wsr_ibreaka
,
5092 .test_exceptions
= test_exceptions_ibreak
,
5093 .par
= (const uint32_t[]){
5095 XTENSA_OPTION_DEBUG
,
5097 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5099 .name
= "wsr.ibreakenable",
5100 .translate
= translate_wsr_ibreakenable
,
5101 .test_exceptions
= test_exceptions_sr
,
5102 .par
= (const uint32_t[]){
5104 XTENSA_OPTION_DEBUG
,
5106 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5108 .name
= "wsr.icount",
5109 .translate
= translate_wsr_icount
,
5110 .test_exceptions
= test_exceptions_sr
,
5111 .par
= (const uint32_t[]){
5113 XTENSA_OPTION_DEBUG
,
5115 .op_flags
= XTENSA_OP_PRIVILEGED
,
5117 .name
= "wsr.icountlevel",
5118 .translate
= translate_wsr_mask
,
5119 .test_exceptions
= test_exceptions_sr
,
5120 .par
= (const uint32_t[]){
5122 XTENSA_OPTION_DEBUG
,
5125 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5127 .name
= "wsr.intclear",
5128 .translate
= translate_wsr_intclear
,
5129 .test_exceptions
= test_exceptions_sr
,
5130 .par
= (const uint32_t[]){
5132 XTENSA_OPTION_INTERRUPT
,
5135 XTENSA_OP_PRIVILEGED
|
5136 XTENSA_OP_EXIT_TB_0
|
5137 XTENSA_OP_CHECK_INTERRUPTS
,
5139 .name
= "wsr.intenable",
5140 .translate
= translate_wsr
,
5141 .test_exceptions
= test_exceptions_sr
,
5142 .par
= (const uint32_t[]){
5144 XTENSA_OPTION_INTERRUPT
,
5147 XTENSA_OP_PRIVILEGED
|
5148 XTENSA_OP_EXIT_TB_0
|
5149 XTENSA_OP_CHECK_INTERRUPTS
,
5151 .name
= "wsr.interrupt",
5152 .translate
= translate_wsr
,
5153 .test_exceptions
= test_exceptions_sr
,
5154 .par
= (const uint32_t[]){
5156 XTENSA_OPTION_INTERRUPT
,
5159 XTENSA_OP_PRIVILEGED
|
5160 XTENSA_OP_EXIT_TB_0
|
5161 XTENSA_OP_CHECK_INTERRUPTS
,
5163 .name
= "wsr.intset",
5164 .translate
= translate_wsr_intset
,
5165 .test_exceptions
= test_exceptions_sr
,
5166 .par
= (const uint32_t[]){
5168 XTENSA_OPTION_INTERRUPT
,
5171 XTENSA_OP_PRIVILEGED
|
5172 XTENSA_OP_EXIT_TB_0
|
5173 XTENSA_OP_CHECK_INTERRUPTS
,
5175 .name
= "wsr.itlbcfg",
5176 .translate
= translate_wsr_mask
,
5177 .test_exceptions
= test_exceptions_sr
,
5178 .par
= (const uint32_t[]){
5183 .op_flags
= XTENSA_OP_PRIVILEGED
,
5186 .translate
= translate_wsr
,
5187 .test_exceptions
= test_exceptions_sr
,
5188 .par
= (const uint32_t[]){
5192 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5194 .name
= "wsr.lcount",
5195 .translate
= translate_wsr
,
5196 .test_exceptions
= test_exceptions_sr
,
5197 .par
= (const uint32_t[]){
5203 .translate
= translate_wsr
,
5204 .test_exceptions
= test_exceptions_sr
,
5205 .par
= (const uint32_t[]){
5209 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5211 .name
= "wsr.litbase",
5212 .translate
= translate_wsr_mask
,
5213 .test_exceptions
= test_exceptions_sr
,
5214 .par
= (const uint32_t[]){
5216 XTENSA_OPTION_EXTENDED_L32R
,
5219 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5222 .translate
= translate_wsr
,
5223 .test_exceptions
= test_exceptions_sr
,
5224 .par
= (const uint32_t[]){
5226 XTENSA_OPTION_MAC16
,
5230 .translate
= translate_wsr
,
5231 .test_exceptions
= test_exceptions_sr
,
5232 .par
= (const uint32_t[]){
5234 XTENSA_OPTION_MAC16
,
5238 .translate
= translate_wsr
,
5239 .test_exceptions
= test_exceptions_sr
,
5240 .par
= (const uint32_t[]){
5242 XTENSA_OPTION_MAC16
,
5246 .translate
= translate_wsr
,
5247 .test_exceptions
= test_exceptions_sr
,
5248 .par
= (const uint32_t[]){
5250 XTENSA_OPTION_MAC16
,
5253 .name
= "wsr.memctl",
5254 .translate
= translate_wsr_memctl
,
5255 .par
= (const uint32_t[]){MEMCTL
},
5256 .op_flags
= XTENSA_OP_PRIVILEGED
,
5259 .translate
= translate_wsr
,
5260 .test_exceptions
= test_exceptions_sr
,
5261 .par
= (const uint32_t[]){
5263 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5265 .op_flags
= XTENSA_OP_PRIVILEGED
,
5268 .translate
= translate_wsr
,
5269 .test_exceptions
= test_exceptions_sr
,
5270 .par
= (const uint32_t[]){
5272 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5274 .op_flags
= XTENSA_OP_PRIVILEGED
,
5277 .translate
= translate_wsr
,
5278 .test_exceptions
= test_exceptions_sr
,
5279 .par
= (const uint32_t[]){
5281 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5283 .op_flags
= XTENSA_OP_PRIVILEGED
,
5285 .name
= "wsr.mesave",
5286 .translate
= translate_wsr
,
5287 .test_exceptions
= test_exceptions_sr
,
5288 .par
= (const uint32_t[]){
5290 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5292 .op_flags
= XTENSA_OP_PRIVILEGED
,
5295 .translate
= translate_wsr
,
5296 .test_exceptions
= test_exceptions_sr
,
5297 .par
= (const uint32_t[]){
5299 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5301 .op_flags
= XTENSA_OP_PRIVILEGED
,
5303 .name
= "wsr.mevaddr",
5304 .translate
= translate_wsr
,
5305 .test_exceptions
= test_exceptions_sr
,
5306 .par
= (const uint32_t[]){
5308 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5310 .op_flags
= XTENSA_OP_PRIVILEGED
,
5312 .name
= "wsr.misc0",
5313 .translate
= translate_wsr
,
5314 .test_exceptions
= test_exceptions_sr
,
5315 .par
= (const uint32_t[]){
5317 XTENSA_OPTION_MISC_SR
,
5319 .op_flags
= XTENSA_OP_PRIVILEGED
,
5321 .name
= "wsr.misc1",
5322 .translate
= translate_wsr
,
5323 .test_exceptions
= test_exceptions_sr
,
5324 .par
= (const uint32_t[]){
5326 XTENSA_OPTION_MISC_SR
,
5328 .op_flags
= XTENSA_OP_PRIVILEGED
,
5330 .name
= "wsr.misc2",
5331 .translate
= translate_wsr
,
5332 .test_exceptions
= test_exceptions_sr
,
5333 .par
= (const uint32_t[]){
5335 XTENSA_OPTION_MISC_SR
,
5337 .op_flags
= XTENSA_OP_PRIVILEGED
,
5339 .name
= "wsr.misc3",
5340 .translate
= translate_wsr
,
5341 .test_exceptions
= test_exceptions_sr
,
5342 .par
= (const uint32_t[]){
5344 XTENSA_OPTION_MISC_SR
,
5346 .op_flags
= XTENSA_OP_PRIVILEGED
,
5349 .translate
= translate_wsr
,
5350 .test_exceptions
= test_exceptions_sr
,
5351 .par
= (const uint32_t[]){
5353 XTENSA_OPTION_TRACE_PORT
,
5355 .op_flags
= XTENSA_OP_PRIVILEGED
,
5357 .name
= "wsr.mpuenb",
5358 .translate
= translate_wsr_mpuenb
,
5359 .test_exceptions
= test_exceptions_sr
,
5360 .par
= (const uint32_t[]){
5364 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5366 .name
= "wsr.prefctl",
5367 .translate
= translate_wsr
,
5368 .par
= (const uint32_t[]){PREFCTL
},
5371 .op_flags
= XTENSA_OP_ILL
,
5374 .translate
= translate_wsr_ps
,
5375 .test_exceptions
= test_exceptions_sr
,
5376 .par
= (const uint32_t[]){
5378 XTENSA_OPTION_EXCEPTION
,
5381 XTENSA_OP_PRIVILEGED
|
5382 XTENSA_OP_EXIT_TB_M1
|
5383 XTENSA_OP_CHECK_INTERRUPTS
,
5385 .name
= "wsr.ptevaddr",
5386 .translate
= translate_wsr_mask
,
5387 .test_exceptions
= test_exceptions_sr
,
5388 .par
= (const uint32_t[]){
5393 .op_flags
= XTENSA_OP_PRIVILEGED
,
5395 .name
= "wsr.rasid",
5396 .translate
= translate_wsr_rasid
,
5397 .test_exceptions
= test_exceptions_sr
,
5398 .par
= (const uint32_t[]){
5402 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5405 .translate
= translate_wsr_sar
,
5406 .par
= (const uint32_t[]){SAR
},
5408 .name
= "wsr.scompare1",
5409 .translate
= translate_wsr
,
5410 .test_exceptions
= test_exceptions_sr
,
5411 .par
= (const uint32_t[]){
5413 XTENSA_OPTION_CONDITIONAL_STORE
,
5416 .name
= "wsr.vecbase",
5417 .translate
= translate_wsr
,
5418 .test_exceptions
= test_exceptions_sr
,
5419 .par
= (const uint32_t[]){
5421 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5423 .op_flags
= XTENSA_OP_PRIVILEGED
,
5425 .name
= "wsr.windowbase",
5426 .translate
= translate_wsr_windowbase
,
5427 .test_exceptions
= test_exceptions_sr
,
5428 .par
= (const uint32_t[]){
5430 XTENSA_OPTION_WINDOWED_REGISTER
,
5432 .op_flags
= XTENSA_OP_PRIVILEGED
|
5433 XTENSA_OP_EXIT_TB_M1
|
5434 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5436 .name
= "wsr.windowstart",
5437 .translate
= translate_wsr_windowstart
,
5438 .test_exceptions
= test_exceptions_sr
,
5439 .par
= (const uint32_t[]){
5441 XTENSA_OPTION_WINDOWED_REGISTER
,
5443 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5445 .name
= "wur.expstate",
5446 .translate
= translate_wur
,
5447 .par
= (const uint32_t[]){EXPSTATE
},
5449 .name
= "wur.threadptr",
5450 .translate
= translate_wur
,
5451 .par
= (const uint32_t[]){THREADPTR
},
5454 .translate
= translate_xor
,
5457 .translate
= translate_boolean
,
5458 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5461 .op_flags
= XTENSA_OP_ILL
,
5464 .op_flags
= XTENSA_OP_ILL
,
5466 .name
= "xsr.acchi",
5467 .translate
= translate_xsr_acchi
,
5468 .test_exceptions
= test_exceptions_sr
,
5469 .par
= (const uint32_t[]){
5471 XTENSA_OPTION_MAC16
,
5474 .name
= "xsr.acclo",
5475 .translate
= translate_xsr
,
5476 .test_exceptions
= test_exceptions_sr
,
5477 .par
= (const uint32_t[]){
5479 XTENSA_OPTION_MAC16
,
5482 .name
= "xsr.atomctl",
5483 .translate
= translate_xsr_mask
,
5484 .test_exceptions
= test_exceptions_sr
,
5485 .par
= (const uint32_t[]){
5487 XTENSA_OPTION_ATOMCTL
,
5490 .op_flags
= XTENSA_OP_PRIVILEGED
,
5493 .translate
= translate_xsr_mask
,
5494 .test_exceptions
= test_exceptions_sr
,
5495 .par
= (const uint32_t[]){
5497 XTENSA_OPTION_BOOLEAN
,
5501 .name
= "xsr.cacheadrdis",
5502 .translate
= translate_xsr_mask
,
5503 .test_exceptions
= test_exceptions_sr
,
5504 .par
= (const uint32_t[]){
5509 .op_flags
= XTENSA_OP_PRIVILEGED
,
5511 .name
= "xsr.cacheattr",
5512 .translate
= translate_xsr
,
5513 .test_exceptions
= test_exceptions_sr
,
5514 .par
= (const uint32_t[]){
5516 XTENSA_OPTION_CACHEATTR
,
5518 .op_flags
= XTENSA_OP_PRIVILEGED
,
5520 .name
= "xsr.ccompare0",
5521 .translate
= translate_xsr_ccompare
,
5522 .test_exceptions
= test_exceptions_ccompare
,
5523 .par
= (const uint32_t[]){
5525 XTENSA_OPTION_TIMER_INTERRUPT
,
5527 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5529 .name
= "xsr.ccompare1",
5530 .translate
= translate_xsr_ccompare
,
5531 .test_exceptions
= test_exceptions_ccompare
,
5532 .par
= (const uint32_t[]){
5534 XTENSA_OPTION_TIMER_INTERRUPT
,
5536 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5538 .name
= "xsr.ccompare2",
5539 .translate
= translate_xsr_ccompare
,
5540 .test_exceptions
= test_exceptions_ccompare
,
5541 .par
= (const uint32_t[]){
5543 XTENSA_OPTION_TIMER_INTERRUPT
,
5545 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5547 .name
= "xsr.ccount",
5548 .translate
= translate_xsr_ccount
,
5549 .test_exceptions
= test_exceptions_sr
,
5550 .par
= (const uint32_t[]){
5552 XTENSA_OPTION_TIMER_INTERRUPT
,
5554 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5556 .name
= "xsr.configid0",
5557 .op_flags
= XTENSA_OP_ILL
,
5559 .name
= "xsr.configid1",
5560 .op_flags
= XTENSA_OP_ILL
,
5562 .name
= "xsr.cpenable",
5563 .translate
= translate_xsr_mask
,
5564 .test_exceptions
= test_exceptions_sr
,
5565 .par
= (const uint32_t[]){
5567 XTENSA_OPTION_COPROCESSOR
,
5570 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5572 .name
= "xsr.dbreaka0",
5573 .translate
= translate_xsr_dbreaka
,
5574 .test_exceptions
= test_exceptions_dbreak
,
5575 .par
= (const uint32_t[]){
5577 XTENSA_OPTION_DEBUG
,
5579 .op_flags
= XTENSA_OP_PRIVILEGED
,
5581 .name
= "xsr.dbreaka1",
5582 .translate
= translate_xsr_dbreaka
,
5583 .test_exceptions
= test_exceptions_dbreak
,
5584 .par
= (const uint32_t[]){
5586 XTENSA_OPTION_DEBUG
,
5588 .op_flags
= XTENSA_OP_PRIVILEGED
,
5590 .name
= "xsr.dbreakc0",
5591 .translate
= translate_xsr_dbreakc
,
5592 .test_exceptions
= test_exceptions_dbreak
,
5593 .par
= (const uint32_t[]){
5595 XTENSA_OPTION_DEBUG
,
5597 .op_flags
= XTENSA_OP_PRIVILEGED
,
5599 .name
= "xsr.dbreakc1",
5600 .translate
= translate_xsr_dbreakc
,
5601 .test_exceptions
= test_exceptions_dbreak
,
5602 .par
= (const uint32_t[]){
5604 XTENSA_OPTION_DEBUG
,
5606 .op_flags
= XTENSA_OP_PRIVILEGED
,
5609 .translate
= translate_xsr
,
5610 .test_exceptions
= test_exceptions_sr
,
5611 .par
= (const uint32_t[]){
5613 XTENSA_OPTION_DEBUG
,
5615 .op_flags
= XTENSA_OP_PRIVILEGED
,
5617 .name
= "xsr.debugcause",
5618 .op_flags
= XTENSA_OP_ILL
,
5621 .translate
= translate_xsr
,
5622 .test_exceptions
= test_exceptions_sr
,
5623 .par
= (const uint32_t[]){
5625 XTENSA_OPTION_EXCEPTION
,
5627 .op_flags
= XTENSA_OP_PRIVILEGED
,
5629 .name
= "xsr.dtlbcfg",
5630 .translate
= translate_xsr_mask
,
5631 .test_exceptions
= test_exceptions_sr
,
5632 .par
= (const uint32_t[]){
5637 .op_flags
= XTENSA_OP_PRIVILEGED
,
5640 .translate
= translate_xsr
,
5641 .test_exceptions
= test_exceptions_sr
,
5642 .par
= (const uint32_t[]){
5644 XTENSA_OPTION_EXCEPTION
,
5646 .op_flags
= XTENSA_OP_PRIVILEGED
,
5649 .translate
= translate_xsr
,
5650 .test_exceptions
= test_exceptions_hpi
,
5651 .par
= (const uint32_t[]){
5653 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5655 .op_flags
= XTENSA_OP_PRIVILEGED
,
5658 .translate
= translate_xsr
,
5659 .test_exceptions
= test_exceptions_hpi
,
5660 .par
= (const uint32_t[]){
5662 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5664 .op_flags
= XTENSA_OP_PRIVILEGED
,
5667 .translate
= translate_xsr
,
5668 .test_exceptions
= test_exceptions_hpi
,
5669 .par
= (const uint32_t[]){
5671 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5673 .op_flags
= XTENSA_OP_PRIVILEGED
,
5676 .translate
= translate_xsr
,
5677 .test_exceptions
= test_exceptions_hpi
,
5678 .par
= (const uint32_t[]){
5680 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5682 .op_flags
= XTENSA_OP_PRIVILEGED
,
5685 .translate
= translate_xsr
,
5686 .test_exceptions
= test_exceptions_hpi
,
5687 .par
= (const uint32_t[]){
5689 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5691 .op_flags
= XTENSA_OP_PRIVILEGED
,
5694 .translate
= translate_xsr
,
5695 .test_exceptions
= test_exceptions_hpi
,
5696 .par
= (const uint32_t[]){
5698 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5700 .op_flags
= XTENSA_OP_PRIVILEGED
,
5703 .translate
= translate_xsr
,
5704 .test_exceptions
= test_exceptions_hpi
,
5705 .par
= (const uint32_t[]){
5707 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5709 .op_flags
= XTENSA_OP_PRIVILEGED
,
5712 .translate
= translate_xsr
,
5713 .test_exceptions
= test_exceptions_hpi
,
5714 .par
= (const uint32_t[]){
5716 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5718 .op_flags
= XTENSA_OP_PRIVILEGED
,
5721 .translate
= translate_xsr
,
5722 .test_exceptions
= test_exceptions_hpi
,
5723 .par
= (const uint32_t[]){
5725 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5727 .op_flags
= XTENSA_OP_PRIVILEGED
,
5730 .translate
= translate_xsr
,
5731 .test_exceptions
= test_exceptions_hpi
,
5732 .par
= (const uint32_t[]){
5734 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5736 .op_flags
= XTENSA_OP_PRIVILEGED
,
5739 .translate
= translate_xsr
,
5740 .test_exceptions
= test_exceptions_hpi
,
5741 .par
= (const uint32_t[]){
5743 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5745 .op_flags
= XTENSA_OP_PRIVILEGED
,
5748 .translate
= translate_xsr
,
5749 .test_exceptions
= test_exceptions_hpi
,
5750 .par
= (const uint32_t[]){
5752 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5754 .op_flags
= XTENSA_OP_PRIVILEGED
,
5756 .name
= "xsr.eraccess",
5757 .translate
= translate_xsr_mask
,
5758 .par
= (const uint32_t[]){
5763 .op_flags
= XTENSA_OP_PRIVILEGED
,
5765 .name
= "xsr.exccause",
5766 .translate
= translate_xsr
,
5767 .test_exceptions
= test_exceptions_sr
,
5768 .par
= (const uint32_t[]){
5770 XTENSA_OPTION_EXCEPTION
,
5772 .op_flags
= XTENSA_OP_PRIVILEGED
,
5774 .name
= "xsr.excsave1",
5775 .translate
= translate_xsr
,
5776 .test_exceptions
= test_exceptions_sr
,
5777 .par
= (const uint32_t[]){
5779 XTENSA_OPTION_EXCEPTION
,
5781 .op_flags
= XTENSA_OP_PRIVILEGED
,
5783 .name
= "xsr.excsave2",
5784 .translate
= translate_xsr
,
5785 .test_exceptions
= test_exceptions_hpi
,
5786 .par
= (const uint32_t[]){
5788 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5790 .op_flags
= XTENSA_OP_PRIVILEGED
,
5792 .name
= "xsr.excsave3",
5793 .translate
= translate_xsr
,
5794 .test_exceptions
= test_exceptions_hpi
,
5795 .par
= (const uint32_t[]){
5797 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5799 .op_flags
= XTENSA_OP_PRIVILEGED
,
5801 .name
= "xsr.excsave4",
5802 .translate
= translate_xsr
,
5803 .test_exceptions
= test_exceptions_hpi
,
5804 .par
= (const uint32_t[]){
5806 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5808 .op_flags
= XTENSA_OP_PRIVILEGED
,
5810 .name
= "xsr.excsave5",
5811 .translate
= translate_xsr
,
5812 .test_exceptions
= test_exceptions_hpi
,
5813 .par
= (const uint32_t[]){
5815 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5817 .op_flags
= XTENSA_OP_PRIVILEGED
,
5819 .name
= "xsr.excsave6",
5820 .translate
= translate_xsr
,
5821 .test_exceptions
= test_exceptions_hpi
,
5822 .par
= (const uint32_t[]){
5824 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5826 .op_flags
= XTENSA_OP_PRIVILEGED
,
5828 .name
= "xsr.excsave7",
5829 .translate
= translate_xsr
,
5830 .test_exceptions
= test_exceptions_hpi
,
5831 .par
= (const uint32_t[]){
5833 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5835 .op_flags
= XTENSA_OP_PRIVILEGED
,
5837 .name
= "xsr.excvaddr",
5838 .translate
= translate_xsr
,
5839 .test_exceptions
= test_exceptions_sr
,
5840 .par
= (const uint32_t[]){
5842 XTENSA_OPTION_EXCEPTION
,
5844 .op_flags
= XTENSA_OP_PRIVILEGED
,
5846 .name
= "xsr.ibreaka0",
5847 .translate
= translate_xsr_ibreaka
,
5848 .test_exceptions
= test_exceptions_ibreak
,
5849 .par
= (const uint32_t[]){
5851 XTENSA_OPTION_DEBUG
,
5853 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5855 .name
= "xsr.ibreaka1",
5856 .translate
= translate_xsr_ibreaka
,
5857 .test_exceptions
= test_exceptions_ibreak
,
5858 .par
= (const uint32_t[]){
5860 XTENSA_OPTION_DEBUG
,
5862 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5864 .name
= "xsr.ibreakenable",
5865 .translate
= translate_xsr_ibreakenable
,
5866 .test_exceptions
= test_exceptions_sr
,
5867 .par
= (const uint32_t[]){
5869 XTENSA_OPTION_DEBUG
,
5871 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5873 .name
= "xsr.icount",
5874 .translate
= translate_xsr_icount
,
5875 .test_exceptions
= test_exceptions_sr
,
5876 .par
= (const uint32_t[]){
5878 XTENSA_OPTION_DEBUG
,
5880 .op_flags
= XTENSA_OP_PRIVILEGED
,
5882 .name
= "xsr.icountlevel",
5883 .translate
= translate_xsr_mask
,
5884 .test_exceptions
= test_exceptions_sr
,
5885 .par
= (const uint32_t[]){
5887 XTENSA_OPTION_DEBUG
,
5890 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5892 .name
= "xsr.intclear",
5893 .op_flags
= XTENSA_OP_ILL
,
5895 .name
= "xsr.intenable",
5896 .translate
= translate_xsr
,
5897 .test_exceptions
= test_exceptions_sr
,
5898 .par
= (const uint32_t[]){
5900 XTENSA_OPTION_INTERRUPT
,
5903 XTENSA_OP_PRIVILEGED
|
5904 XTENSA_OP_EXIT_TB_0
|
5905 XTENSA_OP_CHECK_INTERRUPTS
,
5907 .name
= "xsr.interrupt",
5908 .op_flags
= XTENSA_OP_ILL
,
5910 .name
= "xsr.intset",
5911 .op_flags
= XTENSA_OP_ILL
,
5913 .name
= "xsr.itlbcfg",
5914 .translate
= translate_xsr_mask
,
5915 .test_exceptions
= test_exceptions_sr
,
5916 .par
= (const uint32_t[]){
5921 .op_flags
= XTENSA_OP_PRIVILEGED
,
5924 .translate
= translate_xsr
,
5925 .test_exceptions
= test_exceptions_sr
,
5926 .par
= (const uint32_t[]){
5930 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5932 .name
= "xsr.lcount",
5933 .translate
= translate_xsr
,
5934 .test_exceptions
= test_exceptions_sr
,
5935 .par
= (const uint32_t[]){
5941 .translate
= translate_xsr
,
5942 .test_exceptions
= test_exceptions_sr
,
5943 .par
= (const uint32_t[]){
5947 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5949 .name
= "xsr.litbase",
5950 .translate
= translate_xsr_mask
,
5951 .test_exceptions
= test_exceptions_sr
,
5952 .par
= (const uint32_t[]){
5954 XTENSA_OPTION_EXTENDED_L32R
,
5957 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5960 .translate
= translate_xsr
,
5961 .test_exceptions
= test_exceptions_sr
,
5962 .par
= (const uint32_t[]){
5964 XTENSA_OPTION_MAC16
,
5968 .translate
= translate_xsr
,
5969 .test_exceptions
= test_exceptions_sr
,
5970 .par
= (const uint32_t[]){
5972 XTENSA_OPTION_MAC16
,
5976 .translate
= translate_xsr
,
5977 .test_exceptions
= test_exceptions_sr
,
5978 .par
= (const uint32_t[]){
5980 XTENSA_OPTION_MAC16
,
5984 .translate
= translate_xsr
,
5985 .test_exceptions
= test_exceptions_sr
,
5986 .par
= (const uint32_t[]){
5988 XTENSA_OPTION_MAC16
,
5991 .name
= "xsr.memctl",
5992 .translate
= translate_xsr_memctl
,
5993 .par
= (const uint32_t[]){MEMCTL
},
5994 .op_flags
= XTENSA_OP_PRIVILEGED
,
5997 .translate
= translate_xsr
,
5998 .test_exceptions
= test_exceptions_sr
,
5999 .par
= (const uint32_t[]){
6001 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6003 .op_flags
= XTENSA_OP_PRIVILEGED
,
6006 .translate
= translate_xsr
,
6007 .test_exceptions
= test_exceptions_sr
,
6008 .par
= (const uint32_t[]){
6010 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6012 .op_flags
= XTENSA_OP_PRIVILEGED
,
6015 .translate
= translate_xsr
,
6016 .test_exceptions
= test_exceptions_sr
,
6017 .par
= (const uint32_t[]){
6019 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6021 .op_flags
= XTENSA_OP_PRIVILEGED
,
6023 .name
= "xsr.mesave",
6024 .translate
= translate_xsr
,
6025 .test_exceptions
= test_exceptions_sr
,
6026 .par
= (const uint32_t[]){
6028 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6030 .op_flags
= XTENSA_OP_PRIVILEGED
,
6033 .translate
= translate_xsr
,
6034 .test_exceptions
= test_exceptions_sr
,
6035 .par
= (const uint32_t[]){
6037 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6039 .op_flags
= XTENSA_OP_PRIVILEGED
,
6041 .name
= "xsr.mevaddr",
6042 .translate
= translate_xsr
,
6043 .test_exceptions
= test_exceptions_sr
,
6044 .par
= (const uint32_t[]){
6046 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6048 .op_flags
= XTENSA_OP_PRIVILEGED
,
6050 .name
= "xsr.misc0",
6051 .translate
= translate_xsr
,
6052 .test_exceptions
= test_exceptions_sr
,
6053 .par
= (const uint32_t[]){
6055 XTENSA_OPTION_MISC_SR
,
6057 .op_flags
= XTENSA_OP_PRIVILEGED
,
6059 .name
= "xsr.misc1",
6060 .translate
= translate_xsr
,
6061 .test_exceptions
= test_exceptions_sr
,
6062 .par
= (const uint32_t[]){
6064 XTENSA_OPTION_MISC_SR
,
6066 .op_flags
= XTENSA_OP_PRIVILEGED
,
6068 .name
= "xsr.misc2",
6069 .translate
= translate_xsr
,
6070 .test_exceptions
= test_exceptions_sr
,
6071 .par
= (const uint32_t[]){
6073 XTENSA_OPTION_MISC_SR
,
6075 .op_flags
= XTENSA_OP_PRIVILEGED
,
6077 .name
= "xsr.misc3",
6078 .translate
= translate_xsr
,
6079 .test_exceptions
= test_exceptions_sr
,
6080 .par
= (const uint32_t[]){
6082 XTENSA_OPTION_MISC_SR
,
6084 .op_flags
= XTENSA_OP_PRIVILEGED
,
6086 .name
= "xsr.mpuenb",
6087 .translate
= translate_xsr_mpuenb
,
6088 .test_exceptions
= test_exceptions_sr
,
6089 .par
= (const uint32_t[]){
6093 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6095 .name
= "xsr.prefctl",
6096 .translate
= translate_xsr
,
6097 .par
= (const uint32_t[]){PREFCTL
},
6100 .op_flags
= XTENSA_OP_ILL
,
6103 .translate
= translate_xsr_ps
,
6104 .test_exceptions
= test_exceptions_sr
,
6105 .par
= (const uint32_t[]){
6107 XTENSA_OPTION_EXCEPTION
,
6110 XTENSA_OP_PRIVILEGED
|
6111 XTENSA_OP_EXIT_TB_M1
|
6112 XTENSA_OP_CHECK_INTERRUPTS
,
6114 .name
= "xsr.ptevaddr",
6115 .translate
= translate_xsr_mask
,
6116 .test_exceptions
= test_exceptions_sr
,
6117 .par
= (const uint32_t[]){
6122 .op_flags
= XTENSA_OP_PRIVILEGED
,
6124 .name
= "xsr.rasid",
6125 .translate
= translate_xsr_rasid
,
6126 .test_exceptions
= test_exceptions_sr
,
6127 .par
= (const uint32_t[]){
6131 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6134 .translate
= translate_xsr_sar
,
6135 .par
= (const uint32_t[]){SAR
},
6137 .name
= "xsr.scompare1",
6138 .translate
= translate_xsr
,
6139 .test_exceptions
= test_exceptions_sr
,
6140 .par
= (const uint32_t[]){
6142 XTENSA_OPTION_CONDITIONAL_STORE
,
6145 .name
= "xsr.vecbase",
6146 .translate
= translate_xsr
,
6147 .test_exceptions
= test_exceptions_sr
,
6148 .par
= (const uint32_t[]){
6150 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6152 .op_flags
= XTENSA_OP_PRIVILEGED
,
6154 .name
= "xsr.windowbase",
6155 .translate
= translate_xsr_windowbase
,
6156 .test_exceptions
= test_exceptions_sr
,
6157 .par
= (const uint32_t[]){
6159 XTENSA_OPTION_WINDOWED_REGISTER
,
6161 .op_flags
= XTENSA_OP_PRIVILEGED
|
6162 XTENSA_OP_EXIT_TB_M1
|
6163 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6165 .name
= "xsr.windowstart",
6166 .translate
= translate_xsr_windowstart
,
6167 .test_exceptions
= test_exceptions_sr
,
6168 .par
= (const uint32_t[]){
6170 XTENSA_OPTION_WINDOWED_REGISTER
,
6172 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6176 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6177 .num_opcodes
= ARRAY_SIZE(core_ops
),
6182 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6183 int o0
, int i0
, int i1
, int i2
)
6185 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6186 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6188 arg32
[o0
].out
= tcg_temp_new_i32();
6191 arg32
[i0
].in
= tcg_temp_new_i32();
6192 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6195 arg32
[i1
].in
= tcg_temp_new_i32();
6196 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6199 arg32
[i2
].in
= tcg_temp_new_i32();
6200 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6204 arg32
[o0
].out
= arg
[o0
].out
;
6207 arg32
[i0
].in
= arg
[i0
].in
;
6210 arg32
[i1
].in
= arg
[i1
].in
;
6213 arg32
[i2
].in
= arg
[i2
].in
;
6218 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6219 int o0
, int i0
, int i1
, int i2
)
6221 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6222 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6224 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6229 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6230 int o0
, int i0
, int i1
)
6232 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6235 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6236 int o0
, int i0
, int i1
)
6238 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6241 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6244 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6247 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6250 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6253 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6256 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6259 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6262 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6265 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6268 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6271 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6274 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6277 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6280 get_f32_i2(arg
, arg32
, i0
, -1);
6283 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6286 put_f32_i2(arg
, arg32
, i0
, -1);
6290 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6291 const uint32_t par
[])
6293 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6296 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6297 const uint32_t par
[])
6301 get_f32_o1_i1(arg
, arg32
, 0, 1);
6302 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6303 put_f32_o1_i1(arg
, arg32
, 0, 1);
6306 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6307 const uint32_t par
[])
6309 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
6310 arg
[1].in
, arg
[2].in
);
6323 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6324 const uint32_t par
[])
6326 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6327 TCGv_i64 s
, TCGv_i64 t
) = {
6328 [COMPARE_UN
] = gen_helper_un_d
,
6329 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6330 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6331 [COMPARE_OLT
] = gen_helper_olt_d
,
6332 [COMPARE_ULT
] = gen_helper_ult_d
,
6333 [COMPARE_OLE
] = gen_helper_ole_d
,
6334 [COMPARE_ULE
] = gen_helper_ule_d
,
6336 TCGv_i32 zero
= tcg_constant_i32(0);
6337 TCGv_i32 res
= tcg_temp_new_i32();
6338 TCGv_i32 set_br
= tcg_temp_new_i32();
6339 TCGv_i32 clr_br
= tcg_temp_new_i32();
6341 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6342 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6344 helper
[par
[0]](res
, cpu_env
, arg
[1].in
, arg
[2].in
);
6345 tcg_gen_movcond_i32(TCG_COND_NE
,
6346 arg
[0].out
, res
, zero
,
6350 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6351 const uint32_t par
[])
6353 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6354 TCGv_i32 s
, TCGv_i32 t
) = {
6355 [COMPARE_UN
] = gen_helper_un_s
,
6356 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6357 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6358 [COMPARE_OLT
] = gen_helper_olt_s
,
6359 [COMPARE_ULT
] = gen_helper_ult_s
,
6360 [COMPARE_OLE
] = gen_helper_ole_s
,
6361 [COMPARE_ULE
] = gen_helper_ule_s
,
6364 TCGv_i32 zero
= tcg_constant_i32(0);
6365 TCGv_i32 res
= tcg_temp_new_i32();
6366 TCGv_i32 set_br
= tcg_temp_new_i32();
6367 TCGv_i32 clr_br
= tcg_temp_new_i32();
6369 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6370 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6372 get_f32_i2(arg
, arg32
, 1, 2);
6373 helper
[par
[0]](res
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
6374 tcg_gen_movcond_i32(TCG_COND_NE
,
6375 arg
[0].out
, res
, zero
,
6377 put_f32_i2(arg
, arg32
, 1, 2);
6380 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6381 const uint32_t par
[])
6383 static const uint64_t v
[] = {
6384 UINT64_C(0x0000000000000000),
6385 UINT64_C(0x3ff0000000000000),
6386 UINT64_C(0x4000000000000000),
6387 UINT64_C(0x3fe0000000000000),
6390 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6391 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6392 qemu_log_mask(LOG_GUEST_ERROR
,
6393 "const.d f%d, #%d, immediate value is reserved\n",
6394 arg
[0].imm
, arg
[1].imm
);
6398 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6399 const uint32_t par
[])
6401 static const uint32_t v
[] = {
6408 if (arg
[0].num_bits
== 32) {
6409 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6411 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6413 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6414 qemu_log_mask(LOG_GUEST_ERROR
,
6415 "const.s f%d, #%d, immediate value is reserved\n",
6416 arg
[0].imm
, arg
[1].imm
);
6420 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6421 const uint32_t par
[])
6423 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6426 gen_helper_uitof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6428 gen_helper_itof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6432 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6433 const uint32_t par
[])
6435 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6438 get_f32_o1(arg
, arg32
, 0);
6440 gen_helper_uitof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6442 gen_helper_itof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6444 put_f32_o1(arg
, arg32
, 0);
6447 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6448 const uint32_t par
[])
6450 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6451 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6454 gen_helper_ftoui_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6455 rounding_mode
, scale
);
6457 gen_helper_ftoi_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6458 rounding_mode
, scale
);
6462 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6463 const uint32_t par
[])
6465 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6466 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6469 get_f32_i1(arg
, arg32
, 1);
6471 gen_helper_ftoui_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6472 rounding_mode
, scale
);
6474 gen_helper_ftoi_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6475 rounding_mode
, scale
);
6477 put_f32_i1(arg
, arg32
, 1);
6480 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6481 const uint32_t par
[])
6483 TCGv_i32 addr
= tcg_temp_new_i32();
6486 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6487 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6489 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6491 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6494 tcg_gen_mov_i32(arg
[1].out
, addr
);
6498 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6499 const uint32_t par
[])
6501 TCGv_i32 addr
= tcg_temp_new_i32();
6504 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6505 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6507 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6509 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6512 tcg_gen_mov_i32(arg
[1].out
, addr
);
6516 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6517 const uint32_t par
[])
6519 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
6520 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6523 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6524 const uint32_t par
[])
6526 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6529 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6530 const uint32_t par
[])
6532 if (arg
[0].num_bits
== 32) {
6533 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6535 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6539 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6540 const uint32_t par
[])
6542 TCGv_i64 zero
= tcg_constant_i64(0);
6543 TCGv_i64 arg2
= tcg_temp_new_i64();
6545 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6546 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6548 arg
[1].in
, arg
[0].in
);
6551 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6552 const uint32_t par
[])
6554 if (arg
[0].num_bits
== 32) {
6555 TCGv_i32 zero
= tcg_constant_i32(0);
6557 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6559 arg
[1].in
, arg
[0].in
);
6561 translate_movcond_d(dc
, arg
, par
);
6565 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6566 const uint32_t par
[])
6568 TCGv_i64 zero
= tcg_constant_i64(0);
6569 TCGv_i32 tmp1
= tcg_temp_new_i32();
6570 TCGv_i64 tmp2
= tcg_temp_new_i64();
6572 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6573 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6574 tcg_gen_movcond_i64(par
[0],
6575 arg
[0].out
, tmp2
, zero
,
6576 arg
[1].in
, arg
[0].in
);
6579 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6580 const uint32_t par
[])
6582 if (arg
[0].num_bits
== 32) {
6583 TCGv_i32 zero
= tcg_constant_i32(0);
6584 TCGv_i32 tmp
= tcg_temp_new_i32();
6586 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6587 tcg_gen_movcond_i32(par
[0],
6588 arg
[0].out
, tmp
, zero
,
6589 arg
[1].in
, arg
[0].in
);
6591 translate_movp_d(dc
, arg
, par
);
6595 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6596 const uint32_t par
[])
6598 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
6599 arg
[1].in
, arg
[2].in
);
6602 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6603 const uint32_t par
[])
6605 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
6606 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6609 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6610 const uint32_t par
[])
6612 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6615 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6616 const uint32_t par
[])
6620 get_f32_o1_i1(arg
, arg32
, 0, 1);
6621 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6622 put_f32_o1_i1(arg
, arg32
, 0, 1);
6625 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6626 const uint32_t par
[])
6628 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6631 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6632 const uint32_t par
[])
6634 if (arg
[1].num_bits
== 32) {
6635 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6637 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6641 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6642 const uint32_t par
[])
6644 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
6645 arg
[1].in
, arg
[2].in
);
6648 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6649 const uint32_t par
[])
6651 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6654 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6655 const uint32_t par
[])
6657 if (arg
[0].num_bits
== 32) {
6658 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6660 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6664 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6665 const uint32_t par
[])
6667 gen_helper_wur_fpu2k_fcr(cpu_env
, arg
[0].in
);
6670 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6671 const uint32_t par
[])
6673 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6676 static const XtensaOpcodeOps fpu2000_ops
[] = {
6679 .translate
= translate_abs_s
,
6683 .translate
= translate_fpu2k_add_s
,
6687 .translate
= translate_ftoi_s
,
6688 .par
= (const uint32_t[]){float_round_up
, false},
6692 .translate
= translate_float_s
,
6693 .par
= (const uint32_t[]){false},
6697 .translate
= translate_ftoi_s
,
6698 .par
= (const uint32_t[]){float_round_down
, false},
6702 .translate
= translate_ldsti
,
6703 .par
= (const uint32_t[]){false, false},
6704 .op_flags
= XTENSA_OP_LOAD
,
6708 .translate
= translate_ldsti
,
6709 .par
= (const uint32_t[]){false, true},
6710 .op_flags
= XTENSA_OP_LOAD
,
6714 .translate
= translate_ldstx
,
6715 .par
= (const uint32_t[]){false, false},
6716 .op_flags
= XTENSA_OP_LOAD
,
6720 .translate
= translate_ldstx
,
6721 .par
= (const uint32_t[]){false, true},
6722 .op_flags
= XTENSA_OP_LOAD
,
6726 .translate
= translate_fpu2k_madd_s
,
6730 .translate
= translate_mov_s
,
6734 .translate
= translate_movcond_s
,
6735 .par
= (const uint32_t[]){TCG_COND_EQ
},
6739 .translate
= translate_movp_s
,
6740 .par
= (const uint32_t[]){TCG_COND_EQ
},
6744 .translate
= translate_movcond_s
,
6745 .par
= (const uint32_t[]){TCG_COND_GE
},
6749 .translate
= translate_movcond_s
,
6750 .par
= (const uint32_t[]){TCG_COND_LT
},
6754 .translate
= translate_movcond_s
,
6755 .par
= (const uint32_t[]){TCG_COND_NE
},
6759 .translate
= translate_movp_s
,
6760 .par
= (const uint32_t[]){TCG_COND_NE
},
6764 .translate
= translate_fpu2k_msub_s
,
6768 .translate
= translate_fpu2k_mul_s
,
6772 .translate
= translate_neg_s
,
6776 .translate
= translate_compare_s
,
6777 .par
= (const uint32_t[]){COMPARE_OEQ
},
6781 .translate
= translate_compare_s
,
6782 .par
= (const uint32_t[]){COMPARE_OLE
},
6786 .translate
= translate_compare_s
,
6787 .par
= (const uint32_t[]){COMPARE_OLT
},
6791 .translate
= translate_rfr_s
,
6795 .translate
= translate_ftoi_s
,
6796 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6800 .translate
= translate_rur
,
6801 .par
= (const uint32_t[]){FCR
},
6805 .translate
= translate_rur
,
6806 .par
= (const uint32_t[]){FSR
},
6810 .translate
= translate_ldsti
,
6811 .par
= (const uint32_t[]){true, false},
6812 .op_flags
= XTENSA_OP_STORE
,
6816 .translate
= translate_ldsti
,
6817 .par
= (const uint32_t[]){true, true},
6818 .op_flags
= XTENSA_OP_STORE
,
6822 .translate
= translate_ldstx
,
6823 .par
= (const uint32_t[]){true, false},
6824 .op_flags
= XTENSA_OP_STORE
,
6828 .translate
= translate_ldstx
,
6829 .par
= (const uint32_t[]){true, true},
6830 .op_flags
= XTENSA_OP_STORE
,
6834 .translate
= translate_fpu2k_sub_s
,
6838 .translate
= translate_ftoi_s
,
6839 .par
= (const uint32_t[]){float_round_to_zero
, false},
6843 .translate
= translate_compare_s
,
6844 .par
= (const uint32_t[]){COMPARE_UEQ
},
6848 .translate
= translate_float_s
,
6849 .par
= (const uint32_t[]){true},
6853 .translate
= translate_compare_s
,
6854 .par
= (const uint32_t[]){COMPARE_ULE
},
6858 .translate
= translate_compare_s
,
6859 .par
= (const uint32_t[]){COMPARE_ULT
},
6863 .translate
= translate_compare_s
,
6864 .par
= (const uint32_t[]){COMPARE_UN
},
6868 .translate
= translate_ftoi_s
,
6869 .par
= (const uint32_t[]){float_round_to_zero
, true},
6873 .translate
= translate_wfr_s
,
6877 .translate
= translate_wur_fpu2k_fcr
,
6878 .par
= (const uint32_t[]){FCR
},
6882 .translate
= translate_wur_fpu2k_fsr
,
6883 .par
= (const uint32_t[]){FSR
},
6888 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6889 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6890 .opcode
= fpu2000_ops
,
6893 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
6894 const uint32_t par
[])
6896 gen_helper_add_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
6899 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6900 const uint32_t par
[])
6902 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
6903 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
6904 arg
[1].in
, arg
[2].in
);
6908 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6909 gen_helper_add_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
6910 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6914 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6915 const uint32_t par
[])
6917 TCGv_i32 v
= tcg_temp_new_i32();
6919 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
6920 gen_helper_cvtd_s(arg
[0].out
, cpu_env
, v
);
6923 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
6924 const uint32_t par
[])
6926 TCGv_i32 v
= tcg_temp_new_i32();
6928 gen_helper_cvts_d(v
, cpu_env
, arg
[1].in
);
6929 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
6932 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
6933 const uint32_t par
[])
6939 addr
= tcg_temp_new_i32();
6940 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6944 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
6946 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
6948 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
6952 tcg_gen_mov_i32(arg
[1].out
, addr
);
6954 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6959 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
6960 const uint32_t par
[])
6967 addr
= tcg_temp_new_i32();
6968 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6972 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6974 get_f32_i1(arg
, arg32
, 0);
6975 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
6976 put_f32_i1(arg
, arg32
, 0);
6978 get_f32_o1(arg
, arg32
, 0);
6979 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
6980 put_f32_o1(arg
, arg32
, 0);
6984 tcg_gen_mov_i32(arg
[1].out
, addr
);
6986 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6991 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
6992 const uint32_t par
[])
6998 addr
= tcg_temp_new_i32();
6999 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7003 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
7005 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
7007 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
7011 tcg_gen_mov_i32(arg
[1].out
, addr
);
7013 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7018 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
7019 const uint32_t par
[])
7026 addr
= tcg_temp_new_i32();
7027 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7031 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
7033 get_f32_i1(arg
, arg32
, 0);
7034 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
7035 put_f32_i1(arg
, arg32
, 0);
7037 get_f32_o1(arg
, arg32
, 0);
7038 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
7039 put_f32_o1(arg
, arg32
, 0);
7043 tcg_gen_mov_i32(arg
[1].out
, addr
);
7045 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7050 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7051 const uint32_t par
[])
7053 gen_helper_madd_d(arg
[0].out
, cpu_env
,
7054 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7057 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7058 const uint32_t par
[])
7060 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7061 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
7062 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7066 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7067 gen_helper_madd_s(arg32
[0].out
, cpu_env
,
7068 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7069 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7073 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7074 const uint32_t par
[])
7076 gen_helper_mul_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7079 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7080 const uint32_t par
[])
7082 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7083 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
7084 arg
[1].in
, arg
[2].in
);
7088 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7089 gen_helper_mul_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7090 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7094 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7095 const uint32_t par
[])
7097 gen_helper_msub_d(arg
[0].out
, cpu_env
,
7098 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7101 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7102 const uint32_t par
[])
7104 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7105 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
7106 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7110 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7111 gen_helper_msub_s(arg32
[0].out
, cpu_env
,
7112 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7113 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7117 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7118 const uint32_t par
[])
7120 gen_helper_sub_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7123 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7124 const uint32_t par
[])
7126 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7127 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
7128 arg
[1].in
, arg
[2].in
);
7132 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7133 gen_helper_sub_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7134 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7138 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7139 const uint32_t par
[])
7141 gen_helper_mkdadj_d(arg
[0].out
, cpu_env
, arg
[0].in
, arg
[1].in
);
7144 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7145 const uint32_t par
[])
7149 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7150 gen_helper_mkdadj_s(arg32
[0].out
, cpu_env
, arg32
[0].in
, arg32
[1].in
);
7151 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7154 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7155 const uint32_t par
[])
7157 gen_helper_mksadj_d(arg
[0].out
, cpu_env
, arg
[1].in
);
7160 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7161 const uint32_t par
[])
7165 get_f32_o1_i1(arg
, arg32
, 0, 1);
7166 gen_helper_mksadj_s(arg32
[0].out
, cpu_env
, arg32
[1].in
);
7167 put_f32_o1_i1(arg
, arg32
, 0, 1);
7170 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7171 const uint32_t par
[])
7173 gen_helper_wur_fpu_fcr(cpu_env
, arg
[0].in
);
7176 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7177 const uint32_t par
[])
7179 gen_helper_rur_fpu_fsr(arg
[0].out
, cpu_env
);
7182 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7183 const uint32_t par
[])
7185 gen_helper_wur_fpu_fsr(cpu_env
, arg
[0].in
);
7188 static const XtensaOpcodeOps fpu_ops
[] = {
7191 .translate
= translate_abs_d
,
7195 .translate
= translate_abs_s
,
7199 .translate
= translate_add_d
,
7203 .translate
= translate_add_s
,
7207 .translate
= translate_nop
,
7211 .translate
= translate_nop
,
7214 .name
= "addexpm.d",
7215 .translate
= translate_mov_s
,
7218 .name
= "addexpm.s",
7219 .translate
= translate_mov_s
,
7223 .translate
= translate_ftoi_d
,
7224 .par
= (const uint32_t[]){float_round_up
, false},
7228 .translate
= translate_ftoi_s
,
7229 .par
= (const uint32_t[]){float_round_up
, false},
7233 .translate
= translate_const_d
,
7237 .translate
= translate_const_s
,
7241 .translate
= translate_cvtd_s
,
7245 .translate
= translate_cvts_d
,
7249 .translate
= translate_nop
,
7253 .translate
= translate_nop
,
7257 .translate
= translate_nop
,
7261 .translate
= translate_nop
,
7265 .translate
= translate_float_d
,
7266 .par
= (const uint32_t[]){false},
7270 .translate
= translate_float_s
,
7271 .par
= (const uint32_t[]){false},
7275 .translate
= translate_ftoi_d
,
7276 .par
= (const uint32_t[]){float_round_down
, false},
7280 .translate
= translate_ftoi_s
,
7281 .par
= (const uint32_t[]){float_round_down
, false},
7285 .translate
= translate_ldsti_d
,
7286 .par
= (const uint32_t[]){false, true, false},
7287 .op_flags
= XTENSA_OP_LOAD
,
7291 .translate
= translate_ldsti_d
,
7292 .par
= (const uint32_t[]){false, false, true},
7293 .op_flags
= XTENSA_OP_LOAD
,
7297 .translate
= translate_ldsti_d
,
7298 .par
= (const uint32_t[]){false, true, true},
7299 .op_flags
= XTENSA_OP_LOAD
,
7303 .translate
= translate_ldstx_d
,
7304 .par
= (const uint32_t[]){false, true, false},
7305 .op_flags
= XTENSA_OP_LOAD
,
7309 .translate
= translate_ldstx_d
,
7310 .par
= (const uint32_t[]){false, false, true},
7311 .op_flags
= XTENSA_OP_LOAD
,
7315 .translate
= translate_ldstx_d
,
7316 .par
= (const uint32_t[]){false, true, true},
7317 .op_flags
= XTENSA_OP_LOAD
,
7321 .translate
= translate_ldsti_s
,
7322 .par
= (const uint32_t[]){false, true, false},
7323 .op_flags
= XTENSA_OP_LOAD
,
7327 .translate
= translate_ldsti_s
,
7328 .par
= (const uint32_t[]){false, false, true},
7329 .op_flags
= XTENSA_OP_LOAD
,
7333 .translate
= translate_ldsti_s
,
7334 .par
= (const uint32_t[]){false, true, true},
7335 .op_flags
= XTENSA_OP_LOAD
,
7339 .translate
= translate_ldstx_s
,
7340 .par
= (const uint32_t[]){false, true, false},
7341 .op_flags
= XTENSA_OP_LOAD
,
7345 .translate
= translate_ldstx_s
,
7346 .par
= (const uint32_t[]){false, false, true},
7347 .op_flags
= XTENSA_OP_LOAD
,
7351 .translate
= translate_ldstx_s
,
7352 .par
= (const uint32_t[]){false, true, true},
7353 .op_flags
= XTENSA_OP_LOAD
,
7357 .translate
= translate_madd_d
,
7361 .translate
= translate_madd_s
,
7365 .translate
= translate_nop
,
7369 .translate
= translate_nop
,
7373 .translate
= translate_mkdadj_d
,
7377 .translate
= translate_mkdadj_s
,
7381 .translate
= translate_mksadj_d
,
7385 .translate
= translate_mksadj_s
,
7389 .translate
= translate_mov_d
,
7393 .translate
= translate_mov_s
,
7397 .translate
= translate_movcond_d
,
7398 .par
= (const uint32_t[]){TCG_COND_EQ
},
7402 .translate
= translate_movcond_s
,
7403 .par
= (const uint32_t[]){TCG_COND_EQ
},
7407 .translate
= translate_movp_d
,
7408 .par
= (const uint32_t[]){TCG_COND_EQ
},
7412 .translate
= translate_movp_s
,
7413 .par
= (const uint32_t[]){TCG_COND_EQ
},
7417 .translate
= translate_movcond_d
,
7418 .par
= (const uint32_t[]){TCG_COND_GE
},
7422 .translate
= translate_movcond_s
,
7423 .par
= (const uint32_t[]){TCG_COND_GE
},
7427 .translate
= translate_movcond_d
,
7428 .par
= (const uint32_t[]){TCG_COND_LT
},
7432 .translate
= translate_movcond_s
,
7433 .par
= (const uint32_t[]){TCG_COND_LT
},
7437 .translate
= translate_movcond_d
,
7438 .par
= (const uint32_t[]){TCG_COND_NE
},
7442 .translate
= translate_movcond_s
,
7443 .par
= (const uint32_t[]){TCG_COND_NE
},
7447 .translate
= translate_movp_d
,
7448 .par
= (const uint32_t[]){TCG_COND_NE
},
7452 .translate
= translate_movp_s
,
7453 .par
= (const uint32_t[]){TCG_COND_NE
},
7457 .translate
= translate_msub_d
,
7461 .translate
= translate_msub_s
,
7465 .translate
= translate_mul_d
,
7469 .translate
= translate_mul_s
,
7473 .translate
= translate_neg_d
,
7477 .translate
= translate_neg_s
,
7481 .translate
= translate_nop
,
7485 .translate
= translate_nop
,
7489 .translate
= translate_compare_d
,
7490 .par
= (const uint32_t[]){COMPARE_OEQ
},
7494 .translate
= translate_compare_s
,
7495 .par
= (const uint32_t[]){COMPARE_OEQ
},
7499 .translate
= translate_compare_d
,
7500 .par
= (const uint32_t[]){COMPARE_OLE
},
7504 .translate
= translate_compare_s
,
7505 .par
= (const uint32_t[]){COMPARE_OLE
},
7509 .translate
= translate_compare_d
,
7510 .par
= (const uint32_t[]){COMPARE_OLT
},
7514 .translate
= translate_compare_s
,
7515 .par
= (const uint32_t[]){COMPARE_OLT
},
7519 .translate
= translate_rfr_s
,
7523 .translate
= translate_rfr_d
,
7527 .translate
= translate_ftoi_d
,
7528 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7532 .translate
= translate_ftoi_s
,
7533 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7537 .translate
= translate_rur
,
7538 .par
= (const uint32_t[]){FCR
},
7542 .translate
= translate_rur_fpu_fsr
,
7546 .translate
= translate_ldsti_d
,
7547 .par
= (const uint32_t[]){true, true, false},
7548 .op_flags
= XTENSA_OP_STORE
,
7552 .translate
= translate_ldsti_d
,
7553 .par
= (const uint32_t[]){true, false, true},
7554 .op_flags
= XTENSA_OP_STORE
,
7558 .translate
= translate_ldsti_d
,
7559 .par
= (const uint32_t[]){true, true, true},
7560 .op_flags
= XTENSA_OP_STORE
,
7564 .translate
= translate_ldstx_d
,
7565 .par
= (const uint32_t[]){true, true, false},
7566 .op_flags
= XTENSA_OP_STORE
,
7570 .translate
= translate_ldstx_d
,
7571 .par
= (const uint32_t[]){true, false, true},
7572 .op_flags
= XTENSA_OP_STORE
,
7576 .translate
= translate_ldstx_d
,
7577 .par
= (const uint32_t[]){true, true, true},
7578 .op_flags
= XTENSA_OP_STORE
,
7582 .translate
= translate_nop
,
7586 .translate
= translate_nop
,
7590 .translate
= translate_ldsti_s
,
7591 .par
= (const uint32_t[]){true, true, false},
7592 .op_flags
= XTENSA_OP_STORE
,
7596 .translate
= translate_ldsti_s
,
7597 .par
= (const uint32_t[]){true, false, true},
7598 .op_flags
= XTENSA_OP_STORE
,
7602 .translate
= translate_ldsti_s
,
7603 .par
= (const uint32_t[]){true, true, true},
7604 .op_flags
= XTENSA_OP_STORE
,
7608 .translate
= translate_ldstx_s
,
7609 .par
= (const uint32_t[]){true, true, false},
7610 .op_flags
= XTENSA_OP_STORE
,
7614 .translate
= translate_ldstx_s
,
7615 .par
= (const uint32_t[]){true, false, true},
7616 .op_flags
= XTENSA_OP_STORE
,
7620 .translate
= translate_ldstx_s
,
7621 .par
= (const uint32_t[]){true, true, true},
7622 .op_flags
= XTENSA_OP_STORE
,
7626 .translate
= translate_sub_d
,
7630 .translate
= translate_sub_s
,
7634 .translate
= translate_ftoi_d
,
7635 .par
= (const uint32_t[]){float_round_to_zero
, false},
7639 .translate
= translate_ftoi_s
,
7640 .par
= (const uint32_t[]){float_round_to_zero
, false},
7644 .translate
= translate_compare_d
,
7645 .par
= (const uint32_t[]){COMPARE_UEQ
},
7649 .translate
= translate_compare_s
,
7650 .par
= (const uint32_t[]){COMPARE_UEQ
},
7654 .translate
= translate_float_d
,
7655 .par
= (const uint32_t[]){true},
7659 .translate
= translate_float_s
,
7660 .par
= (const uint32_t[]){true},
7664 .translate
= translate_compare_d
,
7665 .par
= (const uint32_t[]){COMPARE_ULE
},
7669 .translate
= translate_compare_s
,
7670 .par
= (const uint32_t[]){COMPARE_ULE
},
7674 .translate
= translate_compare_d
,
7675 .par
= (const uint32_t[]){COMPARE_ULT
},
7679 .translate
= translate_compare_s
,
7680 .par
= (const uint32_t[]){COMPARE_ULT
},
7684 .translate
= translate_compare_d
,
7685 .par
= (const uint32_t[]){COMPARE_UN
},
7689 .translate
= translate_compare_s
,
7690 .par
= (const uint32_t[]){COMPARE_UN
},
7694 .translate
= translate_ftoi_d
,
7695 .par
= (const uint32_t[]){float_round_to_zero
, true},
7699 .translate
= translate_ftoi_s
,
7700 .par
= (const uint32_t[]){float_round_to_zero
, true},
7704 .translate
= translate_wfr_s
,
7708 .translate
= translate_wfr_d
,
7712 .translate
= translate_wur_fpu_fcr
,
7713 .par
= (const uint32_t[]){FCR
},
7717 .translate
= translate_wur_fpu_fsr
,
7722 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7723 .num_opcodes
= ARRAY_SIZE(fpu_ops
),