1 /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 /* Instruction building/extraction support for mep. -*- C -*-
4 THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
5 - the resultant file is machine generated, cgen-ibld.in isn't
7 Copyright (C) 1996-2023 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
16 It is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
36 #include "cgen/basic-modes.h"
38 #include "safe-ctype.h"
41 #define min(a,b) ((a) < (b) ? (a) : (b))
43 #define max(a,b) ((a) > (b) ? (a) : (b))
45 /* Used by the ifield rtx function. */
46 #define FLD(f) (fields->f)
48 static const char * insert_normal
49 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
50 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
51 static const char * insert_insn_normal
52 (CGEN_CPU_DESC
, const CGEN_INSN
*,
53 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
54 static int extract_normal
55 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
56 unsigned int, unsigned int, unsigned int, unsigned int,
57 unsigned int, unsigned int, bfd_vma
, long *);
58 static int extract_insn_normal
59 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
60 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
62 static void put_insn_int_value
63 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
66 static CGEN_INLINE
void insert_1
67 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
68 static CGEN_INLINE
int fill_cache
69 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
70 static CGEN_INLINE
long extract_1
71 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
74 /* Operand insertion. */
78 /* Subroutine of insert_normal. */
80 static CGEN_INLINE
void
81 insert_1 (CGEN_CPU_DESC cd
,
88 unsigned long x
, mask
;
91 x
= cgen_get_insn_value (cd
, bufp
, word_length
, cd
->endian
);
93 /* Written this way to avoid undefined behaviour. */
94 mask
= (1UL << (length
- 1) << 1) - 1;
96 shift
= (start
+ 1) - length
;
98 shift
= (word_length
- (start
+ length
));
99 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
101 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
, cd
->endian
);
104 #endif /* ! CGEN_INT_INSN_P */
106 /* Default insertion routine.
108 ATTRS is a mask of the boolean attributes.
109 WORD_OFFSET is the offset in bits from the start of the insn of the value.
110 WORD_LENGTH is the length of the word in bits in which the value resides.
111 START is the starting bit number in the word, architecture origin.
112 LENGTH is the length of VALUE in bits.
113 TOTAL_LENGTH is the total length of the insn in bits.
115 The result is an error message or NULL if success. */
117 /* ??? This duplicates functionality with bfd's howto table and
118 bfd_install_relocation. */
119 /* ??? This doesn't handle bfd_vma's. Create another function when
123 insert_normal (CGEN_CPU_DESC cd
,
126 unsigned int word_offset
,
129 unsigned int word_length
,
130 unsigned int total_length
,
131 CGEN_INSN_BYTES_PTR buffer
)
133 static char errbuf
[100];
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
140 /* Written this way to avoid undefined behaviour. */
141 mask
= (1UL << (length
- 1) << 1) - 1;
143 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
146 /* For architectures with insns smaller than the base-insn-bitsize,
147 word_length may be too big. */
148 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
151 && word_length
> total_length
)
152 word_length
= total_length
;
155 /* Ensure VALUE will fit. */
156 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
158 long minval
= - (1UL << (length
- 1));
159 unsigned long maxval
= mask
;
161 if ((value
> 0 && (unsigned long) value
> maxval
)
164 /* xgettext:c-format */
166 _("operand out of range (%ld not between %ld and %lu)"),
167 value
, minval
, maxval
);
171 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
173 unsigned long maxval
= mask
;
174 unsigned long val
= (unsigned long) value
;
176 /* For hosts with a word size > 32 check to see if value has been sign
177 extended beyond 32 bits. If so then ignore these higher sign bits
178 as the user is attempting to store a 32-bit signed value into an
179 unsigned 32-bit field which is allowed. */
180 if (sizeof (unsigned long) > 4 && ((value
>> 32) == -1))
185 /* xgettext:c-format */
187 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
194 if (! cgen_signed_overflow_ok_p (cd
))
196 long minval
= - (1UL << (length
- 1));
197 long maxval
= (1UL << (length
- 1)) - 1;
199 if (value
< minval
|| value
> maxval
)
202 /* xgettext:c-format */
203 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
204 value
, minval
, maxval
);
213 int shift_within_word
, shift_to_word
, shift
;
215 /* How to shift the value to BIT0 of the word. */
216 shift_to_word
= total_length
- (word_offset
+ word_length
);
218 /* How to shift the value to the field within the word. */
219 if (CGEN_INSN_LSB0_P
)
220 shift_within_word
= start
+ 1 - length
;
222 shift_within_word
= word_length
- start
- length
;
224 /* The total SHIFT, then mask in the value. */
225 shift
= shift_to_word
+ shift_within_word
;
226 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
229 #else /* ! CGEN_INT_INSN_P */
232 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
234 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
237 #endif /* ! CGEN_INT_INSN_P */
242 /* Default insn builder (insert handler).
243 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
244 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
245 recorded in host byte order, otherwise BUFFER is an array of bytes
246 and the value is recorded in target byte order).
247 The result is an error message or NULL if success. */
250 insert_insn_normal (CGEN_CPU_DESC cd
,
251 const CGEN_INSN
* insn
,
252 CGEN_FIELDS
* fields
,
253 CGEN_INSN_BYTES_PTR buffer
,
256 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
258 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
260 CGEN_INIT_INSERT (cd
);
261 value
= CGEN_INSN_BASE_VALUE (insn
);
263 /* If we're recording insns as numbers (rather than a string of bytes),
264 target byte order handling is deferred until later. */
268 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
269 CGEN_FIELDS_BITSIZE (fields
), value
);
273 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
274 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
275 value
, cd
->insn_endian
);
277 #endif /* ! CGEN_INT_INSN_P */
279 /* ??? It would be better to scan the format's fields.
280 Still need to be able to insert a value based on the operand though;
281 e.g. storing a branch displacement that got resolved later.
282 Needs more thought first. */
284 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
288 if (CGEN_SYNTAX_CHAR_P (* syn
))
291 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
301 /* Cover function to store an insn value into an integral insn. Must go here
302 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
305 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
306 CGEN_INSN_BYTES_PTR buf
,
311 /* For architectures with insns smaller than the base-insn-bitsize,
312 length may be too big. */
313 if (length
> insn_length
)
317 int shift
= insn_length
- length
;
318 /* Written this way to avoid undefined behaviour. */
319 CGEN_INSN_INT mask
= length
== 0 ? 0 : (1UL << (length
- 1) << 1) - 1;
321 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
326 /* Operand extraction. */
328 #if ! CGEN_INT_INSN_P
330 /* Subroutine of extract_normal.
331 Ensure sufficient bytes are cached in EX_INFO.
332 OFFSET is the offset in bytes from the start of the insn of the value.
333 BYTES is the length of the needed value.
334 Returns 1 for success, 0 for failure. */
336 static CGEN_INLINE
int
337 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
338 CGEN_EXTRACT_INFO
*ex_info
,
343 /* It's doubtful that the middle part has already been fetched so
344 we don't optimize that case. kiss. */
346 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
348 /* First do a quick check. */
349 mask
= (1 << bytes
) - 1;
350 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
353 /* Search for the first byte we need to read. */
354 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
355 if (! (mask
& ex_info
->valid
))
363 status
= (*info
->read_memory_func
)
364 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
368 (*info
->memory_error_func
) (status
, pc
, info
);
372 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
378 /* Subroutine of extract_normal. */
380 static CGEN_INLINE
long
381 extract_1 (CGEN_CPU_DESC cd
,
382 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
387 bfd_vma pc ATTRIBUTE_UNUSED
)
392 x
= cgen_get_insn_value (cd
, bufp
, word_length
, cd
->endian
);
394 if (CGEN_INSN_LSB0_P
)
395 shift
= (start
+ 1) - length
;
397 shift
= (word_length
- (start
+ length
));
401 #endif /* ! CGEN_INT_INSN_P */
403 /* Default extraction routine.
405 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
406 or sometimes less for cases like the m32r where the base insn size is 32
407 but some insns are 16 bits.
408 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
409 but for generality we take a bitmask of all of them.
410 WORD_OFFSET is the offset in bits from the start of the insn of the value.
411 WORD_LENGTH is the length of the word in bits in which the value resides.
412 START is the starting bit number in the word, architecture origin.
413 LENGTH is the length of VALUE in bits.
414 TOTAL_LENGTH is the total length of the insn in bits.
416 Returns 1 for success, 0 for failure. */
418 /* ??? The return code isn't properly used. wip. */
420 /* ??? This doesn't handle bfd_vma's. Create another function when
424 extract_normal (CGEN_CPU_DESC cd
,
425 #if ! CGEN_INT_INSN_P
426 CGEN_EXTRACT_INFO
*ex_info
,
428 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
430 CGEN_INSN_INT insn_value
,
432 unsigned int word_offset
,
435 unsigned int word_length
,
436 unsigned int total_length
,
437 #if ! CGEN_INT_INSN_P
440 bfd_vma pc ATTRIBUTE_UNUSED
,
446 /* If LENGTH is zero, this operand doesn't contribute to the value
447 so give it a standard value of zero. */
454 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
457 /* For architectures with insns smaller than the insn-base-bitsize,
458 word_length may be too big. */
459 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
461 if (word_offset
+ word_length
> total_length
)
462 word_length
= total_length
- word_offset
;
465 /* Does the value reside in INSN_VALUE, and at the right alignment? */
467 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
469 if (CGEN_INSN_LSB0_P
)
470 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
472 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
475 #if ! CGEN_INT_INSN_P
479 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
481 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
484 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
490 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
493 #endif /* ! CGEN_INT_INSN_P */
495 /* Written this way to avoid undefined behaviour. */
496 mask
= (1UL << (length
- 1) << 1) - 1;
500 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
501 && (value
& (1UL << (length
- 1))))
509 /* Default insn extractor.
511 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
512 The extracted fields are stored in FIELDS.
513 EX_INFO is used to handle reading variable length insns.
514 Return the length of the insn in bits, or 0 if no match,
515 or -1 if an error occurs fetching data (memory_error_func will have
519 extract_insn_normal (CGEN_CPU_DESC cd
,
520 const CGEN_INSN
*insn
,
521 CGEN_EXTRACT_INFO
*ex_info
,
522 CGEN_INSN_INT insn_value
,
526 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
527 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
529 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
531 CGEN_INIT_EXTRACT (cd
);
533 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
537 if (CGEN_SYNTAX_CHAR_P (*syn
))
540 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
541 ex_info
, insn_value
, fields
, pc
);
546 /* We recognized and successfully extracted this insn. */
547 return CGEN_INSN_BITSIZE (insn
);
550 /* Machine generated code added here. */
552 const char * mep_cgen_insert_operand
553 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
555 /* Main entry point for operand insertion.
557 This function is basically just a big switch statement. Earlier versions
558 used tables to look up the function to use, but
559 - if the table contains both assembler and disassembler functions then
560 the disassembler contains much of the assembler and vice-versa,
561 - there's a lot of inlining possibilities as things grow,
562 - using a switch statement avoids the function call overhead.
564 This function could be moved into `parse_insn_normal', but keeping it
565 separate makes clear the interface between `parse_insn_normal' and each of
566 the handlers. It's also needed by GAS to insert operands that couldn't be
567 resolved during parsing. */
570 mep_cgen_insert_operand (CGEN_CPU_DESC cd
,
572 CGEN_FIELDS
* fields
,
573 CGEN_INSN_BYTES_PTR buffer
,
574 bfd_vma pc ATTRIBUTE_UNUSED
)
576 const char * errmsg
= NULL
;
577 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
581 case MEP_OPERAND_ADDR24A4
:
584 FLD (f_24u8a4n_hi
) = ((UINT
) (FLD (f_24u8a4n
)) >> (8));
585 FLD (f_24u8a4n_lo
) = ((UINT
) (((FLD (f_24u8a4n
)) & (252))) >> (2));
587 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
590 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_lo
, 0, 0, 8, 6, 32, total_length
, buffer
);
595 case MEP_OPERAND_C5RMUIMM20
:
598 FLD (f_c5_rm
) = ((UINT
) (FLD (f_c5_rmuimm20
)) >> (16));
599 FLD (f_c5_16u16
) = ((FLD (f_c5_rmuimm20
)) & (65535));
601 errmsg
= insert_normal (cd
, fields
->f_c5_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
604 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
609 case MEP_OPERAND_C5RNMUIMM24
:
612 FLD (f_c5_rnm
) = ((UINT
) (FLD (f_c5_rnmuimm24
)) >> (16));
613 FLD (f_c5_16u16
) = ((FLD (f_c5_rnmuimm24
)) & (65535));
615 errmsg
= insert_normal (cd
, fields
->f_c5_rnm
, 0, 0, 4, 8, 32, total_length
, buffer
);
618 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
623 case MEP_OPERAND_CALLNUM
:
626 FLD (f_5
) = ((((UINT
) (FLD (f_callnum
)) >> (3))) & (1));
627 FLD (f_6
) = ((((UINT
) (FLD (f_callnum
)) >> (2))) & (1));
628 FLD (f_7
) = ((((UINT
) (FLD (f_callnum
)) >> (1))) & (1));
629 FLD (f_11
) = ((FLD (f_callnum
)) & (1));
631 errmsg
= insert_normal (cd
, fields
->f_5
, 0, 0, 5, 1, 32, total_length
, buffer
);
634 errmsg
= insert_normal (cd
, fields
->f_6
, 0, 0, 6, 1, 32, total_length
, buffer
);
637 errmsg
= insert_normal (cd
, fields
->f_7
, 0, 0, 7, 1, 32, total_length
, buffer
);
640 errmsg
= insert_normal (cd
, fields
->f_11
, 0, 0, 11, 1, 32, total_length
, buffer
);
645 case MEP_OPERAND_CCCC
:
646 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
648 case MEP_OPERAND_CCRN
:
651 FLD (f_ccrn_hi
) = ((((UINT
) (FLD (f_ccrn
)) >> (4))) & (3));
652 FLD (f_ccrn_lo
) = ((FLD (f_ccrn
)) & (15));
654 errmsg
= insert_normal (cd
, fields
->f_ccrn_hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
657 errmsg
= insert_normal (cd
, fields
->f_ccrn_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
662 case MEP_OPERAND_CDISP10
:
664 long value
= fields
->f_cdisp10
;
665 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
666 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
669 case MEP_OPERAND_CDISP10A2
:
671 long value
= fields
->f_cdisp10
;
672 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
673 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
676 case MEP_OPERAND_CDISP10A4
:
678 long value
= fields
->f_cdisp10
;
679 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
680 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
683 case MEP_OPERAND_CDISP10A8
:
685 long value
= fields
->f_cdisp10
;
686 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
687 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
690 case MEP_OPERAND_CDISP12
:
691 errmsg
= insert_normal (cd
, fields
->f_12s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, buffer
);
693 case MEP_OPERAND_CIMM4
:
694 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
696 case MEP_OPERAND_CIMM5
:
697 errmsg
= insert_normal (cd
, fields
->f_5u24
, 0, 0, 24, 5, 32, total_length
, buffer
);
699 case MEP_OPERAND_CODE16
:
700 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
702 case MEP_OPERAND_CODE24
:
705 FLD (f_24u4n_hi
) = ((UINT
) (FLD (f_24u4n
)) >> (16));
706 FLD (f_24u4n_lo
) = ((FLD (f_24u4n
)) & (65535));
708 errmsg
= insert_normal (cd
, fields
->f_24u4n_hi
, 0, 0, 4, 8, 32, total_length
, buffer
);
711 errmsg
= insert_normal (cd
, fields
->f_24u4n_lo
, 0, 0, 16, 16, 32, total_length
, buffer
);
716 case MEP_OPERAND_CP_FLAG
:
718 case MEP_OPERAND_CRN
:
719 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
721 case MEP_OPERAND_CRN64
:
722 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
724 case MEP_OPERAND_CRNX
:
727 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
728 FLD (f_crnx_hi
) = ((UINT
) (FLD (f_crnx
)) >> (4));
730 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
733 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
738 case MEP_OPERAND_CRNX64
:
741 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
742 FLD (f_crnx_hi
) = ((UINT
) (FLD (f_crnx
)) >> (4));
744 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
747 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
752 case MEP_OPERAND_CROC
:
753 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
755 case MEP_OPERAND_CROP
:
756 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
758 case MEP_OPERAND_CRPC
:
759 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u26
, 0, 0, 26, 5, 32, total_length
, buffer
);
761 case MEP_OPERAND_CRPP
:
762 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u18
, 0, 0, 18, 5, 32, total_length
, buffer
);
764 case MEP_OPERAND_CRQC
:
765 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u21
, 0, 0, 21, 5, 32, total_length
, buffer
);
767 case MEP_OPERAND_CRQP
:
768 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u13
, 0, 0, 13, 5, 32, total_length
, buffer
);
770 case MEP_OPERAND_CSRN
:
773 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
774 FLD (f_csrn_hi
) = ((UINT
) (FLD (f_csrn
)) >> (4));
776 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
779 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
784 case MEP_OPERAND_CSRN_IDX
:
787 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
788 FLD (f_csrn_hi
) = ((UINT
) (FLD (f_csrn
)) >> (4));
790 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
793 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
798 case MEP_OPERAND_DBG
:
800 case MEP_OPERAND_DEPC
:
802 case MEP_OPERAND_EPC
:
804 case MEP_OPERAND_EXC
:
806 case MEP_OPERAND_HI
:
808 case MEP_OPERAND_IMM16P0
:
811 FLD (f_ivc2_8u0
) = ((((UINT
) (FLD (f_ivc2_imm16p0
)) >> (8))) & (255));
812 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_imm16p0
)) & (255));
814 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
817 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
822 case MEP_OPERAND_IMM3P12
:
823 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u12
, 0, 0, 12, 3, 32, total_length
, buffer
);
825 case MEP_OPERAND_IMM3P25
:
826 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u25
, 0, 0, 25, 3, 32, total_length
, buffer
);
828 case MEP_OPERAND_IMM3P4
:
829 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u4
, 0, 0, 4, 3, 32, total_length
, buffer
);
831 case MEP_OPERAND_IMM3P5
:
832 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
834 case MEP_OPERAND_IMM3P9
:
835 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u9
, 0, 0, 9, 3, 32, total_length
, buffer
);
837 case MEP_OPERAND_IMM4P10
:
838 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u10
, 0, 0, 10, 4, 32, total_length
, buffer
);
840 case MEP_OPERAND_IMM4P4
:
841 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u4
, 0, 0, 4, 4, 32, total_length
, buffer
);
843 case MEP_OPERAND_IMM4P8
:
844 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
846 case MEP_OPERAND_IMM5P23
:
847 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
849 case MEP_OPERAND_IMM5P3
:
850 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u3
, 0, 0, 3, 5, 32, total_length
, buffer
);
852 case MEP_OPERAND_IMM5P7
:
853 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
855 case MEP_OPERAND_IMM5P8
:
856 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
858 case MEP_OPERAND_IMM6P2
:
859 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u2
, 0, 0, 2, 6, 32, total_length
, buffer
);
861 case MEP_OPERAND_IMM6P6
:
862 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u6
, 0, 0, 6, 6, 32, total_length
, buffer
);
864 case MEP_OPERAND_IMM8P0
:
865 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
867 case MEP_OPERAND_IMM8P20
:
868 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
870 case MEP_OPERAND_IMM8P4
:
871 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u4
, 0, 0, 4, 8, 32, total_length
, buffer
);
873 case MEP_OPERAND_IVC_X_0_2
:
874 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u0
, 0, 0, 0, 2, 32, total_length
, buffer
);
876 case MEP_OPERAND_IVC_X_0_3
:
877 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u0
, 0, 0, 0, 3, 32, total_length
, buffer
);
879 case MEP_OPERAND_IVC_X_0_4
:
880 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u0
, 0, 0, 0, 4, 32, total_length
, buffer
);
882 case MEP_OPERAND_IVC_X_0_5
:
883 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u0
, 0, 0, 0, 5, 32, total_length
, buffer
);
885 case MEP_OPERAND_IVC_X_6_1
:
886 errmsg
= insert_normal (cd
, fields
->f_ivc2_1u6
, 0, 0, 6, 1, 32, total_length
, buffer
);
888 case MEP_OPERAND_IVC_X_6_2
:
889 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
891 case MEP_OPERAND_IVC_X_6_3
:
892 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u6
, 0, 0, 6, 3, 32, total_length
, buffer
);
894 case MEP_OPERAND_IVC2_ACC0_0
:
896 case MEP_OPERAND_IVC2_ACC0_1
:
898 case MEP_OPERAND_IVC2_ACC0_2
:
900 case MEP_OPERAND_IVC2_ACC0_3
:
902 case MEP_OPERAND_IVC2_ACC0_4
:
904 case MEP_OPERAND_IVC2_ACC0_5
:
906 case MEP_OPERAND_IVC2_ACC0_6
:
908 case MEP_OPERAND_IVC2_ACC0_7
:
910 case MEP_OPERAND_IVC2_ACC1_0
:
912 case MEP_OPERAND_IVC2_ACC1_1
:
914 case MEP_OPERAND_IVC2_ACC1_2
:
916 case MEP_OPERAND_IVC2_ACC1_3
:
918 case MEP_OPERAND_IVC2_ACC1_4
:
920 case MEP_OPERAND_IVC2_ACC1_5
:
922 case MEP_OPERAND_IVC2_ACC1_6
:
924 case MEP_OPERAND_IVC2_ACC1_7
:
926 case MEP_OPERAND_IVC2_CC
:
928 case MEP_OPERAND_IVC2_COFA0
:
930 case MEP_OPERAND_IVC2_COFA1
:
932 case MEP_OPERAND_IVC2_COFR0
:
934 case MEP_OPERAND_IVC2_COFR1
:
936 case MEP_OPERAND_IVC2_CSAR0
:
938 case MEP_OPERAND_IVC2_CSAR1
:
940 case MEP_OPERAND_IVC2C3CCRN
:
943 FLD (f_ivc2_ccrn_c3hi
) = ((((UINT
) (FLD (f_ivc2_ccrn_c3
)) >> (4))) & (3));
944 FLD (f_ivc2_ccrn_c3lo
) = ((FLD (f_ivc2_ccrn_c3
)) & (15));
946 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
949 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
954 case MEP_OPERAND_IVC2CCRN
:
957 FLD (f_ivc2_ccrn_h2
) = ((((UINT
) (FLD (f_ivc2_ccrn
)) >> (4))) & (3));
958 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_ccrn
)) & (15));
960 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h2
, 0, 0, 20, 2, 32, total_length
, buffer
);
963 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
968 case MEP_OPERAND_IVC2CRN
:
971 FLD (f_ivc2_ccrn_h1
) = ((((UINT
) (FLD (f_ivc2_crnx
)) >> (4))) & (1));
972 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_crnx
)) & (15));
974 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h1
, 0, 0, 20, 1, 32, total_length
, buffer
);
977 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
982 case MEP_OPERAND_IVC2RM
:
983 errmsg
= insert_normal (cd
, fields
->f_ivc2_crm
, 0, 0, 4, 4, 32, total_length
, buffer
);
985 case MEP_OPERAND_LO
:
987 case MEP_OPERAND_LP
:
989 case MEP_OPERAND_MB0
:
991 case MEP_OPERAND_MB1
:
993 case MEP_OPERAND_ME0
:
995 case MEP_OPERAND_ME1
:
997 case MEP_OPERAND_NPC
:
999 case MEP_OPERAND_OPT
:
1001 case MEP_OPERAND_PCABS24A2
:
1004 FLD (f_24u5a2n_lo
) = ((UINT
) (((FLD (f_24u5a2n
)) & (255))) >> (1));
1005 FLD (f_24u5a2n_hi
) = ((UINT
) (FLD (f_24u5a2n
)) >> (8));
1007 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1010 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_lo
, 0, 0, 5, 7, 32, total_length
, buffer
);
1015 case MEP_OPERAND_PCREL12A2
:
1017 long value
= fields
->f_12s4a2
;
1018 value
= ((SI
) (((value
) - (pc
))) >> (1));
1019 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, buffer
);
1022 case MEP_OPERAND_PCREL17A2
:
1024 long value
= fields
->f_17s16a2
;
1025 value
= ((SI
) (((value
) - (pc
))) >> (1));
1026 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
1029 case MEP_OPERAND_PCREL24A2
:
1032 FLD (f_24s5a2n
) = ((FLD (f_24s5a2n
)) - (pc
));
1033 FLD (f_24s5a2n_lo
) = ((UINT
) (((FLD (f_24s5a2n
)) & (254))) >> (1));
1034 FLD (f_24s5a2n_hi
) = ((INT
) (FLD (f_24s5a2n
)) >> (8));
1036 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_hi
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
1039 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_lo
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, buffer
);
1044 case MEP_OPERAND_PCREL8A2
:
1046 long value
= fields
->f_8s8a2
;
1047 value
= ((SI
) (((value
) - (pc
))) >> (1));
1048 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, buffer
);
1051 case MEP_OPERAND_PSW
:
1053 case MEP_OPERAND_R0
:
1055 case MEP_OPERAND_R1
:
1057 case MEP_OPERAND_RL
:
1058 errmsg
= insert_normal (cd
, fields
->f_rl
, 0, 0, 12, 4, 32, total_length
, buffer
);
1060 case MEP_OPERAND_RL5
:
1061 errmsg
= insert_normal (cd
, fields
->f_rl5
, 0, 0, 20, 4, 32, total_length
, buffer
);
1063 case MEP_OPERAND_RM
:
1064 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1066 case MEP_OPERAND_RMA
:
1067 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1069 case MEP_OPERAND_RN
:
1070 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1072 case MEP_OPERAND_RN3
:
1073 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1075 case MEP_OPERAND_RN3C
:
1076 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1078 case MEP_OPERAND_RN3L
:
1079 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1081 case MEP_OPERAND_RN3S
:
1082 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1084 case MEP_OPERAND_RN3UC
:
1085 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1087 case MEP_OPERAND_RN3UL
:
1088 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1090 case MEP_OPERAND_RN3US
:
1091 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1093 case MEP_OPERAND_RNC
:
1094 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1096 case MEP_OPERAND_RNL
:
1097 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1099 case MEP_OPERAND_RNS
:
1100 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1102 case MEP_OPERAND_RNUC
:
1103 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1105 case MEP_OPERAND_RNUL
:
1106 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1108 case MEP_OPERAND_RNUS
:
1109 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1111 case MEP_OPERAND_SAR
:
1113 case MEP_OPERAND_SDISP16
:
1114 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1116 case MEP_OPERAND_SIMM16
:
1117 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1119 case MEP_OPERAND_SIMM16P0
:
1122 FLD (f_ivc2_8u0
) = ((((UINT
) (FLD (f_ivc2_simm16p0
)) >> (8))) & (255));
1123 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_simm16p0
)) & (255));
1125 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
1128 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
1133 case MEP_OPERAND_SIMM6
:
1134 errmsg
= insert_normal (cd
, fields
->f_6s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, buffer
);
1136 case MEP_OPERAND_SIMM8
:
1137 errmsg
= insert_normal (cd
, fields
->f_8s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, buffer
);
1139 case MEP_OPERAND_SIMM8P0
:
1140 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s0
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, buffer
);
1142 case MEP_OPERAND_SIMM8P20
:
1143 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, buffer
);
1145 case MEP_OPERAND_SIMM8P4
:
1146 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s4
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, buffer
);
1148 case MEP_OPERAND_SP
:
1150 case MEP_OPERAND_SPR
:
1152 case MEP_OPERAND_TP
:
1154 case MEP_OPERAND_TPR
:
1156 case MEP_OPERAND_UDISP2
:
1157 errmsg
= insert_normal (cd
, fields
->f_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
1159 case MEP_OPERAND_UDISP7
:
1160 errmsg
= insert_normal (cd
, fields
->f_7u9
, 0, 0, 9, 7, 32, total_length
, buffer
);
1162 case MEP_OPERAND_UDISP7A2
:
1164 long value
= fields
->f_7u9a2
;
1165 value
= ((USI
) (value
) >> (1));
1166 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 6, 32, total_length
, buffer
);
1169 case MEP_OPERAND_UDISP7A4
:
1171 long value
= fields
->f_7u9a4
;
1172 value
= ((USI
) (value
) >> (2));
1173 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1176 case MEP_OPERAND_UIMM16
:
1177 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
1179 case MEP_OPERAND_UIMM2
:
1180 errmsg
= insert_normal (cd
, fields
->f_2u10
, 0, 0, 10, 2, 32, total_length
, buffer
);
1182 case MEP_OPERAND_UIMM24
:
1185 FLD (f_24u8n_hi
) = ((UINT
) (FLD (f_24u8n
)) >> (8));
1186 FLD (f_24u8n_lo
) = ((FLD (f_24u8n
)) & (255));
1188 errmsg
= insert_normal (cd
, fields
->f_24u8n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1191 errmsg
= insert_normal (cd
, fields
->f_24u8n_lo
, 0, 0, 8, 8, 32, total_length
, buffer
);
1196 case MEP_OPERAND_UIMM3
:
1197 errmsg
= insert_normal (cd
, fields
->f_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
1199 case MEP_OPERAND_UIMM4
:
1200 errmsg
= insert_normal (cd
, fields
->f_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
1202 case MEP_OPERAND_UIMM5
:
1203 errmsg
= insert_normal (cd
, fields
->f_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
1205 case MEP_OPERAND_UIMM7A4
:
1207 long value
= fields
->f_7u9a4
;
1208 value
= ((USI
) (value
) >> (2));
1209 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1212 case MEP_OPERAND_ZERO
:
1216 /* xgettext:c-format */
1217 opcodes_error_handler
1218 (_("internal error: unrecognized field %d while building insn"),
1226 int mep_cgen_extract_operand
1227 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
1229 /* Main entry point for operand extraction.
1230 The result is <= 0 for error, >0 for success.
1231 ??? Actual values aren't well defined right now.
1233 This function is basically just a big switch statement. Earlier versions
1234 used tables to look up the function to use, but
1235 - if the table contains both assembler and disassembler functions then
1236 the disassembler contains much of the assembler and vice-versa,
1237 - there's a lot of inlining possibilities as things grow,
1238 - using a switch statement avoids the function call overhead.
1240 This function could be moved into `print_insn_normal', but keeping it
1241 separate makes clear the interface between `print_insn_normal' and each of
1245 mep_cgen_extract_operand (CGEN_CPU_DESC cd
,
1247 CGEN_EXTRACT_INFO
*ex_info
,
1248 CGEN_INSN_INT insn_value
,
1249 CGEN_FIELDS
* fields
,
1252 /* Assume success (for those operands that are nops). */
1254 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
1258 case MEP_OPERAND_ADDR24A4
:
1260 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8a4n_hi
);
1261 if (length
<= 0) break;
1262 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 6, 32, total_length
, pc
, & fields
->f_24u8a4n_lo
);
1263 if (length
<= 0) break;
1264 FLD (f_24u8a4n
) = ((((FLD (f_24u8a4n_hi
)) << (8))) | (((FLD (f_24u8a4n_lo
)) << (2))));
1267 case MEP_OPERAND_C5RMUIMM20
:
1269 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_c5_rm
);
1270 if (length
<= 0) break;
1271 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1272 if (length
<= 0) break;
1274 FLD (f_c5_rmuimm20
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rm
)) << (16))));
1278 case MEP_OPERAND_C5RNMUIMM24
:
1280 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_c5_rnm
);
1281 if (length
<= 0) break;
1282 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1283 if (length
<= 0) break;
1285 FLD (f_c5_rnmuimm24
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rnm
)) << (16))));
1289 case MEP_OPERAND_CALLNUM
:
1291 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_5
);
1292 if (length
<= 0) break;
1293 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_6
);
1294 if (length
<= 0) break;
1295 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 1, 32, total_length
, pc
, & fields
->f_7
);
1296 if (length
<= 0) break;
1297 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_11
);
1298 if (length
<= 0) break;
1299 FLD (f_callnum
) = ((((FLD (f_5
)) << (3))) | (((((FLD (f_6
)) << (2))) | (((((FLD (f_7
)) << (1))) | (FLD (f_11
)))))));
1302 case MEP_OPERAND_CCCC
:
1303 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1305 case MEP_OPERAND_CCRN
:
1307 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ccrn_hi
);
1308 if (length
<= 0) break;
1309 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ccrn_lo
);
1310 if (length
<= 0) break;
1311 FLD (f_ccrn
) = ((((FLD (f_ccrn_hi
)) << (4))) | (FLD (f_ccrn_lo
)));
1314 case MEP_OPERAND_CDISP10
:
1317 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1318 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1319 fields
->f_cdisp10
= value
;
1322 case MEP_OPERAND_CDISP10A2
:
1325 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1326 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1327 fields
->f_cdisp10
= value
;
1330 case MEP_OPERAND_CDISP10A4
:
1333 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1334 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1335 fields
->f_cdisp10
= value
;
1338 case MEP_OPERAND_CDISP10A8
:
1341 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1342 value
= (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (512))) ? (((((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023))) - (1024))) : (((((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) & (512))) ? ((((((value
) & (128))) ? (((value
) ^ (768))) : (value
)) - (1024))) : ((((value
) & (128))) ? (((value
) ^ (768))) : (value
))) & (1023)));
1343 fields
->f_cdisp10
= value
;
1346 case MEP_OPERAND_CDISP12
:
1347 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, pc
, & fields
->f_12s20
);
1349 case MEP_OPERAND_CIMM4
:
1350 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1352 case MEP_OPERAND_CIMM5
:
1353 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 5, 32, total_length
, pc
, & fields
->f_5u24
);
1355 case MEP_OPERAND_CODE16
:
1356 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1358 case MEP_OPERAND_CODE24
:
1360 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_24u4n_hi
);
1361 if (length
<= 0) break;
1362 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u4n_lo
);
1363 if (length
<= 0) break;
1364 FLD (f_24u4n
) = ((((FLD (f_24u4n_hi
)) << (16))) | (FLD (f_24u4n_lo
)));
1367 case MEP_OPERAND_CP_FLAG
:
1369 case MEP_OPERAND_CRN
:
1370 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1372 case MEP_OPERAND_CRN64
:
1373 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1375 case MEP_OPERAND_CRNX
:
1377 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1378 if (length
<= 0) break;
1379 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1380 if (length
<= 0) break;
1381 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1384 case MEP_OPERAND_CRNX64
:
1386 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1387 if (length
<= 0) break;
1388 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1389 if (length
<= 0) break;
1390 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1393 case MEP_OPERAND_CROC
:
1394 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1396 case MEP_OPERAND_CROP
:
1397 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1399 case MEP_OPERAND_CRPC
:
1400 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u26
);
1402 case MEP_OPERAND_CRPP
:
1403 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u18
);
1405 case MEP_OPERAND_CRQC
:
1406 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u21
);
1408 case MEP_OPERAND_CRQP
:
1409 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u13
);
1411 case MEP_OPERAND_CSRN
:
1413 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1414 if (length
<= 0) break;
1415 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1416 if (length
<= 0) break;
1417 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1420 case MEP_OPERAND_CSRN_IDX
:
1422 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1423 if (length
<= 0) break;
1424 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1425 if (length
<= 0) break;
1426 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1429 case MEP_OPERAND_DBG
:
1431 case MEP_OPERAND_DEPC
:
1433 case MEP_OPERAND_EPC
:
1435 case MEP_OPERAND_EXC
:
1437 case MEP_OPERAND_HI
:
1439 case MEP_OPERAND_IMM16P0
:
1441 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1442 if (length
<= 0) break;
1443 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1444 if (length
<= 0) break;
1446 FLD (f_ivc2_imm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1450 case MEP_OPERAND_IMM3P12
:
1451 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u12
);
1453 case MEP_OPERAND_IMM3P25
:
1454 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u25
);
1456 case MEP_OPERAND_IMM3P4
:
1457 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u4
);
1459 case MEP_OPERAND_IMM3P5
:
1460 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u5
);
1462 case MEP_OPERAND_IMM3P9
:
1463 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u9
);
1465 case MEP_OPERAND_IMM4P10
:
1466 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u10
);
1468 case MEP_OPERAND_IMM4P4
:
1469 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u4
);
1471 case MEP_OPERAND_IMM4P8
:
1472 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u8
);
1474 case MEP_OPERAND_IMM5P23
:
1475 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1477 case MEP_OPERAND_IMM5P3
:
1478 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u3
);
1480 case MEP_OPERAND_IMM5P7
:
1481 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1483 case MEP_OPERAND_IMM5P8
:
1484 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u8
);
1486 case MEP_OPERAND_IMM6P2
:
1487 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u2
);
1489 case MEP_OPERAND_IMM6P6
:
1490 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u6
);
1492 case MEP_OPERAND_IMM8P0
:
1493 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1495 case MEP_OPERAND_IMM8P20
:
1496 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1498 case MEP_OPERAND_IMM8P4
:
1499 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u4
);
1501 case MEP_OPERAND_IVC_X_0_2
:
1502 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u0
);
1504 case MEP_OPERAND_IVC_X_0_3
:
1505 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u0
);
1507 case MEP_OPERAND_IVC_X_0_4
:
1508 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u0
);
1510 case MEP_OPERAND_IVC_X_0_5
:
1511 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u0
);
1513 case MEP_OPERAND_IVC_X_6_1
:
1514 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_ivc2_1u6
);
1516 case MEP_OPERAND_IVC_X_6_2
:
1517 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u6
);
1519 case MEP_OPERAND_IVC_X_6_3
:
1520 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u6
);
1522 case MEP_OPERAND_IVC2_ACC0_0
:
1524 case MEP_OPERAND_IVC2_ACC0_1
:
1526 case MEP_OPERAND_IVC2_ACC0_2
:
1528 case MEP_OPERAND_IVC2_ACC0_3
:
1530 case MEP_OPERAND_IVC2_ACC0_4
:
1532 case MEP_OPERAND_IVC2_ACC0_5
:
1534 case MEP_OPERAND_IVC2_ACC0_6
:
1536 case MEP_OPERAND_IVC2_ACC0_7
:
1538 case MEP_OPERAND_IVC2_ACC1_0
:
1540 case MEP_OPERAND_IVC2_ACC1_1
:
1542 case MEP_OPERAND_IVC2_ACC1_2
:
1544 case MEP_OPERAND_IVC2_ACC1_3
:
1546 case MEP_OPERAND_IVC2_ACC1_4
:
1548 case MEP_OPERAND_IVC2_ACC1_5
:
1550 case MEP_OPERAND_IVC2_ACC1_6
:
1552 case MEP_OPERAND_IVC2_ACC1_7
:
1554 case MEP_OPERAND_IVC2_CC
:
1556 case MEP_OPERAND_IVC2_COFA0
:
1558 case MEP_OPERAND_IVC2_COFA1
:
1560 case MEP_OPERAND_IVC2_COFR0
:
1562 case MEP_OPERAND_IVC2_COFR1
:
1564 case MEP_OPERAND_IVC2_CSAR0
:
1566 case MEP_OPERAND_IVC2_CSAR1
:
1568 case MEP_OPERAND_IVC2C3CCRN
:
1570 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3hi
);
1571 if (length
<= 0) break;
1572 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3lo
);
1573 if (length
<= 0) break;
1574 FLD (f_ivc2_ccrn_c3
) = ((((FLD (f_ivc2_ccrn_c3hi
)) << (4))) | (FLD (f_ivc2_ccrn_c3lo
)));
1577 case MEP_OPERAND_IVC2CCRN
:
1579 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h2
);
1580 if (length
<= 0) break;
1581 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1582 if (length
<= 0) break;
1583 FLD (f_ivc2_ccrn
) = ((((FLD (f_ivc2_ccrn_h2
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1586 case MEP_OPERAND_IVC2CRN
:
1588 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h1
);
1589 if (length
<= 0) break;
1590 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1591 if (length
<= 0) break;
1592 FLD (f_ivc2_crnx
) = ((((FLD (f_ivc2_ccrn_h1
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1595 case MEP_OPERAND_IVC2RM
:
1596 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_crm
);
1598 case MEP_OPERAND_LO
:
1600 case MEP_OPERAND_LP
:
1602 case MEP_OPERAND_MB0
:
1604 case MEP_OPERAND_MB1
:
1606 case MEP_OPERAND_ME0
:
1608 case MEP_OPERAND_ME1
:
1610 case MEP_OPERAND_NPC
:
1612 case MEP_OPERAND_OPT
:
1614 case MEP_OPERAND_PCABS24A2
:
1616 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u5a2n_hi
);
1617 if (length
<= 0) break;
1618 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 7, 32, total_length
, pc
, & fields
->f_24u5a2n_lo
);
1619 if (length
<= 0) break;
1620 FLD (f_24u5a2n
) = ((((FLD (f_24u5a2n_hi
)) << (8))) | (((FLD (f_24u5a2n_lo
)) << (1))));
1623 case MEP_OPERAND_PCREL12A2
:
1626 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, pc
, & value
);
1627 value
= ((((value
) * (2))) + (pc
));
1628 fields
->f_12s4a2
= value
;
1631 case MEP_OPERAND_PCREL17A2
:
1634 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, pc
, & value
);
1635 value
= ((((value
) * (2))) + (pc
));
1636 fields
->f_17s16a2
= value
;
1639 case MEP_OPERAND_PCREL24A2
:
1641 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_24s5a2n_hi
);
1642 if (length
<= 0) break;
1643 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, pc
, & fields
->f_24s5a2n_lo
);
1644 if (length
<= 0) break;
1645 FLD (f_24s5a2n
) = ((((((FLD (f_24s5a2n_hi
)) * (256))) | (((FLD (f_24s5a2n_lo
)) << (1))))) + (pc
));
1648 case MEP_OPERAND_PCREL8A2
:
1651 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, pc
, & value
);
1652 value
= ((((value
) * (2))) + (pc
));
1653 fields
->f_8s8a2
= value
;
1656 case MEP_OPERAND_PSW
:
1658 case MEP_OPERAND_R0
:
1660 case MEP_OPERAND_R1
:
1662 case MEP_OPERAND_RL
:
1663 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 4, 32, total_length
, pc
, & fields
->f_rl
);
1665 case MEP_OPERAND_RL5
:
1666 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 4, 32, total_length
, pc
, & fields
->f_rl5
);
1668 case MEP_OPERAND_RM
:
1669 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1671 case MEP_OPERAND_RMA
:
1672 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1674 case MEP_OPERAND_RN
:
1675 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1677 case MEP_OPERAND_RN3
:
1678 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1680 case MEP_OPERAND_RN3C
:
1681 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1683 case MEP_OPERAND_RN3L
:
1684 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1686 case MEP_OPERAND_RN3S
:
1687 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1689 case MEP_OPERAND_RN3UC
:
1690 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1692 case MEP_OPERAND_RN3UL
:
1693 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1695 case MEP_OPERAND_RN3US
:
1696 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1698 case MEP_OPERAND_RNC
:
1699 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1701 case MEP_OPERAND_RNL
:
1702 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1704 case MEP_OPERAND_RNS
:
1705 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1707 case MEP_OPERAND_RNUC
:
1708 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1710 case MEP_OPERAND_RNUL
:
1711 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1713 case MEP_OPERAND_RNUS
:
1714 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1716 case MEP_OPERAND_SAR
:
1718 case MEP_OPERAND_SDISP16
:
1719 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1721 case MEP_OPERAND_SIMM16
:
1722 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1724 case MEP_OPERAND_SIMM16P0
:
1726 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1727 if (length
<= 0) break;
1728 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1729 if (length
<= 0) break;
1731 FLD (f_ivc2_simm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1735 case MEP_OPERAND_SIMM6
:
1736 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, pc
, & fields
->f_6s8
);
1738 case MEP_OPERAND_SIMM8
:
1739 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, pc
, & fields
->f_8s8
);
1741 case MEP_OPERAND_SIMM8P0
:
1742 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s0
);
1744 case MEP_OPERAND_SIMM8P20
:
1745 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s20
);
1747 case MEP_OPERAND_SIMM8P4
:
1748 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s4
);
1750 case MEP_OPERAND_SP
:
1752 case MEP_OPERAND_SPR
:
1754 case MEP_OPERAND_TP
:
1756 case MEP_OPERAND_TPR
:
1758 case MEP_OPERAND_UDISP2
:
1759 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_2u6
);
1761 case MEP_OPERAND_UDISP7
:
1762 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_7u9
);
1764 case MEP_OPERAND_UDISP7A2
:
1767 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 6, 32, total_length
, pc
, & value
);
1768 value
= ((value
) * (2));
1769 fields
->f_7u9a2
= value
;
1772 case MEP_OPERAND_UDISP7A4
:
1775 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1776 value
= ((value
) << (2));
1777 fields
->f_7u9a4
= value
;
1780 case MEP_OPERAND_UIMM16
:
1781 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1783 case MEP_OPERAND_UIMM2
:
1784 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 2, 32, total_length
, pc
, & fields
->f_2u10
);
1786 case MEP_OPERAND_UIMM24
:
1788 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8n_hi
);
1789 if (length
<= 0) break;
1790 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_24u8n_lo
);
1791 if (length
<= 0) break;
1792 FLD (f_24u8n
) = ((((FLD (f_24u8n_hi
)) << (8))) | (FLD (f_24u8n_lo
)));
1795 case MEP_OPERAND_UIMM3
:
1796 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_3u5
);
1798 case MEP_OPERAND_UIMM4
:
1799 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_4u8
);
1801 case MEP_OPERAND_UIMM5
:
1802 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_5u8
);
1804 case MEP_OPERAND_UIMM7A4
:
1807 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1808 value
= ((value
) << (2));
1809 fields
->f_7u9a4
= value
;
1812 case MEP_OPERAND_ZERO
:
1816 /* xgettext:c-format */
1817 opcodes_error_handler
1818 (_("internal error: unrecognized field %d while decoding insn"),
1826 cgen_insert_fn
* const mep_cgen_insert_handlers
[] =
1831 cgen_extract_fn
* const mep_cgen_extract_handlers
[] =
1833 extract_insn_normal
,
1836 int mep_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1837 bfd_vma
mep_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1839 /* Getting values from cgen_fields is handled by a collection of functions.
1840 They are distinguished by the type of the VALUE argument they return.
1841 TODO: floating point, inlining support, remove cases where result type
1845 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1847 const CGEN_FIELDS
* fields
)
1853 case MEP_OPERAND_ADDR24A4
:
1854 value
= fields
->f_24u8a4n
;
1856 case MEP_OPERAND_C5RMUIMM20
:
1857 value
= fields
->f_c5_rmuimm20
;
1859 case MEP_OPERAND_C5RNMUIMM24
:
1860 value
= fields
->f_c5_rnmuimm24
;
1862 case MEP_OPERAND_CALLNUM
:
1863 value
= fields
->f_callnum
;
1865 case MEP_OPERAND_CCCC
:
1866 value
= fields
->f_rm
;
1868 case MEP_OPERAND_CCRN
:
1869 value
= fields
->f_ccrn
;
1871 case MEP_OPERAND_CDISP10
:
1872 value
= fields
->f_cdisp10
;
1874 case MEP_OPERAND_CDISP10A2
:
1875 value
= fields
->f_cdisp10
;
1877 case MEP_OPERAND_CDISP10A4
:
1878 value
= fields
->f_cdisp10
;
1880 case MEP_OPERAND_CDISP10A8
:
1881 value
= fields
->f_cdisp10
;
1883 case MEP_OPERAND_CDISP12
:
1884 value
= fields
->f_12s20
;
1886 case MEP_OPERAND_CIMM4
:
1887 value
= fields
->f_rn
;
1889 case MEP_OPERAND_CIMM5
:
1890 value
= fields
->f_5u24
;
1892 case MEP_OPERAND_CODE16
:
1893 value
= fields
->f_16u16
;
1895 case MEP_OPERAND_CODE24
:
1896 value
= fields
->f_24u4n
;
1898 case MEP_OPERAND_CP_FLAG
:
1901 case MEP_OPERAND_CRN
:
1902 value
= fields
->f_crn
;
1904 case MEP_OPERAND_CRN64
:
1905 value
= fields
->f_crn
;
1907 case MEP_OPERAND_CRNX
:
1908 value
= fields
->f_crnx
;
1910 case MEP_OPERAND_CRNX64
:
1911 value
= fields
->f_crnx
;
1913 case MEP_OPERAND_CROC
:
1914 value
= fields
->f_ivc2_5u7
;
1916 case MEP_OPERAND_CROP
:
1917 value
= fields
->f_ivc2_5u23
;
1919 case MEP_OPERAND_CRPC
:
1920 value
= fields
->f_ivc2_5u26
;
1922 case MEP_OPERAND_CRPP
:
1923 value
= fields
->f_ivc2_5u18
;
1925 case MEP_OPERAND_CRQC
:
1926 value
= fields
->f_ivc2_5u21
;
1928 case MEP_OPERAND_CRQP
:
1929 value
= fields
->f_ivc2_5u13
;
1931 case MEP_OPERAND_CSRN
:
1932 value
= fields
->f_csrn
;
1934 case MEP_OPERAND_CSRN_IDX
:
1935 value
= fields
->f_csrn
;
1937 case MEP_OPERAND_DBG
:
1940 case MEP_OPERAND_DEPC
:
1943 case MEP_OPERAND_EPC
:
1946 case MEP_OPERAND_EXC
:
1949 case MEP_OPERAND_HI
:
1952 case MEP_OPERAND_IMM16P0
:
1953 value
= fields
->f_ivc2_imm16p0
;
1955 case MEP_OPERAND_IMM3P12
:
1956 value
= fields
->f_ivc2_3u12
;
1958 case MEP_OPERAND_IMM3P25
:
1959 value
= fields
->f_ivc2_3u25
;
1961 case MEP_OPERAND_IMM3P4
:
1962 value
= fields
->f_ivc2_3u4
;
1964 case MEP_OPERAND_IMM3P5
:
1965 value
= fields
->f_ivc2_3u5
;
1967 case MEP_OPERAND_IMM3P9
:
1968 value
= fields
->f_ivc2_3u9
;
1970 case MEP_OPERAND_IMM4P10
:
1971 value
= fields
->f_ivc2_4u10
;
1973 case MEP_OPERAND_IMM4P4
:
1974 value
= fields
->f_ivc2_4u4
;
1976 case MEP_OPERAND_IMM4P8
:
1977 value
= fields
->f_ivc2_4u8
;
1979 case MEP_OPERAND_IMM5P23
:
1980 value
= fields
->f_ivc2_5u23
;
1982 case MEP_OPERAND_IMM5P3
:
1983 value
= fields
->f_ivc2_5u3
;
1985 case MEP_OPERAND_IMM5P7
:
1986 value
= fields
->f_ivc2_5u7
;
1988 case MEP_OPERAND_IMM5P8
:
1989 value
= fields
->f_ivc2_5u8
;
1991 case MEP_OPERAND_IMM6P2
:
1992 value
= fields
->f_ivc2_6u2
;
1994 case MEP_OPERAND_IMM6P6
:
1995 value
= fields
->f_ivc2_6u6
;
1997 case MEP_OPERAND_IMM8P0
:
1998 value
= fields
->f_ivc2_8u0
;
2000 case MEP_OPERAND_IMM8P20
:
2001 value
= fields
->f_ivc2_8u20
;
2003 case MEP_OPERAND_IMM8P4
:
2004 value
= fields
->f_ivc2_8u4
;
2006 case MEP_OPERAND_IVC_X_0_2
:
2007 value
= fields
->f_ivc2_2u0
;
2009 case MEP_OPERAND_IVC_X_0_3
:
2010 value
= fields
->f_ivc2_3u0
;
2012 case MEP_OPERAND_IVC_X_0_4
:
2013 value
= fields
->f_ivc2_4u0
;
2015 case MEP_OPERAND_IVC_X_0_5
:
2016 value
= fields
->f_ivc2_5u0
;
2018 case MEP_OPERAND_IVC_X_6_1
:
2019 value
= fields
->f_ivc2_1u6
;
2021 case MEP_OPERAND_IVC_X_6_2
:
2022 value
= fields
->f_ivc2_2u6
;
2024 case MEP_OPERAND_IVC_X_6_3
:
2025 value
= fields
->f_ivc2_3u6
;
2027 case MEP_OPERAND_IVC2_ACC0_0
:
2030 case MEP_OPERAND_IVC2_ACC0_1
:
2033 case MEP_OPERAND_IVC2_ACC0_2
:
2036 case MEP_OPERAND_IVC2_ACC0_3
:
2039 case MEP_OPERAND_IVC2_ACC0_4
:
2042 case MEP_OPERAND_IVC2_ACC0_5
:
2045 case MEP_OPERAND_IVC2_ACC0_6
:
2048 case MEP_OPERAND_IVC2_ACC0_7
:
2051 case MEP_OPERAND_IVC2_ACC1_0
:
2054 case MEP_OPERAND_IVC2_ACC1_1
:
2057 case MEP_OPERAND_IVC2_ACC1_2
:
2060 case MEP_OPERAND_IVC2_ACC1_3
:
2063 case MEP_OPERAND_IVC2_ACC1_4
:
2066 case MEP_OPERAND_IVC2_ACC1_5
:
2069 case MEP_OPERAND_IVC2_ACC1_6
:
2072 case MEP_OPERAND_IVC2_ACC1_7
:
2075 case MEP_OPERAND_IVC2_CC
:
2078 case MEP_OPERAND_IVC2_COFA0
:
2081 case MEP_OPERAND_IVC2_COFA1
:
2084 case MEP_OPERAND_IVC2_COFR0
:
2087 case MEP_OPERAND_IVC2_COFR1
:
2090 case MEP_OPERAND_IVC2_CSAR0
:
2093 case MEP_OPERAND_IVC2_CSAR1
:
2096 case MEP_OPERAND_IVC2C3CCRN
:
2097 value
= fields
->f_ivc2_ccrn_c3
;
2099 case MEP_OPERAND_IVC2CCRN
:
2100 value
= fields
->f_ivc2_ccrn
;
2102 case MEP_OPERAND_IVC2CRN
:
2103 value
= fields
->f_ivc2_crnx
;
2105 case MEP_OPERAND_IVC2RM
:
2106 value
= fields
->f_ivc2_crm
;
2108 case MEP_OPERAND_LO
:
2111 case MEP_OPERAND_LP
:
2114 case MEP_OPERAND_MB0
:
2117 case MEP_OPERAND_MB1
:
2120 case MEP_OPERAND_ME0
:
2123 case MEP_OPERAND_ME1
:
2126 case MEP_OPERAND_NPC
:
2129 case MEP_OPERAND_OPT
:
2132 case MEP_OPERAND_PCABS24A2
:
2133 value
= fields
->f_24u5a2n
;
2135 case MEP_OPERAND_PCREL12A2
:
2136 value
= fields
->f_12s4a2
;
2138 case MEP_OPERAND_PCREL17A2
:
2139 value
= fields
->f_17s16a2
;
2141 case MEP_OPERAND_PCREL24A2
:
2142 value
= fields
->f_24s5a2n
;
2144 case MEP_OPERAND_PCREL8A2
:
2145 value
= fields
->f_8s8a2
;
2147 case MEP_OPERAND_PSW
:
2150 case MEP_OPERAND_R0
:
2153 case MEP_OPERAND_R1
:
2156 case MEP_OPERAND_RL
:
2157 value
= fields
->f_rl
;
2159 case MEP_OPERAND_RL5
:
2160 value
= fields
->f_rl5
;
2162 case MEP_OPERAND_RM
:
2163 value
= fields
->f_rm
;
2165 case MEP_OPERAND_RMA
:
2166 value
= fields
->f_rm
;
2168 case MEP_OPERAND_RN
:
2169 value
= fields
->f_rn
;
2171 case MEP_OPERAND_RN3
:
2172 value
= fields
->f_rn3
;
2174 case MEP_OPERAND_RN3C
:
2175 value
= fields
->f_rn3
;
2177 case MEP_OPERAND_RN3L
:
2178 value
= fields
->f_rn3
;
2180 case MEP_OPERAND_RN3S
:
2181 value
= fields
->f_rn3
;
2183 case MEP_OPERAND_RN3UC
:
2184 value
= fields
->f_rn3
;
2186 case MEP_OPERAND_RN3UL
:
2187 value
= fields
->f_rn3
;
2189 case MEP_OPERAND_RN3US
:
2190 value
= fields
->f_rn3
;
2192 case MEP_OPERAND_RNC
:
2193 value
= fields
->f_rn
;
2195 case MEP_OPERAND_RNL
:
2196 value
= fields
->f_rn
;
2198 case MEP_OPERAND_RNS
:
2199 value
= fields
->f_rn
;
2201 case MEP_OPERAND_RNUC
:
2202 value
= fields
->f_rn
;
2204 case MEP_OPERAND_RNUL
:
2205 value
= fields
->f_rn
;
2207 case MEP_OPERAND_RNUS
:
2208 value
= fields
->f_rn
;
2210 case MEP_OPERAND_SAR
:
2213 case MEP_OPERAND_SDISP16
:
2214 value
= fields
->f_16s16
;
2216 case MEP_OPERAND_SIMM16
:
2217 value
= fields
->f_16s16
;
2219 case MEP_OPERAND_SIMM16P0
:
2220 value
= fields
->f_ivc2_simm16p0
;
2222 case MEP_OPERAND_SIMM6
:
2223 value
= fields
->f_6s8
;
2225 case MEP_OPERAND_SIMM8
:
2226 value
= fields
->f_8s8
;
2228 case MEP_OPERAND_SIMM8P0
:
2229 value
= fields
->f_ivc2_8s0
;
2231 case MEP_OPERAND_SIMM8P20
:
2232 value
= fields
->f_ivc2_8s20
;
2234 case MEP_OPERAND_SIMM8P4
:
2235 value
= fields
->f_ivc2_8s4
;
2237 case MEP_OPERAND_SP
:
2240 case MEP_OPERAND_SPR
:
2243 case MEP_OPERAND_TP
:
2246 case MEP_OPERAND_TPR
:
2249 case MEP_OPERAND_UDISP2
:
2250 value
= fields
->f_2u6
;
2252 case MEP_OPERAND_UDISP7
:
2253 value
= fields
->f_7u9
;
2255 case MEP_OPERAND_UDISP7A2
:
2256 value
= fields
->f_7u9a2
;
2258 case MEP_OPERAND_UDISP7A4
:
2259 value
= fields
->f_7u9a4
;
2261 case MEP_OPERAND_UIMM16
:
2262 value
= fields
->f_16u16
;
2264 case MEP_OPERAND_UIMM2
:
2265 value
= fields
->f_2u10
;
2267 case MEP_OPERAND_UIMM24
:
2268 value
= fields
->f_24u8n
;
2270 case MEP_OPERAND_UIMM3
:
2271 value
= fields
->f_3u5
;
2273 case MEP_OPERAND_UIMM4
:
2274 value
= fields
->f_4u8
;
2276 case MEP_OPERAND_UIMM5
:
2277 value
= fields
->f_5u8
;
2279 case MEP_OPERAND_UIMM7A4
:
2280 value
= fields
->f_7u9a4
;
2282 case MEP_OPERAND_ZERO
:
2287 /* xgettext:c-format */
2288 opcodes_error_handler
2289 (_("internal error: unrecognized field %d while getting int operand"),
2298 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2300 const CGEN_FIELDS
* fields
)
2306 case MEP_OPERAND_ADDR24A4
:
2307 value
= fields
->f_24u8a4n
;
2309 case MEP_OPERAND_C5RMUIMM20
:
2310 value
= fields
->f_c5_rmuimm20
;
2312 case MEP_OPERAND_C5RNMUIMM24
:
2313 value
= fields
->f_c5_rnmuimm24
;
2315 case MEP_OPERAND_CALLNUM
:
2316 value
= fields
->f_callnum
;
2318 case MEP_OPERAND_CCCC
:
2319 value
= fields
->f_rm
;
2321 case MEP_OPERAND_CCRN
:
2322 value
= fields
->f_ccrn
;
2324 case MEP_OPERAND_CDISP10
:
2325 value
= fields
->f_cdisp10
;
2327 case MEP_OPERAND_CDISP10A2
:
2328 value
= fields
->f_cdisp10
;
2330 case MEP_OPERAND_CDISP10A4
:
2331 value
= fields
->f_cdisp10
;
2333 case MEP_OPERAND_CDISP10A8
:
2334 value
= fields
->f_cdisp10
;
2336 case MEP_OPERAND_CDISP12
:
2337 value
= fields
->f_12s20
;
2339 case MEP_OPERAND_CIMM4
:
2340 value
= fields
->f_rn
;
2342 case MEP_OPERAND_CIMM5
:
2343 value
= fields
->f_5u24
;
2345 case MEP_OPERAND_CODE16
:
2346 value
= fields
->f_16u16
;
2348 case MEP_OPERAND_CODE24
:
2349 value
= fields
->f_24u4n
;
2351 case MEP_OPERAND_CP_FLAG
:
2354 case MEP_OPERAND_CRN
:
2355 value
= fields
->f_crn
;
2357 case MEP_OPERAND_CRN64
:
2358 value
= fields
->f_crn
;
2360 case MEP_OPERAND_CRNX
:
2361 value
= fields
->f_crnx
;
2363 case MEP_OPERAND_CRNX64
:
2364 value
= fields
->f_crnx
;
2366 case MEP_OPERAND_CROC
:
2367 value
= fields
->f_ivc2_5u7
;
2369 case MEP_OPERAND_CROP
:
2370 value
= fields
->f_ivc2_5u23
;
2372 case MEP_OPERAND_CRPC
:
2373 value
= fields
->f_ivc2_5u26
;
2375 case MEP_OPERAND_CRPP
:
2376 value
= fields
->f_ivc2_5u18
;
2378 case MEP_OPERAND_CRQC
:
2379 value
= fields
->f_ivc2_5u21
;
2381 case MEP_OPERAND_CRQP
:
2382 value
= fields
->f_ivc2_5u13
;
2384 case MEP_OPERAND_CSRN
:
2385 value
= fields
->f_csrn
;
2387 case MEP_OPERAND_CSRN_IDX
:
2388 value
= fields
->f_csrn
;
2390 case MEP_OPERAND_DBG
:
2393 case MEP_OPERAND_DEPC
:
2396 case MEP_OPERAND_EPC
:
2399 case MEP_OPERAND_EXC
:
2402 case MEP_OPERAND_HI
:
2405 case MEP_OPERAND_IMM16P0
:
2406 value
= fields
->f_ivc2_imm16p0
;
2408 case MEP_OPERAND_IMM3P12
:
2409 value
= fields
->f_ivc2_3u12
;
2411 case MEP_OPERAND_IMM3P25
:
2412 value
= fields
->f_ivc2_3u25
;
2414 case MEP_OPERAND_IMM3P4
:
2415 value
= fields
->f_ivc2_3u4
;
2417 case MEP_OPERAND_IMM3P5
:
2418 value
= fields
->f_ivc2_3u5
;
2420 case MEP_OPERAND_IMM3P9
:
2421 value
= fields
->f_ivc2_3u9
;
2423 case MEP_OPERAND_IMM4P10
:
2424 value
= fields
->f_ivc2_4u10
;
2426 case MEP_OPERAND_IMM4P4
:
2427 value
= fields
->f_ivc2_4u4
;
2429 case MEP_OPERAND_IMM4P8
:
2430 value
= fields
->f_ivc2_4u8
;
2432 case MEP_OPERAND_IMM5P23
:
2433 value
= fields
->f_ivc2_5u23
;
2435 case MEP_OPERAND_IMM5P3
:
2436 value
= fields
->f_ivc2_5u3
;
2438 case MEP_OPERAND_IMM5P7
:
2439 value
= fields
->f_ivc2_5u7
;
2441 case MEP_OPERAND_IMM5P8
:
2442 value
= fields
->f_ivc2_5u8
;
2444 case MEP_OPERAND_IMM6P2
:
2445 value
= fields
->f_ivc2_6u2
;
2447 case MEP_OPERAND_IMM6P6
:
2448 value
= fields
->f_ivc2_6u6
;
2450 case MEP_OPERAND_IMM8P0
:
2451 value
= fields
->f_ivc2_8u0
;
2453 case MEP_OPERAND_IMM8P20
:
2454 value
= fields
->f_ivc2_8u20
;
2456 case MEP_OPERAND_IMM8P4
:
2457 value
= fields
->f_ivc2_8u4
;
2459 case MEP_OPERAND_IVC_X_0_2
:
2460 value
= fields
->f_ivc2_2u0
;
2462 case MEP_OPERAND_IVC_X_0_3
:
2463 value
= fields
->f_ivc2_3u0
;
2465 case MEP_OPERAND_IVC_X_0_4
:
2466 value
= fields
->f_ivc2_4u0
;
2468 case MEP_OPERAND_IVC_X_0_5
:
2469 value
= fields
->f_ivc2_5u0
;
2471 case MEP_OPERAND_IVC_X_6_1
:
2472 value
= fields
->f_ivc2_1u6
;
2474 case MEP_OPERAND_IVC_X_6_2
:
2475 value
= fields
->f_ivc2_2u6
;
2477 case MEP_OPERAND_IVC_X_6_3
:
2478 value
= fields
->f_ivc2_3u6
;
2480 case MEP_OPERAND_IVC2_ACC0_0
:
2483 case MEP_OPERAND_IVC2_ACC0_1
:
2486 case MEP_OPERAND_IVC2_ACC0_2
:
2489 case MEP_OPERAND_IVC2_ACC0_3
:
2492 case MEP_OPERAND_IVC2_ACC0_4
:
2495 case MEP_OPERAND_IVC2_ACC0_5
:
2498 case MEP_OPERAND_IVC2_ACC0_6
:
2501 case MEP_OPERAND_IVC2_ACC0_7
:
2504 case MEP_OPERAND_IVC2_ACC1_0
:
2507 case MEP_OPERAND_IVC2_ACC1_1
:
2510 case MEP_OPERAND_IVC2_ACC1_2
:
2513 case MEP_OPERAND_IVC2_ACC1_3
:
2516 case MEP_OPERAND_IVC2_ACC1_4
:
2519 case MEP_OPERAND_IVC2_ACC1_5
:
2522 case MEP_OPERAND_IVC2_ACC1_6
:
2525 case MEP_OPERAND_IVC2_ACC1_7
:
2528 case MEP_OPERAND_IVC2_CC
:
2531 case MEP_OPERAND_IVC2_COFA0
:
2534 case MEP_OPERAND_IVC2_COFA1
:
2537 case MEP_OPERAND_IVC2_COFR0
:
2540 case MEP_OPERAND_IVC2_COFR1
:
2543 case MEP_OPERAND_IVC2_CSAR0
:
2546 case MEP_OPERAND_IVC2_CSAR1
:
2549 case MEP_OPERAND_IVC2C3CCRN
:
2550 value
= fields
->f_ivc2_ccrn_c3
;
2552 case MEP_OPERAND_IVC2CCRN
:
2553 value
= fields
->f_ivc2_ccrn
;
2555 case MEP_OPERAND_IVC2CRN
:
2556 value
= fields
->f_ivc2_crnx
;
2558 case MEP_OPERAND_IVC2RM
:
2559 value
= fields
->f_ivc2_crm
;
2561 case MEP_OPERAND_LO
:
2564 case MEP_OPERAND_LP
:
2567 case MEP_OPERAND_MB0
:
2570 case MEP_OPERAND_MB1
:
2573 case MEP_OPERAND_ME0
:
2576 case MEP_OPERAND_ME1
:
2579 case MEP_OPERAND_NPC
:
2582 case MEP_OPERAND_OPT
:
2585 case MEP_OPERAND_PCABS24A2
:
2586 value
= fields
->f_24u5a2n
;
2588 case MEP_OPERAND_PCREL12A2
:
2589 value
= fields
->f_12s4a2
;
2591 case MEP_OPERAND_PCREL17A2
:
2592 value
= fields
->f_17s16a2
;
2594 case MEP_OPERAND_PCREL24A2
:
2595 value
= fields
->f_24s5a2n
;
2597 case MEP_OPERAND_PCREL8A2
:
2598 value
= fields
->f_8s8a2
;
2600 case MEP_OPERAND_PSW
:
2603 case MEP_OPERAND_R0
:
2606 case MEP_OPERAND_R1
:
2609 case MEP_OPERAND_RL
:
2610 value
= fields
->f_rl
;
2612 case MEP_OPERAND_RL5
:
2613 value
= fields
->f_rl5
;
2615 case MEP_OPERAND_RM
:
2616 value
= fields
->f_rm
;
2618 case MEP_OPERAND_RMA
:
2619 value
= fields
->f_rm
;
2621 case MEP_OPERAND_RN
:
2622 value
= fields
->f_rn
;
2624 case MEP_OPERAND_RN3
:
2625 value
= fields
->f_rn3
;
2627 case MEP_OPERAND_RN3C
:
2628 value
= fields
->f_rn3
;
2630 case MEP_OPERAND_RN3L
:
2631 value
= fields
->f_rn3
;
2633 case MEP_OPERAND_RN3S
:
2634 value
= fields
->f_rn3
;
2636 case MEP_OPERAND_RN3UC
:
2637 value
= fields
->f_rn3
;
2639 case MEP_OPERAND_RN3UL
:
2640 value
= fields
->f_rn3
;
2642 case MEP_OPERAND_RN3US
:
2643 value
= fields
->f_rn3
;
2645 case MEP_OPERAND_RNC
:
2646 value
= fields
->f_rn
;
2648 case MEP_OPERAND_RNL
:
2649 value
= fields
->f_rn
;
2651 case MEP_OPERAND_RNS
:
2652 value
= fields
->f_rn
;
2654 case MEP_OPERAND_RNUC
:
2655 value
= fields
->f_rn
;
2657 case MEP_OPERAND_RNUL
:
2658 value
= fields
->f_rn
;
2660 case MEP_OPERAND_RNUS
:
2661 value
= fields
->f_rn
;
2663 case MEP_OPERAND_SAR
:
2666 case MEP_OPERAND_SDISP16
:
2667 value
= fields
->f_16s16
;
2669 case MEP_OPERAND_SIMM16
:
2670 value
= fields
->f_16s16
;
2672 case MEP_OPERAND_SIMM16P0
:
2673 value
= fields
->f_ivc2_simm16p0
;
2675 case MEP_OPERAND_SIMM6
:
2676 value
= fields
->f_6s8
;
2678 case MEP_OPERAND_SIMM8
:
2679 value
= fields
->f_8s8
;
2681 case MEP_OPERAND_SIMM8P0
:
2682 value
= fields
->f_ivc2_8s0
;
2684 case MEP_OPERAND_SIMM8P20
:
2685 value
= fields
->f_ivc2_8s20
;
2687 case MEP_OPERAND_SIMM8P4
:
2688 value
= fields
->f_ivc2_8s4
;
2690 case MEP_OPERAND_SP
:
2693 case MEP_OPERAND_SPR
:
2696 case MEP_OPERAND_TP
:
2699 case MEP_OPERAND_TPR
:
2702 case MEP_OPERAND_UDISP2
:
2703 value
= fields
->f_2u6
;
2705 case MEP_OPERAND_UDISP7
:
2706 value
= fields
->f_7u9
;
2708 case MEP_OPERAND_UDISP7A2
:
2709 value
= fields
->f_7u9a2
;
2711 case MEP_OPERAND_UDISP7A4
:
2712 value
= fields
->f_7u9a4
;
2714 case MEP_OPERAND_UIMM16
:
2715 value
= fields
->f_16u16
;
2717 case MEP_OPERAND_UIMM2
:
2718 value
= fields
->f_2u10
;
2720 case MEP_OPERAND_UIMM24
:
2721 value
= fields
->f_24u8n
;
2723 case MEP_OPERAND_UIMM3
:
2724 value
= fields
->f_3u5
;
2726 case MEP_OPERAND_UIMM4
:
2727 value
= fields
->f_4u8
;
2729 case MEP_OPERAND_UIMM5
:
2730 value
= fields
->f_5u8
;
2732 case MEP_OPERAND_UIMM7A4
:
2733 value
= fields
->f_7u9a4
;
2735 case MEP_OPERAND_ZERO
:
2740 /* xgettext:c-format */
2741 opcodes_error_handler
2742 (_("internal error: unrecognized field %d while getting vma operand"),
2750 void mep_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
2751 void mep_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
2753 /* Stuffing values in cgen_fields is handled by a collection of functions.
2754 They are distinguished by the type of the VALUE argument they accept.
2755 TODO: floating point, inlining support, remove cases where argument type
2759 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2761 CGEN_FIELDS
* fields
,
2766 case MEP_OPERAND_ADDR24A4
:
2767 fields
->f_24u8a4n
= value
;
2769 case MEP_OPERAND_C5RMUIMM20
:
2770 fields
->f_c5_rmuimm20
= value
;
2772 case MEP_OPERAND_C5RNMUIMM24
:
2773 fields
->f_c5_rnmuimm24
= value
;
2775 case MEP_OPERAND_CALLNUM
:
2776 fields
->f_callnum
= value
;
2778 case MEP_OPERAND_CCCC
:
2779 fields
->f_rm
= value
;
2781 case MEP_OPERAND_CCRN
:
2782 fields
->f_ccrn
= value
;
2784 case MEP_OPERAND_CDISP10
:
2785 fields
->f_cdisp10
= value
;
2787 case MEP_OPERAND_CDISP10A2
:
2788 fields
->f_cdisp10
= value
;
2790 case MEP_OPERAND_CDISP10A4
:
2791 fields
->f_cdisp10
= value
;
2793 case MEP_OPERAND_CDISP10A8
:
2794 fields
->f_cdisp10
= value
;
2796 case MEP_OPERAND_CDISP12
:
2797 fields
->f_12s20
= value
;
2799 case MEP_OPERAND_CIMM4
:
2800 fields
->f_rn
= value
;
2802 case MEP_OPERAND_CIMM5
:
2803 fields
->f_5u24
= value
;
2805 case MEP_OPERAND_CODE16
:
2806 fields
->f_16u16
= value
;
2808 case MEP_OPERAND_CODE24
:
2809 fields
->f_24u4n
= value
;
2811 case MEP_OPERAND_CP_FLAG
:
2813 case MEP_OPERAND_CRN
:
2814 fields
->f_crn
= value
;
2816 case MEP_OPERAND_CRN64
:
2817 fields
->f_crn
= value
;
2819 case MEP_OPERAND_CRNX
:
2820 fields
->f_crnx
= value
;
2822 case MEP_OPERAND_CRNX64
:
2823 fields
->f_crnx
= value
;
2825 case MEP_OPERAND_CROC
:
2826 fields
->f_ivc2_5u7
= value
;
2828 case MEP_OPERAND_CROP
:
2829 fields
->f_ivc2_5u23
= value
;
2831 case MEP_OPERAND_CRPC
:
2832 fields
->f_ivc2_5u26
= value
;
2834 case MEP_OPERAND_CRPP
:
2835 fields
->f_ivc2_5u18
= value
;
2837 case MEP_OPERAND_CRQC
:
2838 fields
->f_ivc2_5u21
= value
;
2840 case MEP_OPERAND_CRQP
:
2841 fields
->f_ivc2_5u13
= value
;
2843 case MEP_OPERAND_CSRN
:
2844 fields
->f_csrn
= value
;
2846 case MEP_OPERAND_CSRN_IDX
:
2847 fields
->f_csrn
= value
;
2849 case MEP_OPERAND_DBG
:
2851 case MEP_OPERAND_DEPC
:
2853 case MEP_OPERAND_EPC
:
2855 case MEP_OPERAND_EXC
:
2857 case MEP_OPERAND_HI
:
2859 case MEP_OPERAND_IMM16P0
:
2860 fields
->f_ivc2_imm16p0
= value
;
2862 case MEP_OPERAND_IMM3P12
:
2863 fields
->f_ivc2_3u12
= value
;
2865 case MEP_OPERAND_IMM3P25
:
2866 fields
->f_ivc2_3u25
= value
;
2868 case MEP_OPERAND_IMM3P4
:
2869 fields
->f_ivc2_3u4
= value
;
2871 case MEP_OPERAND_IMM3P5
:
2872 fields
->f_ivc2_3u5
= value
;
2874 case MEP_OPERAND_IMM3P9
:
2875 fields
->f_ivc2_3u9
= value
;
2877 case MEP_OPERAND_IMM4P10
:
2878 fields
->f_ivc2_4u10
= value
;
2880 case MEP_OPERAND_IMM4P4
:
2881 fields
->f_ivc2_4u4
= value
;
2883 case MEP_OPERAND_IMM4P8
:
2884 fields
->f_ivc2_4u8
= value
;
2886 case MEP_OPERAND_IMM5P23
:
2887 fields
->f_ivc2_5u23
= value
;
2889 case MEP_OPERAND_IMM5P3
:
2890 fields
->f_ivc2_5u3
= value
;
2892 case MEP_OPERAND_IMM5P7
:
2893 fields
->f_ivc2_5u7
= value
;
2895 case MEP_OPERAND_IMM5P8
:
2896 fields
->f_ivc2_5u8
= value
;
2898 case MEP_OPERAND_IMM6P2
:
2899 fields
->f_ivc2_6u2
= value
;
2901 case MEP_OPERAND_IMM6P6
:
2902 fields
->f_ivc2_6u6
= value
;
2904 case MEP_OPERAND_IMM8P0
:
2905 fields
->f_ivc2_8u0
= value
;
2907 case MEP_OPERAND_IMM8P20
:
2908 fields
->f_ivc2_8u20
= value
;
2910 case MEP_OPERAND_IMM8P4
:
2911 fields
->f_ivc2_8u4
= value
;
2913 case MEP_OPERAND_IVC_X_0_2
:
2914 fields
->f_ivc2_2u0
= value
;
2916 case MEP_OPERAND_IVC_X_0_3
:
2917 fields
->f_ivc2_3u0
= value
;
2919 case MEP_OPERAND_IVC_X_0_4
:
2920 fields
->f_ivc2_4u0
= value
;
2922 case MEP_OPERAND_IVC_X_0_5
:
2923 fields
->f_ivc2_5u0
= value
;
2925 case MEP_OPERAND_IVC_X_6_1
:
2926 fields
->f_ivc2_1u6
= value
;
2928 case MEP_OPERAND_IVC_X_6_2
:
2929 fields
->f_ivc2_2u6
= value
;
2931 case MEP_OPERAND_IVC_X_6_3
:
2932 fields
->f_ivc2_3u6
= value
;
2934 case MEP_OPERAND_IVC2_ACC0_0
:
2936 case MEP_OPERAND_IVC2_ACC0_1
:
2938 case MEP_OPERAND_IVC2_ACC0_2
:
2940 case MEP_OPERAND_IVC2_ACC0_3
:
2942 case MEP_OPERAND_IVC2_ACC0_4
:
2944 case MEP_OPERAND_IVC2_ACC0_5
:
2946 case MEP_OPERAND_IVC2_ACC0_6
:
2948 case MEP_OPERAND_IVC2_ACC0_7
:
2950 case MEP_OPERAND_IVC2_ACC1_0
:
2952 case MEP_OPERAND_IVC2_ACC1_1
:
2954 case MEP_OPERAND_IVC2_ACC1_2
:
2956 case MEP_OPERAND_IVC2_ACC1_3
:
2958 case MEP_OPERAND_IVC2_ACC1_4
:
2960 case MEP_OPERAND_IVC2_ACC1_5
:
2962 case MEP_OPERAND_IVC2_ACC1_6
:
2964 case MEP_OPERAND_IVC2_ACC1_7
:
2966 case MEP_OPERAND_IVC2_CC
:
2968 case MEP_OPERAND_IVC2_COFA0
:
2970 case MEP_OPERAND_IVC2_COFA1
:
2972 case MEP_OPERAND_IVC2_COFR0
:
2974 case MEP_OPERAND_IVC2_COFR1
:
2976 case MEP_OPERAND_IVC2_CSAR0
:
2978 case MEP_OPERAND_IVC2_CSAR1
:
2980 case MEP_OPERAND_IVC2C3CCRN
:
2981 fields
->f_ivc2_ccrn_c3
= value
;
2983 case MEP_OPERAND_IVC2CCRN
:
2984 fields
->f_ivc2_ccrn
= value
;
2986 case MEP_OPERAND_IVC2CRN
:
2987 fields
->f_ivc2_crnx
= value
;
2989 case MEP_OPERAND_IVC2RM
:
2990 fields
->f_ivc2_crm
= value
;
2992 case MEP_OPERAND_LO
:
2994 case MEP_OPERAND_LP
:
2996 case MEP_OPERAND_MB0
:
2998 case MEP_OPERAND_MB1
:
3000 case MEP_OPERAND_ME0
:
3002 case MEP_OPERAND_ME1
:
3004 case MEP_OPERAND_NPC
:
3006 case MEP_OPERAND_OPT
:
3008 case MEP_OPERAND_PCABS24A2
:
3009 fields
->f_24u5a2n
= value
;
3011 case MEP_OPERAND_PCREL12A2
:
3012 fields
->f_12s4a2
= value
;
3014 case MEP_OPERAND_PCREL17A2
:
3015 fields
->f_17s16a2
= value
;
3017 case MEP_OPERAND_PCREL24A2
:
3018 fields
->f_24s5a2n
= value
;
3020 case MEP_OPERAND_PCREL8A2
:
3021 fields
->f_8s8a2
= value
;
3023 case MEP_OPERAND_PSW
:
3025 case MEP_OPERAND_R0
:
3027 case MEP_OPERAND_R1
:
3029 case MEP_OPERAND_RL
:
3030 fields
->f_rl
= value
;
3032 case MEP_OPERAND_RL5
:
3033 fields
->f_rl5
= value
;
3035 case MEP_OPERAND_RM
:
3036 fields
->f_rm
= value
;
3038 case MEP_OPERAND_RMA
:
3039 fields
->f_rm
= value
;
3041 case MEP_OPERAND_RN
:
3042 fields
->f_rn
= value
;
3044 case MEP_OPERAND_RN3
:
3045 fields
->f_rn3
= value
;
3047 case MEP_OPERAND_RN3C
:
3048 fields
->f_rn3
= value
;
3050 case MEP_OPERAND_RN3L
:
3051 fields
->f_rn3
= value
;
3053 case MEP_OPERAND_RN3S
:
3054 fields
->f_rn3
= value
;
3056 case MEP_OPERAND_RN3UC
:
3057 fields
->f_rn3
= value
;
3059 case MEP_OPERAND_RN3UL
:
3060 fields
->f_rn3
= value
;
3062 case MEP_OPERAND_RN3US
:
3063 fields
->f_rn3
= value
;
3065 case MEP_OPERAND_RNC
:
3066 fields
->f_rn
= value
;
3068 case MEP_OPERAND_RNL
:
3069 fields
->f_rn
= value
;
3071 case MEP_OPERAND_RNS
:
3072 fields
->f_rn
= value
;
3074 case MEP_OPERAND_RNUC
:
3075 fields
->f_rn
= value
;
3077 case MEP_OPERAND_RNUL
:
3078 fields
->f_rn
= value
;
3080 case MEP_OPERAND_RNUS
:
3081 fields
->f_rn
= value
;
3083 case MEP_OPERAND_SAR
:
3085 case MEP_OPERAND_SDISP16
:
3086 fields
->f_16s16
= value
;
3088 case MEP_OPERAND_SIMM16
:
3089 fields
->f_16s16
= value
;
3091 case MEP_OPERAND_SIMM16P0
:
3092 fields
->f_ivc2_simm16p0
= value
;
3094 case MEP_OPERAND_SIMM6
:
3095 fields
->f_6s8
= value
;
3097 case MEP_OPERAND_SIMM8
:
3098 fields
->f_8s8
= value
;
3100 case MEP_OPERAND_SIMM8P0
:
3101 fields
->f_ivc2_8s0
= value
;
3103 case MEP_OPERAND_SIMM8P20
:
3104 fields
->f_ivc2_8s20
= value
;
3106 case MEP_OPERAND_SIMM8P4
:
3107 fields
->f_ivc2_8s4
= value
;
3109 case MEP_OPERAND_SP
:
3111 case MEP_OPERAND_SPR
:
3113 case MEP_OPERAND_TP
:
3115 case MEP_OPERAND_TPR
:
3117 case MEP_OPERAND_UDISP2
:
3118 fields
->f_2u6
= value
;
3120 case MEP_OPERAND_UDISP7
:
3121 fields
->f_7u9
= value
;
3123 case MEP_OPERAND_UDISP7A2
:
3124 fields
->f_7u9a2
= value
;
3126 case MEP_OPERAND_UDISP7A4
:
3127 fields
->f_7u9a4
= value
;
3129 case MEP_OPERAND_UIMM16
:
3130 fields
->f_16u16
= value
;
3132 case MEP_OPERAND_UIMM2
:
3133 fields
->f_2u10
= value
;
3135 case MEP_OPERAND_UIMM24
:
3136 fields
->f_24u8n
= value
;
3138 case MEP_OPERAND_UIMM3
:
3139 fields
->f_3u5
= value
;
3141 case MEP_OPERAND_UIMM4
:
3142 fields
->f_4u8
= value
;
3144 case MEP_OPERAND_UIMM5
:
3145 fields
->f_5u8
= value
;
3147 case MEP_OPERAND_UIMM7A4
:
3148 fields
->f_7u9a4
= value
;
3150 case MEP_OPERAND_ZERO
:
3154 /* xgettext:c-format */
3155 opcodes_error_handler
3156 (_("internal error: unrecognized field %d while setting int operand"),
3163 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
3165 CGEN_FIELDS
* fields
,
3170 case MEP_OPERAND_ADDR24A4
:
3171 fields
->f_24u8a4n
= value
;
3173 case MEP_OPERAND_C5RMUIMM20
:
3174 fields
->f_c5_rmuimm20
= value
;
3176 case MEP_OPERAND_C5RNMUIMM24
:
3177 fields
->f_c5_rnmuimm24
= value
;
3179 case MEP_OPERAND_CALLNUM
:
3180 fields
->f_callnum
= value
;
3182 case MEP_OPERAND_CCCC
:
3183 fields
->f_rm
= value
;
3185 case MEP_OPERAND_CCRN
:
3186 fields
->f_ccrn
= value
;
3188 case MEP_OPERAND_CDISP10
:
3189 fields
->f_cdisp10
= value
;
3191 case MEP_OPERAND_CDISP10A2
:
3192 fields
->f_cdisp10
= value
;
3194 case MEP_OPERAND_CDISP10A4
:
3195 fields
->f_cdisp10
= value
;
3197 case MEP_OPERAND_CDISP10A8
:
3198 fields
->f_cdisp10
= value
;
3200 case MEP_OPERAND_CDISP12
:
3201 fields
->f_12s20
= value
;
3203 case MEP_OPERAND_CIMM4
:
3204 fields
->f_rn
= value
;
3206 case MEP_OPERAND_CIMM5
:
3207 fields
->f_5u24
= value
;
3209 case MEP_OPERAND_CODE16
:
3210 fields
->f_16u16
= value
;
3212 case MEP_OPERAND_CODE24
:
3213 fields
->f_24u4n
= value
;
3215 case MEP_OPERAND_CP_FLAG
:
3217 case MEP_OPERAND_CRN
:
3218 fields
->f_crn
= value
;
3220 case MEP_OPERAND_CRN64
:
3221 fields
->f_crn
= value
;
3223 case MEP_OPERAND_CRNX
:
3224 fields
->f_crnx
= value
;
3226 case MEP_OPERAND_CRNX64
:
3227 fields
->f_crnx
= value
;
3229 case MEP_OPERAND_CROC
:
3230 fields
->f_ivc2_5u7
= value
;
3232 case MEP_OPERAND_CROP
:
3233 fields
->f_ivc2_5u23
= value
;
3235 case MEP_OPERAND_CRPC
:
3236 fields
->f_ivc2_5u26
= value
;
3238 case MEP_OPERAND_CRPP
:
3239 fields
->f_ivc2_5u18
= value
;
3241 case MEP_OPERAND_CRQC
:
3242 fields
->f_ivc2_5u21
= value
;
3244 case MEP_OPERAND_CRQP
:
3245 fields
->f_ivc2_5u13
= value
;
3247 case MEP_OPERAND_CSRN
:
3248 fields
->f_csrn
= value
;
3250 case MEP_OPERAND_CSRN_IDX
:
3251 fields
->f_csrn
= value
;
3253 case MEP_OPERAND_DBG
:
3255 case MEP_OPERAND_DEPC
:
3257 case MEP_OPERAND_EPC
:
3259 case MEP_OPERAND_EXC
:
3261 case MEP_OPERAND_HI
:
3263 case MEP_OPERAND_IMM16P0
:
3264 fields
->f_ivc2_imm16p0
= value
;
3266 case MEP_OPERAND_IMM3P12
:
3267 fields
->f_ivc2_3u12
= value
;
3269 case MEP_OPERAND_IMM3P25
:
3270 fields
->f_ivc2_3u25
= value
;
3272 case MEP_OPERAND_IMM3P4
:
3273 fields
->f_ivc2_3u4
= value
;
3275 case MEP_OPERAND_IMM3P5
:
3276 fields
->f_ivc2_3u5
= value
;
3278 case MEP_OPERAND_IMM3P9
:
3279 fields
->f_ivc2_3u9
= value
;
3281 case MEP_OPERAND_IMM4P10
:
3282 fields
->f_ivc2_4u10
= value
;
3284 case MEP_OPERAND_IMM4P4
:
3285 fields
->f_ivc2_4u4
= value
;
3287 case MEP_OPERAND_IMM4P8
:
3288 fields
->f_ivc2_4u8
= value
;
3290 case MEP_OPERAND_IMM5P23
:
3291 fields
->f_ivc2_5u23
= value
;
3293 case MEP_OPERAND_IMM5P3
:
3294 fields
->f_ivc2_5u3
= value
;
3296 case MEP_OPERAND_IMM5P7
:
3297 fields
->f_ivc2_5u7
= value
;
3299 case MEP_OPERAND_IMM5P8
:
3300 fields
->f_ivc2_5u8
= value
;
3302 case MEP_OPERAND_IMM6P2
:
3303 fields
->f_ivc2_6u2
= value
;
3305 case MEP_OPERAND_IMM6P6
:
3306 fields
->f_ivc2_6u6
= value
;
3308 case MEP_OPERAND_IMM8P0
:
3309 fields
->f_ivc2_8u0
= value
;
3311 case MEP_OPERAND_IMM8P20
:
3312 fields
->f_ivc2_8u20
= value
;
3314 case MEP_OPERAND_IMM8P4
:
3315 fields
->f_ivc2_8u4
= value
;
3317 case MEP_OPERAND_IVC_X_0_2
:
3318 fields
->f_ivc2_2u0
= value
;
3320 case MEP_OPERAND_IVC_X_0_3
:
3321 fields
->f_ivc2_3u0
= value
;
3323 case MEP_OPERAND_IVC_X_0_4
:
3324 fields
->f_ivc2_4u0
= value
;
3326 case MEP_OPERAND_IVC_X_0_5
:
3327 fields
->f_ivc2_5u0
= value
;
3329 case MEP_OPERAND_IVC_X_6_1
:
3330 fields
->f_ivc2_1u6
= value
;
3332 case MEP_OPERAND_IVC_X_6_2
:
3333 fields
->f_ivc2_2u6
= value
;
3335 case MEP_OPERAND_IVC_X_6_3
:
3336 fields
->f_ivc2_3u6
= value
;
3338 case MEP_OPERAND_IVC2_ACC0_0
:
3340 case MEP_OPERAND_IVC2_ACC0_1
:
3342 case MEP_OPERAND_IVC2_ACC0_2
:
3344 case MEP_OPERAND_IVC2_ACC0_3
:
3346 case MEP_OPERAND_IVC2_ACC0_4
:
3348 case MEP_OPERAND_IVC2_ACC0_5
:
3350 case MEP_OPERAND_IVC2_ACC0_6
:
3352 case MEP_OPERAND_IVC2_ACC0_7
:
3354 case MEP_OPERAND_IVC2_ACC1_0
:
3356 case MEP_OPERAND_IVC2_ACC1_1
:
3358 case MEP_OPERAND_IVC2_ACC1_2
:
3360 case MEP_OPERAND_IVC2_ACC1_3
:
3362 case MEP_OPERAND_IVC2_ACC1_4
:
3364 case MEP_OPERAND_IVC2_ACC1_5
:
3366 case MEP_OPERAND_IVC2_ACC1_6
:
3368 case MEP_OPERAND_IVC2_ACC1_7
:
3370 case MEP_OPERAND_IVC2_CC
:
3372 case MEP_OPERAND_IVC2_COFA0
:
3374 case MEP_OPERAND_IVC2_COFA1
:
3376 case MEP_OPERAND_IVC2_COFR0
:
3378 case MEP_OPERAND_IVC2_COFR1
:
3380 case MEP_OPERAND_IVC2_CSAR0
:
3382 case MEP_OPERAND_IVC2_CSAR1
:
3384 case MEP_OPERAND_IVC2C3CCRN
:
3385 fields
->f_ivc2_ccrn_c3
= value
;
3387 case MEP_OPERAND_IVC2CCRN
:
3388 fields
->f_ivc2_ccrn
= value
;
3390 case MEP_OPERAND_IVC2CRN
:
3391 fields
->f_ivc2_crnx
= value
;
3393 case MEP_OPERAND_IVC2RM
:
3394 fields
->f_ivc2_crm
= value
;
3396 case MEP_OPERAND_LO
:
3398 case MEP_OPERAND_LP
:
3400 case MEP_OPERAND_MB0
:
3402 case MEP_OPERAND_MB1
:
3404 case MEP_OPERAND_ME0
:
3406 case MEP_OPERAND_ME1
:
3408 case MEP_OPERAND_NPC
:
3410 case MEP_OPERAND_OPT
:
3412 case MEP_OPERAND_PCABS24A2
:
3413 fields
->f_24u5a2n
= value
;
3415 case MEP_OPERAND_PCREL12A2
:
3416 fields
->f_12s4a2
= value
;
3418 case MEP_OPERAND_PCREL17A2
:
3419 fields
->f_17s16a2
= value
;
3421 case MEP_OPERAND_PCREL24A2
:
3422 fields
->f_24s5a2n
= value
;
3424 case MEP_OPERAND_PCREL8A2
:
3425 fields
->f_8s8a2
= value
;
3427 case MEP_OPERAND_PSW
:
3429 case MEP_OPERAND_R0
:
3431 case MEP_OPERAND_R1
:
3433 case MEP_OPERAND_RL
:
3434 fields
->f_rl
= value
;
3436 case MEP_OPERAND_RL5
:
3437 fields
->f_rl5
= value
;
3439 case MEP_OPERAND_RM
:
3440 fields
->f_rm
= value
;
3442 case MEP_OPERAND_RMA
:
3443 fields
->f_rm
= value
;
3445 case MEP_OPERAND_RN
:
3446 fields
->f_rn
= value
;
3448 case MEP_OPERAND_RN3
:
3449 fields
->f_rn3
= value
;
3451 case MEP_OPERAND_RN3C
:
3452 fields
->f_rn3
= value
;
3454 case MEP_OPERAND_RN3L
:
3455 fields
->f_rn3
= value
;
3457 case MEP_OPERAND_RN3S
:
3458 fields
->f_rn3
= value
;
3460 case MEP_OPERAND_RN3UC
:
3461 fields
->f_rn3
= value
;
3463 case MEP_OPERAND_RN3UL
:
3464 fields
->f_rn3
= value
;
3466 case MEP_OPERAND_RN3US
:
3467 fields
->f_rn3
= value
;
3469 case MEP_OPERAND_RNC
:
3470 fields
->f_rn
= value
;
3472 case MEP_OPERAND_RNL
:
3473 fields
->f_rn
= value
;
3475 case MEP_OPERAND_RNS
:
3476 fields
->f_rn
= value
;
3478 case MEP_OPERAND_RNUC
:
3479 fields
->f_rn
= value
;
3481 case MEP_OPERAND_RNUL
:
3482 fields
->f_rn
= value
;
3484 case MEP_OPERAND_RNUS
:
3485 fields
->f_rn
= value
;
3487 case MEP_OPERAND_SAR
:
3489 case MEP_OPERAND_SDISP16
:
3490 fields
->f_16s16
= value
;
3492 case MEP_OPERAND_SIMM16
:
3493 fields
->f_16s16
= value
;
3495 case MEP_OPERAND_SIMM16P0
:
3496 fields
->f_ivc2_simm16p0
= value
;
3498 case MEP_OPERAND_SIMM6
:
3499 fields
->f_6s8
= value
;
3501 case MEP_OPERAND_SIMM8
:
3502 fields
->f_8s8
= value
;
3504 case MEP_OPERAND_SIMM8P0
:
3505 fields
->f_ivc2_8s0
= value
;
3507 case MEP_OPERAND_SIMM8P20
:
3508 fields
->f_ivc2_8s20
= value
;
3510 case MEP_OPERAND_SIMM8P4
:
3511 fields
->f_ivc2_8s4
= value
;
3513 case MEP_OPERAND_SP
:
3515 case MEP_OPERAND_SPR
:
3517 case MEP_OPERAND_TP
:
3519 case MEP_OPERAND_TPR
:
3521 case MEP_OPERAND_UDISP2
:
3522 fields
->f_2u6
= value
;
3524 case MEP_OPERAND_UDISP7
:
3525 fields
->f_7u9
= value
;
3527 case MEP_OPERAND_UDISP7A2
:
3528 fields
->f_7u9a2
= value
;
3530 case MEP_OPERAND_UDISP7A4
:
3531 fields
->f_7u9a4
= value
;
3533 case MEP_OPERAND_UIMM16
:
3534 fields
->f_16u16
= value
;
3536 case MEP_OPERAND_UIMM2
:
3537 fields
->f_2u10
= value
;
3539 case MEP_OPERAND_UIMM24
:
3540 fields
->f_24u8n
= value
;
3542 case MEP_OPERAND_UIMM3
:
3543 fields
->f_3u5
= value
;
3545 case MEP_OPERAND_UIMM4
:
3546 fields
->f_4u8
= value
;
3548 case MEP_OPERAND_UIMM5
:
3549 fields
->f_5u8
= value
;
3551 case MEP_OPERAND_UIMM7A4
:
3552 fields
->f_7u9a4
= value
;
3554 case MEP_OPERAND_ZERO
:
3558 /* xgettext:c-format */
3559 opcodes_error_handler
3560 (_("internal error: unrecognized field %d while setting vma operand"),
3566 /* Function to call before using the instruction builder tables. */
3569 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
3571 cd
->insert_handlers
= & mep_cgen_insert_handlers
[0];
3572 cd
->extract_handlers
= & mep_cgen_extract_handlers
[0];
3574 cd
->insert_operand
= mep_cgen_insert_operand
;
3575 cd
->extract_operand
= mep_cgen_extract_operand
;
3577 cd
->get_int_operand
= mep_cgen_get_int_operand
;
3578 cd
->set_int_operand
= mep_cgen_set_int_operand
;
3579 cd
->get_vma_operand
= mep_cgen_get_vma_operand
;
3580 cd
->set_vma_operand
= mep_cgen_set_vma_operand
;