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 "tcg/tcg-op.h"
37 #include "qemu/qemu-print.h"
38 #include "semihosting/semihost.h"
39 #include "exec/translator.h"
41 #include "exec/helper-proto.h"
42 #include "exec/helper-gen.h"
46 #define HELPER_H "helper.h"
47 #include "exec/helper-info.c.inc"
52 DisasContextBase base
;
53 const XtensaConfig
*config
;
75 xtensa_insnbuf_word insnbuf
[MAX_INSNBUF_LENGTH
];
76 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i64 cpu_FRD
[16];
83 static TCGv_i32 cpu_MR
[4];
84 static TCGv_i32 cpu_BR
[16];
85 static TCGv_i32 cpu_BR4
[4];
86 static TCGv_i32 cpu_BR8
[2];
87 static TCGv_i32 cpu_SR
[256];
88 static TCGv_i32 cpu_UR
[256];
89 static TCGv_i32 cpu_windowbase_next
;
90 static TCGv_i32 cpu_exclusive_addr
;
91 static TCGv_i32 cpu_exclusive_val
;
93 static GHashTable
*xtensa_regfile_table
;
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(tcg_env
,
156 offsetof(CPUXtensaState
, pc
), "pc");
158 for (i
= 0; i
< 16; i
++) {
159 cpu_R
[i
] = tcg_global_mem_new_i32(tcg_env
,
160 offsetof(CPUXtensaState
, regs
[i
]),
164 for (i
= 0; i
< 16; i
++) {
165 cpu_FR
[i
] = tcg_global_mem_new_i32(tcg_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(tcg_env
,
173 offsetof(CPUXtensaState
,
178 for (i
= 0; i
< 4; i
++) {
179 cpu_MR
[i
] = tcg_global_mem_new_i32(tcg_env
,
180 offsetof(CPUXtensaState
,
185 for (i
= 0; i
< 16; i
++) {
186 cpu_BR
[i
] = tcg_global_mem_new_i32(tcg_env
,
187 offsetof(CPUXtensaState
,
191 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(tcg_env
,
192 offsetof(CPUXtensaState
,
197 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(tcg_env
,
198 offsetof(CPUXtensaState
,
204 for (i
= 0; i
< 256; ++i
) {
206 cpu_SR
[i
] = tcg_global_mem_new_i32(tcg_env
,
207 offsetof(CPUXtensaState
,
213 for (i
= 0; i
< 256; ++i
) {
215 cpu_UR
[i
] = tcg_global_mem_new_i32(tcg_env
,
216 offsetof(CPUXtensaState
,
222 cpu_windowbase_next
=
223 tcg_global_mem_new_i32(tcg_env
,
224 offsetof(CPUXtensaState
, windowbase_next
),
227 tcg_global_mem_new_i32(tcg_env
,
228 offsetof(CPUXtensaState
, exclusive_addr
),
231 tcg_global_mem_new_i32(tcg_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(tcg_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(tcg_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(tcg_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(tcg_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 translator_io_start(&dc
->base
);
577 gen_helper_check_interrupts(tcg_env
);
580 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
581 gen_helper_sync_windowbase(tcg_env
);
583 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
589 struct opcode_arg_copy
{
595 struct opcode_arg_info
{
601 XtensaOpcodeOps
*ops
;
602 OpcodeArg arg
[MAX_OPCODE_ARGS
];
603 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
604 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
616 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
618 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
619 return (r
<< 24) | (g
<< 16) | n
;
622 static enum resource_type
get_resource_type(uint32_t resource
)
624 return resource
>> 24;
628 * a depends on b if b must be executed before a,
629 * because a's side effects will destroy b's inputs.
631 static bool op_depends_on(const struct slot_prop
*a
,
632 const struct slot_prop
*b
)
637 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
640 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
641 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
644 while (i
< a
->n_out
&& j
< b
->n_in
) {
645 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
647 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
657 * Try to break a dependency on b, append temporary register copy records
658 * to the end of copy and update n_copy in case of success.
659 * This is not always possible: e.g. control flow must always be the last,
660 * load/store must be first and state dependencies are not supported yet.
662 static bool break_dependency(struct slot_prop
*a
,
664 struct opcode_arg_copy
*copy
,
669 unsigned n
= *n_copy
;
672 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
675 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
676 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
679 while (i
< a
->n_out
&& j
< b
->n_in
) {
680 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
682 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
685 int index
= b
->in
[j
].index
;
687 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
691 copy
[n
].resource
= b
->in
[j
].resource
;
692 copy
[n
].arg
= b
->arg
+ index
;
703 * Calculate evaluation order for slot opcodes.
704 * Build opcode order graph and output its nodes in topological sort order.
705 * An edge a -> b in the graph means that opcode a must be followed by
708 static bool tsort(struct slot_prop
*slot
,
709 struct slot_prop
*sorted
[],
711 struct opcode_arg_copy
*copy
,
717 unsigned out_edge
[MAX_INSN_SLOTS
];
718 } node
[MAX_INSN_SLOTS
];
720 unsigned in
[MAX_INSN_SLOTS
];
726 unsigned node_idx
= 0;
728 for (i
= 0; i
< n
; ++i
) {
729 node
[i
].n_in_edge
= 0;
730 node
[i
].n_out_edge
= 0;
733 for (i
= 0; i
< n
; ++i
) {
734 unsigned n_out_edge
= 0;
736 for (j
= 0; j
< n
; ++j
) {
737 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
738 node
[i
].out_edge
[n_out_edge
] = j
;
744 node
[i
].n_out_edge
= n_out_edge
;
747 for (i
= 0; i
< n
; ++i
) {
748 if (!node
[i
].n_in_edge
) {
755 for (; in_idx
< n_in
; ++in_idx
) {
757 sorted
[n_out
] = slot
+ i
;
759 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
761 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
762 in
[n_in
] = node
[i
].out_edge
[j
];
768 for (; node_idx
< n
; ++node_idx
) {
769 struct tsnode
*cnode
= node
+ node_idx
;
771 if (cnode
->n_in_edge
) {
772 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
773 unsigned k
= cnode
->out_edge
[j
];
775 if (break_dependency(slot
+ k
, slot
+ node_idx
,
777 --node
[k
].n_in_edge
== 0) {
782 cnode
->out_edge
[cnode
->n_out_edge
- 1];
793 static void opcode_add_resource(struct slot_prop
*op
,
794 uint32_t resource
, char direction
,
800 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
801 op
->in
[op
->n_in
].resource
= resource
;
802 op
->in
[op
->n_in
].index
= index
;
806 if (direction
== 'm' || direction
== 'o') {
807 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
808 op
->out
[op
->n_out
].resource
= resource
;
809 op
->out
[op
->n_out
].index
= index
;
814 g_assert_not_reached();
818 static int resource_compare(const void *a
, const void *b
)
820 const struct opcode_arg_info
*pa
= a
;
821 const struct opcode_arg_info
*pb
= b
;
823 return pa
->resource
< pb
->resource
?
824 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
827 static int arg_copy_compare(const void *a
, const void *b
)
829 const struct opcode_arg_copy
*pa
= a
;
830 const struct opcode_arg_copy
*pb
= b
;
832 return pa
->resource
< pb
->resource
?
833 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
836 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
838 xtensa_isa isa
= dc
->config
->isa
;
839 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, &dc
->base
,
841 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
845 uint32_t op_flags
= 0;
846 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
847 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
848 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
849 unsigned n_arg_copy
= 0;
850 uint32_t debug_cause
= 0;
851 uint32_t windowed_register
= 0;
852 uint32_t coprocessor
= 0;
854 if (len
== XTENSA_UNDEFINED
) {
855 qemu_log_mask(LOG_GUEST_ERROR
,
856 "unknown instruction length (pc = %08x)\n",
858 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
859 dc
->base
.pc_next
= dc
->pc
+ 1;
863 dc
->base
.pc_next
= dc
->pc
+ len
;
864 for (i
= 1; i
< len
; ++i
) {
865 b
[i
] = translator_ldub(env
, &dc
->base
, dc
->pc
+ i
);
867 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
868 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
869 if (fmt
== XTENSA_UNDEFINED
) {
870 qemu_log_mask(LOG_GUEST_ERROR
,
871 "unrecognized instruction format (pc = %08x)\n",
873 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
876 slots
= xtensa_format_num_slots(isa
, fmt
);
877 for (slot
= 0; slot
< slots
; ++slot
) {
879 int opnd
, vopnd
, opnds
;
880 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
881 XtensaOpcodeOps
*ops
;
883 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
884 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
885 if (opc
== XTENSA_UNDEFINED
) {
886 qemu_log_mask(LOG_GUEST_ERROR
,
887 "unrecognized opcode in slot %d (pc = %08x)\n",
889 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
892 opnds
= xtensa_opcode_num_operands(isa
, opc
);
894 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
895 void **register_file
= NULL
;
898 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
899 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
900 register_file
= dc
->config
->regfile
[rf
];
902 if (rf
== dc
->config
->a_regfile
) {
905 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
907 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
908 windowed_register
|= 1u << v
;
911 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
914 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
916 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
917 arg
[vopnd
].raw_imm
= v
;
918 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
919 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
923 arg
[vopnd
].in
= register_file
[v
];
924 arg
[vopnd
].out
= register_file
[v
];
925 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
927 arg
[vopnd
].num_bits
= 32;
932 ops
= dc
->config
->opcode_ops
[opc
];
933 slot_prop
[slot
].ops
= ops
;
936 op_flags
|= ops
->op_flags
;
937 if (ops
->test_exceptions
) {
938 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
941 qemu_log_mask(LOG_UNIMP
,
942 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
943 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
944 op_flags
|= XTENSA_OP_ILL
;
946 if (op_flags
& XTENSA_OP_ILL
) {
947 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
950 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
951 debug_cause
|= ops
->par
[0];
953 if (ops
->test_overflow
) {
954 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
956 coprocessor
|= ops
->coprocessor
;
959 slot_prop
[slot
].n_in
= 0;
960 slot_prop
[slot
].n_out
= 0;
961 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
963 opnds
= xtensa_opcode_num_operands(isa
, opc
);
965 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
966 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
968 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
969 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
972 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
974 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
975 opcode_add_resource(slot_prop
+ slot
,
976 encode_resource(RES_REGFILE
, rf
, v
),
977 xtensa_operand_inout(isa
, opc
, opnd
),
978 visible
? vopnd
: -1);
985 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
987 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
988 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
990 opcode_add_resource(slot_prop
+ slot
,
991 encode_resource(RES_STATE
, 0, state
),
992 xtensa_stateOperand_inout(isa
, opc
, opnd
),
995 if (xtensa_opcode_is_branch(isa
, opc
) ||
996 xtensa_opcode_is_jump(isa
, opc
) ||
997 xtensa_opcode_is_loop(isa
, opc
) ||
998 xtensa_opcode_is_call(isa
, opc
)) {
999 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1002 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1003 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1004 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1005 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1010 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1011 qemu_log_mask(LOG_UNIMP
,
1012 "Circular resource dependencies (pc = %08x)\n",
1014 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1018 ordered
[0] = slot_prop
+ 0;
1021 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1022 !gen_check_privilege(dc
)) {
1026 if (op_flags
& XTENSA_OP_SYSCALL
) {
1027 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1031 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1032 gen_debug_exception(dc
, debug_cause
);
1036 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1040 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1041 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1043 gen_helper_test_underflow_retw(tcg_env
, pc
);
1046 if (op_flags
& XTENSA_OP_ALLOCA
) {
1047 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1049 gen_helper_movsp(tcg_env
, pc
);
1052 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1061 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1062 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1063 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1064 resource
= arg_copy
[i
].resource
;
1065 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1066 temp
= tcg_temp_new_i32();
1067 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1068 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1069 temp
= tcg_temp_new_i64();
1070 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1072 g_assert_not_reached();
1074 arg_copy
[i
].temp
= temp
;
1077 arg_copy
[j
] = arg_copy
[i
];
1081 arg_copy
[i
].arg
->in
= temp
;
1086 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1087 for (slot
= 0; slot
< slots
; ++slot
) {
1088 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1089 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1094 dc
->op_flags
= op_flags
;
1096 for (slot
= 0; slot
< slots
; ++slot
) {
1097 struct slot_prop
*pslot
= ordered
[slot
];
1098 XtensaOpcodeOps
*ops
= pslot
->ops
;
1100 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1103 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1104 gen_postprocess(dc
, 0);
1106 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1107 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1108 gen_jumpi_check_loop_end(dc
, -1);
1109 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1110 gen_jumpi_check_loop_end(dc
, 0);
1112 gen_check_loop_end(dc
, 0);
1115 dc
->pc
= dc
->base
.pc_next
;
1118 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1120 uint8_t b0
= translator_ldub(env
, &dc
->base
, dc
->pc
);
1121 return xtensa_op0_insn_len(dc
, b0
);
1124 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1127 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1128 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1130 dc
->config
= cpu_env(cpu
)->config
;
1131 dc
->pc
= dc
->base
.pc_first
;
1132 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1133 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1134 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1135 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1136 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1137 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1138 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1139 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1140 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1141 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1142 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1143 XTENSA_TBFLAG_WINDOW_SHIFT
);
1144 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1145 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1146 XTENSA_TBFLAG_CALLINC_SHIFT
);
1147 init_sar_tracker(dc
);
1150 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1152 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1155 dc
->next_icount
= tcg_temp_new_i32();
1159 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1161 tcg_gen_insn_start(dcbase
->pc_next
);
1164 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1166 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1167 CPUXtensaState
*env
= cpu_env(cpu
);
1168 target_ulong page_start
;
1170 /* These two conditions only apply to the first insn in the TB,
1171 but this is the first TranslateOps hook that allows exiting. */
1172 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1173 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1174 gen_exception(dc
, EXCP_YIELD
);
1175 dc
->base
.pc_next
= dc
->pc
+ 1;
1176 dc
->base
.is_jmp
= DISAS_NORETURN
;
1181 TCGLabel
*label
= gen_new_label();
1183 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1184 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1185 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1187 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1189 gen_set_label(label
);
1192 disas_xtensa_insn(env
, dc
);
1195 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1198 /* End the TB if the next insn will cross into the next page. */
1199 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1200 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1201 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1202 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1203 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1207 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1209 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1211 switch (dc
->base
.is_jmp
) {
1212 case DISAS_NORETURN
:
1214 case DISAS_TOO_MANY
:
1215 gen_jumpi(dc
, dc
->pc
, 0);
1218 g_assert_not_reached();
1222 static const TranslatorOps xtensa_translator_ops
= {
1223 .init_disas_context
= xtensa_tr_init_disas_context
,
1224 .tb_start
= xtensa_tr_tb_start
,
1225 .insn_start
= xtensa_tr_insn_start
,
1226 .translate_insn
= xtensa_tr_translate_insn
,
1227 .tb_stop
= xtensa_tr_tb_stop
,
1230 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int *max_insns
,
1231 vaddr pc
, void *host_pc
)
1233 DisasContext dc
= {};
1234 translator_loop(cpu
, tb
, max_insns
, pc
, host_pc
,
1235 &xtensa_translator_ops
, &dc
.base
);
1238 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1240 CPUXtensaState
*env
= cpu_env(cs
);
1241 xtensa_isa isa
= env
->config
->isa
;
1244 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1246 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1247 const uint32_t *reg
=
1248 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1249 int regno
= xtensa_sysreg_number(isa
, i
);
1252 qemu_fprintf(f
, "%12s=%08x%c",
1253 xtensa_sysreg_name(isa
, i
),
1255 (j
++ % 4) == 3 ? '\n' : ' ');
1259 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1261 for (i
= 0; i
< 16; ++i
) {
1262 qemu_fprintf(f
, " A%02d=%08x%c",
1263 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1266 xtensa_sync_phys_from_window(env
);
1267 qemu_fprintf(f
, "\n");
1269 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1270 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1272 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1273 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1275 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1279 if ((flags
& CPU_DUMP_FPU
) &&
1280 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1281 qemu_fprintf(f
, "\n");
1283 for (i
= 0; i
< 16; ++i
) {
1284 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1285 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1286 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1287 (i
% 2) == 1 ? '\n' : ' ');
1291 if ((flags
& CPU_DUMP_FPU
) &&
1292 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1293 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1294 qemu_fprintf(f
, "\n");
1296 for (i
= 0; i
< 16; ++i
) {
1297 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1298 float64_val(env
->fregs
[i
].f64
),
1299 *(double *)(&env
->fregs
[i
].f64
),
1300 (i
% 2) == 1 ? '\n' : ' ');
1305 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1306 const uint32_t par
[])
1308 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1311 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1312 const uint32_t par
[])
1314 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1317 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1318 const uint32_t par
[])
1320 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1323 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1324 const uint32_t par
[])
1326 TCGv_i32 tmp
= tcg_temp_new_i32();
1327 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1328 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1331 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1332 const uint32_t par
[])
1334 uint32_t shift
= par
[1];
1335 TCGv_i32 mask
= tcg_constant_i32(((1 << shift
) - 1) << arg
[1].imm
);
1336 TCGv_i32 tmp
= tcg_temp_new_i32();
1338 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1340 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1342 tcg_gen_add_i32(tmp
, tmp
, mask
);
1344 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1345 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1346 tmp
, arg
[0].imm
, 1);
1349 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1350 const uint32_t par
[])
1352 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1355 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1356 const uint32_t par
[])
1358 TCGv_i32 tmp
= tcg_temp_new_i32();
1359 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1360 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1363 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1364 const uint32_t par
[])
1366 TCGv_i32 tmp
= tcg_temp_new_i32();
1367 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1368 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1371 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1372 const uint32_t par
[])
1374 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1377 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1378 const uint32_t par
[])
1380 TCGv_i32 tmp
= tcg_temp_new_i32();
1382 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1383 if (TARGET_BIG_ENDIAN
) {
1384 tcg_gen_shr_i32(tmp
, tcg_constant_i32(0x80000000u
), tmp
);
1386 tcg_gen_shl_i32(tmp
, tcg_constant_i32(0x00000001u
), tmp
);
1388 tcg_gen_and_i32(tmp
, arg
[0].in
, tmp
);
1389 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1392 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1393 const uint32_t par
[])
1395 TCGv_i32 tmp
= tcg_temp_new_i32();
1396 #if TARGET_BIG_ENDIAN
1397 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1399 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1401 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1404 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1405 const uint32_t par
[])
1407 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1410 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1411 const uint32_t par
[])
1413 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1424 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1425 const uint32_t par
[])
1427 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1428 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1429 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1430 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1431 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1432 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1435 TCGv_i32 tmp1
= tcg_temp_new_i32();
1436 TCGv_i32 tmp2
= tcg_temp_new_i32();
1438 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1439 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1440 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1441 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1444 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1445 const uint32_t par
[])
1447 TCGv_i32 tmp
= tcg_temp_new_i32();
1449 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1450 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1453 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1454 const uint32_t par
[])
1456 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1457 gen_jumpi(dc
, arg
[0].imm
, 0);
1460 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1461 const uint32_t par
[])
1463 TCGv_i32 tmp
= tcg_constant_i32(arg
[0].imm
);
1464 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1467 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1468 const uint32_t par
[])
1470 TCGv_i32 tmp
= tcg_temp_new_i32();
1471 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1472 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1476 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1477 const uint32_t par
[])
1479 TCGv_i32 tmp
= tcg_temp_new_i32();
1481 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1482 gen_callw_slot(dc
, par
[0], tmp
, -1);
1485 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1486 const uint32_t par
[])
1488 TCGv_i32 tmp1
= tcg_constant_i32(-1u << arg
[2].imm
);
1489 TCGv_i32 tmp2
= tcg_constant_i32((1 << arg
[2].imm
) - 1);
1491 tcg_gen_smax_i32(arg
[0].out
, tmp1
, arg
[1].in
);
1492 tcg_gen_smin_i32(arg
[0].out
, arg
[0].out
, tmp2
);
1495 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1496 const uint32_t par
[])
1498 /* TODO: GPIO32 may be a part of coprocessor */
1499 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1502 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1503 const uint32_t par
[])
1505 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1508 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1509 const uint32_t par
[])
1511 TCGv_i32 c
= tcg_constant_i32(arg
[1].imm
);
1513 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1516 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1517 const uint32_t par
[])
1519 TCGv_i32 addr
= tcg_temp_new_i32();
1520 TCGv_i32 res
= tcg_temp_new_i32();
1522 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1523 tcg_gen_qemu_ld_i32(res
, addr
, dc
->cring
, MO_UB
);
1526 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1527 const uint32_t par
[])
1529 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1530 arg
[2].imm
, arg
[3].imm
);
1533 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1534 const uint32_t par
[])
1536 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1539 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1540 const uint32_t par
[])
1542 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1543 qemu_log_mask(LOG_GUEST_ERROR
,
1544 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1545 return XTENSA_OP_ILL
;
1551 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1552 const uint32_t par
[])
1554 return 1 << (dc
->callinc
* 4);
1557 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1558 const uint32_t par
[])
1560 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1561 TCGv_i32 s
= tcg_constant_i32(arg
[0].imm
);
1562 TCGv_i32 imm
= tcg_constant_i32(arg
[1].imm
);
1563 gen_helper_entry(tcg_env
, pc
, s
, imm
);
1566 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1567 const uint32_t par
[])
1569 int maskimm
= (1 << arg
[3].imm
) - 1;
1571 TCGv_i32 tmp
= tcg_temp_new_i32();
1572 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1573 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1576 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1577 const uint32_t par
[])
1579 TCGv_i32 tmp
= tcg_temp_new_i32();
1581 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1582 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1583 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1586 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1587 const uint32_t par
[])
1589 #ifndef CONFIG_USER_ONLY
1590 TCGv_i32 addr
= tcg_temp_new_i32();
1592 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1593 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1594 gen_helper_itlb_hit_test(tcg_env
, addr
);
1598 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1599 const uint32_t par
[])
1601 #ifndef CONFIG_USER_ONLY
1602 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1604 gen_helper_itlb(tcg_env
, arg
[0].in
, dtlb
);
1608 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1609 const uint32_t par
[])
1611 gen_jumpi(dc
, arg
[0].imm
, 0);
1614 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1615 const uint32_t par
[])
1617 gen_jump(dc
, arg
[0].in
);
1620 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1621 const uint32_t par
[])
1623 TCGv_i32 addr
= tcg_temp_new_i32();
1626 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1627 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
1628 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, mop
);
1631 #ifdef CONFIG_USER_ONLY
1632 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1636 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1638 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1639 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
1641 gen_helper_check_exclusive(tcg_env
, pc
, addr
,
1642 tcg_constant_i32(is_write
));
1647 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1648 const uint32_t par
[])
1650 TCGv_i32 addr
= tcg_temp_new_i32();
1653 tcg_gen_mov_i32(addr
, arg
[1].in
);
1654 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
1655 gen_check_exclusive(dc
, addr
, false);
1656 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->cring
, mop
);
1657 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1658 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1661 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1662 const uint32_t par
[])
1664 TCGv_i32 addr
= tcg_temp_new_i32();
1667 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1668 mop
= gen_load_store_alignment(dc
, par
[0], addr
);
1672 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1674 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
1676 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
1678 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1683 static void translate_lct(DisasContext
*dc
, const OpcodeArg arg
[],
1684 const uint32_t par
[])
1686 tcg_gen_movi_i32(arg
[0].out
, 0);
1689 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1690 const uint32_t par
[])
1694 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1695 tmp
= tcg_temp_new();
1696 tcg_gen_addi_i32(tmp
, cpu_SR
[LITBASE
], arg
[1].raw_imm
- 1);
1698 tmp
= tcg_constant_i32(arg
[1].imm
);
1700 tcg_gen_qemu_ld_i32(arg
[0].out
, tmp
, dc
->cring
, MO_TEUL
);
1703 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1704 const uint32_t par
[])
1706 uint32_t lend
= arg
[1].imm
;
1708 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1709 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1710 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1712 if (par
[0] != TCG_COND_NEVER
) {
1713 TCGLabel
*label
= gen_new_label();
1714 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1715 gen_jumpi(dc
, lend
, 1);
1716 gen_set_label(label
);
1719 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1740 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1741 const uint32_t par
[])
1744 unsigned half
= par
[1];
1745 uint32_t ld_offset
= par
[2];
1746 unsigned off
= ld_offset
? 2 : 0;
1747 TCGv_i32 vaddr
= tcg_temp_new_i32();
1748 TCGv_i32 mem32
= tcg_temp_new_i32();
1753 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1754 mop
= gen_load_store_alignment(dc
, MO_TEUL
, vaddr
);
1755 tcg_gen_qemu_ld_tl(mem32
, vaddr
, dc
->cring
, mop
);
1757 if (op
!= MAC16_NONE
) {
1758 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1759 half
& MAC16_HX
, op
== MAC16_UMUL
);
1760 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1761 half
& MAC16_XH
, op
== MAC16_UMUL
);
1763 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1764 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1765 if (op
== MAC16_UMUL
) {
1766 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1768 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1771 TCGv_i32 lo
= tcg_temp_new_i32();
1772 TCGv_i32 hi
= tcg_temp_new_i32();
1774 tcg_gen_mul_i32(lo
, m1
, m2
);
1775 tcg_gen_sari_i32(hi
, lo
, 31);
1776 if (op
== MAC16_MULA
) {
1777 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1778 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1781 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1782 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1785 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1789 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1790 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1794 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1795 const uint32_t par
[])
1797 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1800 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1801 const uint32_t par
[])
1803 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1806 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1807 const uint32_t par
[])
1809 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1812 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1813 const uint32_t par
[])
1815 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1818 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1819 const uint32_t par
[])
1821 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1824 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1825 const uint32_t par
[])
1827 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1830 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
1831 const uint32_t par
[])
1833 TCGv_i32 zero
= tcg_constant_i32(0);
1835 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
1836 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
1839 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
1840 const uint32_t par
[])
1842 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
1845 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
1846 const uint32_t par
[])
1848 TCGv_i32 zero
= tcg_constant_i32(0);
1849 TCGv_i32 tmp
= tcg_temp_new_i32();
1851 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
1852 tcg_gen_movcond_i32(par
[0],
1853 arg
[0].out
, tmp
, zero
,
1854 arg
[1].in
, arg
[0].in
);
1857 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
1858 const uint32_t par
[])
1860 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1863 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
1864 const uint32_t par
[])
1866 TCGv_i32 v1
= tcg_temp_new_i32();
1867 TCGv_i32 v2
= tcg_temp_new_i32();
1870 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
1871 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
1873 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
1874 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
1876 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
1879 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
1880 const uint32_t par
[])
1882 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1885 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
1886 const uint32_t par
[])
1888 TCGv_i32 lo
= tcg_temp_new();
1891 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1893 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
1897 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
1898 const uint32_t par
[])
1900 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
1903 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
1904 const uint32_t par
[])
1908 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
1909 const uint32_t par
[])
1911 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
1914 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
1915 const uint32_t par
[])
1917 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
1920 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
1921 const uint32_t par
[])
1923 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1926 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1927 const uint32_t par
[])
1929 #ifndef CONFIG_USER_ONLY
1930 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
1932 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1933 gen_helper_ptlb(arg
[0].out
, tcg_env
, arg
[1].in
, dtlb
);
1937 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
1938 const uint32_t par
[])
1940 #ifndef CONFIG_USER_ONLY
1941 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1942 gen_helper_pptlb(arg
[0].out
, tcg_env
, arg
[1].in
);
1946 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
1947 const uint32_t par
[])
1949 TCGLabel
*label1
= gen_new_label();
1950 TCGLabel
*label2
= gen_new_label();
1952 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
1954 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
1956 tcg_gen_movi_i32(arg
[0].out
,
1957 par
[0] ? 0x80000000 : 0);
1959 gen_set_label(label1
);
1961 tcg_gen_div_i32(arg
[0].out
,
1962 arg
[1].in
, arg
[2].in
);
1964 tcg_gen_rem_i32(arg
[0].out
,
1965 arg
[1].in
, arg
[2].in
);
1967 gen_set_label(label2
);
1970 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
1971 const uint32_t par
[])
1973 tcg_gen_divu_i32(arg
[0].out
,
1974 arg
[1].in
, arg
[2].in
);
1977 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
1978 const uint32_t par
[])
1980 /* TODO: GPIO32 may be a part of coprocessor */
1981 tcg_gen_movi_i32(arg
[0].out
, 0);
1984 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
1985 const uint32_t par
[])
1987 tcg_gen_remu_i32(arg
[0].out
,
1988 arg
[1].in
, arg
[2].in
);
1991 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
1992 const uint32_t par
[])
1994 gen_helper_rer(arg
[0].out
, tcg_env
, arg
[1].in
);
1997 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
1998 const uint32_t par
[])
2000 gen_jump(dc
, cpu_R
[0]);
2003 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2004 const uint32_t par
[])
2007 qemu_log_mask(LOG_GUEST_ERROR
,
2008 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2009 return XTENSA_OP_ILL
;
2011 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2013 gen_helper_test_ill_retw(tcg_env
, pc
);
2018 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2019 const uint32_t par
[])
2021 TCGv_i32 tmp
= tcg_temp_new();
2022 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2023 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2024 cpu_SR
[WINDOW_START
], tmp
);
2025 tcg_gen_movi_i32(tmp
, dc
->pc
);
2026 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2027 gen_helper_retw(tcg_env
, cpu_R
[0]);
2031 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2032 const uint32_t par
[])
2034 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2037 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2038 const uint32_t par
[])
2040 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2041 gen_jump(dc
, cpu_SR
[EPC1
]);
2044 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2045 const uint32_t par
[])
2047 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2048 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2051 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2052 const uint32_t par
[])
2054 TCGv_i32 tmp
= tcg_temp_new();
2056 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2057 tcg_gen_shl_i32(tmp
, tcg_constant_i32(1), cpu_SR
[WINDOW_BASE
]);
2060 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2061 cpu_SR
[WINDOW_START
], tmp
);
2063 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2064 cpu_SR
[WINDOW_START
], tmp
);
2067 gen_helper_restore_owb(tcg_env
);
2068 gen_jump(dc
, cpu_SR
[EPC1
]);
2071 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2072 const uint32_t par
[])
2074 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2077 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2078 const uint32_t par
[])
2080 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2081 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2082 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2085 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2086 const uint32_t par
[])
2088 if (sr_name
[par
[0]]) {
2089 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2091 tcg_gen_movi_i32(arg
[0].out
, 0);
2095 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2096 const uint32_t par
[])
2098 #ifndef CONFIG_USER_ONLY
2099 translator_io_start(&dc
->base
);
2100 gen_helper_update_ccount(tcg_env
);
2101 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2105 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2106 const uint32_t par
[])
2108 #ifndef CONFIG_USER_ONLY
2109 TCGv_i32 tmp
= tcg_temp_new_i32();
2111 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2112 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2113 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2117 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2118 const uint32_t par
[])
2120 #ifndef CONFIG_USER_ONLY
2121 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2126 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2128 helper
[par
[1]](arg
[0].out
, tcg_env
, arg
[1].in
, dtlb
);
2132 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2133 const uint32_t par
[])
2135 #ifndef CONFIG_USER_ONLY
2136 gen_helper_rptlb0(arg
[0].out
, tcg_env
, arg
[1].in
);
2140 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2141 const uint32_t par
[])
2143 #ifndef CONFIG_USER_ONLY
2144 gen_helper_rptlb1(arg
[0].out
, tcg_env
, arg
[1].in
);
2148 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2149 const uint32_t par
[])
2151 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2154 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2155 const uint32_t par
[])
2157 /* TODO: GPIO32 may be a part of coprocessor */
2158 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2161 #ifdef CONFIG_USER_ONLY
2162 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2166 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2168 TCGv_i32 pc
= tcg_constant_i32(dc
->pc
);
2170 gen_helper_check_atomctl(tcg_env
, pc
, addr
);
2174 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2175 const uint32_t par
[])
2177 TCGv_i32 tmp
= tcg_temp_new_i32();
2178 TCGv_i32 addr
= tcg_temp_new_i32();
2181 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2182 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2183 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2184 gen_check_atomctl(dc
, addr
);
2185 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2186 tmp
, dc
->cring
, mop
);
2189 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2190 const uint32_t par
[])
2192 TCGv_i32 addr
= tcg_temp_new_i32();
2195 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2196 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
2197 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, mop
);
2200 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2201 const uint32_t par
[])
2203 TCGv_i32 prev
= tcg_temp_new_i32();
2204 TCGv_i32 addr
= tcg_temp_new_i32();
2205 TCGv_i32 res
= tcg_temp_new_i32();
2206 TCGLabel
*label
= gen_new_label();
2209 tcg_gen_movi_i32(res
, 0);
2210 tcg_gen_mov_i32(addr
, arg
[1].in
);
2211 mop
= gen_load_store_alignment(dc
, MO_TEUL
| MO_ALIGN
, addr
);
2212 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2213 gen_check_exclusive(dc
, addr
, true);
2214 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2215 arg
[0].in
, dc
->cring
, mop
);
2216 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2217 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2218 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2219 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2220 gen_set_label(label
);
2221 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2222 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2225 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2226 const uint32_t par
[])
2228 tcg_gen_setcond_i32(par
[0],
2230 arg
[1].in
, arg
[2].in
);
2233 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2234 const uint32_t par
[])
2236 tcg_gen_sextract_i32(arg
[0].out
, arg
[1].in
, 0, arg
[2].imm
+ 1);
2239 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2240 const OpcodeArg arg
[],
2241 const uint32_t par
[])
2243 bool is_semi
= semihosting_enabled(dc
->cring
!= 0);
2244 #ifdef CONFIG_USER_ONLY
2247 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2248 bool ill
= dc
->config
->hw_version
<= 250002 && !is_semi
;
2250 if (ill
|| !is_semi
) {
2251 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2253 return ill
? XTENSA_OP_ILL
: 0;
2256 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2257 const uint32_t par
[])
2259 #ifndef CONFIG_USER_ONLY
2260 if (semihosting_enabled(dc
->cring
!= 0)) {
2261 gen_helper_simcall(tcg_env
);
2267 * Note: 64 bit ops are used here solely because SAR values
2270 #define gen_shift_reg(cmd, reg) do { \
2271 TCGv_i64 tmp = tcg_temp_new_i64(); \
2272 tcg_gen_extu_i32_i64(tmp, reg); \
2273 tcg_gen_##cmd##_i64(v, v, tmp); \
2274 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2277 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2279 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2280 const uint32_t par
[])
2282 if (dc
->sar_m32_5bit
) {
2283 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2285 TCGv_i64 v
= tcg_temp_new_i64();
2286 TCGv_i32 s
= tcg_temp_new();
2287 tcg_gen_subfi_i32(s
, 32, cpu_SR
[SAR
]);
2288 tcg_gen_andi_i32(s
, s
, 0x3f);
2289 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2290 gen_shift_reg(shl
, s
);
2294 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2295 const uint32_t par
[])
2297 if (arg
[2].imm
== 32) {
2298 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2299 arg
[0].imm
, arg
[1].imm
);
2301 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2304 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2305 const uint32_t par
[])
2307 if (dc
->sar_m32_5bit
) {
2308 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2310 TCGv_i64 v
= tcg_temp_new_i64();
2311 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2316 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2317 const uint32_t par
[])
2319 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2322 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2323 const uint32_t par
[])
2325 TCGv_i64 v
= tcg_temp_new_i64();
2326 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2330 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2331 const uint32_t par
[])
2333 if (dc
->sar_m32_5bit
) {
2334 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2336 TCGv_i64 v
= tcg_temp_new_i64();
2337 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2343 #undef gen_shift_reg
2345 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2346 const uint32_t par
[])
2348 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2351 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2352 const uint32_t par
[])
2354 TCGv_i32 tmp
= tcg_temp_new_i32();
2355 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2356 gen_left_shift_sar(dc
, tmp
);
2359 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2360 const uint32_t par
[])
2362 TCGv_i32 tmp
= tcg_temp_new_i32();
2363 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2364 gen_right_shift_sar(dc
, tmp
);
2367 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2368 const uint32_t par
[])
2370 gen_right_shift_sar(dc
, tcg_constant_i32(arg
[0].imm
));
2373 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2374 const uint32_t par
[])
2376 gen_left_shift_sar(dc
, arg
[0].in
);
2379 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2380 const uint32_t par
[])
2382 gen_right_shift_sar(dc
, arg
[0].in
);
2385 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2386 const uint32_t par
[])
2388 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2391 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2392 const uint32_t par
[])
2394 TCGv_i32 tmp
= tcg_temp_new_i32();
2395 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2396 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2399 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2400 const uint32_t par
[])
2402 #ifndef CONFIG_USER_ONLY
2403 TCGv_i32 pc
= tcg_constant_i32(dc
->base
.pc_next
);
2405 translator_io_start(&dc
->base
);
2406 gen_helper_waiti(tcg_env
, pc
, tcg_constant_i32(arg
[0].imm
));
2410 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2411 const uint32_t par
[])
2413 #ifndef CONFIG_USER_ONLY
2414 TCGv_i32 dtlb
= tcg_constant_i32(par
[0]);
2416 gen_helper_wtlb(tcg_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2420 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2421 const uint32_t par
[])
2423 #ifndef CONFIG_USER_ONLY
2424 gen_helper_wptlb(tcg_env
, arg
[0].in
, arg
[1].in
);
2428 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2429 const uint32_t par
[])
2431 gen_helper_wer(tcg_env
, arg
[0].in
, arg
[1].in
);
2434 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2435 const uint32_t par
[])
2437 /* TODO: GPIO32 may be a part of coprocessor */
2438 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2441 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2442 const uint32_t par
[])
2444 if (sr_name
[par
[0]]) {
2445 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2449 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2450 const uint32_t par
[])
2452 if (sr_name
[par
[0]]) {
2453 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2457 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2458 const uint32_t par
[])
2460 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2463 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2464 const uint32_t par
[])
2466 #ifndef CONFIG_USER_ONLY
2467 uint32_t id
= par
[0] - CCOMPARE
;
2469 assert(id
< dc
->config
->nccompare
);
2470 translator_io_start(&dc
->base
);
2471 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2472 gen_helper_update_ccompare(tcg_env
, tcg_constant_i32(id
));
2476 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2477 const uint32_t par
[])
2479 #ifndef CONFIG_USER_ONLY
2480 translator_io_start(&dc
->base
);
2481 gen_helper_wsr_ccount(tcg_env
, arg
[0].in
);
2485 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2486 const uint32_t par
[])
2488 #ifndef CONFIG_USER_ONLY
2489 unsigned id
= par
[0] - DBREAKA
;
2491 assert(id
< dc
->config
->ndbreak
);
2492 gen_helper_wsr_dbreaka(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2496 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2497 const uint32_t par
[])
2499 #ifndef CONFIG_USER_ONLY
2500 unsigned id
= par
[0] - DBREAKC
;
2502 assert(id
< dc
->config
->ndbreak
);
2503 gen_helper_wsr_dbreakc(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2507 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2508 const uint32_t par
[])
2510 #ifndef CONFIG_USER_ONLY
2511 unsigned id
= par
[0] - IBREAKA
;
2513 assert(id
< dc
->config
->nibreak
);
2514 gen_helper_wsr_ibreaka(tcg_env
, tcg_constant_i32(id
), arg
[0].in
);
2518 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2519 const uint32_t par
[])
2521 #ifndef CONFIG_USER_ONLY
2522 gen_helper_wsr_ibreakenable(tcg_env
, arg
[0].in
);
2526 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2527 const uint32_t par
[])
2529 #ifndef CONFIG_USER_ONLY
2531 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2533 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2538 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2539 const uint32_t par
[])
2541 #ifndef CONFIG_USER_ONLY
2542 gen_helper_intclear(tcg_env
, arg
[0].in
);
2546 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2547 const uint32_t par
[])
2549 #ifndef CONFIG_USER_ONLY
2550 gen_helper_intset(tcg_env
, arg
[0].in
);
2554 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2555 const uint32_t par
[])
2557 #ifndef CONFIG_USER_ONLY
2558 gen_helper_wsr_memctl(tcg_env
, arg
[0].in
);
2562 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2563 const uint32_t par
[])
2565 #ifndef CONFIG_USER_ONLY
2566 gen_helper_wsr_mpuenb(tcg_env
, arg
[0].in
);
2570 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2571 const uint32_t par
[])
2573 #ifndef CONFIG_USER_ONLY
2574 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2575 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2577 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2578 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2581 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2585 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2586 const uint32_t par
[])
2588 #ifndef CONFIG_USER_ONLY
2589 gen_helper_wsr_rasid(tcg_env
, arg
[0].in
);
2593 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2594 const uint32_t par
[])
2596 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2597 if (dc
->sar_m32_5bit
) {
2598 tcg_gen_discard_i32(dc
->sar_m32
);
2600 dc
->sar_5bit
= false;
2601 dc
->sar_m32_5bit
= false;
2604 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2605 const uint32_t par
[])
2607 #ifndef CONFIG_USER_ONLY
2608 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2612 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2613 const uint32_t par
[])
2615 #ifndef CONFIG_USER_ONLY
2616 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2617 (1 << dc
->config
->nareg
/ 4) - 1);
2621 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2622 const uint32_t par
[])
2624 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2627 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2628 const uint32_t par
[])
2630 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2633 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2634 const uint32_t par
[])
2636 if (sr_name
[par
[0]]) {
2637 TCGv_i32 tmp
= tcg_temp_new_i32();
2639 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2640 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2641 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2643 tcg_gen_movi_i32(arg
[0].out
, 0);
2647 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2648 const uint32_t par
[])
2650 if (sr_name
[par
[0]]) {
2651 TCGv_i32 tmp
= tcg_temp_new_i32();
2653 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2654 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2655 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2657 tcg_gen_movi_i32(arg
[0].out
, 0);
2661 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2662 const uint32_t par
[])
2664 #ifndef CONFIG_USER_ONLY
2665 TCGv_i32 tmp
= tcg_temp_new_i32();
2667 translator_io_start(&dc
->base
);
2668 gen_helper_update_ccount(tcg_env
);
2669 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2670 gen_helper_wsr_ccount(tcg_env
, arg
[0].in
);
2671 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2676 #define gen_translate_xsr(name) \
2677 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2678 const uint32_t par[]) \
2680 TCGv_i32 tmp = tcg_temp_new_i32(); \
2682 if (sr_name[par[0]]) { \
2683 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2685 tcg_gen_movi_i32(tmp, 0); \
2687 translate_wsr_##name(dc, arg, par); \
2688 tcg_gen_mov_i32(arg[0].out, tmp); \
2691 gen_translate_xsr(acchi
)
2692 gen_translate_xsr(ccompare
)
2693 gen_translate_xsr(dbreaka
)
2694 gen_translate_xsr(dbreakc
)
2695 gen_translate_xsr(ibreaka
)
2696 gen_translate_xsr(ibreakenable
)
2697 gen_translate_xsr(icount
)
2698 gen_translate_xsr(memctl
)
2699 gen_translate_xsr(mpuenb
)
2700 gen_translate_xsr(ps
)
2701 gen_translate_xsr(rasid
)
2702 gen_translate_xsr(sar
)
2703 gen_translate_xsr(windowbase
)
2704 gen_translate_xsr(windowstart
)
2706 #undef gen_translate_xsr
2708 static const XtensaOpcodeOps core_ops
[] = {
2711 .translate
= translate_abs
,
2713 .name
= (const char * const[]) {
2714 "add", "add.n", NULL
,
2716 .translate
= translate_add
,
2717 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2719 .name
= (const char * const[]) {
2720 "addi", "addi.n", NULL
,
2722 .translate
= translate_addi
,
2723 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2726 .translate
= translate_addi
,
2729 .translate
= translate_addx
,
2730 .par
= (const uint32_t[]){1},
2733 .translate
= translate_addx
,
2734 .par
= (const uint32_t[]){2},
2737 .translate
= translate_addx
,
2738 .par
= (const uint32_t[]){3},
2741 .translate
= translate_all
,
2742 .par
= (const uint32_t[]){true, 4},
2745 .translate
= translate_all
,
2746 .par
= (const uint32_t[]){true, 8},
2749 .translate
= translate_and
,
2752 .translate
= translate_boolean
,
2753 .par
= (const uint32_t[]){BOOLEAN_AND
},
2756 .translate
= translate_boolean
,
2757 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2760 .translate
= translate_all
,
2761 .par
= (const uint32_t[]){false, 4},
2764 .translate
= translate_all
,
2765 .par
= (const uint32_t[]){false, 8},
2767 .name
= (const char * const[]) {
2768 "ball", "ball.w15", "ball.w18", NULL
,
2770 .translate
= translate_ball
,
2771 .par
= (const uint32_t[]){TCG_COND_EQ
},
2772 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2774 .name
= (const char * const[]) {
2775 "bany", "bany.w15", "bany.w18", NULL
,
2777 .translate
= translate_bany
,
2778 .par
= (const uint32_t[]){TCG_COND_NE
},
2779 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2781 .name
= (const char * const[]) {
2782 "bbc", "bbc.w15", "bbc.w18", NULL
,
2784 .translate
= translate_bb
,
2785 .par
= (const uint32_t[]){TCG_COND_EQ
},
2786 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2788 .name
= (const char * const[]) {
2789 "bbci", "bbci.w15", "bbci.w18", NULL
,
2791 .translate
= translate_bbi
,
2792 .par
= (const uint32_t[]){TCG_COND_EQ
},
2793 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2795 .name
= (const char * const[]) {
2796 "bbs", "bbs.w15", "bbs.w18", NULL
,
2798 .translate
= translate_bb
,
2799 .par
= (const uint32_t[]){TCG_COND_NE
},
2800 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2802 .name
= (const char * const[]) {
2803 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
2805 .translate
= translate_bbi
,
2806 .par
= (const uint32_t[]){TCG_COND_NE
},
2807 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2809 .name
= (const char * const[]) {
2810 "beq", "beq.w15", "beq.w18", NULL
,
2812 .translate
= translate_b
,
2813 .par
= (const uint32_t[]){TCG_COND_EQ
},
2814 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2816 .name
= (const char * const[]) {
2817 "beqi", "beqi.w15", "beqi.w18", NULL
,
2819 .translate
= translate_bi
,
2820 .par
= (const uint32_t[]){TCG_COND_EQ
},
2821 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2823 .name
= (const char * const[]) {
2824 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
2826 .translate
= translate_bz
,
2827 .par
= (const uint32_t[]){TCG_COND_EQ
},
2828 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2831 .translate
= translate_bp
,
2832 .par
= (const uint32_t[]){TCG_COND_EQ
},
2834 .name
= (const char * const[]) {
2835 "bge", "bge.w15", "bge.w18", NULL
,
2837 .translate
= translate_b
,
2838 .par
= (const uint32_t[]){TCG_COND_GE
},
2839 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2841 .name
= (const char * const[]) {
2842 "bgei", "bgei.w15", "bgei.w18", NULL
,
2844 .translate
= translate_bi
,
2845 .par
= (const uint32_t[]){TCG_COND_GE
},
2846 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2848 .name
= (const char * const[]) {
2849 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
2851 .translate
= translate_b
,
2852 .par
= (const uint32_t[]){TCG_COND_GEU
},
2853 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2855 .name
= (const char * const[]) {
2856 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
2858 .translate
= translate_bi
,
2859 .par
= (const uint32_t[]){TCG_COND_GEU
},
2860 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2862 .name
= (const char * const[]) {
2863 "bgez", "bgez.w15", "bgez.w18", NULL
,
2865 .translate
= translate_bz
,
2866 .par
= (const uint32_t[]){TCG_COND_GE
},
2867 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2869 .name
= (const char * const[]) {
2870 "blt", "blt.w15", "blt.w18", NULL
,
2872 .translate
= translate_b
,
2873 .par
= (const uint32_t[]){TCG_COND_LT
},
2874 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2876 .name
= (const char * const[]) {
2877 "blti", "blti.w15", "blti.w18", NULL
,
2879 .translate
= translate_bi
,
2880 .par
= (const uint32_t[]){TCG_COND_LT
},
2881 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2883 .name
= (const char * const[]) {
2884 "bltu", "bltu.w15", "bltu.w18", NULL
,
2886 .translate
= translate_b
,
2887 .par
= (const uint32_t[]){TCG_COND_LTU
},
2888 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2890 .name
= (const char * const[]) {
2891 "bltui", "bltui.w15", "bltui.w18", NULL
,
2893 .translate
= translate_bi
,
2894 .par
= (const uint32_t[]){TCG_COND_LTU
},
2895 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2897 .name
= (const char * const[]) {
2898 "bltz", "bltz.w15", "bltz.w18", NULL
,
2900 .translate
= translate_bz
,
2901 .par
= (const uint32_t[]){TCG_COND_LT
},
2902 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2904 .name
= (const char * const[]) {
2905 "bnall", "bnall.w15", "bnall.w18", NULL
,
2907 .translate
= translate_ball
,
2908 .par
= (const uint32_t[]){TCG_COND_NE
},
2909 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2911 .name
= (const char * const[]) {
2912 "bne", "bne.w15", "bne.w18", NULL
,
2914 .translate
= translate_b
,
2915 .par
= (const uint32_t[]){TCG_COND_NE
},
2916 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2918 .name
= (const char * const[]) {
2919 "bnei", "bnei.w15", "bnei.w18", NULL
,
2921 .translate
= translate_bi
,
2922 .par
= (const uint32_t[]){TCG_COND_NE
},
2923 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2925 .name
= (const char * const[]) {
2926 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
2928 .translate
= translate_bz
,
2929 .par
= (const uint32_t[]){TCG_COND_NE
},
2930 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2932 .name
= (const char * const[]) {
2933 "bnone", "bnone.w15", "bnone.w18", NULL
,
2935 .translate
= translate_bany
,
2936 .par
= (const uint32_t[]){TCG_COND_EQ
},
2937 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2940 .translate
= translate_nop
,
2941 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
2942 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2945 .translate
= translate_nop
,
2946 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
2947 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2950 .translate
= translate_bp
,
2951 .par
= (const uint32_t[]){TCG_COND_NE
},
2954 .translate
= translate_call0
,
2957 .translate
= translate_callw
,
2958 .par
= (const uint32_t[]){3},
2961 .translate
= translate_callw
,
2962 .par
= (const uint32_t[]){1},
2965 .translate
= translate_callw
,
2966 .par
= (const uint32_t[]){2},
2969 .translate
= translate_callx0
,
2972 .translate
= translate_callxw
,
2973 .par
= (const uint32_t[]){3},
2976 .translate
= translate_callxw
,
2977 .par
= (const uint32_t[]){1},
2980 .translate
= translate_callxw
,
2981 .par
= (const uint32_t[]){2},
2984 .translate
= translate_clamps
,
2986 .name
= "clrb_expstate",
2987 .translate
= translate_clrb_expstate
,
2990 .translate
= translate_clrex
,
2993 .translate
= translate_const16
,
2996 .translate
= translate_depbits
,
2999 .translate
= translate_dcache
,
3000 .op_flags
= XTENSA_OP_PRIVILEGED
,
3003 .translate
= translate_nop
,
3006 .translate
= translate_dcache
,
3007 .op_flags
= XTENSA_OP_PRIVILEGED
,
3010 .translate
= translate_dcache
,
3013 .translate
= translate_nop
,
3016 .translate
= translate_dcache
,
3019 .translate
= translate_nop
,
3022 .translate
= translate_nop
,
3023 .op_flags
= XTENSA_OP_PRIVILEGED
,
3026 .translate
= translate_nop
,
3027 .op_flags
= XTENSA_OP_PRIVILEGED
,
3030 .translate
= translate_nop
,
3031 .op_flags
= XTENSA_OP_PRIVILEGED
,
3034 .translate
= translate_nop
,
3035 .op_flags
= XTENSA_OP_PRIVILEGED
,
3038 .translate
= translate_diwbuip
,
3039 .op_flags
= XTENSA_OP_PRIVILEGED
,
3042 .translate
= translate_dcache
,
3043 .op_flags
= XTENSA_OP_PRIVILEGED
,
3046 .translate
= translate_nop
,
3049 .translate
= translate_nop
,
3052 .translate
= translate_nop
,
3055 .translate
= translate_nop
,
3058 .translate
= translate_nop
,
3061 .translate
= translate_nop
,
3064 .translate
= translate_nop
,
3067 .translate
= translate_nop
,
3070 .translate
= translate_nop
,
3073 .translate
= translate_nop
,
3076 .translate
= translate_nop
,
3079 .translate
= translate_entry
,
3080 .test_exceptions
= test_exceptions_entry
,
3081 .test_overflow
= test_overflow_entry
,
3082 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3083 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3086 .translate
= translate_nop
,
3089 .translate
= translate_nop
,
3092 .translate
= translate_extui
,
3095 .translate
= translate_memw
,
3098 .translate
= translate_getex
,
3101 .op_flags
= XTENSA_OP_ILL
,
3104 .op_flags
= XTENSA_OP_ILL
,
3107 .translate
= translate_itlb
,
3108 .par
= (const uint32_t[]){true},
3109 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3112 .translate
= translate_icache
,
3115 .translate
= translate_icache
,
3116 .op_flags
= XTENSA_OP_PRIVILEGED
,
3119 .translate
= translate_nop
,
3120 .op_flags
= XTENSA_OP_PRIVILEGED
,
3123 .translate
= translate_itlb
,
3124 .par
= (const uint32_t[]){false},
3125 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3128 .translate
= translate_nop
,
3129 .op_flags
= XTENSA_OP_PRIVILEGED
,
3131 .name
= (const char * const[]) {
3132 "ill", "ill.n", NULL
,
3134 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3137 .translate
= translate_nop
,
3140 .translate
= translate_icache
,
3141 .op_flags
= XTENSA_OP_PRIVILEGED
,
3144 .translate
= translate_nop
,
3147 .translate
= translate_j
,
3150 .translate
= translate_jx
,
3153 .translate
= translate_ldst
,
3154 .par
= (const uint32_t[]){MO_TESW
, false, false},
3155 .op_flags
= XTENSA_OP_LOAD
,
3158 .translate
= translate_ldst
,
3159 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3160 .op_flags
= XTENSA_OP_LOAD
,
3163 .translate
= translate_ldst
,
3164 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, false},
3165 .op_flags
= XTENSA_OP_LOAD
,
3168 .translate
= translate_l32e
,
3169 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3172 .translate
= translate_l32ex
,
3173 .op_flags
= XTENSA_OP_LOAD
,
3175 .name
= (const char * const[]) {
3176 "l32i", "l32i.n", NULL
,
3178 .translate
= translate_ldst
,
3179 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3180 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3183 .translate
= translate_l32r
,
3184 .op_flags
= XTENSA_OP_LOAD
,
3187 .translate
= translate_ldst
,
3188 .par
= (const uint32_t[]){MO_UB
, false, false},
3189 .op_flags
= XTENSA_OP_LOAD
,
3192 .translate
= translate_lct
,
3193 .op_flags
= XTENSA_OP_PRIVILEGED
,
3196 .translate
= translate_nop
,
3197 .op_flags
= XTENSA_OP_PRIVILEGED
,
3200 .translate
= translate_mac16
,
3201 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3202 .op_flags
= XTENSA_OP_LOAD
,
3205 .translate
= translate_mac16
,
3206 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3207 .op_flags
= XTENSA_OP_LOAD
,
3210 .op_flags
= XTENSA_OP_ILL
,
3213 .translate
= translate_lct
,
3214 .op_flags
= XTENSA_OP_PRIVILEGED
,
3217 .translate
= translate_nop
,
3218 .op_flags
= XTENSA_OP_PRIVILEGED
,
3220 .name
= (const char * const[]) {
3221 "loop", "loop.w15", NULL
,
3223 .translate
= translate_loop
,
3224 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3225 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3227 .name
= (const char * const[]) {
3228 "loopgtz", "loopgtz.w15", NULL
,
3230 .translate
= translate_loop
,
3231 .par
= (const uint32_t[]){TCG_COND_GT
},
3232 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3234 .name
= (const char * const[]) {
3235 "loopnez", "loopnez.w15", NULL
,
3237 .translate
= translate_loop
,
3238 .par
= (const uint32_t[]){TCG_COND_NE
},
3239 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3242 .translate
= translate_smax
,
3245 .translate
= translate_umax
,
3248 .translate
= translate_memw
,
3251 .translate
= translate_smin
,
3254 .translate
= translate_umin
,
3256 .name
= (const char * const[]) {
3257 "mov", "mov.n", NULL
,
3259 .translate
= translate_mov
,
3260 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3263 .translate
= translate_movcond
,
3264 .par
= (const uint32_t[]){TCG_COND_EQ
},
3267 .translate
= translate_movp
,
3268 .par
= (const uint32_t[]){TCG_COND_EQ
},
3271 .translate
= translate_movcond
,
3272 .par
= (const uint32_t[]){TCG_COND_GE
},
3275 .translate
= translate_movi
,
3278 .translate
= translate_movi
,
3281 .translate
= translate_movcond
,
3282 .par
= (const uint32_t[]){TCG_COND_LT
},
3285 .translate
= translate_movcond
,
3286 .par
= (const uint32_t[]){TCG_COND_NE
},
3289 .translate
= translate_movsp
,
3290 .op_flags
= XTENSA_OP_ALLOCA
,
3293 .translate
= translate_movp
,
3294 .par
= (const uint32_t[]){TCG_COND_NE
},
3296 .name
= "mul.aa.hh",
3297 .translate
= translate_mac16
,
3298 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3300 .name
= "mul.aa.hl",
3301 .translate
= translate_mac16
,
3302 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3304 .name
= "mul.aa.lh",
3305 .translate
= translate_mac16
,
3306 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3308 .name
= "mul.aa.ll",
3309 .translate
= translate_mac16
,
3310 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3312 .name
= "mul.ad.hh",
3313 .translate
= translate_mac16
,
3314 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3316 .name
= "mul.ad.hl",
3317 .translate
= translate_mac16
,
3318 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3320 .name
= "mul.ad.lh",
3321 .translate
= translate_mac16
,
3322 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3324 .name
= "mul.ad.ll",
3325 .translate
= translate_mac16
,
3326 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3328 .name
= "mul.da.hh",
3329 .translate
= translate_mac16
,
3330 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3332 .name
= "mul.da.hl",
3333 .translate
= translate_mac16
,
3334 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3336 .name
= "mul.da.lh",
3337 .translate
= translate_mac16
,
3338 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3340 .name
= "mul.da.ll",
3341 .translate
= translate_mac16
,
3342 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3344 .name
= "mul.dd.hh",
3345 .translate
= translate_mac16
,
3346 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3348 .name
= "mul.dd.hl",
3349 .translate
= translate_mac16
,
3350 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3352 .name
= "mul.dd.lh",
3353 .translate
= translate_mac16
,
3354 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3356 .name
= "mul.dd.ll",
3357 .translate
= translate_mac16
,
3358 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3361 .translate
= translate_mul16
,
3362 .par
= (const uint32_t[]){true},
3365 .translate
= translate_mul16
,
3366 .par
= (const uint32_t[]){false},
3368 .name
= "mula.aa.hh",
3369 .translate
= translate_mac16
,
3370 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3372 .name
= "mula.aa.hl",
3373 .translate
= translate_mac16
,
3374 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3376 .name
= "mula.aa.lh",
3377 .translate
= translate_mac16
,
3378 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3380 .name
= "mula.aa.ll",
3381 .translate
= translate_mac16
,
3382 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3384 .name
= "mula.ad.hh",
3385 .translate
= translate_mac16
,
3386 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3388 .name
= "mula.ad.hl",
3389 .translate
= translate_mac16
,
3390 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3392 .name
= "mula.ad.lh",
3393 .translate
= translate_mac16
,
3394 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3396 .name
= "mula.ad.ll",
3397 .translate
= translate_mac16
,
3398 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3400 .name
= "mula.da.hh",
3401 .translate
= translate_mac16
,
3402 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3404 .name
= "mula.da.hh.lddec",
3405 .translate
= translate_mac16
,
3406 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3408 .name
= "mula.da.hh.ldinc",
3409 .translate
= translate_mac16
,
3410 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3412 .name
= "mula.da.hl",
3413 .translate
= translate_mac16
,
3414 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3416 .name
= "mula.da.hl.lddec",
3417 .translate
= translate_mac16
,
3418 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3420 .name
= "mula.da.hl.ldinc",
3421 .translate
= translate_mac16
,
3422 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3424 .name
= "mula.da.lh",
3425 .translate
= translate_mac16
,
3426 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3428 .name
= "mula.da.lh.lddec",
3429 .translate
= translate_mac16
,
3430 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3432 .name
= "mula.da.lh.ldinc",
3433 .translate
= translate_mac16
,
3434 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3436 .name
= "mula.da.ll",
3437 .translate
= translate_mac16
,
3438 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3440 .name
= "mula.da.ll.lddec",
3441 .translate
= translate_mac16
,
3442 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3444 .name
= "mula.da.ll.ldinc",
3445 .translate
= translate_mac16
,
3446 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3448 .name
= "mula.dd.hh",
3449 .translate
= translate_mac16
,
3450 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3452 .name
= "mula.dd.hh.lddec",
3453 .translate
= translate_mac16
,
3454 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3456 .name
= "mula.dd.hh.ldinc",
3457 .translate
= translate_mac16
,
3458 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3460 .name
= "mula.dd.hl",
3461 .translate
= translate_mac16
,
3462 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3464 .name
= "mula.dd.hl.lddec",
3465 .translate
= translate_mac16
,
3466 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3468 .name
= "mula.dd.hl.ldinc",
3469 .translate
= translate_mac16
,
3470 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3472 .name
= "mula.dd.lh",
3473 .translate
= translate_mac16
,
3474 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3476 .name
= "mula.dd.lh.lddec",
3477 .translate
= translate_mac16
,
3478 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3480 .name
= "mula.dd.lh.ldinc",
3481 .translate
= translate_mac16
,
3482 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3484 .name
= "mula.dd.ll",
3485 .translate
= translate_mac16
,
3486 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3488 .name
= "mula.dd.ll.lddec",
3489 .translate
= translate_mac16
,
3490 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3492 .name
= "mula.dd.ll.ldinc",
3493 .translate
= translate_mac16
,
3494 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3497 .translate
= translate_mull
,
3499 .name
= "muls.aa.hh",
3500 .translate
= translate_mac16
,
3501 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3503 .name
= "muls.aa.hl",
3504 .translate
= translate_mac16
,
3505 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3507 .name
= "muls.aa.lh",
3508 .translate
= translate_mac16
,
3509 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3511 .name
= "muls.aa.ll",
3512 .translate
= translate_mac16
,
3513 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3515 .name
= "muls.ad.hh",
3516 .translate
= translate_mac16
,
3517 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3519 .name
= "muls.ad.hl",
3520 .translate
= translate_mac16
,
3521 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3523 .name
= "muls.ad.lh",
3524 .translate
= translate_mac16
,
3525 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3527 .name
= "muls.ad.ll",
3528 .translate
= translate_mac16
,
3529 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3531 .name
= "muls.da.hh",
3532 .translate
= translate_mac16
,
3533 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3535 .name
= "muls.da.hl",
3536 .translate
= translate_mac16
,
3537 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3539 .name
= "muls.da.lh",
3540 .translate
= translate_mac16
,
3541 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3543 .name
= "muls.da.ll",
3544 .translate
= translate_mac16
,
3545 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3547 .name
= "muls.dd.hh",
3548 .translate
= translate_mac16
,
3549 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3551 .name
= "muls.dd.hl",
3552 .translate
= translate_mac16
,
3553 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3555 .name
= "muls.dd.lh",
3556 .translate
= translate_mac16
,
3557 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3559 .name
= "muls.dd.ll",
3560 .translate
= translate_mac16
,
3561 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3564 .translate
= translate_mulh
,
3565 .par
= (const uint32_t[]){true},
3568 .translate
= translate_mulh
,
3569 .par
= (const uint32_t[]){false},
3572 .translate
= translate_neg
,
3574 .name
= (const char * const[]) {
3575 "nop", "nop.n", NULL
,
3577 .translate
= translate_nop
,
3578 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3581 .translate
= translate_nsa
,
3584 .translate
= translate_nsau
,
3587 .translate
= translate_or
,
3590 .translate
= translate_boolean
,
3591 .par
= (const uint32_t[]){BOOLEAN_OR
},
3594 .translate
= translate_boolean
,
3595 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3598 .translate
= translate_ptlb
,
3599 .par
= (const uint32_t[]){true},
3600 .op_flags
= XTENSA_OP_PRIVILEGED
,
3603 .translate
= translate_nop
,
3606 .translate
= translate_nop
,
3609 .translate
= translate_nop
,
3612 .translate
= translate_nop
,
3615 .translate
= translate_nop
,
3618 .translate
= translate_ptlb
,
3619 .par
= (const uint32_t[]){false},
3620 .op_flags
= XTENSA_OP_PRIVILEGED
,
3623 .translate
= translate_pptlb
,
3624 .op_flags
= XTENSA_OP_PRIVILEGED
,
3627 .translate
= translate_quos
,
3628 .par
= (const uint32_t[]){true},
3629 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3632 .translate
= translate_quou
,
3633 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3636 .translate
= translate_rtlb
,
3637 .par
= (const uint32_t[]){true, 0},
3638 .op_flags
= XTENSA_OP_PRIVILEGED
,
3641 .translate
= translate_rtlb
,
3642 .par
= (const uint32_t[]){true, 1},
3643 .op_flags
= XTENSA_OP_PRIVILEGED
,
3645 .name
= "read_impwire",
3646 .translate
= translate_read_impwire
,
3649 .translate
= translate_quos
,
3650 .par
= (const uint32_t[]){false},
3651 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3654 .translate
= translate_remu
,
3655 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3658 .translate
= translate_rer
,
3659 .op_flags
= XTENSA_OP_PRIVILEGED
,
3661 .name
= (const char * const[]) {
3662 "ret", "ret.n", NULL
,
3664 .translate
= translate_ret
,
3665 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3667 .name
= (const char * const[]) {
3668 "retw", "retw.n", NULL
,
3670 .translate
= translate_retw
,
3671 .test_exceptions
= test_exceptions_retw
,
3672 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3675 .op_flags
= XTENSA_OP_ILL
,
3678 .translate
= translate_rfde
,
3679 .op_flags
= XTENSA_OP_PRIVILEGED
,
3682 .op_flags
= XTENSA_OP_ILL
,
3685 .translate
= translate_rfe
,
3686 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3689 .translate
= translate_rfi
,
3690 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3693 .translate
= translate_rfw
,
3694 .par
= (const uint32_t[]){true},
3695 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3698 .translate
= translate_rfw
,
3699 .par
= (const uint32_t[]){false},
3700 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3703 .translate
= translate_rtlb
,
3704 .par
= (const uint32_t[]){false, 0},
3705 .op_flags
= XTENSA_OP_PRIVILEGED
,
3708 .translate
= translate_rtlb
,
3709 .par
= (const uint32_t[]){false, 1},
3710 .op_flags
= XTENSA_OP_PRIVILEGED
,
3713 .translate
= translate_rptlb0
,
3714 .op_flags
= XTENSA_OP_PRIVILEGED
,
3717 .translate
= translate_rptlb1
,
3718 .op_flags
= XTENSA_OP_PRIVILEGED
,
3721 .translate
= translate_rotw
,
3722 .op_flags
= XTENSA_OP_PRIVILEGED
|
3723 XTENSA_OP_EXIT_TB_M1
|
3724 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3727 .translate
= translate_rsil
,
3729 XTENSA_OP_PRIVILEGED
|
3730 XTENSA_OP_EXIT_TB_0
|
3731 XTENSA_OP_CHECK_INTERRUPTS
,
3734 .translate
= translate_rsr
,
3735 .par
= (const uint32_t[]){176},
3736 .op_flags
= XTENSA_OP_PRIVILEGED
,
3739 .translate
= translate_rsr
,
3740 .par
= (const uint32_t[]){208},
3741 .op_flags
= XTENSA_OP_PRIVILEGED
,
3743 .name
= "rsr.acchi",
3744 .translate
= translate_rsr
,
3745 .test_exceptions
= test_exceptions_sr
,
3746 .par
= (const uint32_t[]){
3748 XTENSA_OPTION_MAC16
,
3751 .name
= "rsr.acclo",
3752 .translate
= translate_rsr
,
3753 .test_exceptions
= test_exceptions_sr
,
3754 .par
= (const uint32_t[]){
3756 XTENSA_OPTION_MAC16
,
3759 .name
= "rsr.atomctl",
3760 .translate
= translate_rsr
,
3761 .test_exceptions
= test_exceptions_sr
,
3762 .par
= (const uint32_t[]){
3764 XTENSA_OPTION_ATOMCTL
,
3766 .op_flags
= XTENSA_OP_PRIVILEGED
,
3769 .translate
= translate_rsr
,
3770 .test_exceptions
= test_exceptions_sr
,
3771 .par
= (const uint32_t[]){
3773 XTENSA_OPTION_BOOLEAN
,
3776 .name
= "rsr.cacheadrdis",
3777 .translate
= translate_rsr
,
3778 .test_exceptions
= test_exceptions_sr
,
3779 .par
= (const uint32_t[]){
3783 .op_flags
= XTENSA_OP_PRIVILEGED
,
3785 .name
= "rsr.cacheattr",
3786 .translate
= translate_rsr
,
3787 .test_exceptions
= test_exceptions_sr
,
3788 .par
= (const uint32_t[]){
3790 XTENSA_OPTION_CACHEATTR
,
3792 .op_flags
= XTENSA_OP_PRIVILEGED
,
3794 .name
= "rsr.ccompare0",
3795 .translate
= translate_rsr
,
3796 .test_exceptions
= test_exceptions_ccompare
,
3797 .par
= (const uint32_t[]){
3799 XTENSA_OPTION_TIMER_INTERRUPT
,
3801 .op_flags
= XTENSA_OP_PRIVILEGED
,
3803 .name
= "rsr.ccompare1",
3804 .translate
= translate_rsr
,
3805 .test_exceptions
= test_exceptions_ccompare
,
3806 .par
= (const uint32_t[]){
3808 XTENSA_OPTION_TIMER_INTERRUPT
,
3810 .op_flags
= XTENSA_OP_PRIVILEGED
,
3812 .name
= "rsr.ccompare2",
3813 .translate
= translate_rsr
,
3814 .test_exceptions
= test_exceptions_ccompare
,
3815 .par
= (const uint32_t[]){
3817 XTENSA_OPTION_TIMER_INTERRUPT
,
3819 .op_flags
= XTENSA_OP_PRIVILEGED
,
3821 .name
= "rsr.ccount",
3822 .translate
= translate_rsr_ccount
,
3823 .test_exceptions
= test_exceptions_sr
,
3824 .par
= (const uint32_t[]){
3826 XTENSA_OPTION_TIMER_INTERRUPT
,
3828 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3830 .name
= "rsr.configid0",
3831 .translate
= translate_rsr
,
3832 .par
= (const uint32_t[]){CONFIGID0
},
3833 .op_flags
= XTENSA_OP_PRIVILEGED
,
3835 .name
= "rsr.configid1",
3836 .translate
= translate_rsr
,
3837 .par
= (const uint32_t[]){CONFIGID1
},
3838 .op_flags
= XTENSA_OP_PRIVILEGED
,
3840 .name
= "rsr.cpenable",
3841 .translate
= translate_rsr
,
3842 .test_exceptions
= test_exceptions_sr
,
3843 .par
= (const uint32_t[]){
3845 XTENSA_OPTION_COPROCESSOR
,
3847 .op_flags
= XTENSA_OP_PRIVILEGED
,
3849 .name
= "rsr.dbreaka0",
3850 .translate
= translate_rsr
,
3851 .test_exceptions
= test_exceptions_dbreak
,
3852 .par
= (const uint32_t[]){
3854 XTENSA_OPTION_DEBUG
,
3856 .op_flags
= XTENSA_OP_PRIVILEGED
,
3858 .name
= "rsr.dbreaka1",
3859 .translate
= translate_rsr
,
3860 .test_exceptions
= test_exceptions_dbreak
,
3861 .par
= (const uint32_t[]){
3863 XTENSA_OPTION_DEBUG
,
3865 .op_flags
= XTENSA_OP_PRIVILEGED
,
3867 .name
= "rsr.dbreakc0",
3868 .translate
= translate_rsr
,
3869 .test_exceptions
= test_exceptions_dbreak
,
3870 .par
= (const uint32_t[]){
3872 XTENSA_OPTION_DEBUG
,
3874 .op_flags
= XTENSA_OP_PRIVILEGED
,
3876 .name
= "rsr.dbreakc1",
3877 .translate
= translate_rsr
,
3878 .test_exceptions
= test_exceptions_dbreak
,
3879 .par
= (const uint32_t[]){
3881 XTENSA_OPTION_DEBUG
,
3883 .op_flags
= XTENSA_OP_PRIVILEGED
,
3886 .translate
= translate_rsr
,
3887 .test_exceptions
= test_exceptions_sr
,
3888 .par
= (const uint32_t[]){
3890 XTENSA_OPTION_DEBUG
,
3892 .op_flags
= XTENSA_OP_PRIVILEGED
,
3894 .name
= "rsr.debugcause",
3895 .translate
= translate_rsr
,
3896 .test_exceptions
= test_exceptions_sr
,
3897 .par
= (const uint32_t[]){
3899 XTENSA_OPTION_DEBUG
,
3901 .op_flags
= XTENSA_OP_PRIVILEGED
,
3904 .translate
= translate_rsr
,
3905 .test_exceptions
= test_exceptions_sr
,
3906 .par
= (const uint32_t[]){
3908 XTENSA_OPTION_EXCEPTION
,
3910 .op_flags
= XTENSA_OP_PRIVILEGED
,
3912 .name
= "rsr.dtlbcfg",
3913 .translate
= translate_rsr
,
3914 .test_exceptions
= test_exceptions_sr
,
3915 .par
= (const uint32_t[]){
3919 .op_flags
= XTENSA_OP_PRIVILEGED
,
3922 .translate
= translate_rsr
,
3923 .test_exceptions
= test_exceptions_sr
,
3924 .par
= (const uint32_t[]){
3926 XTENSA_OPTION_EXCEPTION
,
3928 .op_flags
= XTENSA_OP_PRIVILEGED
,
3931 .translate
= translate_rsr
,
3932 .test_exceptions
= test_exceptions_hpi
,
3933 .par
= (const uint32_t[]){
3935 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3937 .op_flags
= XTENSA_OP_PRIVILEGED
,
3940 .translate
= translate_rsr
,
3941 .test_exceptions
= test_exceptions_hpi
,
3942 .par
= (const uint32_t[]){
3944 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3946 .op_flags
= XTENSA_OP_PRIVILEGED
,
3949 .translate
= translate_rsr
,
3950 .test_exceptions
= test_exceptions_hpi
,
3951 .par
= (const uint32_t[]){
3953 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3955 .op_flags
= XTENSA_OP_PRIVILEGED
,
3958 .translate
= translate_rsr
,
3959 .test_exceptions
= test_exceptions_hpi
,
3960 .par
= (const uint32_t[]){
3962 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3964 .op_flags
= XTENSA_OP_PRIVILEGED
,
3967 .translate
= translate_rsr
,
3968 .test_exceptions
= test_exceptions_hpi
,
3969 .par
= (const uint32_t[]){
3971 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3973 .op_flags
= XTENSA_OP_PRIVILEGED
,
3976 .translate
= translate_rsr
,
3977 .test_exceptions
= test_exceptions_hpi
,
3978 .par
= (const uint32_t[]){
3980 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3982 .op_flags
= XTENSA_OP_PRIVILEGED
,
3985 .translate
= translate_rsr
,
3986 .test_exceptions
= test_exceptions_hpi
,
3987 .par
= (const uint32_t[]){
3989 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
3991 .op_flags
= XTENSA_OP_PRIVILEGED
,
3994 .translate
= translate_rsr
,
3995 .test_exceptions
= test_exceptions_hpi
,
3996 .par
= (const uint32_t[]){
3998 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4000 .op_flags
= XTENSA_OP_PRIVILEGED
,
4003 .translate
= translate_rsr
,
4004 .test_exceptions
= test_exceptions_hpi
,
4005 .par
= (const uint32_t[]){
4007 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4009 .op_flags
= XTENSA_OP_PRIVILEGED
,
4012 .translate
= translate_rsr
,
4013 .test_exceptions
= test_exceptions_hpi
,
4014 .par
= (const uint32_t[]){
4016 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4018 .op_flags
= XTENSA_OP_PRIVILEGED
,
4021 .translate
= translate_rsr
,
4022 .test_exceptions
= test_exceptions_hpi
,
4023 .par
= (const uint32_t[]){
4025 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4027 .op_flags
= XTENSA_OP_PRIVILEGED
,
4030 .translate
= translate_rsr
,
4031 .test_exceptions
= test_exceptions_hpi
,
4032 .par
= (const uint32_t[]){
4034 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4036 .op_flags
= XTENSA_OP_PRIVILEGED
,
4038 .name
= "rsr.eraccess",
4039 .translate
= translate_rsr
,
4040 .par
= (const uint32_t[]){ERACCESS
},
4041 .op_flags
= XTENSA_OP_PRIVILEGED
,
4043 .name
= "rsr.exccause",
4044 .translate
= translate_rsr
,
4045 .test_exceptions
= test_exceptions_sr
,
4046 .par
= (const uint32_t[]){
4048 XTENSA_OPTION_EXCEPTION
,
4050 .op_flags
= XTENSA_OP_PRIVILEGED
,
4052 .name
= "rsr.excsave1",
4053 .translate
= translate_rsr
,
4054 .test_exceptions
= test_exceptions_sr
,
4055 .par
= (const uint32_t[]){
4057 XTENSA_OPTION_EXCEPTION
,
4059 .op_flags
= XTENSA_OP_PRIVILEGED
,
4061 .name
= "rsr.excsave2",
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
,
4070 .name
= "rsr.excsave3",
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
,
4079 .name
= "rsr.excsave4",
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.excsave5",
4089 .translate
= translate_rsr
,
4090 .test_exceptions
= test_exceptions_hpi
,
4091 .par
= (const uint32_t[]){
4093 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4095 .op_flags
= XTENSA_OP_PRIVILEGED
,
4097 .name
= "rsr.excsave6",
4098 .translate
= translate_rsr
,
4099 .test_exceptions
= test_exceptions_hpi
,
4100 .par
= (const uint32_t[]){
4102 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4104 .op_flags
= XTENSA_OP_PRIVILEGED
,
4106 .name
= "rsr.excsave7",
4107 .translate
= translate_rsr
,
4108 .test_exceptions
= test_exceptions_hpi
,
4109 .par
= (const uint32_t[]){
4111 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4113 .op_flags
= XTENSA_OP_PRIVILEGED
,
4115 .name
= "rsr.excvaddr",
4116 .translate
= translate_rsr
,
4117 .test_exceptions
= test_exceptions_sr
,
4118 .par
= (const uint32_t[]){
4120 XTENSA_OPTION_EXCEPTION
,
4122 .op_flags
= XTENSA_OP_PRIVILEGED
,
4124 .name
= "rsr.ibreaka0",
4125 .translate
= translate_rsr
,
4126 .test_exceptions
= test_exceptions_ibreak
,
4127 .par
= (const uint32_t[]){
4129 XTENSA_OPTION_DEBUG
,
4131 .op_flags
= XTENSA_OP_PRIVILEGED
,
4133 .name
= "rsr.ibreaka1",
4134 .translate
= translate_rsr
,
4135 .test_exceptions
= test_exceptions_ibreak
,
4136 .par
= (const uint32_t[]){
4138 XTENSA_OPTION_DEBUG
,
4140 .op_flags
= XTENSA_OP_PRIVILEGED
,
4142 .name
= "rsr.ibreakenable",
4143 .translate
= translate_rsr
,
4144 .test_exceptions
= test_exceptions_sr
,
4145 .par
= (const uint32_t[]){
4147 XTENSA_OPTION_DEBUG
,
4149 .op_flags
= XTENSA_OP_PRIVILEGED
,
4151 .name
= "rsr.icount",
4152 .translate
= translate_rsr
,
4153 .test_exceptions
= test_exceptions_sr
,
4154 .par
= (const uint32_t[]){
4156 XTENSA_OPTION_DEBUG
,
4158 .op_flags
= XTENSA_OP_PRIVILEGED
,
4160 .name
= "rsr.icountlevel",
4161 .translate
= translate_rsr
,
4162 .test_exceptions
= test_exceptions_sr
,
4163 .par
= (const uint32_t[]){
4165 XTENSA_OPTION_DEBUG
,
4167 .op_flags
= XTENSA_OP_PRIVILEGED
,
4169 .name
= "rsr.intclear",
4170 .translate
= translate_rsr
,
4171 .test_exceptions
= test_exceptions_sr
,
4172 .par
= (const uint32_t[]){
4174 XTENSA_OPTION_INTERRUPT
,
4176 .op_flags
= XTENSA_OP_PRIVILEGED
,
4178 .name
= "rsr.intenable",
4179 .translate
= translate_rsr
,
4180 .test_exceptions
= test_exceptions_sr
,
4181 .par
= (const uint32_t[]){
4183 XTENSA_OPTION_INTERRUPT
,
4185 .op_flags
= XTENSA_OP_PRIVILEGED
,
4187 .name
= "rsr.interrupt",
4188 .translate
= translate_rsr_ccount
,
4189 .test_exceptions
= test_exceptions_sr
,
4190 .par
= (const uint32_t[]){
4192 XTENSA_OPTION_INTERRUPT
,
4194 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4196 .name
= "rsr.intset",
4197 .translate
= translate_rsr_ccount
,
4198 .test_exceptions
= test_exceptions_sr
,
4199 .par
= (const uint32_t[]){
4201 XTENSA_OPTION_INTERRUPT
,
4203 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4205 .name
= "rsr.itlbcfg",
4206 .translate
= translate_rsr
,
4207 .test_exceptions
= test_exceptions_sr
,
4208 .par
= (const uint32_t[]){
4212 .op_flags
= XTENSA_OP_PRIVILEGED
,
4215 .translate
= translate_rsr
,
4216 .test_exceptions
= test_exceptions_sr
,
4217 .par
= (const uint32_t[]){
4222 .name
= "rsr.lcount",
4223 .translate
= translate_rsr
,
4224 .test_exceptions
= test_exceptions_sr
,
4225 .par
= (const uint32_t[]){
4231 .translate
= translate_rsr
,
4232 .test_exceptions
= test_exceptions_sr
,
4233 .par
= (const uint32_t[]){
4238 .name
= "rsr.litbase",
4239 .translate
= translate_rsr
,
4240 .test_exceptions
= test_exceptions_sr
,
4241 .par
= (const uint32_t[]){
4243 XTENSA_OPTION_EXTENDED_L32R
,
4247 .translate
= translate_rsr
,
4248 .test_exceptions
= test_exceptions_sr
,
4249 .par
= (const uint32_t[]){
4251 XTENSA_OPTION_MAC16
,
4255 .translate
= translate_rsr
,
4256 .test_exceptions
= test_exceptions_sr
,
4257 .par
= (const uint32_t[]){
4259 XTENSA_OPTION_MAC16
,
4263 .translate
= translate_rsr
,
4264 .test_exceptions
= test_exceptions_sr
,
4265 .par
= (const uint32_t[]){
4267 XTENSA_OPTION_MAC16
,
4271 .translate
= translate_rsr
,
4272 .test_exceptions
= test_exceptions_sr
,
4273 .par
= (const uint32_t[]){
4275 XTENSA_OPTION_MAC16
,
4278 .name
= "rsr.memctl",
4279 .translate
= translate_rsr
,
4280 .par
= (const uint32_t[]){MEMCTL
},
4281 .op_flags
= XTENSA_OP_PRIVILEGED
,
4284 .translate
= translate_rsr
,
4285 .test_exceptions
= test_exceptions_sr
,
4286 .par
= (const uint32_t[]){
4288 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4290 .op_flags
= XTENSA_OP_PRIVILEGED
,
4293 .translate
= translate_rsr
,
4294 .test_exceptions
= test_exceptions_sr
,
4295 .par
= (const uint32_t[]){
4297 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4299 .op_flags
= XTENSA_OP_PRIVILEGED
,
4302 .translate
= translate_rsr
,
4303 .test_exceptions
= test_exceptions_sr
,
4304 .par
= (const uint32_t[]){
4306 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4308 .op_flags
= XTENSA_OP_PRIVILEGED
,
4310 .name
= "rsr.mesave",
4311 .translate
= translate_rsr
,
4312 .test_exceptions
= test_exceptions_sr
,
4313 .par
= (const uint32_t[]){
4315 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4317 .op_flags
= XTENSA_OP_PRIVILEGED
,
4320 .translate
= translate_rsr
,
4321 .test_exceptions
= test_exceptions_sr
,
4322 .par
= (const uint32_t[]){
4324 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4326 .op_flags
= XTENSA_OP_PRIVILEGED
,
4328 .name
= "rsr.mevaddr",
4329 .translate
= translate_rsr
,
4330 .test_exceptions
= test_exceptions_sr
,
4331 .par
= (const uint32_t[]){
4333 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4335 .op_flags
= XTENSA_OP_PRIVILEGED
,
4337 .name
= "rsr.misc0",
4338 .translate
= translate_rsr
,
4339 .test_exceptions
= test_exceptions_sr
,
4340 .par
= (const uint32_t[]){
4342 XTENSA_OPTION_MISC_SR
,
4344 .op_flags
= XTENSA_OP_PRIVILEGED
,
4346 .name
= "rsr.misc1",
4347 .translate
= translate_rsr
,
4348 .test_exceptions
= test_exceptions_sr
,
4349 .par
= (const uint32_t[]){
4351 XTENSA_OPTION_MISC_SR
,
4353 .op_flags
= XTENSA_OP_PRIVILEGED
,
4355 .name
= "rsr.misc2",
4356 .translate
= translate_rsr
,
4357 .test_exceptions
= test_exceptions_sr
,
4358 .par
= (const uint32_t[]){
4360 XTENSA_OPTION_MISC_SR
,
4362 .op_flags
= XTENSA_OP_PRIVILEGED
,
4364 .name
= "rsr.misc3",
4365 .translate
= translate_rsr
,
4366 .test_exceptions
= test_exceptions_sr
,
4367 .par
= (const uint32_t[]){
4369 XTENSA_OPTION_MISC_SR
,
4371 .op_flags
= XTENSA_OP_PRIVILEGED
,
4373 .name
= "rsr.mpucfg",
4374 .translate
= translate_rsr
,
4375 .test_exceptions
= test_exceptions_sr
,
4376 .par
= (const uint32_t[]){
4380 .op_flags
= XTENSA_OP_PRIVILEGED
,
4382 .name
= "rsr.mpuenb",
4383 .translate
= translate_rsr
,
4384 .test_exceptions
= test_exceptions_sr
,
4385 .par
= (const uint32_t[]){
4389 .op_flags
= XTENSA_OP_PRIVILEGED
,
4391 .name
= "rsr.prefctl",
4392 .translate
= translate_rsr
,
4393 .par
= (const uint32_t[]){PREFCTL
},
4396 .translate
= translate_rsr
,
4397 .test_exceptions
= test_exceptions_sr
,
4398 .par
= (const uint32_t[]){
4400 XTENSA_OPTION_PROCESSOR_ID
,
4402 .op_flags
= XTENSA_OP_PRIVILEGED
,
4405 .translate
= translate_rsr
,
4406 .test_exceptions
= test_exceptions_sr
,
4407 .par
= (const uint32_t[]){
4409 XTENSA_OPTION_EXCEPTION
,
4411 .op_flags
= XTENSA_OP_PRIVILEGED
,
4413 .name
= "rsr.ptevaddr",
4414 .translate
= translate_rsr_ptevaddr
,
4415 .test_exceptions
= test_exceptions_sr
,
4416 .par
= (const uint32_t[]){
4420 .op_flags
= XTENSA_OP_PRIVILEGED
,
4422 .name
= "rsr.rasid",
4423 .translate
= translate_rsr
,
4424 .test_exceptions
= test_exceptions_sr
,
4425 .par
= (const uint32_t[]){
4429 .op_flags
= XTENSA_OP_PRIVILEGED
,
4432 .translate
= translate_rsr
,
4433 .par
= (const uint32_t[]){SAR
},
4435 .name
= "rsr.scompare1",
4436 .translate
= translate_rsr
,
4437 .test_exceptions
= test_exceptions_sr
,
4438 .par
= (const uint32_t[]){
4440 XTENSA_OPTION_CONDITIONAL_STORE
,
4443 .name
= "rsr.vecbase",
4444 .translate
= translate_rsr
,
4445 .test_exceptions
= test_exceptions_sr
,
4446 .par
= (const uint32_t[]){
4448 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4450 .op_flags
= XTENSA_OP_PRIVILEGED
,
4452 .name
= "rsr.windowbase",
4453 .translate
= translate_rsr
,
4454 .test_exceptions
= test_exceptions_sr
,
4455 .par
= (const uint32_t[]){
4457 XTENSA_OPTION_WINDOWED_REGISTER
,
4459 .op_flags
= XTENSA_OP_PRIVILEGED
,
4461 .name
= "rsr.windowstart",
4462 .translate
= translate_rsr
,
4463 .test_exceptions
= test_exceptions_sr
,
4464 .par
= (const uint32_t[]){
4466 XTENSA_OPTION_WINDOWED_REGISTER
,
4468 .op_flags
= XTENSA_OP_PRIVILEGED
,
4471 .translate
= translate_nop
,
4473 .name
= "rur.expstate",
4474 .translate
= translate_rur
,
4475 .par
= (const uint32_t[]){EXPSTATE
},
4477 .name
= "rur.threadptr",
4478 .translate
= translate_rur
,
4479 .par
= (const uint32_t[]){THREADPTR
},
4482 .translate
= translate_ldst
,
4483 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4484 .op_flags
= XTENSA_OP_STORE
,
4487 .translate
= translate_s32c1i
,
4488 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4491 .translate
= translate_s32e
,
4492 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4495 .translate
= translate_s32ex
,
4496 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4498 .name
= (const char * const[]) {
4499 "s32i", "s32i.n", "s32nb", NULL
,
4501 .translate
= translate_ldst
,
4502 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4503 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4506 .translate
= translate_ldst
,
4507 .par
= (const uint32_t[]){MO_TEUL
| MO_ALIGN
, true, true},
4508 .op_flags
= XTENSA_OP_STORE
,
4511 .translate
= translate_ldst
,
4512 .par
= (const uint32_t[]){MO_UB
, false, true},
4513 .op_flags
= XTENSA_OP_STORE
,
4516 .translate
= translate_salt
,
4517 .par
= (const uint32_t[]){TCG_COND_LT
},
4520 .translate
= translate_salt
,
4521 .par
= (const uint32_t[]){TCG_COND_LTU
},
4524 .translate
= translate_nop
,
4525 .op_flags
= XTENSA_OP_PRIVILEGED
,
4528 .translate
= translate_nop
,
4529 .op_flags
= XTENSA_OP_PRIVILEGED
,
4531 .name
= "setb_expstate",
4532 .translate
= translate_setb_expstate
,
4535 .translate
= translate_sext
,
4538 .translate
= translate_nop
,
4539 .op_flags
= XTENSA_OP_PRIVILEGED
,
4542 .translate
= translate_nop
,
4543 .op_flags
= XTENSA_OP_PRIVILEGED
,
4546 .translate
= translate_simcall
,
4547 .test_exceptions
= test_exceptions_simcall
,
4548 .op_flags
= XTENSA_OP_PRIVILEGED
,
4551 .translate
= translate_sll
,
4554 .translate
= translate_slli
,
4557 .translate
= translate_sra
,
4560 .translate
= translate_srai
,
4563 .translate
= translate_src
,
4566 .translate
= translate_srl
,
4569 .translate
= translate_srli
,
4572 .translate
= translate_ssa8b
,
4575 .translate
= translate_ssa8l
,
4578 .translate
= translate_ssai
,
4581 .translate
= translate_ssl
,
4584 .translate
= translate_ssr
,
4587 .translate
= translate_sub
,
4590 .translate
= translate_subx
,
4591 .par
= (const uint32_t[]){1},
4594 .translate
= translate_subx
,
4595 .par
= (const uint32_t[]){2},
4598 .translate
= translate_subx
,
4599 .par
= (const uint32_t[]){3},
4602 .op_flags
= XTENSA_OP_SYSCALL
,
4604 .name
= "umul.aa.hh",
4605 .translate
= translate_mac16
,
4606 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4608 .name
= "umul.aa.hl",
4609 .translate
= translate_mac16
,
4610 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4612 .name
= "umul.aa.lh",
4613 .translate
= translate_mac16
,
4614 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4616 .name
= "umul.aa.ll",
4617 .translate
= translate_mac16
,
4618 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4621 .translate
= translate_waiti
,
4622 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4625 .translate
= translate_wtlb
,
4626 .par
= (const uint32_t[]){true},
4627 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4630 .translate
= translate_wer
,
4631 .op_flags
= XTENSA_OP_PRIVILEGED
,
4634 .translate
= translate_wtlb
,
4635 .par
= (const uint32_t[]){false},
4636 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4639 .translate
= translate_wptlb
,
4640 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4642 .name
= "wrmsk_expstate",
4643 .translate
= translate_wrmsk_expstate
,
4646 .op_flags
= XTENSA_OP_ILL
,
4649 .op_flags
= XTENSA_OP_ILL
,
4651 .name
= "wsr.acchi",
4652 .translate
= translate_wsr_acchi
,
4653 .test_exceptions
= test_exceptions_sr
,
4654 .par
= (const uint32_t[]){
4656 XTENSA_OPTION_MAC16
,
4659 .name
= "wsr.acclo",
4660 .translate
= translate_wsr
,
4661 .test_exceptions
= test_exceptions_sr
,
4662 .par
= (const uint32_t[]){
4664 XTENSA_OPTION_MAC16
,
4667 .name
= "wsr.atomctl",
4668 .translate
= translate_wsr_mask
,
4669 .test_exceptions
= test_exceptions_sr
,
4670 .par
= (const uint32_t[]){
4672 XTENSA_OPTION_ATOMCTL
,
4675 .op_flags
= XTENSA_OP_PRIVILEGED
,
4678 .translate
= translate_wsr_mask
,
4679 .test_exceptions
= test_exceptions_sr
,
4680 .par
= (const uint32_t[]){
4682 XTENSA_OPTION_BOOLEAN
,
4686 .name
= "wsr.cacheadrdis",
4687 .translate
= translate_wsr_mask
,
4688 .test_exceptions
= test_exceptions_sr
,
4689 .par
= (const uint32_t[]){
4694 .op_flags
= XTENSA_OP_PRIVILEGED
,
4696 .name
= "wsr.cacheattr",
4697 .translate
= translate_wsr
,
4698 .test_exceptions
= test_exceptions_sr
,
4699 .par
= (const uint32_t[]){
4701 XTENSA_OPTION_CACHEATTR
,
4703 .op_flags
= XTENSA_OP_PRIVILEGED
,
4705 .name
= "wsr.ccompare0",
4706 .translate
= translate_wsr_ccompare
,
4707 .test_exceptions
= test_exceptions_ccompare
,
4708 .par
= (const uint32_t[]){
4710 XTENSA_OPTION_TIMER_INTERRUPT
,
4712 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4714 .name
= "wsr.ccompare1",
4715 .translate
= translate_wsr_ccompare
,
4716 .test_exceptions
= test_exceptions_ccompare
,
4717 .par
= (const uint32_t[]){
4719 XTENSA_OPTION_TIMER_INTERRUPT
,
4721 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4723 .name
= "wsr.ccompare2",
4724 .translate
= translate_wsr_ccompare
,
4725 .test_exceptions
= test_exceptions_ccompare
,
4726 .par
= (const uint32_t[]){
4728 XTENSA_OPTION_TIMER_INTERRUPT
,
4730 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4732 .name
= "wsr.ccount",
4733 .translate
= translate_wsr_ccount
,
4734 .test_exceptions
= test_exceptions_sr
,
4735 .par
= (const uint32_t[]){
4737 XTENSA_OPTION_TIMER_INTERRUPT
,
4739 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4741 .name
= "wsr.configid0",
4742 .op_flags
= XTENSA_OP_ILL
,
4744 .name
= "wsr.configid1",
4745 .op_flags
= XTENSA_OP_ILL
,
4747 .name
= "wsr.cpenable",
4748 .translate
= translate_wsr_mask
,
4749 .test_exceptions
= test_exceptions_sr
,
4750 .par
= (const uint32_t[]){
4752 XTENSA_OPTION_COPROCESSOR
,
4755 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4757 .name
= "wsr.dbreaka0",
4758 .translate
= translate_wsr_dbreaka
,
4759 .test_exceptions
= test_exceptions_dbreak
,
4760 .par
= (const uint32_t[]){
4762 XTENSA_OPTION_DEBUG
,
4764 .op_flags
= XTENSA_OP_PRIVILEGED
,
4766 .name
= "wsr.dbreaka1",
4767 .translate
= translate_wsr_dbreaka
,
4768 .test_exceptions
= test_exceptions_dbreak
,
4769 .par
= (const uint32_t[]){
4771 XTENSA_OPTION_DEBUG
,
4773 .op_flags
= XTENSA_OP_PRIVILEGED
,
4775 .name
= "wsr.dbreakc0",
4776 .translate
= translate_wsr_dbreakc
,
4777 .test_exceptions
= test_exceptions_dbreak
,
4778 .par
= (const uint32_t[]){
4780 XTENSA_OPTION_DEBUG
,
4782 .op_flags
= XTENSA_OP_PRIVILEGED
,
4784 .name
= "wsr.dbreakc1",
4785 .translate
= translate_wsr_dbreakc
,
4786 .test_exceptions
= test_exceptions_dbreak
,
4787 .par
= (const uint32_t[]){
4789 XTENSA_OPTION_DEBUG
,
4791 .op_flags
= XTENSA_OP_PRIVILEGED
,
4794 .translate
= translate_wsr
,
4795 .test_exceptions
= test_exceptions_sr
,
4796 .par
= (const uint32_t[]){
4798 XTENSA_OPTION_DEBUG
,
4800 .op_flags
= XTENSA_OP_PRIVILEGED
,
4802 .name
= "wsr.debugcause",
4803 .op_flags
= XTENSA_OP_ILL
,
4806 .translate
= translate_wsr
,
4807 .test_exceptions
= test_exceptions_sr
,
4808 .par
= (const uint32_t[]){
4810 XTENSA_OPTION_EXCEPTION
,
4812 .op_flags
= XTENSA_OP_PRIVILEGED
,
4814 .name
= "wsr.dtlbcfg",
4815 .translate
= translate_wsr_mask
,
4816 .test_exceptions
= test_exceptions_sr
,
4817 .par
= (const uint32_t[]){
4822 .op_flags
= XTENSA_OP_PRIVILEGED
,
4825 .translate
= translate_wsr
,
4826 .test_exceptions
= test_exceptions_sr
,
4827 .par
= (const uint32_t[]){
4829 XTENSA_OPTION_EXCEPTION
,
4831 .op_flags
= XTENSA_OP_PRIVILEGED
,
4834 .translate
= translate_wsr
,
4835 .test_exceptions
= test_exceptions_hpi
,
4836 .par
= (const uint32_t[]){
4838 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4840 .op_flags
= XTENSA_OP_PRIVILEGED
,
4843 .translate
= translate_wsr
,
4844 .test_exceptions
= test_exceptions_hpi
,
4845 .par
= (const uint32_t[]){
4847 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4849 .op_flags
= XTENSA_OP_PRIVILEGED
,
4852 .translate
= translate_wsr
,
4853 .test_exceptions
= test_exceptions_hpi
,
4854 .par
= (const uint32_t[]){
4856 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4858 .op_flags
= XTENSA_OP_PRIVILEGED
,
4861 .translate
= translate_wsr
,
4862 .test_exceptions
= test_exceptions_hpi
,
4863 .par
= (const uint32_t[]){
4865 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4867 .op_flags
= XTENSA_OP_PRIVILEGED
,
4870 .translate
= translate_wsr
,
4871 .test_exceptions
= test_exceptions_hpi
,
4872 .par
= (const uint32_t[]){
4874 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4876 .op_flags
= XTENSA_OP_PRIVILEGED
,
4879 .translate
= translate_wsr
,
4880 .test_exceptions
= test_exceptions_hpi
,
4881 .par
= (const uint32_t[]){
4883 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4885 .op_flags
= XTENSA_OP_PRIVILEGED
,
4888 .translate
= translate_wsr
,
4889 .test_exceptions
= test_exceptions_hpi
,
4890 .par
= (const uint32_t[]){
4892 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4894 .op_flags
= XTENSA_OP_PRIVILEGED
,
4897 .translate
= translate_wsr
,
4898 .test_exceptions
= test_exceptions_hpi
,
4899 .par
= (const uint32_t[]){
4901 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4903 .op_flags
= XTENSA_OP_PRIVILEGED
,
4906 .translate
= translate_wsr
,
4907 .test_exceptions
= test_exceptions_hpi
,
4908 .par
= (const uint32_t[]){
4910 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4912 .op_flags
= XTENSA_OP_PRIVILEGED
,
4915 .translate
= translate_wsr
,
4916 .test_exceptions
= test_exceptions_hpi
,
4917 .par
= (const uint32_t[]){
4919 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4921 .op_flags
= XTENSA_OP_PRIVILEGED
,
4924 .translate
= translate_wsr
,
4925 .test_exceptions
= test_exceptions_hpi
,
4926 .par
= (const uint32_t[]){
4928 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4930 .op_flags
= XTENSA_OP_PRIVILEGED
,
4933 .translate
= translate_wsr
,
4934 .test_exceptions
= test_exceptions_hpi
,
4935 .par
= (const uint32_t[]){
4937 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4939 .op_flags
= XTENSA_OP_PRIVILEGED
,
4941 .name
= "wsr.eraccess",
4942 .translate
= translate_wsr_mask
,
4943 .par
= (const uint32_t[]){
4948 .op_flags
= XTENSA_OP_PRIVILEGED
,
4950 .name
= "wsr.exccause",
4951 .translate
= translate_wsr
,
4952 .test_exceptions
= test_exceptions_sr
,
4953 .par
= (const uint32_t[]){
4955 XTENSA_OPTION_EXCEPTION
,
4957 .op_flags
= XTENSA_OP_PRIVILEGED
,
4959 .name
= "wsr.excsave1",
4960 .translate
= translate_wsr
,
4961 .test_exceptions
= test_exceptions_sr
,
4962 .par
= (const uint32_t[]){
4964 XTENSA_OPTION_EXCEPTION
,
4966 .op_flags
= XTENSA_OP_PRIVILEGED
,
4968 .name
= "wsr.excsave2",
4969 .translate
= translate_wsr
,
4970 .test_exceptions
= test_exceptions_hpi
,
4971 .par
= (const uint32_t[]){
4973 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4975 .op_flags
= XTENSA_OP_PRIVILEGED
,
4977 .name
= "wsr.excsave3",
4978 .translate
= translate_wsr
,
4979 .test_exceptions
= test_exceptions_hpi
,
4980 .par
= (const uint32_t[]){
4982 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4984 .op_flags
= XTENSA_OP_PRIVILEGED
,
4986 .name
= "wsr.excsave4",
4987 .translate
= translate_wsr
,
4988 .test_exceptions
= test_exceptions_hpi
,
4989 .par
= (const uint32_t[]){
4991 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4993 .op_flags
= XTENSA_OP_PRIVILEGED
,
4995 .name
= "wsr.excsave5",
4996 .translate
= translate_wsr
,
4997 .test_exceptions
= test_exceptions_hpi
,
4998 .par
= (const uint32_t[]){
5000 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5002 .op_flags
= XTENSA_OP_PRIVILEGED
,
5004 .name
= "wsr.excsave6",
5005 .translate
= translate_wsr
,
5006 .test_exceptions
= test_exceptions_hpi
,
5007 .par
= (const uint32_t[]){
5009 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5011 .op_flags
= XTENSA_OP_PRIVILEGED
,
5013 .name
= "wsr.excsave7",
5014 .translate
= translate_wsr
,
5015 .test_exceptions
= test_exceptions_hpi
,
5016 .par
= (const uint32_t[]){
5018 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5020 .op_flags
= XTENSA_OP_PRIVILEGED
,
5022 .name
= "wsr.excvaddr",
5023 .translate
= translate_wsr
,
5024 .test_exceptions
= test_exceptions_sr
,
5025 .par
= (const uint32_t[]){
5027 XTENSA_OPTION_EXCEPTION
,
5029 .op_flags
= XTENSA_OP_PRIVILEGED
,
5031 .name
= "wsr.ibreaka0",
5032 .translate
= translate_wsr_ibreaka
,
5033 .test_exceptions
= test_exceptions_ibreak
,
5034 .par
= (const uint32_t[]){
5036 XTENSA_OPTION_DEBUG
,
5038 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5040 .name
= "wsr.ibreaka1",
5041 .translate
= translate_wsr_ibreaka
,
5042 .test_exceptions
= test_exceptions_ibreak
,
5043 .par
= (const uint32_t[]){
5045 XTENSA_OPTION_DEBUG
,
5047 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5049 .name
= "wsr.ibreakenable",
5050 .translate
= translate_wsr_ibreakenable
,
5051 .test_exceptions
= test_exceptions_sr
,
5052 .par
= (const uint32_t[]){
5054 XTENSA_OPTION_DEBUG
,
5056 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5058 .name
= "wsr.icount",
5059 .translate
= translate_wsr_icount
,
5060 .test_exceptions
= test_exceptions_sr
,
5061 .par
= (const uint32_t[]){
5063 XTENSA_OPTION_DEBUG
,
5065 .op_flags
= XTENSA_OP_PRIVILEGED
,
5067 .name
= "wsr.icountlevel",
5068 .translate
= translate_wsr_mask
,
5069 .test_exceptions
= test_exceptions_sr
,
5070 .par
= (const uint32_t[]){
5072 XTENSA_OPTION_DEBUG
,
5075 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5077 .name
= "wsr.intclear",
5078 .translate
= translate_wsr_intclear
,
5079 .test_exceptions
= test_exceptions_sr
,
5080 .par
= (const uint32_t[]){
5082 XTENSA_OPTION_INTERRUPT
,
5085 XTENSA_OP_PRIVILEGED
|
5086 XTENSA_OP_EXIT_TB_0
|
5087 XTENSA_OP_CHECK_INTERRUPTS
,
5089 .name
= "wsr.intenable",
5090 .translate
= translate_wsr
,
5091 .test_exceptions
= test_exceptions_sr
,
5092 .par
= (const uint32_t[]){
5094 XTENSA_OPTION_INTERRUPT
,
5097 XTENSA_OP_PRIVILEGED
|
5098 XTENSA_OP_EXIT_TB_0
|
5099 XTENSA_OP_CHECK_INTERRUPTS
,
5101 .name
= "wsr.interrupt",
5102 .translate
= translate_wsr
,
5103 .test_exceptions
= test_exceptions_sr
,
5104 .par
= (const uint32_t[]){
5106 XTENSA_OPTION_INTERRUPT
,
5109 XTENSA_OP_PRIVILEGED
|
5110 XTENSA_OP_EXIT_TB_0
|
5111 XTENSA_OP_CHECK_INTERRUPTS
,
5113 .name
= "wsr.intset",
5114 .translate
= translate_wsr_intset
,
5115 .test_exceptions
= test_exceptions_sr
,
5116 .par
= (const uint32_t[]){
5118 XTENSA_OPTION_INTERRUPT
,
5121 XTENSA_OP_PRIVILEGED
|
5122 XTENSA_OP_EXIT_TB_0
|
5123 XTENSA_OP_CHECK_INTERRUPTS
,
5125 .name
= "wsr.itlbcfg",
5126 .translate
= translate_wsr_mask
,
5127 .test_exceptions
= test_exceptions_sr
,
5128 .par
= (const uint32_t[]){
5133 .op_flags
= XTENSA_OP_PRIVILEGED
,
5136 .translate
= translate_wsr
,
5137 .test_exceptions
= test_exceptions_sr
,
5138 .par
= (const uint32_t[]){
5142 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5144 .name
= "wsr.lcount",
5145 .translate
= translate_wsr
,
5146 .test_exceptions
= test_exceptions_sr
,
5147 .par
= (const uint32_t[]){
5153 .translate
= translate_wsr
,
5154 .test_exceptions
= test_exceptions_sr
,
5155 .par
= (const uint32_t[]){
5159 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5161 .name
= "wsr.litbase",
5162 .translate
= translate_wsr_mask
,
5163 .test_exceptions
= test_exceptions_sr
,
5164 .par
= (const uint32_t[]){
5166 XTENSA_OPTION_EXTENDED_L32R
,
5169 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5172 .translate
= translate_wsr
,
5173 .test_exceptions
= test_exceptions_sr
,
5174 .par
= (const uint32_t[]){
5176 XTENSA_OPTION_MAC16
,
5180 .translate
= translate_wsr
,
5181 .test_exceptions
= test_exceptions_sr
,
5182 .par
= (const uint32_t[]){
5184 XTENSA_OPTION_MAC16
,
5188 .translate
= translate_wsr
,
5189 .test_exceptions
= test_exceptions_sr
,
5190 .par
= (const uint32_t[]){
5192 XTENSA_OPTION_MAC16
,
5196 .translate
= translate_wsr
,
5197 .test_exceptions
= test_exceptions_sr
,
5198 .par
= (const uint32_t[]){
5200 XTENSA_OPTION_MAC16
,
5203 .name
= "wsr.memctl",
5204 .translate
= translate_wsr_memctl
,
5205 .par
= (const uint32_t[]){MEMCTL
},
5206 .op_flags
= XTENSA_OP_PRIVILEGED
,
5209 .translate
= translate_wsr
,
5210 .test_exceptions
= test_exceptions_sr
,
5211 .par
= (const uint32_t[]){
5213 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5215 .op_flags
= XTENSA_OP_PRIVILEGED
,
5218 .translate
= translate_wsr
,
5219 .test_exceptions
= test_exceptions_sr
,
5220 .par
= (const uint32_t[]){
5222 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5224 .op_flags
= XTENSA_OP_PRIVILEGED
,
5227 .translate
= translate_wsr
,
5228 .test_exceptions
= test_exceptions_sr
,
5229 .par
= (const uint32_t[]){
5231 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5233 .op_flags
= XTENSA_OP_PRIVILEGED
,
5235 .name
= "wsr.mesave",
5236 .translate
= translate_wsr
,
5237 .test_exceptions
= test_exceptions_sr
,
5238 .par
= (const uint32_t[]){
5240 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5242 .op_flags
= XTENSA_OP_PRIVILEGED
,
5245 .translate
= translate_wsr
,
5246 .test_exceptions
= test_exceptions_sr
,
5247 .par
= (const uint32_t[]){
5249 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5251 .op_flags
= XTENSA_OP_PRIVILEGED
,
5253 .name
= "wsr.mevaddr",
5254 .translate
= translate_wsr
,
5255 .test_exceptions
= test_exceptions_sr
,
5256 .par
= (const uint32_t[]){
5258 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5260 .op_flags
= XTENSA_OP_PRIVILEGED
,
5262 .name
= "wsr.misc0",
5263 .translate
= translate_wsr
,
5264 .test_exceptions
= test_exceptions_sr
,
5265 .par
= (const uint32_t[]){
5267 XTENSA_OPTION_MISC_SR
,
5269 .op_flags
= XTENSA_OP_PRIVILEGED
,
5271 .name
= "wsr.misc1",
5272 .translate
= translate_wsr
,
5273 .test_exceptions
= test_exceptions_sr
,
5274 .par
= (const uint32_t[]){
5276 XTENSA_OPTION_MISC_SR
,
5278 .op_flags
= XTENSA_OP_PRIVILEGED
,
5280 .name
= "wsr.misc2",
5281 .translate
= translate_wsr
,
5282 .test_exceptions
= test_exceptions_sr
,
5283 .par
= (const uint32_t[]){
5285 XTENSA_OPTION_MISC_SR
,
5287 .op_flags
= XTENSA_OP_PRIVILEGED
,
5289 .name
= "wsr.misc3",
5290 .translate
= translate_wsr
,
5291 .test_exceptions
= test_exceptions_sr
,
5292 .par
= (const uint32_t[]){
5294 XTENSA_OPTION_MISC_SR
,
5296 .op_flags
= XTENSA_OP_PRIVILEGED
,
5299 .translate
= translate_wsr
,
5300 .test_exceptions
= test_exceptions_sr
,
5301 .par
= (const uint32_t[]){
5303 XTENSA_OPTION_TRACE_PORT
,
5305 .op_flags
= XTENSA_OP_PRIVILEGED
,
5307 .name
= "wsr.mpuenb",
5308 .translate
= translate_wsr_mpuenb
,
5309 .test_exceptions
= test_exceptions_sr
,
5310 .par
= (const uint32_t[]){
5314 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5316 .name
= "wsr.prefctl",
5317 .translate
= translate_wsr
,
5318 .par
= (const uint32_t[]){PREFCTL
},
5321 .op_flags
= XTENSA_OP_ILL
,
5324 .translate
= translate_wsr_ps
,
5325 .test_exceptions
= test_exceptions_sr
,
5326 .par
= (const uint32_t[]){
5328 XTENSA_OPTION_EXCEPTION
,
5331 XTENSA_OP_PRIVILEGED
|
5332 XTENSA_OP_EXIT_TB_M1
|
5333 XTENSA_OP_CHECK_INTERRUPTS
,
5335 .name
= "wsr.ptevaddr",
5336 .translate
= translate_wsr_mask
,
5337 .test_exceptions
= test_exceptions_sr
,
5338 .par
= (const uint32_t[]){
5343 .op_flags
= XTENSA_OP_PRIVILEGED
,
5345 .name
= "wsr.rasid",
5346 .translate
= translate_wsr_rasid
,
5347 .test_exceptions
= test_exceptions_sr
,
5348 .par
= (const uint32_t[]){
5352 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5355 .translate
= translate_wsr_sar
,
5356 .par
= (const uint32_t[]){SAR
},
5358 .name
= "wsr.scompare1",
5359 .translate
= translate_wsr
,
5360 .test_exceptions
= test_exceptions_sr
,
5361 .par
= (const uint32_t[]){
5363 XTENSA_OPTION_CONDITIONAL_STORE
,
5366 .name
= "wsr.vecbase",
5367 .translate
= translate_wsr
,
5368 .test_exceptions
= test_exceptions_sr
,
5369 .par
= (const uint32_t[]){
5371 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5373 .op_flags
= XTENSA_OP_PRIVILEGED
,
5375 .name
= "wsr.windowbase",
5376 .translate
= translate_wsr_windowbase
,
5377 .test_exceptions
= test_exceptions_sr
,
5378 .par
= (const uint32_t[]){
5380 XTENSA_OPTION_WINDOWED_REGISTER
,
5382 .op_flags
= XTENSA_OP_PRIVILEGED
|
5383 XTENSA_OP_EXIT_TB_M1
|
5384 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5386 .name
= "wsr.windowstart",
5387 .translate
= translate_wsr_windowstart
,
5388 .test_exceptions
= test_exceptions_sr
,
5389 .par
= (const uint32_t[]){
5391 XTENSA_OPTION_WINDOWED_REGISTER
,
5393 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5395 .name
= "wur.expstate",
5396 .translate
= translate_wur
,
5397 .par
= (const uint32_t[]){EXPSTATE
},
5399 .name
= "wur.threadptr",
5400 .translate
= translate_wur
,
5401 .par
= (const uint32_t[]){THREADPTR
},
5404 .translate
= translate_xor
,
5407 .translate
= translate_boolean
,
5408 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5411 .op_flags
= XTENSA_OP_ILL
,
5414 .op_flags
= XTENSA_OP_ILL
,
5416 .name
= "xsr.acchi",
5417 .translate
= translate_xsr_acchi
,
5418 .test_exceptions
= test_exceptions_sr
,
5419 .par
= (const uint32_t[]){
5421 XTENSA_OPTION_MAC16
,
5424 .name
= "xsr.acclo",
5425 .translate
= translate_xsr
,
5426 .test_exceptions
= test_exceptions_sr
,
5427 .par
= (const uint32_t[]){
5429 XTENSA_OPTION_MAC16
,
5432 .name
= "xsr.atomctl",
5433 .translate
= translate_xsr_mask
,
5434 .test_exceptions
= test_exceptions_sr
,
5435 .par
= (const uint32_t[]){
5437 XTENSA_OPTION_ATOMCTL
,
5440 .op_flags
= XTENSA_OP_PRIVILEGED
,
5443 .translate
= translate_xsr_mask
,
5444 .test_exceptions
= test_exceptions_sr
,
5445 .par
= (const uint32_t[]){
5447 XTENSA_OPTION_BOOLEAN
,
5451 .name
= "xsr.cacheadrdis",
5452 .translate
= translate_xsr_mask
,
5453 .test_exceptions
= test_exceptions_sr
,
5454 .par
= (const uint32_t[]){
5459 .op_flags
= XTENSA_OP_PRIVILEGED
,
5461 .name
= "xsr.cacheattr",
5462 .translate
= translate_xsr
,
5463 .test_exceptions
= test_exceptions_sr
,
5464 .par
= (const uint32_t[]){
5466 XTENSA_OPTION_CACHEATTR
,
5468 .op_flags
= XTENSA_OP_PRIVILEGED
,
5470 .name
= "xsr.ccompare0",
5471 .translate
= translate_xsr_ccompare
,
5472 .test_exceptions
= test_exceptions_ccompare
,
5473 .par
= (const uint32_t[]){
5475 XTENSA_OPTION_TIMER_INTERRUPT
,
5477 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5479 .name
= "xsr.ccompare1",
5480 .translate
= translate_xsr_ccompare
,
5481 .test_exceptions
= test_exceptions_ccompare
,
5482 .par
= (const uint32_t[]){
5484 XTENSA_OPTION_TIMER_INTERRUPT
,
5486 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5488 .name
= "xsr.ccompare2",
5489 .translate
= translate_xsr_ccompare
,
5490 .test_exceptions
= test_exceptions_ccompare
,
5491 .par
= (const uint32_t[]){
5493 XTENSA_OPTION_TIMER_INTERRUPT
,
5495 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5497 .name
= "xsr.ccount",
5498 .translate
= translate_xsr_ccount
,
5499 .test_exceptions
= test_exceptions_sr
,
5500 .par
= (const uint32_t[]){
5502 XTENSA_OPTION_TIMER_INTERRUPT
,
5504 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5506 .name
= "xsr.configid0",
5507 .op_flags
= XTENSA_OP_ILL
,
5509 .name
= "xsr.configid1",
5510 .op_flags
= XTENSA_OP_ILL
,
5512 .name
= "xsr.cpenable",
5513 .translate
= translate_xsr_mask
,
5514 .test_exceptions
= test_exceptions_sr
,
5515 .par
= (const uint32_t[]){
5517 XTENSA_OPTION_COPROCESSOR
,
5520 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5522 .name
= "xsr.dbreaka0",
5523 .translate
= translate_xsr_dbreaka
,
5524 .test_exceptions
= test_exceptions_dbreak
,
5525 .par
= (const uint32_t[]){
5527 XTENSA_OPTION_DEBUG
,
5529 .op_flags
= XTENSA_OP_PRIVILEGED
,
5531 .name
= "xsr.dbreaka1",
5532 .translate
= translate_xsr_dbreaka
,
5533 .test_exceptions
= test_exceptions_dbreak
,
5534 .par
= (const uint32_t[]){
5536 XTENSA_OPTION_DEBUG
,
5538 .op_flags
= XTENSA_OP_PRIVILEGED
,
5540 .name
= "xsr.dbreakc0",
5541 .translate
= translate_xsr_dbreakc
,
5542 .test_exceptions
= test_exceptions_dbreak
,
5543 .par
= (const uint32_t[]){
5545 XTENSA_OPTION_DEBUG
,
5547 .op_flags
= XTENSA_OP_PRIVILEGED
,
5549 .name
= "xsr.dbreakc1",
5550 .translate
= translate_xsr_dbreakc
,
5551 .test_exceptions
= test_exceptions_dbreak
,
5552 .par
= (const uint32_t[]){
5554 XTENSA_OPTION_DEBUG
,
5556 .op_flags
= XTENSA_OP_PRIVILEGED
,
5559 .translate
= translate_xsr
,
5560 .test_exceptions
= test_exceptions_sr
,
5561 .par
= (const uint32_t[]){
5563 XTENSA_OPTION_DEBUG
,
5565 .op_flags
= XTENSA_OP_PRIVILEGED
,
5567 .name
= "xsr.debugcause",
5568 .op_flags
= XTENSA_OP_ILL
,
5571 .translate
= translate_xsr
,
5572 .test_exceptions
= test_exceptions_sr
,
5573 .par
= (const uint32_t[]){
5575 XTENSA_OPTION_EXCEPTION
,
5577 .op_flags
= XTENSA_OP_PRIVILEGED
,
5579 .name
= "xsr.dtlbcfg",
5580 .translate
= translate_xsr_mask
,
5581 .test_exceptions
= test_exceptions_sr
,
5582 .par
= (const uint32_t[]){
5587 .op_flags
= XTENSA_OP_PRIVILEGED
,
5590 .translate
= translate_xsr
,
5591 .test_exceptions
= test_exceptions_sr
,
5592 .par
= (const uint32_t[]){
5594 XTENSA_OPTION_EXCEPTION
,
5596 .op_flags
= XTENSA_OP_PRIVILEGED
,
5599 .translate
= translate_xsr
,
5600 .test_exceptions
= test_exceptions_hpi
,
5601 .par
= (const uint32_t[]){
5603 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5605 .op_flags
= XTENSA_OP_PRIVILEGED
,
5608 .translate
= translate_xsr
,
5609 .test_exceptions
= test_exceptions_hpi
,
5610 .par
= (const uint32_t[]){
5612 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5614 .op_flags
= XTENSA_OP_PRIVILEGED
,
5617 .translate
= translate_xsr
,
5618 .test_exceptions
= test_exceptions_hpi
,
5619 .par
= (const uint32_t[]){
5621 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5623 .op_flags
= XTENSA_OP_PRIVILEGED
,
5626 .translate
= translate_xsr
,
5627 .test_exceptions
= test_exceptions_hpi
,
5628 .par
= (const uint32_t[]){
5630 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5632 .op_flags
= XTENSA_OP_PRIVILEGED
,
5635 .translate
= translate_xsr
,
5636 .test_exceptions
= test_exceptions_hpi
,
5637 .par
= (const uint32_t[]){
5639 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5641 .op_flags
= XTENSA_OP_PRIVILEGED
,
5644 .translate
= translate_xsr
,
5645 .test_exceptions
= test_exceptions_hpi
,
5646 .par
= (const uint32_t[]){
5648 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5650 .op_flags
= XTENSA_OP_PRIVILEGED
,
5653 .translate
= translate_xsr
,
5654 .test_exceptions
= test_exceptions_hpi
,
5655 .par
= (const uint32_t[]){
5657 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5659 .op_flags
= XTENSA_OP_PRIVILEGED
,
5662 .translate
= translate_xsr
,
5663 .test_exceptions
= test_exceptions_hpi
,
5664 .par
= (const uint32_t[]){
5666 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5668 .op_flags
= XTENSA_OP_PRIVILEGED
,
5671 .translate
= translate_xsr
,
5672 .test_exceptions
= test_exceptions_hpi
,
5673 .par
= (const uint32_t[]){
5675 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5677 .op_flags
= XTENSA_OP_PRIVILEGED
,
5680 .translate
= translate_xsr
,
5681 .test_exceptions
= test_exceptions_hpi
,
5682 .par
= (const uint32_t[]){
5684 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5686 .op_flags
= XTENSA_OP_PRIVILEGED
,
5689 .translate
= translate_xsr
,
5690 .test_exceptions
= test_exceptions_hpi
,
5691 .par
= (const uint32_t[]){
5693 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5695 .op_flags
= XTENSA_OP_PRIVILEGED
,
5698 .translate
= translate_xsr
,
5699 .test_exceptions
= test_exceptions_hpi
,
5700 .par
= (const uint32_t[]){
5702 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5704 .op_flags
= XTENSA_OP_PRIVILEGED
,
5706 .name
= "xsr.eraccess",
5707 .translate
= translate_xsr_mask
,
5708 .par
= (const uint32_t[]){
5713 .op_flags
= XTENSA_OP_PRIVILEGED
,
5715 .name
= "xsr.exccause",
5716 .translate
= translate_xsr
,
5717 .test_exceptions
= test_exceptions_sr
,
5718 .par
= (const uint32_t[]){
5720 XTENSA_OPTION_EXCEPTION
,
5722 .op_flags
= XTENSA_OP_PRIVILEGED
,
5724 .name
= "xsr.excsave1",
5725 .translate
= translate_xsr
,
5726 .test_exceptions
= test_exceptions_sr
,
5727 .par
= (const uint32_t[]){
5729 XTENSA_OPTION_EXCEPTION
,
5731 .op_flags
= XTENSA_OP_PRIVILEGED
,
5733 .name
= "xsr.excsave2",
5734 .translate
= translate_xsr
,
5735 .test_exceptions
= test_exceptions_hpi
,
5736 .par
= (const uint32_t[]){
5738 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5740 .op_flags
= XTENSA_OP_PRIVILEGED
,
5742 .name
= "xsr.excsave3",
5743 .translate
= translate_xsr
,
5744 .test_exceptions
= test_exceptions_hpi
,
5745 .par
= (const uint32_t[]){
5747 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5749 .op_flags
= XTENSA_OP_PRIVILEGED
,
5751 .name
= "xsr.excsave4",
5752 .translate
= translate_xsr
,
5753 .test_exceptions
= test_exceptions_hpi
,
5754 .par
= (const uint32_t[]){
5756 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5758 .op_flags
= XTENSA_OP_PRIVILEGED
,
5760 .name
= "xsr.excsave5",
5761 .translate
= translate_xsr
,
5762 .test_exceptions
= test_exceptions_hpi
,
5763 .par
= (const uint32_t[]){
5765 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5767 .op_flags
= XTENSA_OP_PRIVILEGED
,
5769 .name
= "xsr.excsave6",
5770 .translate
= translate_xsr
,
5771 .test_exceptions
= test_exceptions_hpi
,
5772 .par
= (const uint32_t[]){
5774 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5776 .op_flags
= XTENSA_OP_PRIVILEGED
,
5778 .name
= "xsr.excsave7",
5779 .translate
= translate_xsr
,
5780 .test_exceptions
= test_exceptions_hpi
,
5781 .par
= (const uint32_t[]){
5783 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5785 .op_flags
= XTENSA_OP_PRIVILEGED
,
5787 .name
= "xsr.excvaddr",
5788 .translate
= translate_xsr
,
5789 .test_exceptions
= test_exceptions_sr
,
5790 .par
= (const uint32_t[]){
5792 XTENSA_OPTION_EXCEPTION
,
5794 .op_flags
= XTENSA_OP_PRIVILEGED
,
5796 .name
= "xsr.ibreaka0",
5797 .translate
= translate_xsr_ibreaka
,
5798 .test_exceptions
= test_exceptions_ibreak
,
5799 .par
= (const uint32_t[]){
5801 XTENSA_OPTION_DEBUG
,
5803 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5805 .name
= "xsr.ibreaka1",
5806 .translate
= translate_xsr_ibreaka
,
5807 .test_exceptions
= test_exceptions_ibreak
,
5808 .par
= (const uint32_t[]){
5810 XTENSA_OPTION_DEBUG
,
5812 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5814 .name
= "xsr.ibreakenable",
5815 .translate
= translate_xsr_ibreakenable
,
5816 .test_exceptions
= test_exceptions_sr
,
5817 .par
= (const uint32_t[]){
5819 XTENSA_OPTION_DEBUG
,
5821 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5823 .name
= "xsr.icount",
5824 .translate
= translate_xsr_icount
,
5825 .test_exceptions
= test_exceptions_sr
,
5826 .par
= (const uint32_t[]){
5828 XTENSA_OPTION_DEBUG
,
5830 .op_flags
= XTENSA_OP_PRIVILEGED
,
5832 .name
= "xsr.icountlevel",
5833 .translate
= translate_xsr_mask
,
5834 .test_exceptions
= test_exceptions_sr
,
5835 .par
= (const uint32_t[]){
5837 XTENSA_OPTION_DEBUG
,
5840 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5842 .name
= "xsr.intclear",
5843 .op_flags
= XTENSA_OP_ILL
,
5845 .name
= "xsr.intenable",
5846 .translate
= translate_xsr
,
5847 .test_exceptions
= test_exceptions_sr
,
5848 .par
= (const uint32_t[]){
5850 XTENSA_OPTION_INTERRUPT
,
5853 XTENSA_OP_PRIVILEGED
|
5854 XTENSA_OP_EXIT_TB_0
|
5855 XTENSA_OP_CHECK_INTERRUPTS
,
5857 .name
= "xsr.interrupt",
5858 .op_flags
= XTENSA_OP_ILL
,
5860 .name
= "xsr.intset",
5861 .op_flags
= XTENSA_OP_ILL
,
5863 .name
= "xsr.itlbcfg",
5864 .translate
= translate_xsr_mask
,
5865 .test_exceptions
= test_exceptions_sr
,
5866 .par
= (const uint32_t[]){
5871 .op_flags
= XTENSA_OP_PRIVILEGED
,
5874 .translate
= translate_xsr
,
5875 .test_exceptions
= test_exceptions_sr
,
5876 .par
= (const uint32_t[]){
5880 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5882 .name
= "xsr.lcount",
5883 .translate
= translate_xsr
,
5884 .test_exceptions
= test_exceptions_sr
,
5885 .par
= (const uint32_t[]){
5891 .translate
= translate_xsr
,
5892 .test_exceptions
= test_exceptions_sr
,
5893 .par
= (const uint32_t[]){
5897 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5899 .name
= "xsr.litbase",
5900 .translate
= translate_xsr_mask
,
5901 .test_exceptions
= test_exceptions_sr
,
5902 .par
= (const uint32_t[]){
5904 XTENSA_OPTION_EXTENDED_L32R
,
5907 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5910 .translate
= translate_xsr
,
5911 .test_exceptions
= test_exceptions_sr
,
5912 .par
= (const uint32_t[]){
5914 XTENSA_OPTION_MAC16
,
5918 .translate
= translate_xsr
,
5919 .test_exceptions
= test_exceptions_sr
,
5920 .par
= (const uint32_t[]){
5922 XTENSA_OPTION_MAC16
,
5926 .translate
= translate_xsr
,
5927 .test_exceptions
= test_exceptions_sr
,
5928 .par
= (const uint32_t[]){
5930 XTENSA_OPTION_MAC16
,
5934 .translate
= translate_xsr
,
5935 .test_exceptions
= test_exceptions_sr
,
5936 .par
= (const uint32_t[]){
5938 XTENSA_OPTION_MAC16
,
5941 .name
= "xsr.memctl",
5942 .translate
= translate_xsr_memctl
,
5943 .par
= (const uint32_t[]){MEMCTL
},
5944 .op_flags
= XTENSA_OP_PRIVILEGED
,
5947 .translate
= translate_xsr
,
5948 .test_exceptions
= test_exceptions_sr
,
5949 .par
= (const uint32_t[]){
5951 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5953 .op_flags
= XTENSA_OP_PRIVILEGED
,
5956 .translate
= translate_xsr
,
5957 .test_exceptions
= test_exceptions_sr
,
5958 .par
= (const uint32_t[]){
5960 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5962 .op_flags
= XTENSA_OP_PRIVILEGED
,
5965 .translate
= translate_xsr
,
5966 .test_exceptions
= test_exceptions_sr
,
5967 .par
= (const uint32_t[]){
5969 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5971 .op_flags
= XTENSA_OP_PRIVILEGED
,
5973 .name
= "xsr.mesave",
5974 .translate
= translate_xsr
,
5975 .test_exceptions
= test_exceptions_sr
,
5976 .par
= (const uint32_t[]){
5978 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5980 .op_flags
= XTENSA_OP_PRIVILEGED
,
5983 .translate
= translate_xsr
,
5984 .test_exceptions
= test_exceptions_sr
,
5985 .par
= (const uint32_t[]){
5987 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5989 .op_flags
= XTENSA_OP_PRIVILEGED
,
5991 .name
= "xsr.mevaddr",
5992 .translate
= translate_xsr
,
5993 .test_exceptions
= test_exceptions_sr
,
5994 .par
= (const uint32_t[]){
5996 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5998 .op_flags
= XTENSA_OP_PRIVILEGED
,
6000 .name
= "xsr.misc0",
6001 .translate
= translate_xsr
,
6002 .test_exceptions
= test_exceptions_sr
,
6003 .par
= (const uint32_t[]){
6005 XTENSA_OPTION_MISC_SR
,
6007 .op_flags
= XTENSA_OP_PRIVILEGED
,
6009 .name
= "xsr.misc1",
6010 .translate
= translate_xsr
,
6011 .test_exceptions
= test_exceptions_sr
,
6012 .par
= (const uint32_t[]){
6014 XTENSA_OPTION_MISC_SR
,
6016 .op_flags
= XTENSA_OP_PRIVILEGED
,
6018 .name
= "xsr.misc2",
6019 .translate
= translate_xsr
,
6020 .test_exceptions
= test_exceptions_sr
,
6021 .par
= (const uint32_t[]){
6023 XTENSA_OPTION_MISC_SR
,
6025 .op_flags
= XTENSA_OP_PRIVILEGED
,
6027 .name
= "xsr.misc3",
6028 .translate
= translate_xsr
,
6029 .test_exceptions
= test_exceptions_sr
,
6030 .par
= (const uint32_t[]){
6032 XTENSA_OPTION_MISC_SR
,
6034 .op_flags
= XTENSA_OP_PRIVILEGED
,
6036 .name
= "xsr.mpuenb",
6037 .translate
= translate_xsr_mpuenb
,
6038 .test_exceptions
= test_exceptions_sr
,
6039 .par
= (const uint32_t[]){
6043 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6045 .name
= "xsr.prefctl",
6046 .translate
= translate_xsr
,
6047 .par
= (const uint32_t[]){PREFCTL
},
6050 .op_flags
= XTENSA_OP_ILL
,
6053 .translate
= translate_xsr_ps
,
6054 .test_exceptions
= test_exceptions_sr
,
6055 .par
= (const uint32_t[]){
6057 XTENSA_OPTION_EXCEPTION
,
6060 XTENSA_OP_PRIVILEGED
|
6061 XTENSA_OP_EXIT_TB_M1
|
6062 XTENSA_OP_CHECK_INTERRUPTS
,
6064 .name
= "xsr.ptevaddr",
6065 .translate
= translate_xsr_mask
,
6066 .test_exceptions
= test_exceptions_sr
,
6067 .par
= (const uint32_t[]){
6072 .op_flags
= XTENSA_OP_PRIVILEGED
,
6074 .name
= "xsr.rasid",
6075 .translate
= translate_xsr_rasid
,
6076 .test_exceptions
= test_exceptions_sr
,
6077 .par
= (const uint32_t[]){
6081 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6084 .translate
= translate_xsr_sar
,
6085 .par
= (const uint32_t[]){SAR
},
6087 .name
= "xsr.scompare1",
6088 .translate
= translate_xsr
,
6089 .test_exceptions
= test_exceptions_sr
,
6090 .par
= (const uint32_t[]){
6092 XTENSA_OPTION_CONDITIONAL_STORE
,
6095 .name
= "xsr.vecbase",
6096 .translate
= translate_xsr
,
6097 .test_exceptions
= test_exceptions_sr
,
6098 .par
= (const uint32_t[]){
6100 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6102 .op_flags
= XTENSA_OP_PRIVILEGED
,
6104 .name
= "xsr.windowbase",
6105 .translate
= translate_xsr_windowbase
,
6106 .test_exceptions
= test_exceptions_sr
,
6107 .par
= (const uint32_t[]){
6109 XTENSA_OPTION_WINDOWED_REGISTER
,
6111 .op_flags
= XTENSA_OP_PRIVILEGED
|
6112 XTENSA_OP_EXIT_TB_M1
|
6113 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6115 .name
= "xsr.windowstart",
6116 .translate
= translate_xsr_windowstart
,
6117 .test_exceptions
= test_exceptions_sr
,
6118 .par
= (const uint32_t[]){
6120 XTENSA_OPTION_WINDOWED_REGISTER
,
6122 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6126 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6127 .num_opcodes
= ARRAY_SIZE(core_ops
),
6132 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6133 int o0
, int i0
, int i1
, int i2
)
6135 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6136 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6138 arg32
[o0
].out
= tcg_temp_new_i32();
6141 arg32
[i0
].in
= tcg_temp_new_i32();
6142 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6145 arg32
[i1
].in
= tcg_temp_new_i32();
6146 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6149 arg32
[i2
].in
= tcg_temp_new_i32();
6150 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6154 arg32
[o0
].out
= arg
[o0
].out
;
6157 arg32
[i0
].in
= arg
[i0
].in
;
6160 arg32
[i1
].in
= arg
[i1
].in
;
6163 arg32
[i2
].in
= arg
[i2
].in
;
6168 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6169 int o0
, int i0
, int i1
, int i2
)
6171 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6172 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6174 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6179 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6180 int o0
, int i0
, int i1
)
6182 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6185 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6186 int o0
, int i0
, int i1
)
6188 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6191 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6194 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6197 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6200 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6203 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6206 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6209 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6212 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6215 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6218 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6221 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6224 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6227 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6230 get_f32_i2(arg
, arg32
, i0
, -1);
6233 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6236 put_f32_i2(arg
, arg32
, i0
, -1);
6240 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6241 const uint32_t par
[])
6243 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6246 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6247 const uint32_t par
[])
6251 get_f32_o1_i1(arg
, arg32
, 0, 1);
6252 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6253 put_f32_o1_i1(arg
, arg32
, 0, 1);
6256 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6257 const uint32_t par
[])
6259 gen_helper_fpu2k_add_s(arg
[0].out
, tcg_env
,
6260 arg
[1].in
, arg
[2].in
);
6273 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6274 const uint32_t par
[])
6276 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6277 TCGv_i64 s
, TCGv_i64 t
) = {
6278 [COMPARE_UN
] = gen_helper_un_d
,
6279 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6280 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6281 [COMPARE_OLT
] = gen_helper_olt_d
,
6282 [COMPARE_ULT
] = gen_helper_ult_d
,
6283 [COMPARE_OLE
] = gen_helper_ole_d
,
6284 [COMPARE_ULE
] = gen_helper_ule_d
,
6286 TCGv_i32 zero
= tcg_constant_i32(0);
6287 TCGv_i32 res
= tcg_temp_new_i32();
6288 TCGv_i32 set_br
= tcg_temp_new_i32();
6289 TCGv_i32 clr_br
= tcg_temp_new_i32();
6291 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6292 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6294 helper
[par
[0]](res
, tcg_env
, arg
[1].in
, arg
[2].in
);
6295 tcg_gen_movcond_i32(TCG_COND_NE
,
6296 arg
[0].out
, res
, zero
,
6300 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6301 const uint32_t par
[])
6303 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6304 TCGv_i32 s
, TCGv_i32 t
) = {
6305 [COMPARE_UN
] = gen_helper_un_s
,
6306 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6307 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6308 [COMPARE_OLT
] = gen_helper_olt_s
,
6309 [COMPARE_ULT
] = gen_helper_ult_s
,
6310 [COMPARE_OLE
] = gen_helper_ole_s
,
6311 [COMPARE_ULE
] = gen_helper_ule_s
,
6314 TCGv_i32 zero
= tcg_constant_i32(0);
6315 TCGv_i32 res
= tcg_temp_new_i32();
6316 TCGv_i32 set_br
= tcg_temp_new_i32();
6317 TCGv_i32 clr_br
= tcg_temp_new_i32();
6319 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6320 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6322 get_f32_i2(arg
, arg32
, 1, 2);
6323 helper
[par
[0]](res
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
6324 tcg_gen_movcond_i32(TCG_COND_NE
,
6325 arg
[0].out
, res
, zero
,
6327 put_f32_i2(arg
, arg32
, 1, 2);
6330 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6331 const uint32_t par
[])
6333 static const uint64_t v
[] = {
6334 UINT64_C(0x0000000000000000),
6335 UINT64_C(0x3ff0000000000000),
6336 UINT64_C(0x4000000000000000),
6337 UINT64_C(0x3fe0000000000000),
6340 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6341 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6342 qemu_log_mask(LOG_GUEST_ERROR
,
6343 "const.d f%d, #%d, immediate value is reserved\n",
6344 arg
[0].imm
, arg
[1].imm
);
6348 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6349 const uint32_t par
[])
6351 static const uint32_t v
[] = {
6358 if (arg
[0].num_bits
== 32) {
6359 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6361 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6363 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6364 qemu_log_mask(LOG_GUEST_ERROR
,
6365 "const.s f%d, #%d, immediate value is reserved\n",
6366 arg
[0].imm
, arg
[1].imm
);
6370 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6371 const uint32_t par
[])
6373 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6376 gen_helper_uitof_d(arg
[0].out
, tcg_env
, arg
[1].in
, scale
);
6378 gen_helper_itof_d(arg
[0].out
, tcg_env
, arg
[1].in
, scale
);
6382 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6383 const uint32_t par
[])
6385 TCGv_i32 scale
= tcg_constant_i32(-arg
[2].imm
);
6388 get_f32_o1(arg
, arg32
, 0);
6390 gen_helper_uitof_s(arg32
[0].out
, tcg_env
, arg
[1].in
, scale
);
6392 gen_helper_itof_s(arg32
[0].out
, tcg_env
, arg
[1].in
, scale
);
6394 put_f32_o1(arg
, arg32
, 0);
6397 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6398 const uint32_t par
[])
6400 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6401 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6404 gen_helper_ftoui_d(arg
[0].out
, tcg_env
, arg
[1].in
,
6405 rounding_mode
, scale
);
6407 gen_helper_ftoi_d(arg
[0].out
, tcg_env
, arg
[1].in
,
6408 rounding_mode
, scale
);
6412 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6413 const uint32_t par
[])
6415 TCGv_i32 rounding_mode
= tcg_constant_i32(par
[0]);
6416 TCGv_i32 scale
= tcg_constant_i32(arg
[2].imm
);
6419 get_f32_i1(arg
, arg32
, 1);
6421 gen_helper_ftoui_s(arg
[0].out
, tcg_env
, arg32
[1].in
,
6422 rounding_mode
, scale
);
6424 gen_helper_ftoi_s(arg
[0].out
, tcg_env
, arg32
[1].in
,
6425 rounding_mode
, scale
);
6427 put_f32_i1(arg
, arg32
, 1);
6430 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6431 const uint32_t par
[])
6433 TCGv_i32 addr
= tcg_temp_new_i32();
6436 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6437 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6439 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6441 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6444 tcg_gen_mov_i32(arg
[1].out
, addr
);
6448 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6449 const uint32_t par
[])
6451 TCGv_i32 addr
= tcg_temp_new_i32();
6454 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6455 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6457 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, mop
);
6459 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, mop
);
6462 tcg_gen_mov_i32(arg
[1].out
, addr
);
6466 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6467 const uint32_t par
[])
6469 gen_helper_fpu2k_madd_s(arg
[0].out
, tcg_env
,
6470 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6473 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6474 const uint32_t par
[])
6476 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6479 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6480 const uint32_t par
[])
6482 if (arg
[0].num_bits
== 32) {
6483 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6485 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6489 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6490 const uint32_t par
[])
6492 TCGv_i64 zero
= tcg_constant_i64(0);
6493 TCGv_i64 arg2
= tcg_temp_new_i64();
6495 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6496 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6498 arg
[1].in
, arg
[0].in
);
6501 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6502 const uint32_t par
[])
6504 if (arg
[0].num_bits
== 32) {
6505 TCGv_i32 zero
= tcg_constant_i32(0);
6507 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6509 arg
[1].in
, arg
[0].in
);
6511 translate_movcond_d(dc
, arg
, par
);
6515 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6516 const uint32_t par
[])
6518 TCGv_i64 zero
= tcg_constant_i64(0);
6519 TCGv_i32 tmp1
= tcg_temp_new_i32();
6520 TCGv_i64 tmp2
= tcg_temp_new_i64();
6522 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6523 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6524 tcg_gen_movcond_i64(par
[0],
6525 arg
[0].out
, tmp2
, zero
,
6526 arg
[1].in
, arg
[0].in
);
6529 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6530 const uint32_t par
[])
6532 if (arg
[0].num_bits
== 32) {
6533 TCGv_i32 zero
= tcg_constant_i32(0);
6534 TCGv_i32 tmp
= tcg_temp_new_i32();
6536 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6537 tcg_gen_movcond_i32(par
[0],
6538 arg
[0].out
, tmp
, zero
,
6539 arg
[1].in
, arg
[0].in
);
6541 translate_movp_d(dc
, arg
, par
);
6545 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6546 const uint32_t par
[])
6548 gen_helper_fpu2k_mul_s(arg
[0].out
, tcg_env
,
6549 arg
[1].in
, arg
[2].in
);
6552 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6553 const uint32_t par
[])
6555 gen_helper_fpu2k_msub_s(arg
[0].out
, tcg_env
,
6556 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6559 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6560 const uint32_t par
[])
6562 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6565 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6566 const uint32_t par
[])
6570 get_f32_o1_i1(arg
, arg32
, 0, 1);
6571 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6572 put_f32_o1_i1(arg
, arg32
, 0, 1);
6575 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6576 const uint32_t par
[])
6578 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6581 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6582 const uint32_t par
[])
6584 if (arg
[1].num_bits
== 32) {
6585 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6587 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6591 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6592 const uint32_t par
[])
6594 gen_helper_fpu2k_sub_s(arg
[0].out
, tcg_env
,
6595 arg
[1].in
, arg
[2].in
);
6598 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6599 const uint32_t par
[])
6601 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6604 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6605 const uint32_t par
[])
6607 if (arg
[0].num_bits
== 32) {
6608 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6610 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6614 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6615 const uint32_t par
[])
6617 gen_helper_wur_fpu2k_fcr(tcg_env
, arg
[0].in
);
6620 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6621 const uint32_t par
[])
6623 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6626 static const XtensaOpcodeOps fpu2000_ops
[] = {
6629 .translate
= translate_abs_s
,
6633 .translate
= translate_fpu2k_add_s
,
6637 .translate
= translate_ftoi_s
,
6638 .par
= (const uint32_t[]){float_round_up
, false},
6642 .translate
= translate_float_s
,
6643 .par
= (const uint32_t[]){false},
6647 .translate
= translate_ftoi_s
,
6648 .par
= (const uint32_t[]){float_round_down
, false},
6652 .translate
= translate_ldsti
,
6653 .par
= (const uint32_t[]){false, false},
6654 .op_flags
= XTENSA_OP_LOAD
,
6658 .translate
= translate_ldsti
,
6659 .par
= (const uint32_t[]){false, true},
6660 .op_flags
= XTENSA_OP_LOAD
,
6664 .translate
= translate_ldstx
,
6665 .par
= (const uint32_t[]){false, false},
6666 .op_flags
= XTENSA_OP_LOAD
,
6670 .translate
= translate_ldstx
,
6671 .par
= (const uint32_t[]){false, true},
6672 .op_flags
= XTENSA_OP_LOAD
,
6676 .translate
= translate_fpu2k_madd_s
,
6680 .translate
= translate_mov_s
,
6684 .translate
= translate_movcond_s
,
6685 .par
= (const uint32_t[]){TCG_COND_EQ
},
6689 .translate
= translate_movp_s
,
6690 .par
= (const uint32_t[]){TCG_COND_EQ
},
6694 .translate
= translate_movcond_s
,
6695 .par
= (const uint32_t[]){TCG_COND_GE
},
6699 .translate
= translate_movcond_s
,
6700 .par
= (const uint32_t[]){TCG_COND_LT
},
6704 .translate
= translate_movcond_s
,
6705 .par
= (const uint32_t[]){TCG_COND_NE
},
6709 .translate
= translate_movp_s
,
6710 .par
= (const uint32_t[]){TCG_COND_NE
},
6714 .translate
= translate_fpu2k_msub_s
,
6718 .translate
= translate_fpu2k_mul_s
,
6722 .translate
= translate_neg_s
,
6726 .translate
= translate_compare_s
,
6727 .par
= (const uint32_t[]){COMPARE_OEQ
},
6731 .translate
= translate_compare_s
,
6732 .par
= (const uint32_t[]){COMPARE_OLE
},
6736 .translate
= translate_compare_s
,
6737 .par
= (const uint32_t[]){COMPARE_OLT
},
6741 .translate
= translate_rfr_s
,
6745 .translate
= translate_ftoi_s
,
6746 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6750 .translate
= translate_rur
,
6751 .par
= (const uint32_t[]){FCR
},
6755 .translate
= translate_rur
,
6756 .par
= (const uint32_t[]){FSR
},
6760 .translate
= translate_ldsti
,
6761 .par
= (const uint32_t[]){true, false},
6762 .op_flags
= XTENSA_OP_STORE
,
6766 .translate
= translate_ldsti
,
6767 .par
= (const uint32_t[]){true, true},
6768 .op_flags
= XTENSA_OP_STORE
,
6772 .translate
= translate_ldstx
,
6773 .par
= (const uint32_t[]){true, false},
6774 .op_flags
= XTENSA_OP_STORE
,
6778 .translate
= translate_ldstx
,
6779 .par
= (const uint32_t[]){true, true},
6780 .op_flags
= XTENSA_OP_STORE
,
6784 .translate
= translate_fpu2k_sub_s
,
6788 .translate
= translate_ftoi_s
,
6789 .par
= (const uint32_t[]){float_round_to_zero
, false},
6793 .translate
= translate_compare_s
,
6794 .par
= (const uint32_t[]){COMPARE_UEQ
},
6798 .translate
= translate_float_s
,
6799 .par
= (const uint32_t[]){true},
6803 .translate
= translate_compare_s
,
6804 .par
= (const uint32_t[]){COMPARE_ULE
},
6808 .translate
= translate_compare_s
,
6809 .par
= (const uint32_t[]){COMPARE_ULT
},
6813 .translate
= translate_compare_s
,
6814 .par
= (const uint32_t[]){COMPARE_UN
},
6818 .translate
= translate_ftoi_s
,
6819 .par
= (const uint32_t[]){float_round_to_zero
, true},
6823 .translate
= translate_wfr_s
,
6827 .translate
= translate_wur_fpu2k_fcr
,
6828 .par
= (const uint32_t[]){FCR
},
6832 .translate
= translate_wur_fpu2k_fsr
,
6833 .par
= (const uint32_t[]){FSR
},
6838 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
6839 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
6840 .opcode
= fpu2000_ops
,
6843 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
6844 const uint32_t par
[])
6846 gen_helper_add_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
6849 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6850 const uint32_t par
[])
6852 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
6853 gen_helper_fpu2k_add_s(arg
[0].out
, tcg_env
,
6854 arg
[1].in
, arg
[2].in
);
6858 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6859 gen_helper_add_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
6860 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
6864 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6865 const uint32_t par
[])
6867 TCGv_i32 v
= tcg_temp_new_i32();
6869 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
6870 gen_helper_cvtd_s(arg
[0].out
, tcg_env
, v
);
6873 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
6874 const uint32_t par
[])
6876 TCGv_i32 v
= tcg_temp_new_i32();
6878 gen_helper_cvts_d(v
, tcg_env
, arg
[1].in
);
6879 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
6882 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
6883 const uint32_t par
[])
6889 addr
= tcg_temp_new_i32();
6890 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6894 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
6896 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
6898 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
6902 tcg_gen_mov_i32(arg
[1].out
, addr
);
6904 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6909 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
6910 const uint32_t par
[])
6917 addr
= tcg_temp_new_i32();
6918 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6922 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6924 get_f32_i1(arg
, arg32
, 0);
6925 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
6926 put_f32_i1(arg
, arg32
, 0);
6928 get_f32_o1(arg
, arg32
, 0);
6929 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
6930 put_f32_o1(arg
, arg32
, 0);
6934 tcg_gen_mov_i32(arg
[1].out
, addr
);
6936 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
6941 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
6942 const uint32_t par
[])
6948 addr
= tcg_temp_new_i32();
6949 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6953 mop
= gen_load_store_alignment(dc
, MO_TEUQ
, addr
);
6955 tcg_gen_qemu_st_i64(arg
[0].in
, addr
, dc
->cring
, mop
);
6957 tcg_gen_qemu_ld_i64(arg
[0].out
, addr
, dc
->cring
, mop
);
6961 tcg_gen_mov_i32(arg
[1].out
, addr
);
6963 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
6968 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
6969 const uint32_t par
[])
6976 addr
= tcg_temp_new_i32();
6977 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6981 mop
= gen_load_store_alignment(dc
, MO_TEUL
, addr
);
6983 get_f32_i1(arg
, arg32
, 0);
6984 tcg_gen_qemu_st_tl(arg32
[0].in
, addr
, dc
->cring
, mop
);
6985 put_f32_i1(arg
, arg32
, 0);
6987 get_f32_o1(arg
, arg32
, 0);
6988 tcg_gen_qemu_ld_tl(arg32
[0].out
, addr
, dc
->cring
, mop
);
6989 put_f32_o1(arg
, arg32
, 0);
6993 tcg_gen_mov_i32(arg
[1].out
, addr
);
6995 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7000 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7001 const uint32_t par
[])
7003 gen_helper_madd_d(arg
[0].out
, tcg_env
,
7004 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7007 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7008 const uint32_t par
[])
7010 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7011 gen_helper_fpu2k_madd_s(arg
[0].out
, tcg_env
,
7012 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7016 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7017 gen_helper_madd_s(arg32
[0].out
, tcg_env
,
7018 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7019 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7023 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7024 const uint32_t par
[])
7026 gen_helper_mul_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
7029 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7030 const uint32_t par
[])
7032 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7033 gen_helper_fpu2k_mul_s(arg
[0].out
, tcg_env
,
7034 arg
[1].in
, arg
[2].in
);
7038 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7039 gen_helper_mul_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
7040 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7044 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7045 const uint32_t par
[])
7047 gen_helper_msub_d(arg
[0].out
, tcg_env
,
7048 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7051 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7052 const uint32_t par
[])
7054 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7055 gen_helper_fpu2k_msub_s(arg
[0].out
, tcg_env
,
7056 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7060 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7061 gen_helper_msub_s(arg32
[0].out
, tcg_env
,
7062 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7063 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7067 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7068 const uint32_t par
[])
7070 gen_helper_sub_d(arg
[0].out
, tcg_env
, arg
[1].in
, arg
[2].in
);
7073 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7074 const uint32_t par
[])
7076 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7077 gen_helper_fpu2k_sub_s(arg
[0].out
, tcg_env
,
7078 arg
[1].in
, arg
[2].in
);
7082 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7083 gen_helper_sub_s(arg32
[0].out
, tcg_env
, arg32
[1].in
, arg32
[2].in
);
7084 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7088 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7089 const uint32_t par
[])
7091 gen_helper_mkdadj_d(arg
[0].out
, tcg_env
, arg
[0].in
, arg
[1].in
);
7094 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7095 const uint32_t par
[])
7099 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7100 gen_helper_mkdadj_s(arg32
[0].out
, tcg_env
, arg32
[0].in
, arg32
[1].in
);
7101 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7104 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7105 const uint32_t par
[])
7107 gen_helper_mksadj_d(arg
[0].out
, tcg_env
, arg
[1].in
);
7110 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7111 const uint32_t par
[])
7115 get_f32_o1_i1(arg
, arg32
, 0, 1);
7116 gen_helper_mksadj_s(arg32
[0].out
, tcg_env
, arg32
[1].in
);
7117 put_f32_o1_i1(arg
, arg32
, 0, 1);
7120 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7121 const uint32_t par
[])
7123 gen_helper_wur_fpu_fcr(tcg_env
, arg
[0].in
);
7126 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7127 const uint32_t par
[])
7129 gen_helper_rur_fpu_fsr(arg
[0].out
, tcg_env
);
7132 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7133 const uint32_t par
[])
7135 gen_helper_wur_fpu_fsr(tcg_env
, arg
[0].in
);
7138 static const XtensaOpcodeOps fpu_ops
[] = {
7141 .translate
= translate_abs_d
,
7145 .translate
= translate_abs_s
,
7149 .translate
= translate_add_d
,
7153 .translate
= translate_add_s
,
7157 .translate
= translate_nop
,
7161 .translate
= translate_nop
,
7164 .name
= "addexpm.d",
7165 .translate
= translate_mov_s
,
7168 .name
= "addexpm.s",
7169 .translate
= translate_mov_s
,
7173 .translate
= translate_ftoi_d
,
7174 .par
= (const uint32_t[]){float_round_up
, false},
7178 .translate
= translate_ftoi_s
,
7179 .par
= (const uint32_t[]){float_round_up
, false},
7183 .translate
= translate_const_d
,
7187 .translate
= translate_const_s
,
7191 .translate
= translate_cvtd_s
,
7195 .translate
= translate_cvts_d
,
7199 .translate
= translate_nop
,
7203 .translate
= translate_nop
,
7207 .translate
= translate_nop
,
7211 .translate
= translate_nop
,
7215 .translate
= translate_float_d
,
7216 .par
= (const uint32_t[]){false},
7220 .translate
= translate_float_s
,
7221 .par
= (const uint32_t[]){false},
7225 .translate
= translate_ftoi_d
,
7226 .par
= (const uint32_t[]){float_round_down
, false},
7230 .translate
= translate_ftoi_s
,
7231 .par
= (const uint32_t[]){float_round_down
, false},
7235 .translate
= translate_ldsti_d
,
7236 .par
= (const uint32_t[]){false, true, false},
7237 .op_flags
= XTENSA_OP_LOAD
,
7241 .translate
= translate_ldsti_d
,
7242 .par
= (const uint32_t[]){false, false, true},
7243 .op_flags
= XTENSA_OP_LOAD
,
7247 .translate
= translate_ldsti_d
,
7248 .par
= (const uint32_t[]){false, true, true},
7249 .op_flags
= XTENSA_OP_LOAD
,
7253 .translate
= translate_ldstx_d
,
7254 .par
= (const uint32_t[]){false, true, false},
7255 .op_flags
= XTENSA_OP_LOAD
,
7259 .translate
= translate_ldstx_d
,
7260 .par
= (const uint32_t[]){false, false, true},
7261 .op_flags
= XTENSA_OP_LOAD
,
7265 .translate
= translate_ldstx_d
,
7266 .par
= (const uint32_t[]){false, true, true},
7267 .op_flags
= XTENSA_OP_LOAD
,
7271 .translate
= translate_ldsti_s
,
7272 .par
= (const uint32_t[]){false, true, false},
7273 .op_flags
= XTENSA_OP_LOAD
,
7277 .translate
= translate_ldsti_s
,
7278 .par
= (const uint32_t[]){false, false, true},
7279 .op_flags
= XTENSA_OP_LOAD
,
7283 .translate
= translate_ldsti_s
,
7284 .par
= (const uint32_t[]){false, true, true},
7285 .op_flags
= XTENSA_OP_LOAD
,
7289 .translate
= translate_ldstx_s
,
7290 .par
= (const uint32_t[]){false, true, false},
7291 .op_flags
= XTENSA_OP_LOAD
,
7295 .translate
= translate_ldstx_s
,
7296 .par
= (const uint32_t[]){false, false, true},
7297 .op_flags
= XTENSA_OP_LOAD
,
7301 .translate
= translate_ldstx_s
,
7302 .par
= (const uint32_t[]){false, true, true},
7303 .op_flags
= XTENSA_OP_LOAD
,
7307 .translate
= translate_madd_d
,
7311 .translate
= translate_madd_s
,
7315 .translate
= translate_nop
,
7319 .translate
= translate_nop
,
7323 .translate
= translate_mkdadj_d
,
7327 .translate
= translate_mkdadj_s
,
7331 .translate
= translate_mksadj_d
,
7335 .translate
= translate_mksadj_s
,
7339 .translate
= translate_mov_d
,
7343 .translate
= translate_mov_s
,
7347 .translate
= translate_movcond_d
,
7348 .par
= (const uint32_t[]){TCG_COND_EQ
},
7352 .translate
= translate_movcond_s
,
7353 .par
= (const uint32_t[]){TCG_COND_EQ
},
7357 .translate
= translate_movp_d
,
7358 .par
= (const uint32_t[]){TCG_COND_EQ
},
7362 .translate
= translate_movp_s
,
7363 .par
= (const uint32_t[]){TCG_COND_EQ
},
7367 .translate
= translate_movcond_d
,
7368 .par
= (const uint32_t[]){TCG_COND_GE
},
7372 .translate
= translate_movcond_s
,
7373 .par
= (const uint32_t[]){TCG_COND_GE
},
7377 .translate
= translate_movcond_d
,
7378 .par
= (const uint32_t[]){TCG_COND_LT
},
7382 .translate
= translate_movcond_s
,
7383 .par
= (const uint32_t[]){TCG_COND_LT
},
7387 .translate
= translate_movcond_d
,
7388 .par
= (const uint32_t[]){TCG_COND_NE
},
7392 .translate
= translate_movcond_s
,
7393 .par
= (const uint32_t[]){TCG_COND_NE
},
7397 .translate
= translate_movp_d
,
7398 .par
= (const uint32_t[]){TCG_COND_NE
},
7402 .translate
= translate_movp_s
,
7403 .par
= (const uint32_t[]){TCG_COND_NE
},
7407 .translate
= translate_msub_d
,
7411 .translate
= translate_msub_s
,
7415 .translate
= translate_mul_d
,
7419 .translate
= translate_mul_s
,
7423 .translate
= translate_neg_d
,
7427 .translate
= translate_neg_s
,
7431 .translate
= translate_nop
,
7435 .translate
= translate_nop
,
7439 .translate
= translate_compare_d
,
7440 .par
= (const uint32_t[]){COMPARE_OEQ
},
7444 .translate
= translate_compare_s
,
7445 .par
= (const uint32_t[]){COMPARE_OEQ
},
7449 .translate
= translate_compare_d
,
7450 .par
= (const uint32_t[]){COMPARE_OLE
},
7454 .translate
= translate_compare_s
,
7455 .par
= (const uint32_t[]){COMPARE_OLE
},
7459 .translate
= translate_compare_d
,
7460 .par
= (const uint32_t[]){COMPARE_OLT
},
7464 .translate
= translate_compare_s
,
7465 .par
= (const uint32_t[]){COMPARE_OLT
},
7469 .translate
= translate_rfr_s
,
7473 .translate
= translate_rfr_d
,
7477 .translate
= translate_ftoi_d
,
7478 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7482 .translate
= translate_ftoi_s
,
7483 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7487 .translate
= translate_rur
,
7488 .par
= (const uint32_t[]){FCR
},
7492 .translate
= translate_rur_fpu_fsr
,
7496 .translate
= translate_ldsti_d
,
7497 .par
= (const uint32_t[]){true, true, false},
7498 .op_flags
= XTENSA_OP_STORE
,
7502 .translate
= translate_ldsti_d
,
7503 .par
= (const uint32_t[]){true, false, true},
7504 .op_flags
= XTENSA_OP_STORE
,
7508 .translate
= translate_ldsti_d
,
7509 .par
= (const uint32_t[]){true, true, true},
7510 .op_flags
= XTENSA_OP_STORE
,
7514 .translate
= translate_ldstx_d
,
7515 .par
= (const uint32_t[]){true, true, false},
7516 .op_flags
= XTENSA_OP_STORE
,
7520 .translate
= translate_ldstx_d
,
7521 .par
= (const uint32_t[]){true, false, true},
7522 .op_flags
= XTENSA_OP_STORE
,
7526 .translate
= translate_ldstx_d
,
7527 .par
= (const uint32_t[]){true, true, true},
7528 .op_flags
= XTENSA_OP_STORE
,
7532 .translate
= translate_nop
,
7536 .translate
= translate_nop
,
7540 .translate
= translate_ldsti_s
,
7541 .par
= (const uint32_t[]){true, true, false},
7542 .op_flags
= XTENSA_OP_STORE
,
7546 .translate
= translate_ldsti_s
,
7547 .par
= (const uint32_t[]){true, false, true},
7548 .op_flags
= XTENSA_OP_STORE
,
7552 .translate
= translate_ldsti_s
,
7553 .par
= (const uint32_t[]){true, true, true},
7554 .op_flags
= XTENSA_OP_STORE
,
7558 .translate
= translate_ldstx_s
,
7559 .par
= (const uint32_t[]){true, true, false},
7560 .op_flags
= XTENSA_OP_STORE
,
7564 .translate
= translate_ldstx_s
,
7565 .par
= (const uint32_t[]){true, false, true},
7566 .op_flags
= XTENSA_OP_STORE
,
7570 .translate
= translate_ldstx_s
,
7571 .par
= (const uint32_t[]){true, true, true},
7572 .op_flags
= XTENSA_OP_STORE
,
7576 .translate
= translate_sub_d
,
7580 .translate
= translate_sub_s
,
7584 .translate
= translate_ftoi_d
,
7585 .par
= (const uint32_t[]){float_round_to_zero
, false},
7589 .translate
= translate_ftoi_s
,
7590 .par
= (const uint32_t[]){float_round_to_zero
, false},
7594 .translate
= translate_compare_d
,
7595 .par
= (const uint32_t[]){COMPARE_UEQ
},
7599 .translate
= translate_compare_s
,
7600 .par
= (const uint32_t[]){COMPARE_UEQ
},
7604 .translate
= translate_float_d
,
7605 .par
= (const uint32_t[]){true},
7609 .translate
= translate_float_s
,
7610 .par
= (const uint32_t[]){true},
7614 .translate
= translate_compare_d
,
7615 .par
= (const uint32_t[]){COMPARE_ULE
},
7619 .translate
= translate_compare_s
,
7620 .par
= (const uint32_t[]){COMPARE_ULE
},
7624 .translate
= translate_compare_d
,
7625 .par
= (const uint32_t[]){COMPARE_ULT
},
7629 .translate
= translate_compare_s
,
7630 .par
= (const uint32_t[]){COMPARE_ULT
},
7634 .translate
= translate_compare_d
,
7635 .par
= (const uint32_t[]){COMPARE_UN
},
7639 .translate
= translate_compare_s
,
7640 .par
= (const uint32_t[]){COMPARE_UN
},
7644 .translate
= translate_ftoi_d
,
7645 .par
= (const uint32_t[]){float_round_to_zero
, true},
7649 .translate
= translate_ftoi_s
,
7650 .par
= (const uint32_t[]){float_round_to_zero
, true},
7654 .translate
= translate_wfr_s
,
7658 .translate
= translate_wfr_d
,
7662 .translate
= translate_wur_fpu_fcr
,
7663 .par
= (const uint32_t[]){FCR
},
7667 .translate
= translate_wur_fpu_fsr
,
7672 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7673 .num_opcodes
= ARRAY_SIZE(fpu_ops
),