1 /* Instruction building/extraction support for mep. -*- C -*-
3 THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
4 - the resultant file is machine generated, cgen-ibld.in isn't
6 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2006, 2007,
7 2008 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.
37 #include "safe-ctype.h"
40 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #define max(a,b) ((a) > (b) ? (a) : (b))
44 /* Used by the ifield rtx function. */
45 #define FLD(f) (fields->f)
47 static const char * insert_normal
48 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
49 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
50 static const char * insert_insn_normal
51 (CGEN_CPU_DESC
, const CGEN_INSN
*,
52 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
53 static int extract_normal
54 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
55 unsigned int, unsigned int, unsigned int, unsigned int,
56 unsigned int, unsigned int, bfd_vma
, long *);
57 static int extract_insn_normal
58 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
59 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
61 static void put_insn_int_value
62 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
65 static CGEN_INLINE
void insert_1
66 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
67 static CGEN_INLINE
int fill_cache
68 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
69 static CGEN_INLINE
long extract_1
70 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
73 /* Operand insertion. */
77 /* Subroutine of insert_normal. */
79 static CGEN_INLINE
void
80 insert_1 (CGEN_CPU_DESC cd
,
90 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
92 /* Written this way to avoid undefined behaviour. */
93 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
95 shift
= (start
+ 1) - length
;
97 shift
= (word_length
- (start
+ length
));
98 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
100 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
);
103 #endif /* ! CGEN_INT_INSN_P */
105 /* Default insertion routine.
107 ATTRS is a mask of the boolean attributes.
108 WORD_OFFSET is the offset in bits from the start of the insn of the value.
109 WORD_LENGTH is the length of the word in bits in which the value resides.
110 START is the starting bit number in the word, architecture origin.
111 LENGTH is the length of VALUE in bits.
112 TOTAL_LENGTH is the total length of the insn in bits.
114 The result is an error message or NULL if success. */
116 /* ??? This duplicates functionality with bfd's howto table and
117 bfd_install_relocation. */
118 /* ??? This doesn't handle bfd_vma's. Create another function when
122 insert_normal (CGEN_CPU_DESC cd
,
125 unsigned int word_offset
,
128 unsigned int word_length
,
129 unsigned int total_length
,
130 CGEN_INSN_BYTES_PTR buffer
)
132 static char errbuf
[100];
133 /* Written this way to avoid undefined behaviour. */
134 unsigned long mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
140 if (word_length
> 32)
143 /* For architectures with insns smaller than the base-insn-bitsize,
144 word_length may be too big. */
145 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
148 && word_length
> total_length
)
149 word_length
= total_length
;
152 /* Ensure VALUE will fit. */
153 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
155 long minval
= - (1L << (length
- 1));
156 unsigned long maxval
= mask
;
158 if ((value
> 0 && (unsigned long) value
> maxval
)
161 /* xgettext:c-format */
163 _("operand out of range (%ld not between %ld and %lu)"),
164 value
, minval
, maxval
);
168 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
170 unsigned long maxval
= mask
;
171 unsigned long val
= (unsigned long) value
;
173 /* For hosts with a word size > 32 check to see if value has been sign
174 extended beyond 32 bits. If so then ignore these higher sign bits
175 as the user is attempting to store a 32-bit signed value into an
176 unsigned 32-bit field which is allowed. */
177 if (sizeof (unsigned long) > 4 && ((value
>> 32) == -1))
182 /* xgettext:c-format */
184 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
191 if (! cgen_signed_overflow_ok_p (cd
))
193 long minval
= - (1L << (length
- 1));
194 long maxval
= (1L << (length
- 1)) - 1;
196 if (value
< minval
|| value
> maxval
)
199 /* xgettext:c-format */
200 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
201 value
, minval
, maxval
);
212 if (CGEN_INSN_LSB0_P
)
213 shift
= (word_offset
+ start
+ 1) - length
;
215 shift
= total_length
- (word_offset
+ start
+ length
);
216 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
219 #else /* ! CGEN_INT_INSN_P */
222 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
224 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
227 #endif /* ! CGEN_INT_INSN_P */
232 /* Default insn builder (insert handler).
233 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
234 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
235 recorded in host byte order, otherwise BUFFER is an array of bytes
236 and the value is recorded in target byte order).
237 The result is an error message or NULL if success. */
240 insert_insn_normal (CGEN_CPU_DESC cd
,
241 const CGEN_INSN
* insn
,
242 CGEN_FIELDS
* fields
,
243 CGEN_INSN_BYTES_PTR buffer
,
246 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
248 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
250 CGEN_INIT_INSERT (cd
);
251 value
= CGEN_INSN_BASE_VALUE (insn
);
253 /* If we're recording insns as numbers (rather than a string of bytes),
254 target byte order handling is deferred until later. */
258 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
259 CGEN_FIELDS_BITSIZE (fields
), value
);
263 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
264 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
267 #endif /* ! CGEN_INT_INSN_P */
269 /* ??? It would be better to scan the format's fields.
270 Still need to be able to insert a value based on the operand though;
271 e.g. storing a branch displacement that got resolved later.
272 Needs more thought first. */
274 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
278 if (CGEN_SYNTAX_CHAR_P (* syn
))
281 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
291 /* Cover function to store an insn value into an integral insn. Must go here
292 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
295 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
296 CGEN_INSN_BYTES_PTR buf
,
301 /* For architectures with insns smaller than the base-insn-bitsize,
302 length may be too big. */
303 if (length
> insn_length
)
307 int shift
= insn_length
- length
;
308 /* Written this way to avoid undefined behaviour. */
309 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
311 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
316 /* Operand extraction. */
318 #if ! CGEN_INT_INSN_P
320 /* Subroutine of extract_normal.
321 Ensure sufficient bytes are cached in EX_INFO.
322 OFFSET is the offset in bytes from the start of the insn of the value.
323 BYTES is the length of the needed value.
324 Returns 1 for success, 0 for failure. */
326 static CGEN_INLINE
int
327 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
328 CGEN_EXTRACT_INFO
*ex_info
,
333 /* It's doubtful that the middle part has already been fetched so
334 we don't optimize that case. kiss. */
336 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
338 /* First do a quick check. */
339 mask
= (1 << bytes
) - 1;
340 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
343 /* Search for the first byte we need to read. */
344 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
345 if (! (mask
& ex_info
->valid
))
353 status
= (*info
->read_memory_func
)
354 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
358 (*info
->memory_error_func
) (status
, pc
, info
);
362 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
368 /* Subroutine of extract_normal. */
370 static CGEN_INLINE
long
371 extract_1 (CGEN_CPU_DESC cd
,
372 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
377 bfd_vma pc ATTRIBUTE_UNUSED
)
382 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
384 if (CGEN_INSN_LSB0_P
)
385 shift
= (start
+ 1) - length
;
387 shift
= (word_length
- (start
+ length
));
391 #endif /* ! CGEN_INT_INSN_P */
393 /* Default extraction routine.
395 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
396 or sometimes less for cases like the m32r where the base insn size is 32
397 but some insns are 16 bits.
398 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
399 but for generality we take a bitmask of all of them.
400 WORD_OFFSET is the offset in bits from the start of the insn of the value.
401 WORD_LENGTH is the length of the word in bits in which the value resides.
402 START is the starting bit number in the word, architecture origin.
403 LENGTH is the length of VALUE in bits.
404 TOTAL_LENGTH is the total length of the insn in bits.
406 Returns 1 for success, 0 for failure. */
408 /* ??? The return code isn't properly used. wip. */
410 /* ??? This doesn't handle bfd_vma's. Create another function when
414 extract_normal (CGEN_CPU_DESC cd
,
415 #if ! CGEN_INT_INSN_P
416 CGEN_EXTRACT_INFO
*ex_info
,
418 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
420 CGEN_INSN_INT insn_value
,
422 unsigned int word_offset
,
425 unsigned int word_length
,
426 unsigned int total_length
,
427 #if ! CGEN_INT_INSN_P
430 bfd_vma pc ATTRIBUTE_UNUSED
,
436 /* If LENGTH is zero, this operand doesn't contribute to the value
437 so give it a standard value of zero. */
444 if (word_length
> 32)
447 /* For architectures with insns smaller than the insn-base-bitsize,
448 word_length may be too big. */
449 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
451 if (word_offset
+ word_length
> total_length
)
452 word_length
= total_length
- word_offset
;
455 /* Does the value reside in INSN_VALUE, and at the right alignment? */
457 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
459 if (CGEN_INSN_LSB0_P
)
460 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
462 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
465 #if ! CGEN_INT_INSN_P
469 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
471 if (word_length
> 32)
474 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
477 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
480 #endif /* ! CGEN_INT_INSN_P */
482 /* Written this way to avoid undefined behaviour. */
483 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
487 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
488 && (value
& (1L << (length
- 1))))
496 /* Default insn extractor.
498 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
499 The extracted fields are stored in FIELDS.
500 EX_INFO is used to handle reading variable length insns.
501 Return the length of the insn in bits, or 0 if no match,
502 or -1 if an error occurs fetching data (memory_error_func will have
506 extract_insn_normal (CGEN_CPU_DESC cd
,
507 const CGEN_INSN
*insn
,
508 CGEN_EXTRACT_INFO
*ex_info
,
509 CGEN_INSN_INT insn_value
,
513 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
514 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
516 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
518 CGEN_INIT_EXTRACT (cd
);
520 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
524 if (CGEN_SYNTAX_CHAR_P (*syn
))
527 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
528 ex_info
, insn_value
, fields
, pc
);
533 /* We recognized and successfully extracted this insn. */
534 return CGEN_INSN_BITSIZE (insn
);
537 /* Machine generated code added here. */
539 const char * mep_cgen_insert_operand
540 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
542 /* Main entry point for operand insertion.
544 This function is basically just a big switch statement. Earlier versions
545 used tables to look up the function to use, but
546 - if the table contains both assembler and disassembler functions then
547 the disassembler contains much of the assembler and vice-versa,
548 - there's a lot of inlining possibilities as things grow,
549 - using a switch statement avoids the function call overhead.
551 This function could be moved into `parse_insn_normal', but keeping it
552 separate makes clear the interface between `parse_insn_normal' and each of
553 the handlers. It's also needed by GAS to insert operands that couldn't be
554 resolved during parsing. */
557 mep_cgen_insert_operand (CGEN_CPU_DESC cd
,
559 CGEN_FIELDS
* fields
,
560 CGEN_INSN_BYTES_PTR buffer
,
561 bfd_vma pc ATTRIBUTE_UNUSED
)
563 const char * errmsg
= NULL
;
564 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
568 case MEP_OPERAND_ADDR24A4
:
571 FLD (f_24u8a4n_hi
) = ((unsigned int) (FLD (f_24u8a4n
)) >> (8));
572 FLD (f_24u8a4n_lo
) = ((unsigned int) (((FLD (f_24u8a4n
)) & (252))) >> (2));
574 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
577 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_lo
, 0, 0, 8, 6, 32, total_length
, buffer
);
582 case MEP_OPERAND_C5RMUIMM20
:
585 FLD (f_c5_rm
) = ((unsigned int) (FLD (f_c5_rmuimm20
)) >> (16));
586 FLD (f_c5_16u16
) = ((FLD (f_c5_rmuimm20
)) & (65535));
588 errmsg
= insert_normal (cd
, fields
->f_c5_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
591 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
596 case MEP_OPERAND_C5RNMUIMM24
:
599 FLD (f_c5_rnm
) = ((unsigned int) (FLD (f_c5_rnmuimm24
)) >> (16));
600 FLD (f_c5_16u16
) = ((FLD (f_c5_rnmuimm24
)) & (65535));
602 errmsg
= insert_normal (cd
, fields
->f_c5_rnm
, 0, 0, 4, 8, 32, total_length
, buffer
);
605 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
610 case MEP_OPERAND_CALLNUM
:
613 FLD (f_5
) = ((((unsigned int) (FLD (f_callnum
)) >> (3))) & (1));
614 FLD (f_6
) = ((((unsigned int) (FLD (f_callnum
)) >> (2))) & (1));
615 FLD (f_7
) = ((((unsigned int) (FLD (f_callnum
)) >> (1))) & (1));
616 FLD (f_11
) = ((FLD (f_callnum
)) & (1));
618 errmsg
= insert_normal (cd
, fields
->f_5
, 0, 0, 5, 1, 32, total_length
, buffer
);
621 errmsg
= insert_normal (cd
, fields
->f_6
, 0, 0, 6, 1, 32, total_length
, buffer
);
624 errmsg
= insert_normal (cd
, fields
->f_7
, 0, 0, 7, 1, 32, total_length
, buffer
);
627 errmsg
= insert_normal (cd
, fields
->f_11
, 0, 0, 11, 1, 32, total_length
, buffer
);
632 case MEP_OPERAND_CCCC
:
633 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
635 case MEP_OPERAND_CCRN
:
638 FLD (f_ccrn_hi
) = ((((unsigned int) (FLD (f_ccrn
)) >> (4))) & (3));
639 FLD (f_ccrn_lo
) = ((FLD (f_ccrn
)) & (15));
641 errmsg
= insert_normal (cd
, fields
->f_ccrn_hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
644 errmsg
= insert_normal (cd
, fields
->f_ccrn_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
649 case MEP_OPERAND_CDISP10
:
651 long value
= fields
->f_cdisp10
;
652 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)));
653 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
656 case MEP_OPERAND_CDISP10A2
:
658 long value
= fields
->f_cdisp10
;
659 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)));
660 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
663 case MEP_OPERAND_CDISP10A4
:
665 long value
= fields
->f_cdisp10
;
666 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)));
667 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
670 case MEP_OPERAND_CDISP10A8
:
672 long value
= fields
->f_cdisp10
;
673 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)));
674 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
677 case MEP_OPERAND_CDISP12
:
678 errmsg
= insert_normal (cd
, fields
->f_12s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, buffer
);
680 case MEP_OPERAND_CIMM4
:
681 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
683 case MEP_OPERAND_CIMM5
:
684 errmsg
= insert_normal (cd
, fields
->f_5u24
, 0, 0, 24, 5, 32, total_length
, buffer
);
686 case MEP_OPERAND_CODE16
:
687 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
689 case MEP_OPERAND_CODE24
:
692 FLD (f_24u4n_hi
) = ((unsigned int) (FLD (f_24u4n
)) >> (16));
693 FLD (f_24u4n_lo
) = ((FLD (f_24u4n
)) & (65535));
695 errmsg
= insert_normal (cd
, fields
->f_24u4n_hi
, 0, 0, 4, 8, 32, total_length
, buffer
);
698 errmsg
= insert_normal (cd
, fields
->f_24u4n_lo
, 0, 0, 16, 16, 32, total_length
, buffer
);
703 case MEP_OPERAND_CP_FLAG
:
705 case MEP_OPERAND_CRN
:
706 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
708 case MEP_OPERAND_CRN64
:
709 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
711 case MEP_OPERAND_CRNX
:
714 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
715 FLD (f_crnx_hi
) = ((unsigned int) (FLD (f_crnx
)) >> (4));
717 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
720 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
725 case MEP_OPERAND_CRNX64
:
728 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
729 FLD (f_crnx_hi
) = ((unsigned int) (FLD (f_crnx
)) >> (4));
731 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
734 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
739 case MEP_OPERAND_CROC
:
740 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
742 case MEP_OPERAND_CROP
:
743 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
745 case MEP_OPERAND_CRPC
:
746 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u26
, 0, 0, 26, 5, 32, total_length
, buffer
);
748 case MEP_OPERAND_CRPP
:
749 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u18
, 0, 0, 18, 5, 32, total_length
, buffer
);
751 case MEP_OPERAND_CRQC
:
752 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u21
, 0, 0, 21, 5, 32, total_length
, buffer
);
754 case MEP_OPERAND_CRQP
:
755 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u13
, 0, 0, 13, 5, 32, total_length
, buffer
);
757 case MEP_OPERAND_CSRN
:
760 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
761 FLD (f_csrn_hi
) = ((unsigned int) (FLD (f_csrn
)) >> (4));
763 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
766 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
771 case MEP_OPERAND_CSRN_IDX
:
774 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
775 FLD (f_csrn_hi
) = ((unsigned int) (FLD (f_csrn
)) >> (4));
777 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
780 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
785 case MEP_OPERAND_DBG
:
787 case MEP_OPERAND_DEPC
:
789 case MEP_OPERAND_EPC
:
791 case MEP_OPERAND_EXC
:
793 case MEP_OPERAND_HI
:
795 case MEP_OPERAND_IMM16P0
:
798 FLD (f_ivc2_8u0
) = ((((unsigned int) (FLD (f_ivc2_imm16p0
)) >> (8))) & (255));
799 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_imm16p0
)) & (255));
801 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
804 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
809 case MEP_OPERAND_IMM3P12
:
810 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u12
, 0, 0, 12, 3, 32, total_length
, buffer
);
812 case MEP_OPERAND_IMM3P25
:
813 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u25
, 0, 0, 25, 3, 32, total_length
, buffer
);
815 case MEP_OPERAND_IMM3P4
:
816 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u4
, 0, 0, 4, 3, 32, total_length
, buffer
);
818 case MEP_OPERAND_IMM3P5
:
819 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
821 case MEP_OPERAND_IMM3P9
:
822 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u9
, 0, 0, 9, 3, 32, total_length
, buffer
);
824 case MEP_OPERAND_IMM4P10
:
825 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u10
, 0, 0, 10, 4, 32, total_length
, buffer
);
827 case MEP_OPERAND_IMM4P4
:
828 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u4
, 0, 0, 4, 4, 32, total_length
, buffer
);
830 case MEP_OPERAND_IMM4P8
:
831 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
833 case MEP_OPERAND_IMM5P23
:
834 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
836 case MEP_OPERAND_IMM5P3
:
837 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u3
, 0, 0, 3, 5, 32, total_length
, buffer
);
839 case MEP_OPERAND_IMM5P7
:
840 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
842 case MEP_OPERAND_IMM5P8
:
843 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
845 case MEP_OPERAND_IMM6P2
:
846 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u2
, 0, 0, 2, 6, 32, total_length
, buffer
);
848 case MEP_OPERAND_IMM6P6
:
849 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u6
, 0, 0, 6, 6, 32, total_length
, buffer
);
851 case MEP_OPERAND_IMM8P0
:
852 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
854 case MEP_OPERAND_IMM8P20
:
855 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
857 case MEP_OPERAND_IMM8P4
:
858 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u4
, 0, 0, 4, 8, 32, total_length
, buffer
);
860 case MEP_OPERAND_IVC_X_0_2
:
861 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u0
, 0, 0, 0, 2, 32, total_length
, buffer
);
863 case MEP_OPERAND_IVC_X_0_3
:
864 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u0
, 0, 0, 0, 3, 32, total_length
, buffer
);
866 case MEP_OPERAND_IVC_X_0_4
:
867 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u0
, 0, 0, 0, 4, 32, total_length
, buffer
);
869 case MEP_OPERAND_IVC_X_0_5
:
870 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u0
, 0, 0, 0, 5, 32, total_length
, buffer
);
872 case MEP_OPERAND_IVC_X_6_1
:
873 errmsg
= insert_normal (cd
, fields
->f_ivc2_1u6
, 0, 0, 6, 1, 32, total_length
, buffer
);
875 case MEP_OPERAND_IVC_X_6_2
:
876 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
878 case MEP_OPERAND_IVC_X_6_3
:
879 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u6
, 0, 0, 6, 3, 32, total_length
, buffer
);
881 case MEP_OPERAND_IVC2_ACC0_0
:
883 case MEP_OPERAND_IVC2_ACC0_1
:
885 case MEP_OPERAND_IVC2_ACC0_2
:
887 case MEP_OPERAND_IVC2_ACC0_3
:
889 case MEP_OPERAND_IVC2_ACC0_4
:
891 case MEP_OPERAND_IVC2_ACC0_5
:
893 case MEP_OPERAND_IVC2_ACC0_6
:
895 case MEP_OPERAND_IVC2_ACC0_7
:
897 case MEP_OPERAND_IVC2_ACC1_0
:
899 case MEP_OPERAND_IVC2_ACC1_1
:
901 case MEP_OPERAND_IVC2_ACC1_2
:
903 case MEP_OPERAND_IVC2_ACC1_3
:
905 case MEP_OPERAND_IVC2_ACC1_4
:
907 case MEP_OPERAND_IVC2_ACC1_5
:
909 case MEP_OPERAND_IVC2_ACC1_6
:
911 case MEP_OPERAND_IVC2_ACC1_7
:
913 case MEP_OPERAND_IVC2_CC
:
915 case MEP_OPERAND_IVC2_COFA0
:
917 case MEP_OPERAND_IVC2_COFA1
:
919 case MEP_OPERAND_IVC2_COFR0
:
921 case MEP_OPERAND_IVC2_COFR1
:
923 case MEP_OPERAND_IVC2_CSAR0
:
925 case MEP_OPERAND_IVC2_CSAR1
:
927 case MEP_OPERAND_IVC2C3CCRN
:
930 FLD (f_ivc2_ccrn_c3hi
) = ((((unsigned int) (FLD (f_ivc2_ccrn_c3
)) >> (4))) & (3));
931 FLD (f_ivc2_ccrn_c3lo
) = ((FLD (f_ivc2_ccrn_c3
)) & (15));
933 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
936 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
941 case MEP_OPERAND_IVC2CCRN
:
944 FLD (f_ivc2_ccrn_h2
) = ((((unsigned int) (FLD (f_ivc2_ccrn
)) >> (4))) & (3));
945 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_ccrn
)) & (15));
947 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h2
, 0, 0, 20, 2, 32, total_length
, buffer
);
950 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
955 case MEP_OPERAND_IVC2CRN
:
958 FLD (f_ivc2_ccrn_h1
) = ((((unsigned int) (FLD (f_ivc2_crnx
)) >> (4))) & (1));
959 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_crnx
)) & (15));
961 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h1
, 0, 0, 20, 1, 32, total_length
, buffer
);
964 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
969 case MEP_OPERAND_IVC2RM
:
970 errmsg
= insert_normal (cd
, fields
->f_ivc2_crm
, 0, 0, 4, 4, 32, total_length
, buffer
);
972 case MEP_OPERAND_LO
:
974 case MEP_OPERAND_LP
:
976 case MEP_OPERAND_MB0
:
978 case MEP_OPERAND_MB1
:
980 case MEP_OPERAND_ME0
:
982 case MEP_OPERAND_ME1
:
984 case MEP_OPERAND_NPC
:
986 case MEP_OPERAND_OPT
:
988 case MEP_OPERAND_PCABS24A2
:
991 FLD (f_24u5a2n_lo
) = ((unsigned int) (((FLD (f_24u5a2n
)) & (255))) >> (1));
992 FLD (f_24u5a2n_hi
) = ((unsigned int) (FLD (f_24u5a2n
)) >> (8));
994 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
997 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_lo
, 0, 0, 5, 7, 32, total_length
, buffer
);
1002 case MEP_OPERAND_PCREL12A2
:
1004 long value
= fields
->f_12s4a2
;
1005 value
= ((int) (((value
) - (pc
))) >> (1));
1006 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, buffer
);
1009 case MEP_OPERAND_PCREL17A2
:
1011 long value
= fields
->f_17s16a2
;
1012 value
= ((int) (((value
) - (pc
))) >> (1));
1013 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
1016 case MEP_OPERAND_PCREL24A2
:
1019 FLD (f_24s5a2n
) = ((FLD (f_24s5a2n
)) - (pc
));
1020 FLD (f_24s5a2n_lo
) = ((unsigned int) (((FLD (f_24s5a2n
)) & (254))) >> (1));
1021 FLD (f_24s5a2n_hi
) = ((int) (FLD (f_24s5a2n
)) >> (8));
1023 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
);
1026 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_lo
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, buffer
);
1031 case MEP_OPERAND_PCREL8A2
:
1033 long value
= fields
->f_8s8a2
;
1034 value
= ((int) (((value
) - (pc
))) >> (1));
1035 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, buffer
);
1038 case MEP_OPERAND_PSW
:
1040 case MEP_OPERAND_R0
:
1042 case MEP_OPERAND_R1
:
1044 case MEP_OPERAND_RL
:
1045 errmsg
= insert_normal (cd
, fields
->f_rl
, 0, 0, 12, 4, 32, total_length
, buffer
);
1047 case MEP_OPERAND_RL5
:
1048 errmsg
= insert_normal (cd
, fields
->f_rl5
, 0, 0, 20, 4, 32, total_length
, buffer
);
1050 case MEP_OPERAND_RM
:
1051 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1053 case MEP_OPERAND_RMA
:
1054 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1056 case MEP_OPERAND_RN
:
1057 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1059 case MEP_OPERAND_RN3
:
1060 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1062 case MEP_OPERAND_RN3C
:
1063 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1065 case MEP_OPERAND_RN3L
:
1066 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1068 case MEP_OPERAND_RN3S
:
1069 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1071 case MEP_OPERAND_RN3UC
:
1072 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1074 case MEP_OPERAND_RN3UL
:
1075 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1077 case MEP_OPERAND_RN3US
:
1078 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1080 case MEP_OPERAND_RNC
:
1081 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1083 case MEP_OPERAND_RNL
:
1084 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1086 case MEP_OPERAND_RNS
:
1087 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1089 case MEP_OPERAND_RNUC
:
1090 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1092 case MEP_OPERAND_RNUL
:
1093 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1095 case MEP_OPERAND_RNUS
:
1096 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1098 case MEP_OPERAND_SAR
:
1100 case MEP_OPERAND_SDISP16
:
1101 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1103 case MEP_OPERAND_SIMM16
:
1104 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1106 case MEP_OPERAND_SIMM16P0
:
1109 FLD (f_ivc2_8u0
) = ((((unsigned int) (FLD (f_ivc2_simm16p0
)) >> (8))) & (255));
1110 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_simm16p0
)) & (255));
1112 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
1115 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
1120 case MEP_OPERAND_SIMM6
:
1121 errmsg
= insert_normal (cd
, fields
->f_6s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, buffer
);
1123 case MEP_OPERAND_SIMM8
:
1124 errmsg
= insert_normal (cd
, fields
->f_8s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, buffer
);
1126 case MEP_OPERAND_SIMM8P0
:
1127 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s0
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, buffer
);
1129 case MEP_OPERAND_SIMM8P20
:
1130 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, buffer
);
1132 case MEP_OPERAND_SIMM8P4
:
1133 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s4
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, buffer
);
1135 case MEP_OPERAND_SP
:
1137 case MEP_OPERAND_SPR
:
1139 case MEP_OPERAND_TP
:
1141 case MEP_OPERAND_TPR
:
1143 case MEP_OPERAND_UDISP2
:
1144 errmsg
= insert_normal (cd
, fields
->f_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
1146 case MEP_OPERAND_UDISP7
:
1147 errmsg
= insert_normal (cd
, fields
->f_7u9
, 0, 0, 9, 7, 32, total_length
, buffer
);
1149 case MEP_OPERAND_UDISP7A2
:
1151 long value
= fields
->f_7u9a2
;
1152 value
= ((unsigned int) (value
) >> (1));
1153 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 6, 32, total_length
, buffer
);
1156 case MEP_OPERAND_UDISP7A4
:
1158 long value
= fields
->f_7u9a4
;
1159 value
= ((unsigned int) (value
) >> (2));
1160 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1163 case MEP_OPERAND_UIMM16
:
1164 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
1166 case MEP_OPERAND_UIMM2
:
1167 errmsg
= insert_normal (cd
, fields
->f_2u10
, 0, 0, 10, 2, 32, total_length
, buffer
);
1169 case MEP_OPERAND_UIMM24
:
1172 FLD (f_24u8n_hi
) = ((unsigned int) (FLD (f_24u8n
)) >> (8));
1173 FLD (f_24u8n_lo
) = ((FLD (f_24u8n
)) & (255));
1175 errmsg
= insert_normal (cd
, fields
->f_24u8n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1178 errmsg
= insert_normal (cd
, fields
->f_24u8n_lo
, 0, 0, 8, 8, 32, total_length
, buffer
);
1183 case MEP_OPERAND_UIMM3
:
1184 errmsg
= insert_normal (cd
, fields
->f_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
1186 case MEP_OPERAND_UIMM4
:
1187 errmsg
= insert_normal (cd
, fields
->f_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
1189 case MEP_OPERAND_UIMM5
:
1190 errmsg
= insert_normal (cd
, fields
->f_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
1192 case MEP_OPERAND_UIMM7A4
:
1194 long value
= fields
->f_7u9a4
;
1195 value
= ((unsigned int) (value
) >> (2));
1196 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1199 case MEP_OPERAND_ZERO
:
1203 /* xgettext:c-format */
1204 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
1212 int mep_cgen_extract_operand
1213 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
1215 /* Main entry point for operand extraction.
1216 The result is <= 0 for error, >0 for success.
1217 ??? Actual values aren't well defined right now.
1219 This function is basically just a big switch statement. Earlier versions
1220 used tables to look up the function to use, but
1221 - if the table contains both assembler and disassembler functions then
1222 the disassembler contains much of the assembler and vice-versa,
1223 - there's a lot of inlining possibilities as things grow,
1224 - using a switch statement avoids the function call overhead.
1226 This function could be moved into `print_insn_normal', but keeping it
1227 separate makes clear the interface between `print_insn_normal' and each of
1231 mep_cgen_extract_operand (CGEN_CPU_DESC cd
,
1233 CGEN_EXTRACT_INFO
*ex_info
,
1234 CGEN_INSN_INT insn_value
,
1235 CGEN_FIELDS
* fields
,
1238 /* Assume success (for those operands that are nops). */
1240 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
1244 case MEP_OPERAND_ADDR24A4
:
1246 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8a4n_hi
);
1247 if (length
<= 0) break;
1248 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 6, 32, total_length
, pc
, & fields
->f_24u8a4n_lo
);
1249 if (length
<= 0) break;
1250 FLD (f_24u8a4n
) = ((((FLD (f_24u8a4n_hi
)) << (8))) | (((FLD (f_24u8a4n_lo
)) << (2))));
1253 case MEP_OPERAND_C5RMUIMM20
:
1255 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_c5_rm
);
1256 if (length
<= 0) break;
1257 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1258 if (length
<= 0) break;
1260 FLD (f_c5_rmuimm20
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rm
)) << (16))));
1264 case MEP_OPERAND_C5RNMUIMM24
:
1266 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_c5_rnm
);
1267 if (length
<= 0) break;
1268 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1269 if (length
<= 0) break;
1271 FLD (f_c5_rnmuimm24
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rnm
)) << (16))));
1275 case MEP_OPERAND_CALLNUM
:
1277 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_5
);
1278 if (length
<= 0) break;
1279 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_6
);
1280 if (length
<= 0) break;
1281 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 1, 32, total_length
, pc
, & fields
->f_7
);
1282 if (length
<= 0) break;
1283 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_11
);
1284 if (length
<= 0) break;
1285 FLD (f_callnum
) = ((((FLD (f_5
)) << (3))) | (((((FLD (f_6
)) << (2))) | (((((FLD (f_7
)) << (1))) | (FLD (f_11
)))))));
1288 case MEP_OPERAND_CCCC
:
1289 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1291 case MEP_OPERAND_CCRN
:
1293 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ccrn_hi
);
1294 if (length
<= 0) break;
1295 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ccrn_lo
);
1296 if (length
<= 0) break;
1297 FLD (f_ccrn
) = ((((FLD (f_ccrn_hi
)) << (4))) | (FLD (f_ccrn_lo
)));
1300 case MEP_OPERAND_CDISP10
:
1303 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1304 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)));
1305 fields
->f_cdisp10
= value
;
1308 case MEP_OPERAND_CDISP10A2
:
1311 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1312 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)));
1313 fields
->f_cdisp10
= value
;
1316 case MEP_OPERAND_CDISP10A4
:
1319 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1320 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)));
1321 fields
->f_cdisp10
= value
;
1324 case MEP_OPERAND_CDISP10A8
:
1327 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1328 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)));
1329 fields
->f_cdisp10
= value
;
1332 case MEP_OPERAND_CDISP12
:
1333 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, pc
, & fields
->f_12s20
);
1335 case MEP_OPERAND_CIMM4
:
1336 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1338 case MEP_OPERAND_CIMM5
:
1339 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 5, 32, total_length
, pc
, & fields
->f_5u24
);
1341 case MEP_OPERAND_CODE16
:
1342 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1344 case MEP_OPERAND_CODE24
:
1346 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_24u4n_hi
);
1347 if (length
<= 0) break;
1348 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u4n_lo
);
1349 if (length
<= 0) break;
1350 FLD (f_24u4n
) = ((((FLD (f_24u4n_hi
)) << (16))) | (FLD (f_24u4n_lo
)));
1353 case MEP_OPERAND_CP_FLAG
:
1355 case MEP_OPERAND_CRN
:
1356 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1358 case MEP_OPERAND_CRN64
:
1359 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1361 case MEP_OPERAND_CRNX
:
1363 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1364 if (length
<= 0) break;
1365 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1366 if (length
<= 0) break;
1367 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1370 case MEP_OPERAND_CRNX64
:
1372 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1373 if (length
<= 0) break;
1374 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1375 if (length
<= 0) break;
1376 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1379 case MEP_OPERAND_CROC
:
1380 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1382 case MEP_OPERAND_CROP
:
1383 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1385 case MEP_OPERAND_CRPC
:
1386 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u26
);
1388 case MEP_OPERAND_CRPP
:
1389 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u18
);
1391 case MEP_OPERAND_CRQC
:
1392 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u21
);
1394 case MEP_OPERAND_CRQP
:
1395 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u13
);
1397 case MEP_OPERAND_CSRN
:
1399 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1400 if (length
<= 0) break;
1401 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1402 if (length
<= 0) break;
1403 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1406 case MEP_OPERAND_CSRN_IDX
:
1408 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1409 if (length
<= 0) break;
1410 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1411 if (length
<= 0) break;
1412 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1415 case MEP_OPERAND_DBG
:
1417 case MEP_OPERAND_DEPC
:
1419 case MEP_OPERAND_EPC
:
1421 case MEP_OPERAND_EXC
:
1423 case MEP_OPERAND_HI
:
1425 case MEP_OPERAND_IMM16P0
:
1427 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1428 if (length
<= 0) break;
1429 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1430 if (length
<= 0) break;
1432 FLD (f_ivc2_imm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1436 case MEP_OPERAND_IMM3P12
:
1437 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u12
);
1439 case MEP_OPERAND_IMM3P25
:
1440 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u25
);
1442 case MEP_OPERAND_IMM3P4
:
1443 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u4
);
1445 case MEP_OPERAND_IMM3P5
:
1446 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u5
);
1448 case MEP_OPERAND_IMM3P9
:
1449 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u9
);
1451 case MEP_OPERAND_IMM4P10
:
1452 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u10
);
1454 case MEP_OPERAND_IMM4P4
:
1455 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u4
);
1457 case MEP_OPERAND_IMM4P8
:
1458 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u8
);
1460 case MEP_OPERAND_IMM5P23
:
1461 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1463 case MEP_OPERAND_IMM5P3
:
1464 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u3
);
1466 case MEP_OPERAND_IMM5P7
:
1467 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1469 case MEP_OPERAND_IMM5P8
:
1470 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u8
);
1472 case MEP_OPERAND_IMM6P2
:
1473 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u2
);
1475 case MEP_OPERAND_IMM6P6
:
1476 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u6
);
1478 case MEP_OPERAND_IMM8P0
:
1479 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1481 case MEP_OPERAND_IMM8P20
:
1482 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1484 case MEP_OPERAND_IMM8P4
:
1485 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u4
);
1487 case MEP_OPERAND_IVC_X_0_2
:
1488 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u0
);
1490 case MEP_OPERAND_IVC_X_0_3
:
1491 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u0
);
1493 case MEP_OPERAND_IVC_X_0_4
:
1494 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u0
);
1496 case MEP_OPERAND_IVC_X_0_5
:
1497 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u0
);
1499 case MEP_OPERAND_IVC_X_6_1
:
1500 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_ivc2_1u6
);
1502 case MEP_OPERAND_IVC_X_6_2
:
1503 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u6
);
1505 case MEP_OPERAND_IVC_X_6_3
:
1506 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u6
);
1508 case MEP_OPERAND_IVC2_ACC0_0
:
1510 case MEP_OPERAND_IVC2_ACC0_1
:
1512 case MEP_OPERAND_IVC2_ACC0_2
:
1514 case MEP_OPERAND_IVC2_ACC0_3
:
1516 case MEP_OPERAND_IVC2_ACC0_4
:
1518 case MEP_OPERAND_IVC2_ACC0_5
:
1520 case MEP_OPERAND_IVC2_ACC0_6
:
1522 case MEP_OPERAND_IVC2_ACC0_7
:
1524 case MEP_OPERAND_IVC2_ACC1_0
:
1526 case MEP_OPERAND_IVC2_ACC1_1
:
1528 case MEP_OPERAND_IVC2_ACC1_2
:
1530 case MEP_OPERAND_IVC2_ACC1_3
:
1532 case MEP_OPERAND_IVC2_ACC1_4
:
1534 case MEP_OPERAND_IVC2_ACC1_5
:
1536 case MEP_OPERAND_IVC2_ACC1_6
:
1538 case MEP_OPERAND_IVC2_ACC1_7
:
1540 case MEP_OPERAND_IVC2_CC
:
1542 case MEP_OPERAND_IVC2_COFA0
:
1544 case MEP_OPERAND_IVC2_COFA1
:
1546 case MEP_OPERAND_IVC2_COFR0
:
1548 case MEP_OPERAND_IVC2_COFR1
:
1550 case MEP_OPERAND_IVC2_CSAR0
:
1552 case MEP_OPERAND_IVC2_CSAR1
:
1554 case MEP_OPERAND_IVC2C3CCRN
:
1556 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3hi
);
1557 if (length
<= 0) break;
1558 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3lo
);
1559 if (length
<= 0) break;
1560 FLD (f_ivc2_ccrn_c3
) = ((((FLD (f_ivc2_ccrn_c3hi
)) << (4))) | (FLD (f_ivc2_ccrn_c3lo
)));
1563 case MEP_OPERAND_IVC2CCRN
:
1565 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h2
);
1566 if (length
<= 0) break;
1567 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1568 if (length
<= 0) break;
1569 FLD (f_ivc2_ccrn
) = ((((FLD (f_ivc2_ccrn_h2
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1572 case MEP_OPERAND_IVC2CRN
:
1574 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h1
);
1575 if (length
<= 0) break;
1576 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1577 if (length
<= 0) break;
1578 FLD (f_ivc2_crnx
) = ((((FLD (f_ivc2_ccrn_h1
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1581 case MEP_OPERAND_IVC2RM
:
1582 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_crm
);
1584 case MEP_OPERAND_LO
:
1586 case MEP_OPERAND_LP
:
1588 case MEP_OPERAND_MB0
:
1590 case MEP_OPERAND_MB1
:
1592 case MEP_OPERAND_ME0
:
1594 case MEP_OPERAND_ME1
:
1596 case MEP_OPERAND_NPC
:
1598 case MEP_OPERAND_OPT
:
1600 case MEP_OPERAND_PCABS24A2
:
1602 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u5a2n_hi
);
1603 if (length
<= 0) break;
1604 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 7, 32, total_length
, pc
, & fields
->f_24u5a2n_lo
);
1605 if (length
<= 0) break;
1606 FLD (f_24u5a2n
) = ((((FLD (f_24u5a2n_hi
)) << (8))) | (((FLD (f_24u5a2n_lo
)) << (1))));
1609 case MEP_OPERAND_PCREL12A2
:
1612 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
);
1613 value
= ((((value
) << (1))) + (pc
));
1614 fields
->f_12s4a2
= value
;
1617 case MEP_OPERAND_PCREL17A2
:
1620 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
);
1621 value
= ((((value
) << (1))) + (pc
));
1622 fields
->f_17s16a2
= value
;
1625 case MEP_OPERAND_PCREL24A2
:
1627 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
);
1628 if (length
<= 0) break;
1629 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
);
1630 if (length
<= 0) break;
1631 FLD (f_24s5a2n
) = ((((((FLD (f_24s5a2n_hi
)) << (8))) | (((FLD (f_24s5a2n_lo
)) << (1))))) + (pc
));
1634 case MEP_OPERAND_PCREL8A2
:
1637 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
);
1638 value
= ((((value
) << (1))) + (pc
));
1639 fields
->f_8s8a2
= value
;
1642 case MEP_OPERAND_PSW
:
1644 case MEP_OPERAND_R0
:
1646 case MEP_OPERAND_R1
:
1648 case MEP_OPERAND_RL
:
1649 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 4, 32, total_length
, pc
, & fields
->f_rl
);
1651 case MEP_OPERAND_RL5
:
1652 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 4, 32, total_length
, pc
, & fields
->f_rl5
);
1654 case MEP_OPERAND_RM
:
1655 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1657 case MEP_OPERAND_RMA
:
1658 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1660 case MEP_OPERAND_RN
:
1661 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1663 case MEP_OPERAND_RN3
:
1664 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1666 case MEP_OPERAND_RN3C
:
1667 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1669 case MEP_OPERAND_RN3L
:
1670 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1672 case MEP_OPERAND_RN3S
:
1673 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1675 case MEP_OPERAND_RN3UC
:
1676 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1678 case MEP_OPERAND_RN3UL
:
1679 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1681 case MEP_OPERAND_RN3US
:
1682 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1684 case MEP_OPERAND_RNC
:
1685 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1687 case MEP_OPERAND_RNL
:
1688 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1690 case MEP_OPERAND_RNS
:
1691 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1693 case MEP_OPERAND_RNUC
:
1694 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1696 case MEP_OPERAND_RNUL
:
1697 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1699 case MEP_OPERAND_RNUS
:
1700 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1702 case MEP_OPERAND_SAR
:
1704 case MEP_OPERAND_SDISP16
:
1705 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1707 case MEP_OPERAND_SIMM16
:
1708 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1710 case MEP_OPERAND_SIMM16P0
:
1712 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1713 if (length
<= 0) break;
1714 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1715 if (length
<= 0) break;
1717 FLD (f_ivc2_simm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1721 case MEP_OPERAND_SIMM6
:
1722 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, pc
, & fields
->f_6s8
);
1724 case MEP_OPERAND_SIMM8
:
1725 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, pc
, & fields
->f_8s8
);
1727 case MEP_OPERAND_SIMM8P0
:
1728 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s0
);
1730 case MEP_OPERAND_SIMM8P20
:
1731 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s20
);
1733 case MEP_OPERAND_SIMM8P4
:
1734 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s4
);
1736 case MEP_OPERAND_SP
:
1738 case MEP_OPERAND_SPR
:
1740 case MEP_OPERAND_TP
:
1742 case MEP_OPERAND_TPR
:
1744 case MEP_OPERAND_UDISP2
:
1745 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_2u6
);
1747 case MEP_OPERAND_UDISP7
:
1748 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_7u9
);
1750 case MEP_OPERAND_UDISP7A2
:
1753 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 6, 32, total_length
, pc
, & value
);
1754 value
= ((value
) << (1));
1755 fields
->f_7u9a2
= value
;
1758 case MEP_OPERAND_UDISP7A4
:
1761 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1762 value
= ((value
) << (2));
1763 fields
->f_7u9a4
= value
;
1766 case MEP_OPERAND_UIMM16
:
1767 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1769 case MEP_OPERAND_UIMM2
:
1770 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 2, 32, total_length
, pc
, & fields
->f_2u10
);
1772 case MEP_OPERAND_UIMM24
:
1774 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8n_hi
);
1775 if (length
<= 0) break;
1776 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_24u8n_lo
);
1777 if (length
<= 0) break;
1778 FLD (f_24u8n
) = ((((FLD (f_24u8n_hi
)) << (8))) | (FLD (f_24u8n_lo
)));
1781 case MEP_OPERAND_UIMM3
:
1782 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_3u5
);
1784 case MEP_OPERAND_UIMM4
:
1785 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_4u8
);
1787 case MEP_OPERAND_UIMM5
:
1788 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_5u8
);
1790 case MEP_OPERAND_UIMM7A4
:
1793 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1794 value
= ((value
) << (2));
1795 fields
->f_7u9a4
= value
;
1798 case MEP_OPERAND_ZERO
:
1802 /* xgettext:c-format */
1803 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1811 cgen_insert_fn
* const mep_cgen_insert_handlers
[] =
1816 cgen_extract_fn
* const mep_cgen_extract_handlers
[] =
1818 extract_insn_normal
,
1821 int mep_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1822 bfd_vma
mep_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1824 /* Getting values from cgen_fields is handled by a collection of functions.
1825 They are distinguished by the type of the VALUE argument they return.
1826 TODO: floating point, inlining support, remove cases where result type
1830 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1832 const CGEN_FIELDS
* fields
)
1838 case MEP_OPERAND_ADDR24A4
:
1839 value
= fields
->f_24u8a4n
;
1841 case MEP_OPERAND_C5RMUIMM20
:
1842 value
= fields
->f_c5_rmuimm20
;
1844 case MEP_OPERAND_C5RNMUIMM24
:
1845 value
= fields
->f_c5_rnmuimm24
;
1847 case MEP_OPERAND_CALLNUM
:
1848 value
= fields
->f_callnum
;
1850 case MEP_OPERAND_CCCC
:
1851 value
= fields
->f_rm
;
1853 case MEP_OPERAND_CCRN
:
1854 value
= fields
->f_ccrn
;
1856 case MEP_OPERAND_CDISP10
:
1857 value
= fields
->f_cdisp10
;
1859 case MEP_OPERAND_CDISP10A2
:
1860 value
= fields
->f_cdisp10
;
1862 case MEP_OPERAND_CDISP10A4
:
1863 value
= fields
->f_cdisp10
;
1865 case MEP_OPERAND_CDISP10A8
:
1866 value
= fields
->f_cdisp10
;
1868 case MEP_OPERAND_CDISP12
:
1869 value
= fields
->f_12s20
;
1871 case MEP_OPERAND_CIMM4
:
1872 value
= fields
->f_rn
;
1874 case MEP_OPERAND_CIMM5
:
1875 value
= fields
->f_5u24
;
1877 case MEP_OPERAND_CODE16
:
1878 value
= fields
->f_16u16
;
1880 case MEP_OPERAND_CODE24
:
1881 value
= fields
->f_24u4n
;
1883 case MEP_OPERAND_CP_FLAG
:
1886 case MEP_OPERAND_CRN
:
1887 value
= fields
->f_crn
;
1889 case MEP_OPERAND_CRN64
:
1890 value
= fields
->f_crn
;
1892 case MEP_OPERAND_CRNX
:
1893 value
= fields
->f_crnx
;
1895 case MEP_OPERAND_CRNX64
:
1896 value
= fields
->f_crnx
;
1898 case MEP_OPERAND_CROC
:
1899 value
= fields
->f_ivc2_5u7
;
1901 case MEP_OPERAND_CROP
:
1902 value
= fields
->f_ivc2_5u23
;
1904 case MEP_OPERAND_CRPC
:
1905 value
= fields
->f_ivc2_5u26
;
1907 case MEP_OPERAND_CRPP
:
1908 value
= fields
->f_ivc2_5u18
;
1910 case MEP_OPERAND_CRQC
:
1911 value
= fields
->f_ivc2_5u21
;
1913 case MEP_OPERAND_CRQP
:
1914 value
= fields
->f_ivc2_5u13
;
1916 case MEP_OPERAND_CSRN
:
1917 value
= fields
->f_csrn
;
1919 case MEP_OPERAND_CSRN_IDX
:
1920 value
= fields
->f_csrn
;
1922 case MEP_OPERAND_DBG
:
1925 case MEP_OPERAND_DEPC
:
1928 case MEP_OPERAND_EPC
:
1931 case MEP_OPERAND_EXC
:
1934 case MEP_OPERAND_HI
:
1937 case MEP_OPERAND_IMM16P0
:
1938 value
= fields
->f_ivc2_imm16p0
;
1940 case MEP_OPERAND_IMM3P12
:
1941 value
= fields
->f_ivc2_3u12
;
1943 case MEP_OPERAND_IMM3P25
:
1944 value
= fields
->f_ivc2_3u25
;
1946 case MEP_OPERAND_IMM3P4
:
1947 value
= fields
->f_ivc2_3u4
;
1949 case MEP_OPERAND_IMM3P5
:
1950 value
= fields
->f_ivc2_3u5
;
1952 case MEP_OPERAND_IMM3P9
:
1953 value
= fields
->f_ivc2_3u9
;
1955 case MEP_OPERAND_IMM4P10
:
1956 value
= fields
->f_ivc2_4u10
;
1958 case MEP_OPERAND_IMM4P4
:
1959 value
= fields
->f_ivc2_4u4
;
1961 case MEP_OPERAND_IMM4P8
:
1962 value
= fields
->f_ivc2_4u8
;
1964 case MEP_OPERAND_IMM5P23
:
1965 value
= fields
->f_ivc2_5u23
;
1967 case MEP_OPERAND_IMM5P3
:
1968 value
= fields
->f_ivc2_5u3
;
1970 case MEP_OPERAND_IMM5P7
:
1971 value
= fields
->f_ivc2_5u7
;
1973 case MEP_OPERAND_IMM5P8
:
1974 value
= fields
->f_ivc2_5u8
;
1976 case MEP_OPERAND_IMM6P2
:
1977 value
= fields
->f_ivc2_6u2
;
1979 case MEP_OPERAND_IMM6P6
:
1980 value
= fields
->f_ivc2_6u6
;
1982 case MEP_OPERAND_IMM8P0
:
1983 value
= fields
->f_ivc2_8u0
;
1985 case MEP_OPERAND_IMM8P20
:
1986 value
= fields
->f_ivc2_8u20
;
1988 case MEP_OPERAND_IMM8P4
:
1989 value
= fields
->f_ivc2_8u4
;
1991 case MEP_OPERAND_IVC_X_0_2
:
1992 value
= fields
->f_ivc2_2u0
;
1994 case MEP_OPERAND_IVC_X_0_3
:
1995 value
= fields
->f_ivc2_3u0
;
1997 case MEP_OPERAND_IVC_X_0_4
:
1998 value
= fields
->f_ivc2_4u0
;
2000 case MEP_OPERAND_IVC_X_0_5
:
2001 value
= fields
->f_ivc2_5u0
;
2003 case MEP_OPERAND_IVC_X_6_1
:
2004 value
= fields
->f_ivc2_1u6
;
2006 case MEP_OPERAND_IVC_X_6_2
:
2007 value
= fields
->f_ivc2_2u6
;
2009 case MEP_OPERAND_IVC_X_6_3
:
2010 value
= fields
->f_ivc2_3u6
;
2012 case MEP_OPERAND_IVC2_ACC0_0
:
2015 case MEP_OPERAND_IVC2_ACC0_1
:
2018 case MEP_OPERAND_IVC2_ACC0_2
:
2021 case MEP_OPERAND_IVC2_ACC0_3
:
2024 case MEP_OPERAND_IVC2_ACC0_4
:
2027 case MEP_OPERAND_IVC2_ACC0_5
:
2030 case MEP_OPERAND_IVC2_ACC0_6
:
2033 case MEP_OPERAND_IVC2_ACC0_7
:
2036 case MEP_OPERAND_IVC2_ACC1_0
:
2039 case MEP_OPERAND_IVC2_ACC1_1
:
2042 case MEP_OPERAND_IVC2_ACC1_2
:
2045 case MEP_OPERAND_IVC2_ACC1_3
:
2048 case MEP_OPERAND_IVC2_ACC1_4
:
2051 case MEP_OPERAND_IVC2_ACC1_5
:
2054 case MEP_OPERAND_IVC2_ACC1_6
:
2057 case MEP_OPERAND_IVC2_ACC1_7
:
2060 case MEP_OPERAND_IVC2_CC
:
2063 case MEP_OPERAND_IVC2_COFA0
:
2066 case MEP_OPERAND_IVC2_COFA1
:
2069 case MEP_OPERAND_IVC2_COFR0
:
2072 case MEP_OPERAND_IVC2_COFR1
:
2075 case MEP_OPERAND_IVC2_CSAR0
:
2078 case MEP_OPERAND_IVC2_CSAR1
:
2081 case MEP_OPERAND_IVC2C3CCRN
:
2082 value
= fields
->f_ivc2_ccrn_c3
;
2084 case MEP_OPERAND_IVC2CCRN
:
2085 value
= fields
->f_ivc2_ccrn
;
2087 case MEP_OPERAND_IVC2CRN
:
2088 value
= fields
->f_ivc2_crnx
;
2090 case MEP_OPERAND_IVC2RM
:
2091 value
= fields
->f_ivc2_crm
;
2093 case MEP_OPERAND_LO
:
2096 case MEP_OPERAND_LP
:
2099 case MEP_OPERAND_MB0
:
2102 case MEP_OPERAND_MB1
:
2105 case MEP_OPERAND_ME0
:
2108 case MEP_OPERAND_ME1
:
2111 case MEP_OPERAND_NPC
:
2114 case MEP_OPERAND_OPT
:
2117 case MEP_OPERAND_PCABS24A2
:
2118 value
= fields
->f_24u5a2n
;
2120 case MEP_OPERAND_PCREL12A2
:
2121 value
= fields
->f_12s4a2
;
2123 case MEP_OPERAND_PCREL17A2
:
2124 value
= fields
->f_17s16a2
;
2126 case MEP_OPERAND_PCREL24A2
:
2127 value
= fields
->f_24s5a2n
;
2129 case MEP_OPERAND_PCREL8A2
:
2130 value
= fields
->f_8s8a2
;
2132 case MEP_OPERAND_PSW
:
2135 case MEP_OPERAND_R0
:
2138 case MEP_OPERAND_R1
:
2141 case MEP_OPERAND_RL
:
2142 value
= fields
->f_rl
;
2144 case MEP_OPERAND_RL5
:
2145 value
= fields
->f_rl5
;
2147 case MEP_OPERAND_RM
:
2148 value
= fields
->f_rm
;
2150 case MEP_OPERAND_RMA
:
2151 value
= fields
->f_rm
;
2153 case MEP_OPERAND_RN
:
2154 value
= fields
->f_rn
;
2156 case MEP_OPERAND_RN3
:
2157 value
= fields
->f_rn3
;
2159 case MEP_OPERAND_RN3C
:
2160 value
= fields
->f_rn3
;
2162 case MEP_OPERAND_RN3L
:
2163 value
= fields
->f_rn3
;
2165 case MEP_OPERAND_RN3S
:
2166 value
= fields
->f_rn3
;
2168 case MEP_OPERAND_RN3UC
:
2169 value
= fields
->f_rn3
;
2171 case MEP_OPERAND_RN3UL
:
2172 value
= fields
->f_rn3
;
2174 case MEP_OPERAND_RN3US
:
2175 value
= fields
->f_rn3
;
2177 case MEP_OPERAND_RNC
:
2178 value
= fields
->f_rn
;
2180 case MEP_OPERAND_RNL
:
2181 value
= fields
->f_rn
;
2183 case MEP_OPERAND_RNS
:
2184 value
= fields
->f_rn
;
2186 case MEP_OPERAND_RNUC
:
2187 value
= fields
->f_rn
;
2189 case MEP_OPERAND_RNUL
:
2190 value
= fields
->f_rn
;
2192 case MEP_OPERAND_RNUS
:
2193 value
= fields
->f_rn
;
2195 case MEP_OPERAND_SAR
:
2198 case MEP_OPERAND_SDISP16
:
2199 value
= fields
->f_16s16
;
2201 case MEP_OPERAND_SIMM16
:
2202 value
= fields
->f_16s16
;
2204 case MEP_OPERAND_SIMM16P0
:
2205 value
= fields
->f_ivc2_simm16p0
;
2207 case MEP_OPERAND_SIMM6
:
2208 value
= fields
->f_6s8
;
2210 case MEP_OPERAND_SIMM8
:
2211 value
= fields
->f_8s8
;
2213 case MEP_OPERAND_SIMM8P0
:
2214 value
= fields
->f_ivc2_8s0
;
2216 case MEP_OPERAND_SIMM8P20
:
2217 value
= fields
->f_ivc2_8s20
;
2219 case MEP_OPERAND_SIMM8P4
:
2220 value
= fields
->f_ivc2_8s4
;
2222 case MEP_OPERAND_SP
:
2225 case MEP_OPERAND_SPR
:
2228 case MEP_OPERAND_TP
:
2231 case MEP_OPERAND_TPR
:
2234 case MEP_OPERAND_UDISP2
:
2235 value
= fields
->f_2u6
;
2237 case MEP_OPERAND_UDISP7
:
2238 value
= fields
->f_7u9
;
2240 case MEP_OPERAND_UDISP7A2
:
2241 value
= fields
->f_7u9a2
;
2243 case MEP_OPERAND_UDISP7A4
:
2244 value
= fields
->f_7u9a4
;
2246 case MEP_OPERAND_UIMM16
:
2247 value
= fields
->f_16u16
;
2249 case MEP_OPERAND_UIMM2
:
2250 value
= fields
->f_2u10
;
2252 case MEP_OPERAND_UIMM24
:
2253 value
= fields
->f_24u8n
;
2255 case MEP_OPERAND_UIMM3
:
2256 value
= fields
->f_3u5
;
2258 case MEP_OPERAND_UIMM4
:
2259 value
= fields
->f_4u8
;
2261 case MEP_OPERAND_UIMM5
:
2262 value
= fields
->f_5u8
;
2264 case MEP_OPERAND_UIMM7A4
:
2265 value
= fields
->f_7u9a4
;
2267 case MEP_OPERAND_ZERO
:
2272 /* xgettext:c-format */
2273 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
2282 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2284 const CGEN_FIELDS
* fields
)
2290 case MEP_OPERAND_ADDR24A4
:
2291 value
= fields
->f_24u8a4n
;
2293 case MEP_OPERAND_C5RMUIMM20
:
2294 value
= fields
->f_c5_rmuimm20
;
2296 case MEP_OPERAND_C5RNMUIMM24
:
2297 value
= fields
->f_c5_rnmuimm24
;
2299 case MEP_OPERAND_CALLNUM
:
2300 value
= fields
->f_callnum
;
2302 case MEP_OPERAND_CCCC
:
2303 value
= fields
->f_rm
;
2305 case MEP_OPERAND_CCRN
:
2306 value
= fields
->f_ccrn
;
2308 case MEP_OPERAND_CDISP10
:
2309 value
= fields
->f_cdisp10
;
2311 case MEP_OPERAND_CDISP10A2
:
2312 value
= fields
->f_cdisp10
;
2314 case MEP_OPERAND_CDISP10A4
:
2315 value
= fields
->f_cdisp10
;
2317 case MEP_OPERAND_CDISP10A8
:
2318 value
= fields
->f_cdisp10
;
2320 case MEP_OPERAND_CDISP12
:
2321 value
= fields
->f_12s20
;
2323 case MEP_OPERAND_CIMM4
:
2324 value
= fields
->f_rn
;
2326 case MEP_OPERAND_CIMM5
:
2327 value
= fields
->f_5u24
;
2329 case MEP_OPERAND_CODE16
:
2330 value
= fields
->f_16u16
;
2332 case MEP_OPERAND_CODE24
:
2333 value
= fields
->f_24u4n
;
2335 case MEP_OPERAND_CP_FLAG
:
2338 case MEP_OPERAND_CRN
:
2339 value
= fields
->f_crn
;
2341 case MEP_OPERAND_CRN64
:
2342 value
= fields
->f_crn
;
2344 case MEP_OPERAND_CRNX
:
2345 value
= fields
->f_crnx
;
2347 case MEP_OPERAND_CRNX64
:
2348 value
= fields
->f_crnx
;
2350 case MEP_OPERAND_CROC
:
2351 value
= fields
->f_ivc2_5u7
;
2353 case MEP_OPERAND_CROP
:
2354 value
= fields
->f_ivc2_5u23
;
2356 case MEP_OPERAND_CRPC
:
2357 value
= fields
->f_ivc2_5u26
;
2359 case MEP_OPERAND_CRPP
:
2360 value
= fields
->f_ivc2_5u18
;
2362 case MEP_OPERAND_CRQC
:
2363 value
= fields
->f_ivc2_5u21
;
2365 case MEP_OPERAND_CRQP
:
2366 value
= fields
->f_ivc2_5u13
;
2368 case MEP_OPERAND_CSRN
:
2369 value
= fields
->f_csrn
;
2371 case MEP_OPERAND_CSRN_IDX
:
2372 value
= fields
->f_csrn
;
2374 case MEP_OPERAND_DBG
:
2377 case MEP_OPERAND_DEPC
:
2380 case MEP_OPERAND_EPC
:
2383 case MEP_OPERAND_EXC
:
2386 case MEP_OPERAND_HI
:
2389 case MEP_OPERAND_IMM16P0
:
2390 value
= fields
->f_ivc2_imm16p0
;
2392 case MEP_OPERAND_IMM3P12
:
2393 value
= fields
->f_ivc2_3u12
;
2395 case MEP_OPERAND_IMM3P25
:
2396 value
= fields
->f_ivc2_3u25
;
2398 case MEP_OPERAND_IMM3P4
:
2399 value
= fields
->f_ivc2_3u4
;
2401 case MEP_OPERAND_IMM3P5
:
2402 value
= fields
->f_ivc2_3u5
;
2404 case MEP_OPERAND_IMM3P9
:
2405 value
= fields
->f_ivc2_3u9
;
2407 case MEP_OPERAND_IMM4P10
:
2408 value
= fields
->f_ivc2_4u10
;
2410 case MEP_OPERAND_IMM4P4
:
2411 value
= fields
->f_ivc2_4u4
;
2413 case MEP_OPERAND_IMM4P8
:
2414 value
= fields
->f_ivc2_4u8
;
2416 case MEP_OPERAND_IMM5P23
:
2417 value
= fields
->f_ivc2_5u23
;
2419 case MEP_OPERAND_IMM5P3
:
2420 value
= fields
->f_ivc2_5u3
;
2422 case MEP_OPERAND_IMM5P7
:
2423 value
= fields
->f_ivc2_5u7
;
2425 case MEP_OPERAND_IMM5P8
:
2426 value
= fields
->f_ivc2_5u8
;
2428 case MEP_OPERAND_IMM6P2
:
2429 value
= fields
->f_ivc2_6u2
;
2431 case MEP_OPERAND_IMM6P6
:
2432 value
= fields
->f_ivc2_6u6
;
2434 case MEP_OPERAND_IMM8P0
:
2435 value
= fields
->f_ivc2_8u0
;
2437 case MEP_OPERAND_IMM8P20
:
2438 value
= fields
->f_ivc2_8u20
;
2440 case MEP_OPERAND_IMM8P4
:
2441 value
= fields
->f_ivc2_8u4
;
2443 case MEP_OPERAND_IVC_X_0_2
:
2444 value
= fields
->f_ivc2_2u0
;
2446 case MEP_OPERAND_IVC_X_0_3
:
2447 value
= fields
->f_ivc2_3u0
;
2449 case MEP_OPERAND_IVC_X_0_4
:
2450 value
= fields
->f_ivc2_4u0
;
2452 case MEP_OPERAND_IVC_X_0_5
:
2453 value
= fields
->f_ivc2_5u0
;
2455 case MEP_OPERAND_IVC_X_6_1
:
2456 value
= fields
->f_ivc2_1u6
;
2458 case MEP_OPERAND_IVC_X_6_2
:
2459 value
= fields
->f_ivc2_2u6
;
2461 case MEP_OPERAND_IVC_X_6_3
:
2462 value
= fields
->f_ivc2_3u6
;
2464 case MEP_OPERAND_IVC2_ACC0_0
:
2467 case MEP_OPERAND_IVC2_ACC0_1
:
2470 case MEP_OPERAND_IVC2_ACC0_2
:
2473 case MEP_OPERAND_IVC2_ACC0_3
:
2476 case MEP_OPERAND_IVC2_ACC0_4
:
2479 case MEP_OPERAND_IVC2_ACC0_5
:
2482 case MEP_OPERAND_IVC2_ACC0_6
:
2485 case MEP_OPERAND_IVC2_ACC0_7
:
2488 case MEP_OPERAND_IVC2_ACC1_0
:
2491 case MEP_OPERAND_IVC2_ACC1_1
:
2494 case MEP_OPERAND_IVC2_ACC1_2
:
2497 case MEP_OPERAND_IVC2_ACC1_3
:
2500 case MEP_OPERAND_IVC2_ACC1_4
:
2503 case MEP_OPERAND_IVC2_ACC1_5
:
2506 case MEP_OPERAND_IVC2_ACC1_6
:
2509 case MEP_OPERAND_IVC2_ACC1_7
:
2512 case MEP_OPERAND_IVC2_CC
:
2515 case MEP_OPERAND_IVC2_COFA0
:
2518 case MEP_OPERAND_IVC2_COFA1
:
2521 case MEP_OPERAND_IVC2_COFR0
:
2524 case MEP_OPERAND_IVC2_COFR1
:
2527 case MEP_OPERAND_IVC2_CSAR0
:
2530 case MEP_OPERAND_IVC2_CSAR1
:
2533 case MEP_OPERAND_IVC2C3CCRN
:
2534 value
= fields
->f_ivc2_ccrn_c3
;
2536 case MEP_OPERAND_IVC2CCRN
:
2537 value
= fields
->f_ivc2_ccrn
;
2539 case MEP_OPERAND_IVC2CRN
:
2540 value
= fields
->f_ivc2_crnx
;
2542 case MEP_OPERAND_IVC2RM
:
2543 value
= fields
->f_ivc2_crm
;
2545 case MEP_OPERAND_LO
:
2548 case MEP_OPERAND_LP
:
2551 case MEP_OPERAND_MB0
:
2554 case MEP_OPERAND_MB1
:
2557 case MEP_OPERAND_ME0
:
2560 case MEP_OPERAND_ME1
:
2563 case MEP_OPERAND_NPC
:
2566 case MEP_OPERAND_OPT
:
2569 case MEP_OPERAND_PCABS24A2
:
2570 value
= fields
->f_24u5a2n
;
2572 case MEP_OPERAND_PCREL12A2
:
2573 value
= fields
->f_12s4a2
;
2575 case MEP_OPERAND_PCREL17A2
:
2576 value
= fields
->f_17s16a2
;
2578 case MEP_OPERAND_PCREL24A2
:
2579 value
= fields
->f_24s5a2n
;
2581 case MEP_OPERAND_PCREL8A2
:
2582 value
= fields
->f_8s8a2
;
2584 case MEP_OPERAND_PSW
:
2587 case MEP_OPERAND_R0
:
2590 case MEP_OPERAND_R1
:
2593 case MEP_OPERAND_RL
:
2594 value
= fields
->f_rl
;
2596 case MEP_OPERAND_RL5
:
2597 value
= fields
->f_rl5
;
2599 case MEP_OPERAND_RM
:
2600 value
= fields
->f_rm
;
2602 case MEP_OPERAND_RMA
:
2603 value
= fields
->f_rm
;
2605 case MEP_OPERAND_RN
:
2606 value
= fields
->f_rn
;
2608 case MEP_OPERAND_RN3
:
2609 value
= fields
->f_rn3
;
2611 case MEP_OPERAND_RN3C
:
2612 value
= fields
->f_rn3
;
2614 case MEP_OPERAND_RN3L
:
2615 value
= fields
->f_rn3
;
2617 case MEP_OPERAND_RN3S
:
2618 value
= fields
->f_rn3
;
2620 case MEP_OPERAND_RN3UC
:
2621 value
= fields
->f_rn3
;
2623 case MEP_OPERAND_RN3UL
:
2624 value
= fields
->f_rn3
;
2626 case MEP_OPERAND_RN3US
:
2627 value
= fields
->f_rn3
;
2629 case MEP_OPERAND_RNC
:
2630 value
= fields
->f_rn
;
2632 case MEP_OPERAND_RNL
:
2633 value
= fields
->f_rn
;
2635 case MEP_OPERAND_RNS
:
2636 value
= fields
->f_rn
;
2638 case MEP_OPERAND_RNUC
:
2639 value
= fields
->f_rn
;
2641 case MEP_OPERAND_RNUL
:
2642 value
= fields
->f_rn
;
2644 case MEP_OPERAND_RNUS
:
2645 value
= fields
->f_rn
;
2647 case MEP_OPERAND_SAR
:
2650 case MEP_OPERAND_SDISP16
:
2651 value
= fields
->f_16s16
;
2653 case MEP_OPERAND_SIMM16
:
2654 value
= fields
->f_16s16
;
2656 case MEP_OPERAND_SIMM16P0
:
2657 value
= fields
->f_ivc2_simm16p0
;
2659 case MEP_OPERAND_SIMM6
:
2660 value
= fields
->f_6s8
;
2662 case MEP_OPERAND_SIMM8
:
2663 value
= fields
->f_8s8
;
2665 case MEP_OPERAND_SIMM8P0
:
2666 value
= fields
->f_ivc2_8s0
;
2668 case MEP_OPERAND_SIMM8P20
:
2669 value
= fields
->f_ivc2_8s20
;
2671 case MEP_OPERAND_SIMM8P4
:
2672 value
= fields
->f_ivc2_8s4
;
2674 case MEP_OPERAND_SP
:
2677 case MEP_OPERAND_SPR
:
2680 case MEP_OPERAND_TP
:
2683 case MEP_OPERAND_TPR
:
2686 case MEP_OPERAND_UDISP2
:
2687 value
= fields
->f_2u6
;
2689 case MEP_OPERAND_UDISP7
:
2690 value
= fields
->f_7u9
;
2692 case MEP_OPERAND_UDISP7A2
:
2693 value
= fields
->f_7u9a2
;
2695 case MEP_OPERAND_UDISP7A4
:
2696 value
= fields
->f_7u9a4
;
2698 case MEP_OPERAND_UIMM16
:
2699 value
= fields
->f_16u16
;
2701 case MEP_OPERAND_UIMM2
:
2702 value
= fields
->f_2u10
;
2704 case MEP_OPERAND_UIMM24
:
2705 value
= fields
->f_24u8n
;
2707 case MEP_OPERAND_UIMM3
:
2708 value
= fields
->f_3u5
;
2710 case MEP_OPERAND_UIMM4
:
2711 value
= fields
->f_4u8
;
2713 case MEP_OPERAND_UIMM5
:
2714 value
= fields
->f_5u8
;
2716 case MEP_OPERAND_UIMM7A4
:
2717 value
= fields
->f_7u9a4
;
2719 case MEP_OPERAND_ZERO
:
2724 /* xgettext:c-format */
2725 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
2733 void mep_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
2734 void mep_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
2736 /* Stuffing values in cgen_fields is handled by a collection of functions.
2737 They are distinguished by the type of the VALUE argument they accept.
2738 TODO: floating point, inlining support, remove cases where argument type
2742 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2744 CGEN_FIELDS
* fields
,
2749 case MEP_OPERAND_ADDR24A4
:
2750 fields
->f_24u8a4n
= value
;
2752 case MEP_OPERAND_C5RMUIMM20
:
2753 fields
->f_c5_rmuimm20
= value
;
2755 case MEP_OPERAND_C5RNMUIMM24
:
2756 fields
->f_c5_rnmuimm24
= value
;
2758 case MEP_OPERAND_CALLNUM
:
2759 fields
->f_callnum
= value
;
2761 case MEP_OPERAND_CCCC
:
2762 fields
->f_rm
= value
;
2764 case MEP_OPERAND_CCRN
:
2765 fields
->f_ccrn
= value
;
2767 case MEP_OPERAND_CDISP10
:
2768 fields
->f_cdisp10
= value
;
2770 case MEP_OPERAND_CDISP10A2
:
2771 fields
->f_cdisp10
= value
;
2773 case MEP_OPERAND_CDISP10A4
:
2774 fields
->f_cdisp10
= value
;
2776 case MEP_OPERAND_CDISP10A8
:
2777 fields
->f_cdisp10
= value
;
2779 case MEP_OPERAND_CDISP12
:
2780 fields
->f_12s20
= value
;
2782 case MEP_OPERAND_CIMM4
:
2783 fields
->f_rn
= value
;
2785 case MEP_OPERAND_CIMM5
:
2786 fields
->f_5u24
= value
;
2788 case MEP_OPERAND_CODE16
:
2789 fields
->f_16u16
= value
;
2791 case MEP_OPERAND_CODE24
:
2792 fields
->f_24u4n
= value
;
2794 case MEP_OPERAND_CP_FLAG
:
2796 case MEP_OPERAND_CRN
:
2797 fields
->f_crn
= value
;
2799 case MEP_OPERAND_CRN64
:
2800 fields
->f_crn
= value
;
2802 case MEP_OPERAND_CRNX
:
2803 fields
->f_crnx
= value
;
2805 case MEP_OPERAND_CRNX64
:
2806 fields
->f_crnx
= value
;
2808 case MEP_OPERAND_CROC
:
2809 fields
->f_ivc2_5u7
= value
;
2811 case MEP_OPERAND_CROP
:
2812 fields
->f_ivc2_5u23
= value
;
2814 case MEP_OPERAND_CRPC
:
2815 fields
->f_ivc2_5u26
= value
;
2817 case MEP_OPERAND_CRPP
:
2818 fields
->f_ivc2_5u18
= value
;
2820 case MEP_OPERAND_CRQC
:
2821 fields
->f_ivc2_5u21
= value
;
2823 case MEP_OPERAND_CRQP
:
2824 fields
->f_ivc2_5u13
= value
;
2826 case MEP_OPERAND_CSRN
:
2827 fields
->f_csrn
= value
;
2829 case MEP_OPERAND_CSRN_IDX
:
2830 fields
->f_csrn
= value
;
2832 case MEP_OPERAND_DBG
:
2834 case MEP_OPERAND_DEPC
:
2836 case MEP_OPERAND_EPC
:
2838 case MEP_OPERAND_EXC
:
2840 case MEP_OPERAND_HI
:
2842 case MEP_OPERAND_IMM16P0
:
2843 fields
->f_ivc2_imm16p0
= value
;
2845 case MEP_OPERAND_IMM3P12
:
2846 fields
->f_ivc2_3u12
= value
;
2848 case MEP_OPERAND_IMM3P25
:
2849 fields
->f_ivc2_3u25
= value
;
2851 case MEP_OPERAND_IMM3P4
:
2852 fields
->f_ivc2_3u4
= value
;
2854 case MEP_OPERAND_IMM3P5
:
2855 fields
->f_ivc2_3u5
= value
;
2857 case MEP_OPERAND_IMM3P9
:
2858 fields
->f_ivc2_3u9
= value
;
2860 case MEP_OPERAND_IMM4P10
:
2861 fields
->f_ivc2_4u10
= value
;
2863 case MEP_OPERAND_IMM4P4
:
2864 fields
->f_ivc2_4u4
= value
;
2866 case MEP_OPERAND_IMM4P8
:
2867 fields
->f_ivc2_4u8
= value
;
2869 case MEP_OPERAND_IMM5P23
:
2870 fields
->f_ivc2_5u23
= value
;
2872 case MEP_OPERAND_IMM5P3
:
2873 fields
->f_ivc2_5u3
= value
;
2875 case MEP_OPERAND_IMM5P7
:
2876 fields
->f_ivc2_5u7
= value
;
2878 case MEP_OPERAND_IMM5P8
:
2879 fields
->f_ivc2_5u8
= value
;
2881 case MEP_OPERAND_IMM6P2
:
2882 fields
->f_ivc2_6u2
= value
;
2884 case MEP_OPERAND_IMM6P6
:
2885 fields
->f_ivc2_6u6
= value
;
2887 case MEP_OPERAND_IMM8P0
:
2888 fields
->f_ivc2_8u0
= value
;
2890 case MEP_OPERAND_IMM8P20
:
2891 fields
->f_ivc2_8u20
= value
;
2893 case MEP_OPERAND_IMM8P4
:
2894 fields
->f_ivc2_8u4
= value
;
2896 case MEP_OPERAND_IVC_X_0_2
:
2897 fields
->f_ivc2_2u0
= value
;
2899 case MEP_OPERAND_IVC_X_0_3
:
2900 fields
->f_ivc2_3u0
= value
;
2902 case MEP_OPERAND_IVC_X_0_4
:
2903 fields
->f_ivc2_4u0
= value
;
2905 case MEP_OPERAND_IVC_X_0_5
:
2906 fields
->f_ivc2_5u0
= value
;
2908 case MEP_OPERAND_IVC_X_6_1
:
2909 fields
->f_ivc2_1u6
= value
;
2911 case MEP_OPERAND_IVC_X_6_2
:
2912 fields
->f_ivc2_2u6
= value
;
2914 case MEP_OPERAND_IVC_X_6_3
:
2915 fields
->f_ivc2_3u6
= value
;
2917 case MEP_OPERAND_IVC2_ACC0_0
:
2919 case MEP_OPERAND_IVC2_ACC0_1
:
2921 case MEP_OPERAND_IVC2_ACC0_2
:
2923 case MEP_OPERAND_IVC2_ACC0_3
:
2925 case MEP_OPERAND_IVC2_ACC0_4
:
2927 case MEP_OPERAND_IVC2_ACC0_5
:
2929 case MEP_OPERAND_IVC2_ACC0_6
:
2931 case MEP_OPERAND_IVC2_ACC0_7
:
2933 case MEP_OPERAND_IVC2_ACC1_0
:
2935 case MEP_OPERAND_IVC2_ACC1_1
:
2937 case MEP_OPERAND_IVC2_ACC1_2
:
2939 case MEP_OPERAND_IVC2_ACC1_3
:
2941 case MEP_OPERAND_IVC2_ACC1_4
:
2943 case MEP_OPERAND_IVC2_ACC1_5
:
2945 case MEP_OPERAND_IVC2_ACC1_6
:
2947 case MEP_OPERAND_IVC2_ACC1_7
:
2949 case MEP_OPERAND_IVC2_CC
:
2951 case MEP_OPERAND_IVC2_COFA0
:
2953 case MEP_OPERAND_IVC2_COFA1
:
2955 case MEP_OPERAND_IVC2_COFR0
:
2957 case MEP_OPERAND_IVC2_COFR1
:
2959 case MEP_OPERAND_IVC2_CSAR0
:
2961 case MEP_OPERAND_IVC2_CSAR1
:
2963 case MEP_OPERAND_IVC2C3CCRN
:
2964 fields
->f_ivc2_ccrn_c3
= value
;
2966 case MEP_OPERAND_IVC2CCRN
:
2967 fields
->f_ivc2_ccrn
= value
;
2969 case MEP_OPERAND_IVC2CRN
:
2970 fields
->f_ivc2_crnx
= value
;
2972 case MEP_OPERAND_IVC2RM
:
2973 fields
->f_ivc2_crm
= value
;
2975 case MEP_OPERAND_LO
:
2977 case MEP_OPERAND_LP
:
2979 case MEP_OPERAND_MB0
:
2981 case MEP_OPERAND_MB1
:
2983 case MEP_OPERAND_ME0
:
2985 case MEP_OPERAND_ME1
:
2987 case MEP_OPERAND_NPC
:
2989 case MEP_OPERAND_OPT
:
2991 case MEP_OPERAND_PCABS24A2
:
2992 fields
->f_24u5a2n
= value
;
2994 case MEP_OPERAND_PCREL12A2
:
2995 fields
->f_12s4a2
= value
;
2997 case MEP_OPERAND_PCREL17A2
:
2998 fields
->f_17s16a2
= value
;
3000 case MEP_OPERAND_PCREL24A2
:
3001 fields
->f_24s5a2n
= value
;
3003 case MEP_OPERAND_PCREL8A2
:
3004 fields
->f_8s8a2
= value
;
3006 case MEP_OPERAND_PSW
:
3008 case MEP_OPERAND_R0
:
3010 case MEP_OPERAND_R1
:
3012 case MEP_OPERAND_RL
:
3013 fields
->f_rl
= value
;
3015 case MEP_OPERAND_RL5
:
3016 fields
->f_rl5
= value
;
3018 case MEP_OPERAND_RM
:
3019 fields
->f_rm
= value
;
3021 case MEP_OPERAND_RMA
:
3022 fields
->f_rm
= value
;
3024 case MEP_OPERAND_RN
:
3025 fields
->f_rn
= value
;
3027 case MEP_OPERAND_RN3
:
3028 fields
->f_rn3
= value
;
3030 case MEP_OPERAND_RN3C
:
3031 fields
->f_rn3
= value
;
3033 case MEP_OPERAND_RN3L
:
3034 fields
->f_rn3
= value
;
3036 case MEP_OPERAND_RN3S
:
3037 fields
->f_rn3
= value
;
3039 case MEP_OPERAND_RN3UC
:
3040 fields
->f_rn3
= value
;
3042 case MEP_OPERAND_RN3UL
:
3043 fields
->f_rn3
= value
;
3045 case MEP_OPERAND_RN3US
:
3046 fields
->f_rn3
= value
;
3048 case MEP_OPERAND_RNC
:
3049 fields
->f_rn
= value
;
3051 case MEP_OPERAND_RNL
:
3052 fields
->f_rn
= value
;
3054 case MEP_OPERAND_RNS
:
3055 fields
->f_rn
= value
;
3057 case MEP_OPERAND_RNUC
:
3058 fields
->f_rn
= value
;
3060 case MEP_OPERAND_RNUL
:
3061 fields
->f_rn
= value
;
3063 case MEP_OPERAND_RNUS
:
3064 fields
->f_rn
= value
;
3066 case MEP_OPERAND_SAR
:
3068 case MEP_OPERAND_SDISP16
:
3069 fields
->f_16s16
= value
;
3071 case MEP_OPERAND_SIMM16
:
3072 fields
->f_16s16
= value
;
3074 case MEP_OPERAND_SIMM16P0
:
3075 fields
->f_ivc2_simm16p0
= value
;
3077 case MEP_OPERAND_SIMM6
:
3078 fields
->f_6s8
= value
;
3080 case MEP_OPERAND_SIMM8
:
3081 fields
->f_8s8
= value
;
3083 case MEP_OPERAND_SIMM8P0
:
3084 fields
->f_ivc2_8s0
= value
;
3086 case MEP_OPERAND_SIMM8P20
:
3087 fields
->f_ivc2_8s20
= value
;
3089 case MEP_OPERAND_SIMM8P4
:
3090 fields
->f_ivc2_8s4
= value
;
3092 case MEP_OPERAND_SP
:
3094 case MEP_OPERAND_SPR
:
3096 case MEP_OPERAND_TP
:
3098 case MEP_OPERAND_TPR
:
3100 case MEP_OPERAND_UDISP2
:
3101 fields
->f_2u6
= value
;
3103 case MEP_OPERAND_UDISP7
:
3104 fields
->f_7u9
= value
;
3106 case MEP_OPERAND_UDISP7A2
:
3107 fields
->f_7u9a2
= value
;
3109 case MEP_OPERAND_UDISP7A4
:
3110 fields
->f_7u9a4
= value
;
3112 case MEP_OPERAND_UIMM16
:
3113 fields
->f_16u16
= value
;
3115 case MEP_OPERAND_UIMM2
:
3116 fields
->f_2u10
= value
;
3118 case MEP_OPERAND_UIMM24
:
3119 fields
->f_24u8n
= value
;
3121 case MEP_OPERAND_UIMM3
:
3122 fields
->f_3u5
= value
;
3124 case MEP_OPERAND_UIMM4
:
3125 fields
->f_4u8
= value
;
3127 case MEP_OPERAND_UIMM5
:
3128 fields
->f_5u8
= value
;
3130 case MEP_OPERAND_UIMM7A4
:
3131 fields
->f_7u9a4
= value
;
3133 case MEP_OPERAND_ZERO
:
3137 /* xgettext:c-format */
3138 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
3145 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
3147 CGEN_FIELDS
* fields
,
3152 case MEP_OPERAND_ADDR24A4
:
3153 fields
->f_24u8a4n
= value
;
3155 case MEP_OPERAND_C5RMUIMM20
:
3156 fields
->f_c5_rmuimm20
= value
;
3158 case MEP_OPERAND_C5RNMUIMM24
:
3159 fields
->f_c5_rnmuimm24
= value
;
3161 case MEP_OPERAND_CALLNUM
:
3162 fields
->f_callnum
= value
;
3164 case MEP_OPERAND_CCCC
:
3165 fields
->f_rm
= value
;
3167 case MEP_OPERAND_CCRN
:
3168 fields
->f_ccrn
= value
;
3170 case MEP_OPERAND_CDISP10
:
3171 fields
->f_cdisp10
= value
;
3173 case MEP_OPERAND_CDISP10A2
:
3174 fields
->f_cdisp10
= value
;
3176 case MEP_OPERAND_CDISP10A4
:
3177 fields
->f_cdisp10
= value
;
3179 case MEP_OPERAND_CDISP10A8
:
3180 fields
->f_cdisp10
= value
;
3182 case MEP_OPERAND_CDISP12
:
3183 fields
->f_12s20
= value
;
3185 case MEP_OPERAND_CIMM4
:
3186 fields
->f_rn
= value
;
3188 case MEP_OPERAND_CIMM5
:
3189 fields
->f_5u24
= value
;
3191 case MEP_OPERAND_CODE16
:
3192 fields
->f_16u16
= value
;
3194 case MEP_OPERAND_CODE24
:
3195 fields
->f_24u4n
= value
;
3197 case MEP_OPERAND_CP_FLAG
:
3199 case MEP_OPERAND_CRN
:
3200 fields
->f_crn
= value
;
3202 case MEP_OPERAND_CRN64
:
3203 fields
->f_crn
= value
;
3205 case MEP_OPERAND_CRNX
:
3206 fields
->f_crnx
= value
;
3208 case MEP_OPERAND_CRNX64
:
3209 fields
->f_crnx
= value
;
3211 case MEP_OPERAND_CROC
:
3212 fields
->f_ivc2_5u7
= value
;
3214 case MEP_OPERAND_CROP
:
3215 fields
->f_ivc2_5u23
= value
;
3217 case MEP_OPERAND_CRPC
:
3218 fields
->f_ivc2_5u26
= value
;
3220 case MEP_OPERAND_CRPP
:
3221 fields
->f_ivc2_5u18
= value
;
3223 case MEP_OPERAND_CRQC
:
3224 fields
->f_ivc2_5u21
= value
;
3226 case MEP_OPERAND_CRQP
:
3227 fields
->f_ivc2_5u13
= value
;
3229 case MEP_OPERAND_CSRN
:
3230 fields
->f_csrn
= value
;
3232 case MEP_OPERAND_CSRN_IDX
:
3233 fields
->f_csrn
= value
;
3235 case MEP_OPERAND_DBG
:
3237 case MEP_OPERAND_DEPC
:
3239 case MEP_OPERAND_EPC
:
3241 case MEP_OPERAND_EXC
:
3243 case MEP_OPERAND_HI
:
3245 case MEP_OPERAND_IMM16P0
:
3246 fields
->f_ivc2_imm16p0
= value
;
3248 case MEP_OPERAND_IMM3P12
:
3249 fields
->f_ivc2_3u12
= value
;
3251 case MEP_OPERAND_IMM3P25
:
3252 fields
->f_ivc2_3u25
= value
;
3254 case MEP_OPERAND_IMM3P4
:
3255 fields
->f_ivc2_3u4
= value
;
3257 case MEP_OPERAND_IMM3P5
:
3258 fields
->f_ivc2_3u5
= value
;
3260 case MEP_OPERAND_IMM3P9
:
3261 fields
->f_ivc2_3u9
= value
;
3263 case MEP_OPERAND_IMM4P10
:
3264 fields
->f_ivc2_4u10
= value
;
3266 case MEP_OPERAND_IMM4P4
:
3267 fields
->f_ivc2_4u4
= value
;
3269 case MEP_OPERAND_IMM4P8
:
3270 fields
->f_ivc2_4u8
= value
;
3272 case MEP_OPERAND_IMM5P23
:
3273 fields
->f_ivc2_5u23
= value
;
3275 case MEP_OPERAND_IMM5P3
:
3276 fields
->f_ivc2_5u3
= value
;
3278 case MEP_OPERAND_IMM5P7
:
3279 fields
->f_ivc2_5u7
= value
;
3281 case MEP_OPERAND_IMM5P8
:
3282 fields
->f_ivc2_5u8
= value
;
3284 case MEP_OPERAND_IMM6P2
:
3285 fields
->f_ivc2_6u2
= value
;
3287 case MEP_OPERAND_IMM6P6
:
3288 fields
->f_ivc2_6u6
= value
;
3290 case MEP_OPERAND_IMM8P0
:
3291 fields
->f_ivc2_8u0
= value
;
3293 case MEP_OPERAND_IMM8P20
:
3294 fields
->f_ivc2_8u20
= value
;
3296 case MEP_OPERAND_IMM8P4
:
3297 fields
->f_ivc2_8u4
= value
;
3299 case MEP_OPERAND_IVC_X_0_2
:
3300 fields
->f_ivc2_2u0
= value
;
3302 case MEP_OPERAND_IVC_X_0_3
:
3303 fields
->f_ivc2_3u0
= value
;
3305 case MEP_OPERAND_IVC_X_0_4
:
3306 fields
->f_ivc2_4u0
= value
;
3308 case MEP_OPERAND_IVC_X_0_5
:
3309 fields
->f_ivc2_5u0
= value
;
3311 case MEP_OPERAND_IVC_X_6_1
:
3312 fields
->f_ivc2_1u6
= value
;
3314 case MEP_OPERAND_IVC_X_6_2
:
3315 fields
->f_ivc2_2u6
= value
;
3317 case MEP_OPERAND_IVC_X_6_3
:
3318 fields
->f_ivc2_3u6
= value
;
3320 case MEP_OPERAND_IVC2_ACC0_0
:
3322 case MEP_OPERAND_IVC2_ACC0_1
:
3324 case MEP_OPERAND_IVC2_ACC0_2
:
3326 case MEP_OPERAND_IVC2_ACC0_3
:
3328 case MEP_OPERAND_IVC2_ACC0_4
:
3330 case MEP_OPERAND_IVC2_ACC0_5
:
3332 case MEP_OPERAND_IVC2_ACC0_6
:
3334 case MEP_OPERAND_IVC2_ACC0_7
:
3336 case MEP_OPERAND_IVC2_ACC1_0
:
3338 case MEP_OPERAND_IVC2_ACC1_1
:
3340 case MEP_OPERAND_IVC2_ACC1_2
:
3342 case MEP_OPERAND_IVC2_ACC1_3
:
3344 case MEP_OPERAND_IVC2_ACC1_4
:
3346 case MEP_OPERAND_IVC2_ACC1_5
:
3348 case MEP_OPERAND_IVC2_ACC1_6
:
3350 case MEP_OPERAND_IVC2_ACC1_7
:
3352 case MEP_OPERAND_IVC2_CC
:
3354 case MEP_OPERAND_IVC2_COFA0
:
3356 case MEP_OPERAND_IVC2_COFA1
:
3358 case MEP_OPERAND_IVC2_COFR0
:
3360 case MEP_OPERAND_IVC2_COFR1
:
3362 case MEP_OPERAND_IVC2_CSAR0
:
3364 case MEP_OPERAND_IVC2_CSAR1
:
3366 case MEP_OPERAND_IVC2C3CCRN
:
3367 fields
->f_ivc2_ccrn_c3
= value
;
3369 case MEP_OPERAND_IVC2CCRN
:
3370 fields
->f_ivc2_ccrn
= value
;
3372 case MEP_OPERAND_IVC2CRN
:
3373 fields
->f_ivc2_crnx
= value
;
3375 case MEP_OPERAND_IVC2RM
:
3376 fields
->f_ivc2_crm
= value
;
3378 case MEP_OPERAND_LO
:
3380 case MEP_OPERAND_LP
:
3382 case MEP_OPERAND_MB0
:
3384 case MEP_OPERAND_MB1
:
3386 case MEP_OPERAND_ME0
:
3388 case MEP_OPERAND_ME1
:
3390 case MEP_OPERAND_NPC
:
3392 case MEP_OPERAND_OPT
:
3394 case MEP_OPERAND_PCABS24A2
:
3395 fields
->f_24u5a2n
= value
;
3397 case MEP_OPERAND_PCREL12A2
:
3398 fields
->f_12s4a2
= value
;
3400 case MEP_OPERAND_PCREL17A2
:
3401 fields
->f_17s16a2
= value
;
3403 case MEP_OPERAND_PCREL24A2
:
3404 fields
->f_24s5a2n
= value
;
3406 case MEP_OPERAND_PCREL8A2
:
3407 fields
->f_8s8a2
= value
;
3409 case MEP_OPERAND_PSW
:
3411 case MEP_OPERAND_R0
:
3413 case MEP_OPERAND_R1
:
3415 case MEP_OPERAND_RL
:
3416 fields
->f_rl
= value
;
3418 case MEP_OPERAND_RL5
:
3419 fields
->f_rl5
= value
;
3421 case MEP_OPERAND_RM
:
3422 fields
->f_rm
= value
;
3424 case MEP_OPERAND_RMA
:
3425 fields
->f_rm
= value
;
3427 case MEP_OPERAND_RN
:
3428 fields
->f_rn
= value
;
3430 case MEP_OPERAND_RN3
:
3431 fields
->f_rn3
= value
;
3433 case MEP_OPERAND_RN3C
:
3434 fields
->f_rn3
= value
;
3436 case MEP_OPERAND_RN3L
:
3437 fields
->f_rn3
= value
;
3439 case MEP_OPERAND_RN3S
:
3440 fields
->f_rn3
= value
;
3442 case MEP_OPERAND_RN3UC
:
3443 fields
->f_rn3
= value
;
3445 case MEP_OPERAND_RN3UL
:
3446 fields
->f_rn3
= value
;
3448 case MEP_OPERAND_RN3US
:
3449 fields
->f_rn3
= value
;
3451 case MEP_OPERAND_RNC
:
3452 fields
->f_rn
= value
;
3454 case MEP_OPERAND_RNL
:
3455 fields
->f_rn
= value
;
3457 case MEP_OPERAND_RNS
:
3458 fields
->f_rn
= value
;
3460 case MEP_OPERAND_RNUC
:
3461 fields
->f_rn
= value
;
3463 case MEP_OPERAND_RNUL
:
3464 fields
->f_rn
= value
;
3466 case MEP_OPERAND_RNUS
:
3467 fields
->f_rn
= value
;
3469 case MEP_OPERAND_SAR
:
3471 case MEP_OPERAND_SDISP16
:
3472 fields
->f_16s16
= value
;
3474 case MEP_OPERAND_SIMM16
:
3475 fields
->f_16s16
= value
;
3477 case MEP_OPERAND_SIMM16P0
:
3478 fields
->f_ivc2_simm16p0
= value
;
3480 case MEP_OPERAND_SIMM6
:
3481 fields
->f_6s8
= value
;
3483 case MEP_OPERAND_SIMM8
:
3484 fields
->f_8s8
= value
;
3486 case MEP_OPERAND_SIMM8P0
:
3487 fields
->f_ivc2_8s0
= value
;
3489 case MEP_OPERAND_SIMM8P20
:
3490 fields
->f_ivc2_8s20
= value
;
3492 case MEP_OPERAND_SIMM8P4
:
3493 fields
->f_ivc2_8s4
= value
;
3495 case MEP_OPERAND_SP
:
3497 case MEP_OPERAND_SPR
:
3499 case MEP_OPERAND_TP
:
3501 case MEP_OPERAND_TPR
:
3503 case MEP_OPERAND_UDISP2
:
3504 fields
->f_2u6
= value
;
3506 case MEP_OPERAND_UDISP7
:
3507 fields
->f_7u9
= value
;
3509 case MEP_OPERAND_UDISP7A2
:
3510 fields
->f_7u9a2
= value
;
3512 case MEP_OPERAND_UDISP7A4
:
3513 fields
->f_7u9a4
= value
;
3515 case MEP_OPERAND_UIMM16
:
3516 fields
->f_16u16
= value
;
3518 case MEP_OPERAND_UIMM2
:
3519 fields
->f_2u10
= value
;
3521 case MEP_OPERAND_UIMM24
:
3522 fields
->f_24u8n
= value
;
3524 case MEP_OPERAND_UIMM3
:
3525 fields
->f_3u5
= value
;
3527 case MEP_OPERAND_UIMM4
:
3528 fields
->f_4u8
= value
;
3530 case MEP_OPERAND_UIMM5
:
3531 fields
->f_5u8
= value
;
3533 case MEP_OPERAND_UIMM7A4
:
3534 fields
->f_7u9a4
= value
;
3536 case MEP_OPERAND_ZERO
:
3540 /* xgettext:c-format */
3541 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
3547 /* Function to call before using the instruction builder tables. */
3550 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
3552 cd
->insert_handlers
= & mep_cgen_insert_handlers
[0];
3553 cd
->extract_handlers
= & mep_cgen_extract_handlers
[0];
3555 cd
->insert_operand
= mep_cgen_insert_operand
;
3556 cd
->extract_operand
= mep_cgen_extract_operand
;
3558 cd
->get_int_operand
= mep_cgen_get_int_operand
;
3559 cd
->set_int_operand
= mep_cgen_set_int_operand
;
3560 cd
->get_vma_operand
= mep_cgen_get_vma_operand
;
3561 cd
->set_vma_operand
= mep_cgen_set_vma_operand
;