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, 2010 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
16 It is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19 License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
25 /* ??? Eventually more and more of this stuff can go to cpu-independent files.
36 #include "cgen/basic-modes.h"
38 #include "safe-ctype.h"
41 #define min(a,b) ((a) < (b) ? (a) : (b))
43 #define max(a,b) ((a) > (b) ? (a) : (b))
45 /* Used by the ifield rtx function. */
46 #define FLD(f) (fields->f)
48 static const char * insert_normal
49 (CGEN_CPU_DESC
, long, unsigned int, unsigned int, unsigned int,
50 unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR
);
51 static const char * insert_insn_normal
52 (CGEN_CPU_DESC
, const CGEN_INSN
*,
53 CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
54 static int extract_normal
55 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
,
56 unsigned int, unsigned int, unsigned int, unsigned int,
57 unsigned int, unsigned int, bfd_vma
, long *);
58 static int extract_insn_normal
59 (CGEN_CPU_DESC
, const CGEN_INSN
*, CGEN_EXTRACT_INFO
*,
60 CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
62 static void put_insn_int_value
63 (CGEN_CPU_DESC
, CGEN_INSN_BYTES_PTR
, int, int, CGEN_INSN_INT
);
66 static CGEN_INLINE
void insert_1
67 (CGEN_CPU_DESC
, unsigned long, int, int, int, unsigned char *);
68 static CGEN_INLINE
int fill_cache
69 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, bfd_vma
);
70 static CGEN_INLINE
long extract_1
71 (CGEN_CPU_DESC
, CGEN_EXTRACT_INFO
*, int, int, int, unsigned char *, bfd_vma
);
74 /* Operand insertion. */
78 /* Subroutine of insert_normal. */
80 static CGEN_INLINE
void
81 insert_1 (CGEN_CPU_DESC cd
,
91 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
93 /* Written this way to avoid undefined behaviour. */
94 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
96 shift
= (start
+ 1) - length
;
98 shift
= (word_length
- (start
+ length
));
99 x
= (x
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
101 cgen_put_insn_value (cd
, bufp
, word_length
, (bfd_vma
) x
);
104 #endif /* ! CGEN_INT_INSN_P */
106 /* Default insertion routine.
108 ATTRS is a mask of the boolean attributes.
109 WORD_OFFSET is the offset in bits from the start of the insn of the value.
110 WORD_LENGTH is the length of the word in bits in which the value resides.
111 START is the starting bit number in the word, architecture origin.
112 LENGTH is the length of VALUE in bits.
113 TOTAL_LENGTH is the total length of the insn in bits.
115 The result is an error message or NULL if success. */
117 /* ??? This duplicates functionality with bfd's howto table and
118 bfd_install_relocation. */
119 /* ??? This doesn't handle bfd_vma's. Create another function when
123 insert_normal (CGEN_CPU_DESC cd
,
126 unsigned int word_offset
,
129 unsigned int word_length
,
130 unsigned int total_length
,
131 CGEN_INSN_BYTES_PTR buffer
)
133 static char errbuf
[100];
134 /* Written this way to avoid undefined behaviour. */
135 unsigned long mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
137 /* If LENGTH is zero, this operand doesn't contribute to the value. */
141 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
144 /* For architectures with insns smaller than the base-insn-bitsize,
145 word_length may be too big. */
146 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
149 && word_length
> total_length
)
150 word_length
= total_length
;
153 /* Ensure VALUE will fit. */
154 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGN_OPT
))
156 long minval
= - (1L << (length
- 1));
157 unsigned long maxval
= mask
;
159 if ((value
> 0 && (unsigned long) value
> maxval
)
162 /* xgettext:c-format */
164 _("operand out of range (%ld not between %ld and %lu)"),
165 value
, minval
, maxval
);
169 else if (! CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
))
171 unsigned long maxval
= mask
;
172 unsigned long val
= (unsigned long) value
;
174 /* For hosts with a word size > 32 check to see if value has been sign
175 extended beyond 32 bits. If so then ignore these higher sign bits
176 as the user is attempting to store a 32-bit signed value into an
177 unsigned 32-bit field which is allowed. */
178 if (sizeof (unsigned long) > 4 && ((value
>> 32) == -1))
183 /* xgettext:c-format */
185 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
192 if (! cgen_signed_overflow_ok_p (cd
))
194 long minval
= - (1L << (length
- 1));
195 long maxval
= (1L << (length
- 1)) - 1;
197 if (value
< minval
|| value
> maxval
)
200 /* xgettext:c-format */
201 (errbuf
, _("operand out of range (%ld not between %ld and %ld)"),
202 value
, minval
, maxval
);
213 if (CGEN_INSN_LSB0_P
)
214 shift
= (word_offset
+ start
+ 1) - length
;
216 shift
= total_length
- (word_offset
+ start
+ length
);
217 *buffer
= (*buffer
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
220 #else /* ! CGEN_INT_INSN_P */
223 unsigned char *bufp
= (unsigned char *) buffer
+ word_offset
/ 8;
225 insert_1 (cd
, value
, start
, length
, word_length
, bufp
);
228 #endif /* ! CGEN_INT_INSN_P */
233 /* Default insn builder (insert handler).
234 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
235 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
236 recorded in host byte order, otherwise BUFFER is an array of bytes
237 and the value is recorded in target byte order).
238 The result is an error message or NULL if success. */
241 insert_insn_normal (CGEN_CPU_DESC cd
,
242 const CGEN_INSN
* insn
,
243 CGEN_FIELDS
* fields
,
244 CGEN_INSN_BYTES_PTR buffer
,
247 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
249 const CGEN_SYNTAX_CHAR_TYPE
* syn
;
251 CGEN_INIT_INSERT (cd
);
252 value
= CGEN_INSN_BASE_VALUE (insn
);
254 /* If we're recording insns as numbers (rather than a string of bytes),
255 target byte order handling is deferred until later. */
259 put_insn_int_value (cd
, buffer
, cd
->base_insn_bitsize
,
260 CGEN_FIELDS_BITSIZE (fields
), value
);
264 cgen_put_insn_value (cd
, buffer
, min ((unsigned) cd
->base_insn_bitsize
,
265 (unsigned) CGEN_FIELDS_BITSIZE (fields
)),
268 #endif /* ! CGEN_INT_INSN_P */
270 /* ??? It would be better to scan the format's fields.
271 Still need to be able to insert a value based on the operand though;
272 e.g. storing a branch displacement that got resolved later.
273 Needs more thought first. */
275 for (syn
= CGEN_SYNTAX_STRING (syntax
); * syn
; ++ syn
)
279 if (CGEN_SYNTAX_CHAR_P (* syn
))
282 errmsg
= (* cd
->insert_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
292 /* Cover function to store an insn value into an integral insn. Must go here
293 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
296 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
297 CGEN_INSN_BYTES_PTR buf
,
302 /* For architectures with insns smaller than the base-insn-bitsize,
303 length may be too big. */
304 if (length
> insn_length
)
308 int shift
= insn_length
- length
;
309 /* Written this way to avoid undefined behaviour. */
310 CGEN_INSN_INT mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
312 *buf
= (*buf
& ~(mask
<< shift
)) | ((value
& mask
) << shift
);
317 /* Operand extraction. */
319 #if ! CGEN_INT_INSN_P
321 /* Subroutine of extract_normal.
322 Ensure sufficient bytes are cached in EX_INFO.
323 OFFSET is the offset in bytes from the start of the insn of the value.
324 BYTES is the length of the needed value.
325 Returns 1 for success, 0 for failure. */
327 static CGEN_INLINE
int
328 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
329 CGEN_EXTRACT_INFO
*ex_info
,
334 /* It's doubtful that the middle part has already been fetched so
335 we don't optimize that case. kiss. */
337 disassemble_info
*info
= (disassemble_info
*) ex_info
->dis_info
;
339 /* First do a quick check. */
340 mask
= (1 << bytes
) - 1;
341 if (((ex_info
->valid
>> offset
) & mask
) == mask
)
344 /* Search for the first byte we need to read. */
345 for (mask
= 1 << offset
; bytes
> 0; --bytes
, ++offset
, mask
<<= 1)
346 if (! (mask
& ex_info
->valid
))
354 status
= (*info
->read_memory_func
)
355 (pc
, ex_info
->insn_bytes
+ offset
, bytes
, info
);
359 (*info
->memory_error_func
) (status
, pc
, info
);
363 ex_info
->valid
|= ((1 << bytes
) - 1) << offset
;
369 /* Subroutine of extract_normal. */
371 static CGEN_INLINE
long
372 extract_1 (CGEN_CPU_DESC cd
,
373 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
378 bfd_vma pc ATTRIBUTE_UNUSED
)
383 x
= cgen_get_insn_value (cd
, bufp
, word_length
);
385 if (CGEN_INSN_LSB0_P
)
386 shift
= (start
+ 1) - length
;
388 shift
= (word_length
- (start
+ length
));
392 #endif /* ! CGEN_INT_INSN_P */
394 /* Default extraction routine.
396 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
397 or sometimes less for cases like the m32r where the base insn size is 32
398 but some insns are 16 bits.
399 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
400 but for generality we take a bitmask of all of them.
401 WORD_OFFSET is the offset in bits from the start of the insn of the value.
402 WORD_LENGTH is the length of the word in bits in which the value resides.
403 START is the starting bit number in the word, architecture origin.
404 LENGTH is the length of VALUE in bits.
405 TOTAL_LENGTH is the total length of the insn in bits.
407 Returns 1 for success, 0 for failure. */
409 /* ??? The return code isn't properly used. wip. */
411 /* ??? This doesn't handle bfd_vma's. Create another function when
415 extract_normal (CGEN_CPU_DESC cd
,
416 #if ! CGEN_INT_INSN_P
417 CGEN_EXTRACT_INFO
*ex_info
,
419 CGEN_EXTRACT_INFO
*ex_info ATTRIBUTE_UNUSED
,
421 CGEN_INSN_INT insn_value
,
423 unsigned int word_offset
,
426 unsigned int word_length
,
427 unsigned int total_length
,
428 #if ! CGEN_INT_INSN_P
431 bfd_vma pc ATTRIBUTE_UNUSED
,
437 /* If LENGTH is zero, this operand doesn't contribute to the value
438 so give it a standard value of zero. */
445 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
448 /* For architectures with insns smaller than the insn-base-bitsize,
449 word_length may be too big. */
450 if (cd
->min_insn_bitsize
< cd
->base_insn_bitsize
)
452 if (word_offset
+ word_length
> total_length
)
453 word_length
= total_length
- word_offset
;
456 /* Does the value reside in INSN_VALUE, and at the right alignment? */
458 if (CGEN_INT_INSN_P
|| (word_offset
== 0 && word_length
== total_length
))
460 if (CGEN_INSN_LSB0_P
)
461 value
= insn_value
>> ((word_offset
+ start
+ 1) - length
);
463 value
= insn_value
>> (total_length
- ( word_offset
+ start
+ length
));
466 #if ! CGEN_INT_INSN_P
470 unsigned char *bufp
= ex_info
->insn_bytes
+ word_offset
/ 8;
472 if (word_length
> 8 * sizeof (CGEN_INSN_INT
))
475 if (fill_cache (cd
, ex_info
, word_offset
/ 8, word_length
/ 8, pc
) == 0)
478 value
= extract_1 (cd
, ex_info
, start
, length
, word_length
, bufp
, pc
);
481 #endif /* ! CGEN_INT_INSN_P */
483 /* Written this way to avoid undefined behaviour. */
484 mask
= (((1L << (length
- 1)) - 1) << 1) | 1;
488 if (CGEN_BOOL_ATTR (attrs
, CGEN_IFLD_SIGNED
)
489 && (value
& (1L << (length
- 1))))
497 /* Default insn extractor.
499 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
500 The extracted fields are stored in FIELDS.
501 EX_INFO is used to handle reading variable length insns.
502 Return the length of the insn in bits, or 0 if no match,
503 or -1 if an error occurs fetching data (memory_error_func will have
507 extract_insn_normal (CGEN_CPU_DESC cd
,
508 const CGEN_INSN
*insn
,
509 CGEN_EXTRACT_INFO
*ex_info
,
510 CGEN_INSN_INT insn_value
,
514 const CGEN_SYNTAX
*syntax
= CGEN_INSN_SYNTAX (insn
);
515 const CGEN_SYNTAX_CHAR_TYPE
*syn
;
517 CGEN_FIELDS_BITSIZE (fields
) = CGEN_INSN_BITSIZE (insn
);
519 CGEN_INIT_EXTRACT (cd
);
521 for (syn
= CGEN_SYNTAX_STRING (syntax
); *syn
; ++syn
)
525 if (CGEN_SYNTAX_CHAR_P (*syn
))
528 length
= (* cd
->extract_operand
) (cd
, CGEN_SYNTAX_FIELD (*syn
),
529 ex_info
, insn_value
, fields
, pc
);
534 /* We recognized and successfully extracted this insn. */
535 return CGEN_INSN_BITSIZE (insn
);
538 /* Machine generated code added here. */
540 const char * mep_cgen_insert_operand
541 (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, CGEN_INSN_BYTES_PTR
, bfd_vma
);
543 /* Main entry point for operand insertion.
545 This function is basically just a big switch statement. Earlier versions
546 used tables to look up the function to use, but
547 - if the table contains both assembler and disassembler functions then
548 the disassembler contains much of the assembler and vice-versa,
549 - there's a lot of inlining possibilities as things grow,
550 - using a switch statement avoids the function call overhead.
552 This function could be moved into `parse_insn_normal', but keeping it
553 separate makes clear the interface between `parse_insn_normal' and each of
554 the handlers. It's also needed by GAS to insert operands that couldn't be
555 resolved during parsing. */
558 mep_cgen_insert_operand (CGEN_CPU_DESC cd
,
560 CGEN_FIELDS
* fields
,
561 CGEN_INSN_BYTES_PTR buffer
,
562 bfd_vma pc ATTRIBUTE_UNUSED
)
564 const char * errmsg
= NULL
;
565 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
569 case MEP_OPERAND_ADDR24A4
:
572 FLD (f_24u8a4n_hi
) = ((UINT
) (FLD (f_24u8a4n
)) >> (8));
573 FLD (f_24u8a4n_lo
) = ((UINT
) (((FLD (f_24u8a4n
)) & (252))) >> (2));
575 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
578 errmsg
= insert_normal (cd
, fields
->f_24u8a4n_lo
, 0, 0, 8, 6, 32, total_length
, buffer
);
583 case MEP_OPERAND_C5RMUIMM20
:
586 FLD (f_c5_rm
) = ((UINT
) (FLD (f_c5_rmuimm20
)) >> (16));
587 FLD (f_c5_16u16
) = ((FLD (f_c5_rmuimm20
)) & (65535));
589 errmsg
= insert_normal (cd
, fields
->f_c5_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
592 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
597 case MEP_OPERAND_C5RNMUIMM24
:
600 FLD (f_c5_rnm
) = ((UINT
) (FLD (f_c5_rnmuimm24
)) >> (16));
601 FLD (f_c5_16u16
) = ((FLD (f_c5_rnmuimm24
)) & (65535));
603 errmsg
= insert_normal (cd
, fields
->f_c5_rnm
, 0, 0, 4, 8, 32, total_length
, buffer
);
606 errmsg
= insert_normal (cd
, fields
->f_c5_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
611 case MEP_OPERAND_CALLNUM
:
614 FLD (f_5
) = ((((UINT
) (FLD (f_callnum
)) >> (3))) & (1));
615 FLD (f_6
) = ((((UINT
) (FLD (f_callnum
)) >> (2))) & (1));
616 FLD (f_7
) = ((((UINT
) (FLD (f_callnum
)) >> (1))) & (1));
617 FLD (f_11
) = ((FLD (f_callnum
)) & (1));
619 errmsg
= insert_normal (cd
, fields
->f_5
, 0, 0, 5, 1, 32, total_length
, buffer
);
622 errmsg
= insert_normal (cd
, fields
->f_6
, 0, 0, 6, 1, 32, total_length
, buffer
);
625 errmsg
= insert_normal (cd
, fields
->f_7
, 0, 0, 7, 1, 32, total_length
, buffer
);
628 errmsg
= insert_normal (cd
, fields
->f_11
, 0, 0, 11, 1, 32, total_length
, buffer
);
633 case MEP_OPERAND_CCCC
:
634 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
636 case MEP_OPERAND_CCRN
:
639 FLD (f_ccrn_hi
) = ((((UINT
) (FLD (f_ccrn
)) >> (4))) & (3));
640 FLD (f_ccrn_lo
) = ((FLD (f_ccrn
)) & (15));
642 errmsg
= insert_normal (cd
, fields
->f_ccrn_hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
645 errmsg
= insert_normal (cd
, fields
->f_ccrn_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
650 case MEP_OPERAND_CDISP10
:
652 long value
= fields
->f_cdisp10
;
653 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)));
654 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
657 case MEP_OPERAND_CDISP10A2
:
659 long value
= fields
->f_cdisp10
;
660 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)));
661 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
664 case MEP_OPERAND_CDISP10A4
:
666 long value
= fields
->f_cdisp10
;
667 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)));
668 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
671 case MEP_OPERAND_CDISP10A8
:
673 long value
= fields
->f_cdisp10
;
674 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)));
675 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, buffer
);
678 case MEP_OPERAND_CDISP12
:
679 errmsg
= insert_normal (cd
, fields
->f_12s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, buffer
);
681 case MEP_OPERAND_CIMM4
:
682 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
684 case MEP_OPERAND_CIMM5
:
685 errmsg
= insert_normal (cd
, fields
->f_5u24
, 0, 0, 24, 5, 32, total_length
, buffer
);
687 case MEP_OPERAND_CODE16
:
688 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
690 case MEP_OPERAND_CODE24
:
693 FLD (f_24u4n_hi
) = ((UINT
) (FLD (f_24u4n
)) >> (16));
694 FLD (f_24u4n_lo
) = ((FLD (f_24u4n
)) & (65535));
696 errmsg
= insert_normal (cd
, fields
->f_24u4n_hi
, 0, 0, 4, 8, 32, total_length
, buffer
);
699 errmsg
= insert_normal (cd
, fields
->f_24u4n_lo
, 0, 0, 16, 16, 32, total_length
, buffer
);
704 case MEP_OPERAND_CP_FLAG
:
706 case MEP_OPERAND_CRN
:
707 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
709 case MEP_OPERAND_CRN64
:
710 errmsg
= insert_normal (cd
, fields
->f_crn
, 0, 0, 4, 4, 32, total_length
, buffer
);
712 case MEP_OPERAND_CRNX
:
715 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
716 FLD (f_crnx_hi
) = ((UINT
) (FLD (f_crnx
)) >> (4));
718 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
721 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
726 case MEP_OPERAND_CRNX64
:
729 FLD (f_crnx_lo
) = ((FLD (f_crnx
)) & (15));
730 FLD (f_crnx_hi
) = ((UINT
) (FLD (f_crnx
)) >> (4));
732 errmsg
= insert_normal (cd
, fields
->f_crnx_hi
, 0, 0, 28, 1, 32, total_length
, buffer
);
735 errmsg
= insert_normal (cd
, fields
->f_crnx_lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
740 case MEP_OPERAND_CROC
:
741 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
743 case MEP_OPERAND_CROP
:
744 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
746 case MEP_OPERAND_CRPC
:
747 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u26
, 0, 0, 26, 5, 32, total_length
, buffer
);
749 case MEP_OPERAND_CRPP
:
750 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u18
, 0, 0, 18, 5, 32, total_length
, buffer
);
752 case MEP_OPERAND_CRQC
:
753 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u21
, 0, 0, 21, 5, 32, total_length
, buffer
);
755 case MEP_OPERAND_CRQP
:
756 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u13
, 0, 0, 13, 5, 32, total_length
, buffer
);
758 case MEP_OPERAND_CSRN
:
761 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
762 FLD (f_csrn_hi
) = ((UINT
) (FLD (f_csrn
)) >> (4));
764 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
767 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
772 case MEP_OPERAND_CSRN_IDX
:
775 FLD (f_csrn_lo
) = ((FLD (f_csrn
)) & (15));
776 FLD (f_csrn_hi
) = ((UINT
) (FLD (f_csrn
)) >> (4));
778 errmsg
= insert_normal (cd
, fields
->f_csrn_hi
, 0, 0, 15, 1, 32, total_length
, buffer
);
781 errmsg
= insert_normal (cd
, fields
->f_csrn_lo
, 0, 0, 8, 4, 32, total_length
, buffer
);
786 case MEP_OPERAND_DBG
:
788 case MEP_OPERAND_DEPC
:
790 case MEP_OPERAND_EPC
:
792 case MEP_OPERAND_EXC
:
794 case MEP_OPERAND_HI
:
796 case MEP_OPERAND_IMM16P0
:
799 FLD (f_ivc2_8u0
) = ((((UINT
) (FLD (f_ivc2_imm16p0
)) >> (8))) & (255));
800 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_imm16p0
)) & (255));
802 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
805 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
810 case MEP_OPERAND_IMM3P12
:
811 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u12
, 0, 0, 12, 3, 32, total_length
, buffer
);
813 case MEP_OPERAND_IMM3P25
:
814 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u25
, 0, 0, 25, 3, 32, total_length
, buffer
);
816 case MEP_OPERAND_IMM3P4
:
817 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u4
, 0, 0, 4, 3, 32, total_length
, buffer
);
819 case MEP_OPERAND_IMM3P5
:
820 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
822 case MEP_OPERAND_IMM3P9
:
823 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u9
, 0, 0, 9, 3, 32, total_length
, buffer
);
825 case MEP_OPERAND_IMM4P10
:
826 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u10
, 0, 0, 10, 4, 32, total_length
, buffer
);
828 case MEP_OPERAND_IMM4P4
:
829 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u4
, 0, 0, 4, 4, 32, total_length
, buffer
);
831 case MEP_OPERAND_IMM4P8
:
832 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
834 case MEP_OPERAND_IMM5P23
:
835 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u23
, 0, 0, 23, 5, 32, total_length
, buffer
);
837 case MEP_OPERAND_IMM5P3
:
838 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u3
, 0, 0, 3, 5, 32, total_length
, buffer
);
840 case MEP_OPERAND_IMM5P7
:
841 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u7
, 0, 0, 7, 5, 32, total_length
, buffer
);
843 case MEP_OPERAND_IMM5P8
:
844 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
846 case MEP_OPERAND_IMM6P2
:
847 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u2
, 0, 0, 2, 6, 32, total_length
, buffer
);
849 case MEP_OPERAND_IMM6P6
:
850 errmsg
= insert_normal (cd
, fields
->f_ivc2_6u6
, 0, 0, 6, 6, 32, total_length
, buffer
);
852 case MEP_OPERAND_IMM8P0
:
853 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
855 case MEP_OPERAND_IMM8P20
:
856 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
858 case MEP_OPERAND_IMM8P4
:
859 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u4
, 0, 0, 4, 8, 32, total_length
, buffer
);
861 case MEP_OPERAND_IVC_X_0_2
:
862 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u0
, 0, 0, 0, 2, 32, total_length
, buffer
);
864 case MEP_OPERAND_IVC_X_0_3
:
865 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u0
, 0, 0, 0, 3, 32, total_length
, buffer
);
867 case MEP_OPERAND_IVC_X_0_4
:
868 errmsg
= insert_normal (cd
, fields
->f_ivc2_4u0
, 0, 0, 0, 4, 32, total_length
, buffer
);
870 case MEP_OPERAND_IVC_X_0_5
:
871 errmsg
= insert_normal (cd
, fields
->f_ivc2_5u0
, 0, 0, 0, 5, 32, total_length
, buffer
);
873 case MEP_OPERAND_IVC_X_6_1
:
874 errmsg
= insert_normal (cd
, fields
->f_ivc2_1u6
, 0, 0, 6, 1, 32, total_length
, buffer
);
876 case MEP_OPERAND_IVC_X_6_2
:
877 errmsg
= insert_normal (cd
, fields
->f_ivc2_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
879 case MEP_OPERAND_IVC_X_6_3
:
880 errmsg
= insert_normal (cd
, fields
->f_ivc2_3u6
, 0, 0, 6, 3, 32, total_length
, buffer
);
882 case MEP_OPERAND_IVC2_ACC0_0
:
884 case MEP_OPERAND_IVC2_ACC0_1
:
886 case MEP_OPERAND_IVC2_ACC0_2
:
888 case MEP_OPERAND_IVC2_ACC0_3
:
890 case MEP_OPERAND_IVC2_ACC0_4
:
892 case MEP_OPERAND_IVC2_ACC0_5
:
894 case MEP_OPERAND_IVC2_ACC0_6
:
896 case MEP_OPERAND_IVC2_ACC0_7
:
898 case MEP_OPERAND_IVC2_ACC1_0
:
900 case MEP_OPERAND_IVC2_ACC1_1
:
902 case MEP_OPERAND_IVC2_ACC1_2
:
904 case MEP_OPERAND_IVC2_ACC1_3
:
906 case MEP_OPERAND_IVC2_ACC1_4
:
908 case MEP_OPERAND_IVC2_ACC1_5
:
910 case MEP_OPERAND_IVC2_ACC1_6
:
912 case MEP_OPERAND_IVC2_ACC1_7
:
914 case MEP_OPERAND_IVC2_CC
:
916 case MEP_OPERAND_IVC2_COFA0
:
918 case MEP_OPERAND_IVC2_COFA1
:
920 case MEP_OPERAND_IVC2_COFR0
:
922 case MEP_OPERAND_IVC2_COFR1
:
924 case MEP_OPERAND_IVC2_CSAR0
:
926 case MEP_OPERAND_IVC2_CSAR1
:
928 case MEP_OPERAND_IVC2C3CCRN
:
931 FLD (f_ivc2_ccrn_c3hi
) = ((((UINT
) (FLD (f_ivc2_ccrn_c3
)) >> (4))) & (3));
932 FLD (f_ivc2_ccrn_c3lo
) = ((FLD (f_ivc2_ccrn_c3
)) & (15));
934 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3hi
, 0, 0, 28, 2, 32, total_length
, buffer
);
937 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_c3lo
, 0, 0, 4, 4, 32, total_length
, buffer
);
942 case MEP_OPERAND_IVC2CCRN
:
945 FLD (f_ivc2_ccrn_h2
) = ((((UINT
) (FLD (f_ivc2_ccrn
)) >> (4))) & (3));
946 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_ccrn
)) & (15));
948 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h2
, 0, 0, 20, 2, 32, total_length
, buffer
);
951 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
956 case MEP_OPERAND_IVC2CRN
:
959 FLD (f_ivc2_ccrn_h1
) = ((((UINT
) (FLD (f_ivc2_crnx
)) >> (4))) & (1));
960 FLD (f_ivc2_ccrn_lo
) = ((FLD (f_ivc2_crnx
)) & (15));
962 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_h1
, 0, 0, 20, 1, 32, total_length
, buffer
);
965 errmsg
= insert_normal (cd
, fields
->f_ivc2_ccrn_lo
, 0, 0, 0, 4, 32, total_length
, buffer
);
970 case MEP_OPERAND_IVC2RM
:
971 errmsg
= insert_normal (cd
, fields
->f_ivc2_crm
, 0, 0, 4, 4, 32, total_length
, buffer
);
973 case MEP_OPERAND_LO
:
975 case MEP_OPERAND_LP
:
977 case MEP_OPERAND_MB0
:
979 case MEP_OPERAND_MB1
:
981 case MEP_OPERAND_ME0
:
983 case MEP_OPERAND_ME1
:
985 case MEP_OPERAND_NPC
:
987 case MEP_OPERAND_OPT
:
989 case MEP_OPERAND_PCABS24A2
:
992 FLD (f_24u5a2n_lo
) = ((UINT
) (((FLD (f_24u5a2n
)) & (255))) >> (1));
993 FLD (f_24u5a2n_hi
) = ((UINT
) (FLD (f_24u5a2n
)) >> (8));
995 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
998 errmsg
= insert_normal (cd
, fields
->f_24u5a2n_lo
, 0, 0, 5, 7, 32, total_length
, buffer
);
1003 case MEP_OPERAND_PCREL12A2
:
1005 long value
= fields
->f_12s4a2
;
1006 value
= ((SI
) (((value
) - (pc
))) >> (1));
1007 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 4, 11, 32, total_length
, buffer
);
1010 case MEP_OPERAND_PCREL17A2
:
1012 long value
= fields
->f_17s16a2
;
1013 value
= ((SI
) (((value
) - (pc
))) >> (1));
1014 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 16, 16, 32, total_length
, buffer
);
1017 case MEP_OPERAND_PCREL24A2
:
1020 FLD (f_24s5a2n
) = ((FLD (f_24s5a2n
)) - (pc
));
1021 FLD (f_24s5a2n_lo
) = ((UINT
) (((FLD (f_24s5a2n
)) & (254))) >> (1));
1022 FLD (f_24s5a2n_hi
) = ((INT
) (FLD (f_24s5a2n
)) >> (8));
1024 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
);
1027 errmsg
= insert_normal (cd
, fields
->f_24s5a2n_lo
, 0|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 5, 7, 32, total_length
, buffer
);
1032 case MEP_OPERAND_PCREL8A2
:
1034 long value
= fields
->f_8s8a2
;
1035 value
= ((SI
) (((value
) - (pc
))) >> (1));
1036 errmsg
= insert_normal (cd
, value
, 0|(1<<CGEN_IFLD_SIGNED
)|(1<<CGEN_IFLD_PCREL_ADDR
), 0, 8, 7, 32, total_length
, buffer
);
1039 case MEP_OPERAND_PSW
:
1041 case MEP_OPERAND_R0
:
1043 case MEP_OPERAND_R1
:
1045 case MEP_OPERAND_RL
:
1046 errmsg
= insert_normal (cd
, fields
->f_rl
, 0, 0, 12, 4, 32, total_length
, buffer
);
1048 case MEP_OPERAND_RL5
:
1049 errmsg
= insert_normal (cd
, fields
->f_rl5
, 0, 0, 20, 4, 32, total_length
, buffer
);
1051 case MEP_OPERAND_RM
:
1052 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1054 case MEP_OPERAND_RMA
:
1055 errmsg
= insert_normal (cd
, fields
->f_rm
, 0, 0, 8, 4, 32, total_length
, buffer
);
1057 case MEP_OPERAND_RN
:
1058 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1060 case MEP_OPERAND_RN3
:
1061 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1063 case MEP_OPERAND_RN3C
:
1064 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1066 case MEP_OPERAND_RN3L
:
1067 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1069 case MEP_OPERAND_RN3S
:
1070 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1072 case MEP_OPERAND_RN3UC
:
1073 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1075 case MEP_OPERAND_RN3UL
:
1076 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1078 case MEP_OPERAND_RN3US
:
1079 errmsg
= insert_normal (cd
, fields
->f_rn3
, 0, 0, 5, 3, 32, total_length
, buffer
);
1081 case MEP_OPERAND_RNC
:
1082 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1084 case MEP_OPERAND_RNL
:
1085 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1087 case MEP_OPERAND_RNS
:
1088 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1090 case MEP_OPERAND_RNUC
:
1091 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1093 case MEP_OPERAND_RNUL
:
1094 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1096 case MEP_OPERAND_RNUS
:
1097 errmsg
= insert_normal (cd
, fields
->f_rn
, 0, 0, 4, 4, 32, total_length
, buffer
);
1099 case MEP_OPERAND_SAR
:
1101 case MEP_OPERAND_SDISP16
:
1102 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1104 case MEP_OPERAND_SIMM16
:
1105 errmsg
= insert_normal (cd
, fields
->f_16s16
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, buffer
);
1107 case MEP_OPERAND_SIMM16P0
:
1110 FLD (f_ivc2_8u0
) = ((((UINT
) (FLD (f_ivc2_simm16p0
)) >> (8))) & (255));
1111 FLD (f_ivc2_8u20
) = ((FLD (f_ivc2_simm16p0
)) & (255));
1113 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u0
, 0, 0, 0, 8, 32, total_length
, buffer
);
1116 errmsg
= insert_normal (cd
, fields
->f_ivc2_8u20
, 0, 0, 20, 8, 32, total_length
, buffer
);
1121 case MEP_OPERAND_SIMM6
:
1122 errmsg
= insert_normal (cd
, fields
->f_6s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, buffer
);
1124 case MEP_OPERAND_SIMM8
:
1125 errmsg
= insert_normal (cd
, fields
->f_8s8
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, buffer
);
1127 case MEP_OPERAND_SIMM8P0
:
1128 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s0
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, buffer
);
1130 case MEP_OPERAND_SIMM8P20
:
1131 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s20
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, buffer
);
1133 case MEP_OPERAND_SIMM8P4
:
1134 errmsg
= insert_normal (cd
, fields
->f_ivc2_8s4
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, buffer
);
1136 case MEP_OPERAND_SP
:
1138 case MEP_OPERAND_SPR
:
1140 case MEP_OPERAND_TP
:
1142 case MEP_OPERAND_TPR
:
1144 case MEP_OPERAND_UDISP2
:
1145 errmsg
= insert_normal (cd
, fields
->f_2u6
, 0, 0, 6, 2, 32, total_length
, buffer
);
1147 case MEP_OPERAND_UDISP7
:
1148 errmsg
= insert_normal (cd
, fields
->f_7u9
, 0, 0, 9, 7, 32, total_length
, buffer
);
1150 case MEP_OPERAND_UDISP7A2
:
1152 long value
= fields
->f_7u9a2
;
1153 value
= ((USI
) (value
) >> (1));
1154 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 6, 32, total_length
, buffer
);
1157 case MEP_OPERAND_UDISP7A4
:
1159 long value
= fields
->f_7u9a4
;
1160 value
= ((USI
) (value
) >> (2));
1161 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1164 case MEP_OPERAND_UIMM16
:
1165 errmsg
= insert_normal (cd
, fields
->f_16u16
, 0, 0, 16, 16, 32, total_length
, buffer
);
1167 case MEP_OPERAND_UIMM2
:
1168 errmsg
= insert_normal (cd
, fields
->f_2u10
, 0, 0, 10, 2, 32, total_length
, buffer
);
1170 case MEP_OPERAND_UIMM24
:
1173 FLD (f_24u8n_hi
) = ((UINT
) (FLD (f_24u8n
)) >> (8));
1174 FLD (f_24u8n_lo
) = ((FLD (f_24u8n
)) & (255));
1176 errmsg
= insert_normal (cd
, fields
->f_24u8n_hi
, 0, 0, 16, 16, 32, total_length
, buffer
);
1179 errmsg
= insert_normal (cd
, fields
->f_24u8n_lo
, 0, 0, 8, 8, 32, total_length
, buffer
);
1184 case MEP_OPERAND_UIMM3
:
1185 errmsg
= insert_normal (cd
, fields
->f_3u5
, 0, 0, 5, 3, 32, total_length
, buffer
);
1187 case MEP_OPERAND_UIMM4
:
1188 errmsg
= insert_normal (cd
, fields
->f_4u8
, 0, 0, 8, 4, 32, total_length
, buffer
);
1190 case MEP_OPERAND_UIMM5
:
1191 errmsg
= insert_normal (cd
, fields
->f_5u8
, 0, 0, 8, 5, 32, total_length
, buffer
);
1193 case MEP_OPERAND_UIMM7A4
:
1195 long value
= fields
->f_7u9a4
;
1196 value
= ((USI
) (value
) >> (2));
1197 errmsg
= insert_normal (cd
, value
, 0, 0, 9, 5, 32, total_length
, buffer
);
1200 case MEP_OPERAND_ZERO
:
1204 /* xgettext:c-format */
1205 fprintf (stderr
, _("Unrecognized field %d while building insn.\n"),
1213 int mep_cgen_extract_operand
1214 (CGEN_CPU_DESC
, int, CGEN_EXTRACT_INFO
*, CGEN_INSN_INT
, CGEN_FIELDS
*, bfd_vma
);
1216 /* Main entry point for operand extraction.
1217 The result is <= 0 for error, >0 for success.
1218 ??? Actual values aren't well defined right now.
1220 This function is basically just a big switch statement. Earlier versions
1221 used tables to look up the function to use, but
1222 - if the table contains both assembler and disassembler functions then
1223 the disassembler contains much of the assembler and vice-versa,
1224 - there's a lot of inlining possibilities as things grow,
1225 - using a switch statement avoids the function call overhead.
1227 This function could be moved into `print_insn_normal', but keeping it
1228 separate makes clear the interface between `print_insn_normal' and each of
1232 mep_cgen_extract_operand (CGEN_CPU_DESC cd
,
1234 CGEN_EXTRACT_INFO
*ex_info
,
1235 CGEN_INSN_INT insn_value
,
1236 CGEN_FIELDS
* fields
,
1239 /* Assume success (for those operands that are nops). */
1241 unsigned int total_length
= CGEN_FIELDS_BITSIZE (fields
);
1245 case MEP_OPERAND_ADDR24A4
:
1247 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8a4n_hi
);
1248 if (length
<= 0) break;
1249 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 6, 32, total_length
, pc
, & fields
->f_24u8a4n_lo
);
1250 if (length
<= 0) break;
1251 FLD (f_24u8a4n
) = ((((FLD (f_24u8a4n_hi
)) << (8))) | (((FLD (f_24u8a4n_lo
)) << (2))));
1254 case MEP_OPERAND_C5RMUIMM20
:
1256 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_c5_rm
);
1257 if (length
<= 0) break;
1258 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1259 if (length
<= 0) break;
1261 FLD (f_c5_rmuimm20
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rm
)) << (16))));
1265 case MEP_OPERAND_C5RNMUIMM24
:
1267 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_c5_rnm
);
1268 if (length
<= 0) break;
1269 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_c5_16u16
);
1270 if (length
<= 0) break;
1272 FLD (f_c5_rnmuimm24
) = ((FLD (f_c5_16u16
)) | (((FLD (f_c5_rnm
)) << (16))));
1276 case MEP_OPERAND_CALLNUM
:
1278 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 1, 32, total_length
, pc
, & fields
->f_5
);
1279 if (length
<= 0) break;
1280 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_6
);
1281 if (length
<= 0) break;
1282 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 1, 32, total_length
, pc
, & fields
->f_7
);
1283 if (length
<= 0) break;
1284 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 11, 1, 32, total_length
, pc
, & fields
->f_11
);
1285 if (length
<= 0) break;
1286 FLD (f_callnum
) = ((((FLD (f_5
)) << (3))) | (((((FLD (f_6
)) << (2))) | (((((FLD (f_7
)) << (1))) | (FLD (f_11
)))))));
1289 case MEP_OPERAND_CCCC
:
1290 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1292 case MEP_OPERAND_CCRN
:
1294 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ccrn_hi
);
1295 if (length
<= 0) break;
1296 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ccrn_lo
);
1297 if (length
<= 0) break;
1298 FLD (f_ccrn
) = ((((FLD (f_ccrn_hi
)) << (4))) | (FLD (f_ccrn_lo
)));
1301 case MEP_OPERAND_CDISP10
:
1304 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1305 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)));
1306 fields
->f_cdisp10
= value
;
1309 case MEP_OPERAND_CDISP10A2
:
1312 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1313 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)));
1314 fields
->f_cdisp10
= value
;
1317 case MEP_OPERAND_CDISP10A4
:
1320 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1321 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)));
1322 fields
->f_cdisp10
= value
;
1325 case MEP_OPERAND_CDISP10A8
:
1328 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 22, 10, 32, total_length
, pc
, & value
);
1329 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)));
1330 fields
->f_cdisp10
= value
;
1333 case MEP_OPERAND_CDISP12
:
1334 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 12, 32, total_length
, pc
, & fields
->f_12s20
);
1336 case MEP_OPERAND_CIMM4
:
1337 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1339 case MEP_OPERAND_CIMM5
:
1340 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 24, 5, 32, total_length
, pc
, & fields
->f_5u24
);
1342 case MEP_OPERAND_CODE16
:
1343 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1345 case MEP_OPERAND_CODE24
:
1347 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_24u4n_hi
);
1348 if (length
<= 0) break;
1349 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u4n_lo
);
1350 if (length
<= 0) break;
1351 FLD (f_24u4n
) = ((((FLD (f_24u4n_hi
)) << (16))) | (FLD (f_24u4n_lo
)));
1354 case MEP_OPERAND_CP_FLAG
:
1356 case MEP_OPERAND_CRN
:
1357 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1359 case MEP_OPERAND_CRN64
:
1360 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crn
);
1362 case MEP_OPERAND_CRNX
:
1364 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1365 if (length
<= 0) break;
1366 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1367 if (length
<= 0) break;
1368 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1371 case MEP_OPERAND_CRNX64
:
1373 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 1, 32, total_length
, pc
, & fields
->f_crnx_hi
);
1374 if (length
<= 0) break;
1375 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_crnx_lo
);
1376 if (length
<= 0) break;
1377 FLD (f_crnx
) = ((((FLD (f_crnx_hi
)) << (4))) | (FLD (f_crnx_lo
)));
1380 case MEP_OPERAND_CROC
:
1381 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1383 case MEP_OPERAND_CROP
:
1384 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1386 case MEP_OPERAND_CRPC
:
1387 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 26, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u26
);
1389 case MEP_OPERAND_CRPP
:
1390 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 18, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u18
);
1392 case MEP_OPERAND_CRQC
:
1393 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 21, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u21
);
1395 case MEP_OPERAND_CRQP
:
1396 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 13, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u13
);
1398 case MEP_OPERAND_CSRN
:
1400 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1401 if (length
<= 0) break;
1402 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1403 if (length
<= 0) break;
1404 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1407 case MEP_OPERAND_CSRN_IDX
:
1409 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 15, 1, 32, total_length
, pc
, & fields
->f_csrn_hi
);
1410 if (length
<= 0) break;
1411 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_csrn_lo
);
1412 if (length
<= 0) break;
1413 FLD (f_csrn
) = ((((FLD (f_csrn_hi
)) << (4))) | (FLD (f_csrn_lo
)));
1416 case MEP_OPERAND_DBG
:
1418 case MEP_OPERAND_DEPC
:
1420 case MEP_OPERAND_EPC
:
1422 case MEP_OPERAND_EXC
:
1424 case MEP_OPERAND_HI
:
1426 case MEP_OPERAND_IMM16P0
:
1428 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1429 if (length
<= 0) break;
1430 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1431 if (length
<= 0) break;
1433 FLD (f_ivc2_imm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1437 case MEP_OPERAND_IMM3P12
:
1438 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u12
);
1440 case MEP_OPERAND_IMM3P25
:
1441 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 25, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u25
);
1443 case MEP_OPERAND_IMM3P4
:
1444 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u4
);
1446 case MEP_OPERAND_IMM3P5
:
1447 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u5
);
1449 case MEP_OPERAND_IMM3P9
:
1450 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u9
);
1452 case MEP_OPERAND_IMM4P10
:
1453 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u10
);
1455 case MEP_OPERAND_IMM4P4
:
1456 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u4
);
1458 case MEP_OPERAND_IMM4P8
:
1459 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u8
);
1461 case MEP_OPERAND_IMM5P23
:
1462 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 23, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u23
);
1464 case MEP_OPERAND_IMM5P3
:
1465 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 3, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u3
);
1467 case MEP_OPERAND_IMM5P7
:
1468 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 7, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u7
);
1470 case MEP_OPERAND_IMM5P8
:
1471 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u8
);
1473 case MEP_OPERAND_IMM6P2
:
1474 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 2, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u2
);
1476 case MEP_OPERAND_IMM6P6
:
1477 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 6, 32, total_length
, pc
, & fields
->f_ivc2_6u6
);
1479 case MEP_OPERAND_IMM8P0
:
1480 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1482 case MEP_OPERAND_IMM8P20
:
1483 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1485 case MEP_OPERAND_IMM8P4
:
1486 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u4
);
1488 case MEP_OPERAND_IVC_X_0_2
:
1489 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u0
);
1491 case MEP_OPERAND_IVC_X_0_3
:
1492 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u0
);
1494 case MEP_OPERAND_IVC_X_0_4
:
1495 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_4u0
);
1497 case MEP_OPERAND_IVC_X_0_5
:
1498 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 5, 32, total_length
, pc
, & fields
->f_ivc2_5u0
);
1500 case MEP_OPERAND_IVC_X_6_1
:
1501 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 1, 32, total_length
, pc
, & fields
->f_ivc2_1u6
);
1503 case MEP_OPERAND_IVC_X_6_2
:
1504 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_ivc2_2u6
);
1506 case MEP_OPERAND_IVC_X_6_3
:
1507 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 3, 32, total_length
, pc
, & fields
->f_ivc2_3u6
);
1509 case MEP_OPERAND_IVC2_ACC0_0
:
1511 case MEP_OPERAND_IVC2_ACC0_1
:
1513 case MEP_OPERAND_IVC2_ACC0_2
:
1515 case MEP_OPERAND_IVC2_ACC0_3
:
1517 case MEP_OPERAND_IVC2_ACC0_4
:
1519 case MEP_OPERAND_IVC2_ACC0_5
:
1521 case MEP_OPERAND_IVC2_ACC0_6
:
1523 case MEP_OPERAND_IVC2_ACC0_7
:
1525 case MEP_OPERAND_IVC2_ACC1_0
:
1527 case MEP_OPERAND_IVC2_ACC1_1
:
1529 case MEP_OPERAND_IVC2_ACC1_2
:
1531 case MEP_OPERAND_IVC2_ACC1_3
:
1533 case MEP_OPERAND_IVC2_ACC1_4
:
1535 case MEP_OPERAND_IVC2_ACC1_5
:
1537 case MEP_OPERAND_IVC2_ACC1_6
:
1539 case MEP_OPERAND_IVC2_ACC1_7
:
1541 case MEP_OPERAND_IVC2_CC
:
1543 case MEP_OPERAND_IVC2_COFA0
:
1545 case MEP_OPERAND_IVC2_COFA1
:
1547 case MEP_OPERAND_IVC2_COFR0
:
1549 case MEP_OPERAND_IVC2_COFR1
:
1551 case MEP_OPERAND_IVC2_CSAR0
:
1553 case MEP_OPERAND_IVC2_CSAR1
:
1555 case MEP_OPERAND_IVC2C3CCRN
:
1557 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 28, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3hi
);
1558 if (length
<= 0) break;
1559 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_c3lo
);
1560 if (length
<= 0) break;
1561 FLD (f_ivc2_ccrn_c3
) = ((((FLD (f_ivc2_ccrn_c3hi
)) << (4))) | (FLD (f_ivc2_ccrn_c3lo
)));
1564 case MEP_OPERAND_IVC2CCRN
:
1566 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 2, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h2
);
1567 if (length
<= 0) break;
1568 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1569 if (length
<= 0) break;
1570 FLD (f_ivc2_ccrn
) = ((((FLD (f_ivc2_ccrn_h2
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1573 case MEP_OPERAND_IVC2CRN
:
1575 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 1, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_h1
);
1576 if (length
<= 0) break;
1577 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 4, 32, total_length
, pc
, & fields
->f_ivc2_ccrn_lo
);
1578 if (length
<= 0) break;
1579 FLD (f_ivc2_crnx
) = ((((FLD (f_ivc2_ccrn_h1
)) << (4))) | (FLD (f_ivc2_ccrn_lo
)));
1582 case MEP_OPERAND_IVC2RM
:
1583 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_ivc2_crm
);
1585 case MEP_OPERAND_LO
:
1587 case MEP_OPERAND_LP
:
1589 case MEP_OPERAND_MB0
:
1591 case MEP_OPERAND_MB1
:
1593 case MEP_OPERAND_ME0
:
1595 case MEP_OPERAND_ME1
:
1597 case MEP_OPERAND_NPC
:
1599 case MEP_OPERAND_OPT
:
1601 case MEP_OPERAND_PCABS24A2
:
1603 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u5a2n_hi
);
1604 if (length
<= 0) break;
1605 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 7, 32, total_length
, pc
, & fields
->f_24u5a2n_lo
);
1606 if (length
<= 0) break;
1607 FLD (f_24u5a2n
) = ((((FLD (f_24u5a2n_hi
)) << (8))) | (((FLD (f_24u5a2n_lo
)) << (1))));
1610 case MEP_OPERAND_PCREL12A2
:
1613 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
);
1614 value
= ((((value
) << (1))) + (pc
));
1615 fields
->f_12s4a2
= value
;
1618 case MEP_OPERAND_PCREL17A2
:
1621 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
);
1622 value
= ((((value
) << (1))) + (pc
));
1623 fields
->f_17s16a2
= value
;
1626 case MEP_OPERAND_PCREL24A2
:
1628 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
);
1629 if (length
<= 0) break;
1630 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
);
1631 if (length
<= 0) break;
1632 FLD (f_24s5a2n
) = ((((((FLD (f_24s5a2n_hi
)) << (8))) | (((FLD (f_24s5a2n_lo
)) << (1))))) + (pc
));
1635 case MEP_OPERAND_PCREL8A2
:
1638 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
);
1639 value
= ((((value
) << (1))) + (pc
));
1640 fields
->f_8s8a2
= value
;
1643 case MEP_OPERAND_PSW
:
1645 case MEP_OPERAND_R0
:
1647 case MEP_OPERAND_R1
:
1649 case MEP_OPERAND_RL
:
1650 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 12, 4, 32, total_length
, pc
, & fields
->f_rl
);
1652 case MEP_OPERAND_RL5
:
1653 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 4, 32, total_length
, pc
, & fields
->f_rl5
);
1655 case MEP_OPERAND_RM
:
1656 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1658 case MEP_OPERAND_RMA
:
1659 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_rm
);
1661 case MEP_OPERAND_RN
:
1662 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1664 case MEP_OPERAND_RN3
:
1665 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1667 case MEP_OPERAND_RN3C
:
1668 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1670 case MEP_OPERAND_RN3L
:
1671 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1673 case MEP_OPERAND_RN3S
:
1674 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1676 case MEP_OPERAND_RN3UC
:
1677 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1679 case MEP_OPERAND_RN3UL
:
1680 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1682 case MEP_OPERAND_RN3US
:
1683 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_rn3
);
1685 case MEP_OPERAND_RNC
:
1686 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1688 case MEP_OPERAND_RNL
:
1689 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1691 case MEP_OPERAND_RNS
:
1692 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1694 case MEP_OPERAND_RNUC
:
1695 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1697 case MEP_OPERAND_RNUL
:
1698 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1700 case MEP_OPERAND_RNUS
:
1701 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 4, 4, 32, total_length
, pc
, & fields
->f_rn
);
1703 case MEP_OPERAND_SAR
:
1705 case MEP_OPERAND_SDISP16
:
1706 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1708 case MEP_OPERAND_SIMM16
:
1709 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 16, 16, 32, total_length
, pc
, & fields
->f_16s16
);
1711 case MEP_OPERAND_SIMM16P0
:
1713 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u0
);
1714 if (length
<= 0) break;
1715 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8u20
);
1716 if (length
<= 0) break;
1718 FLD (f_ivc2_simm16p0
) = ((FLD (f_ivc2_8u20
)) | (((FLD (f_ivc2_8u0
)) << (8))));
1722 case MEP_OPERAND_SIMM6
:
1723 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 6, 32, total_length
, pc
, & fields
->f_6s8
);
1725 case MEP_OPERAND_SIMM8
:
1726 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 8, 8, 32, total_length
, pc
, & fields
->f_8s8
);
1728 case MEP_OPERAND_SIMM8P0
:
1729 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 0, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s0
);
1731 case MEP_OPERAND_SIMM8P20
:
1732 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 20, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s20
);
1734 case MEP_OPERAND_SIMM8P4
:
1735 length
= extract_normal (cd
, ex_info
, insn_value
, 0|(1<<CGEN_IFLD_SIGNED
), 0, 4, 8, 32, total_length
, pc
, & fields
->f_ivc2_8s4
);
1737 case MEP_OPERAND_SP
:
1739 case MEP_OPERAND_SPR
:
1741 case MEP_OPERAND_TP
:
1743 case MEP_OPERAND_TPR
:
1745 case MEP_OPERAND_UDISP2
:
1746 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 6, 2, 32, total_length
, pc
, & fields
->f_2u6
);
1748 case MEP_OPERAND_UDISP7
:
1749 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 7, 32, total_length
, pc
, & fields
->f_7u9
);
1751 case MEP_OPERAND_UDISP7A2
:
1754 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 6, 32, total_length
, pc
, & value
);
1755 value
= ((value
) << (1));
1756 fields
->f_7u9a2
= value
;
1759 case MEP_OPERAND_UDISP7A4
:
1762 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1763 value
= ((value
) << (2));
1764 fields
->f_7u9a4
= value
;
1767 case MEP_OPERAND_UIMM16
:
1768 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_16u16
);
1770 case MEP_OPERAND_UIMM2
:
1771 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 10, 2, 32, total_length
, pc
, & fields
->f_2u10
);
1773 case MEP_OPERAND_UIMM24
:
1775 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 16, 16, 32, total_length
, pc
, & fields
->f_24u8n_hi
);
1776 if (length
<= 0) break;
1777 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 8, 32, total_length
, pc
, & fields
->f_24u8n_lo
);
1778 if (length
<= 0) break;
1779 FLD (f_24u8n
) = ((((FLD (f_24u8n_hi
)) << (8))) | (FLD (f_24u8n_lo
)));
1782 case MEP_OPERAND_UIMM3
:
1783 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 5, 3, 32, total_length
, pc
, & fields
->f_3u5
);
1785 case MEP_OPERAND_UIMM4
:
1786 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 4, 32, total_length
, pc
, & fields
->f_4u8
);
1788 case MEP_OPERAND_UIMM5
:
1789 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 8, 5, 32, total_length
, pc
, & fields
->f_5u8
);
1791 case MEP_OPERAND_UIMM7A4
:
1794 length
= extract_normal (cd
, ex_info
, insn_value
, 0, 0, 9, 5, 32, total_length
, pc
, & value
);
1795 value
= ((value
) << (2));
1796 fields
->f_7u9a4
= value
;
1799 case MEP_OPERAND_ZERO
:
1803 /* xgettext:c-format */
1804 fprintf (stderr
, _("Unrecognized field %d while decoding insn.\n"),
1812 cgen_insert_fn
* const mep_cgen_insert_handlers
[] =
1817 cgen_extract_fn
* const mep_cgen_extract_handlers
[] =
1819 extract_insn_normal
,
1822 int mep_cgen_get_int_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1823 bfd_vma
mep_cgen_get_vma_operand (CGEN_CPU_DESC
, int, const CGEN_FIELDS
*);
1825 /* Getting values from cgen_fields is handled by a collection of functions.
1826 They are distinguished by the type of the VALUE argument they return.
1827 TODO: floating point, inlining support, remove cases where result type
1831 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
1833 const CGEN_FIELDS
* fields
)
1839 case MEP_OPERAND_ADDR24A4
:
1840 value
= fields
->f_24u8a4n
;
1842 case MEP_OPERAND_C5RMUIMM20
:
1843 value
= fields
->f_c5_rmuimm20
;
1845 case MEP_OPERAND_C5RNMUIMM24
:
1846 value
= fields
->f_c5_rnmuimm24
;
1848 case MEP_OPERAND_CALLNUM
:
1849 value
= fields
->f_callnum
;
1851 case MEP_OPERAND_CCCC
:
1852 value
= fields
->f_rm
;
1854 case MEP_OPERAND_CCRN
:
1855 value
= fields
->f_ccrn
;
1857 case MEP_OPERAND_CDISP10
:
1858 value
= fields
->f_cdisp10
;
1860 case MEP_OPERAND_CDISP10A2
:
1861 value
= fields
->f_cdisp10
;
1863 case MEP_OPERAND_CDISP10A4
:
1864 value
= fields
->f_cdisp10
;
1866 case MEP_OPERAND_CDISP10A8
:
1867 value
= fields
->f_cdisp10
;
1869 case MEP_OPERAND_CDISP12
:
1870 value
= fields
->f_12s20
;
1872 case MEP_OPERAND_CIMM4
:
1873 value
= fields
->f_rn
;
1875 case MEP_OPERAND_CIMM5
:
1876 value
= fields
->f_5u24
;
1878 case MEP_OPERAND_CODE16
:
1879 value
= fields
->f_16u16
;
1881 case MEP_OPERAND_CODE24
:
1882 value
= fields
->f_24u4n
;
1884 case MEP_OPERAND_CP_FLAG
:
1887 case MEP_OPERAND_CRN
:
1888 value
= fields
->f_crn
;
1890 case MEP_OPERAND_CRN64
:
1891 value
= fields
->f_crn
;
1893 case MEP_OPERAND_CRNX
:
1894 value
= fields
->f_crnx
;
1896 case MEP_OPERAND_CRNX64
:
1897 value
= fields
->f_crnx
;
1899 case MEP_OPERAND_CROC
:
1900 value
= fields
->f_ivc2_5u7
;
1902 case MEP_OPERAND_CROP
:
1903 value
= fields
->f_ivc2_5u23
;
1905 case MEP_OPERAND_CRPC
:
1906 value
= fields
->f_ivc2_5u26
;
1908 case MEP_OPERAND_CRPP
:
1909 value
= fields
->f_ivc2_5u18
;
1911 case MEP_OPERAND_CRQC
:
1912 value
= fields
->f_ivc2_5u21
;
1914 case MEP_OPERAND_CRQP
:
1915 value
= fields
->f_ivc2_5u13
;
1917 case MEP_OPERAND_CSRN
:
1918 value
= fields
->f_csrn
;
1920 case MEP_OPERAND_CSRN_IDX
:
1921 value
= fields
->f_csrn
;
1923 case MEP_OPERAND_DBG
:
1926 case MEP_OPERAND_DEPC
:
1929 case MEP_OPERAND_EPC
:
1932 case MEP_OPERAND_EXC
:
1935 case MEP_OPERAND_HI
:
1938 case MEP_OPERAND_IMM16P0
:
1939 value
= fields
->f_ivc2_imm16p0
;
1941 case MEP_OPERAND_IMM3P12
:
1942 value
= fields
->f_ivc2_3u12
;
1944 case MEP_OPERAND_IMM3P25
:
1945 value
= fields
->f_ivc2_3u25
;
1947 case MEP_OPERAND_IMM3P4
:
1948 value
= fields
->f_ivc2_3u4
;
1950 case MEP_OPERAND_IMM3P5
:
1951 value
= fields
->f_ivc2_3u5
;
1953 case MEP_OPERAND_IMM3P9
:
1954 value
= fields
->f_ivc2_3u9
;
1956 case MEP_OPERAND_IMM4P10
:
1957 value
= fields
->f_ivc2_4u10
;
1959 case MEP_OPERAND_IMM4P4
:
1960 value
= fields
->f_ivc2_4u4
;
1962 case MEP_OPERAND_IMM4P8
:
1963 value
= fields
->f_ivc2_4u8
;
1965 case MEP_OPERAND_IMM5P23
:
1966 value
= fields
->f_ivc2_5u23
;
1968 case MEP_OPERAND_IMM5P3
:
1969 value
= fields
->f_ivc2_5u3
;
1971 case MEP_OPERAND_IMM5P7
:
1972 value
= fields
->f_ivc2_5u7
;
1974 case MEP_OPERAND_IMM5P8
:
1975 value
= fields
->f_ivc2_5u8
;
1977 case MEP_OPERAND_IMM6P2
:
1978 value
= fields
->f_ivc2_6u2
;
1980 case MEP_OPERAND_IMM6P6
:
1981 value
= fields
->f_ivc2_6u6
;
1983 case MEP_OPERAND_IMM8P0
:
1984 value
= fields
->f_ivc2_8u0
;
1986 case MEP_OPERAND_IMM8P20
:
1987 value
= fields
->f_ivc2_8u20
;
1989 case MEP_OPERAND_IMM8P4
:
1990 value
= fields
->f_ivc2_8u4
;
1992 case MEP_OPERAND_IVC_X_0_2
:
1993 value
= fields
->f_ivc2_2u0
;
1995 case MEP_OPERAND_IVC_X_0_3
:
1996 value
= fields
->f_ivc2_3u0
;
1998 case MEP_OPERAND_IVC_X_0_4
:
1999 value
= fields
->f_ivc2_4u0
;
2001 case MEP_OPERAND_IVC_X_0_5
:
2002 value
= fields
->f_ivc2_5u0
;
2004 case MEP_OPERAND_IVC_X_6_1
:
2005 value
= fields
->f_ivc2_1u6
;
2007 case MEP_OPERAND_IVC_X_6_2
:
2008 value
= fields
->f_ivc2_2u6
;
2010 case MEP_OPERAND_IVC_X_6_3
:
2011 value
= fields
->f_ivc2_3u6
;
2013 case MEP_OPERAND_IVC2_ACC0_0
:
2016 case MEP_OPERAND_IVC2_ACC0_1
:
2019 case MEP_OPERAND_IVC2_ACC0_2
:
2022 case MEP_OPERAND_IVC2_ACC0_3
:
2025 case MEP_OPERAND_IVC2_ACC0_4
:
2028 case MEP_OPERAND_IVC2_ACC0_5
:
2031 case MEP_OPERAND_IVC2_ACC0_6
:
2034 case MEP_OPERAND_IVC2_ACC0_7
:
2037 case MEP_OPERAND_IVC2_ACC1_0
:
2040 case MEP_OPERAND_IVC2_ACC1_1
:
2043 case MEP_OPERAND_IVC2_ACC1_2
:
2046 case MEP_OPERAND_IVC2_ACC1_3
:
2049 case MEP_OPERAND_IVC2_ACC1_4
:
2052 case MEP_OPERAND_IVC2_ACC1_5
:
2055 case MEP_OPERAND_IVC2_ACC1_6
:
2058 case MEP_OPERAND_IVC2_ACC1_7
:
2061 case MEP_OPERAND_IVC2_CC
:
2064 case MEP_OPERAND_IVC2_COFA0
:
2067 case MEP_OPERAND_IVC2_COFA1
:
2070 case MEP_OPERAND_IVC2_COFR0
:
2073 case MEP_OPERAND_IVC2_COFR1
:
2076 case MEP_OPERAND_IVC2_CSAR0
:
2079 case MEP_OPERAND_IVC2_CSAR1
:
2082 case MEP_OPERAND_IVC2C3CCRN
:
2083 value
= fields
->f_ivc2_ccrn_c3
;
2085 case MEP_OPERAND_IVC2CCRN
:
2086 value
= fields
->f_ivc2_ccrn
;
2088 case MEP_OPERAND_IVC2CRN
:
2089 value
= fields
->f_ivc2_crnx
;
2091 case MEP_OPERAND_IVC2RM
:
2092 value
= fields
->f_ivc2_crm
;
2094 case MEP_OPERAND_LO
:
2097 case MEP_OPERAND_LP
:
2100 case MEP_OPERAND_MB0
:
2103 case MEP_OPERAND_MB1
:
2106 case MEP_OPERAND_ME0
:
2109 case MEP_OPERAND_ME1
:
2112 case MEP_OPERAND_NPC
:
2115 case MEP_OPERAND_OPT
:
2118 case MEP_OPERAND_PCABS24A2
:
2119 value
= fields
->f_24u5a2n
;
2121 case MEP_OPERAND_PCREL12A2
:
2122 value
= fields
->f_12s4a2
;
2124 case MEP_OPERAND_PCREL17A2
:
2125 value
= fields
->f_17s16a2
;
2127 case MEP_OPERAND_PCREL24A2
:
2128 value
= fields
->f_24s5a2n
;
2130 case MEP_OPERAND_PCREL8A2
:
2131 value
= fields
->f_8s8a2
;
2133 case MEP_OPERAND_PSW
:
2136 case MEP_OPERAND_R0
:
2139 case MEP_OPERAND_R1
:
2142 case MEP_OPERAND_RL
:
2143 value
= fields
->f_rl
;
2145 case MEP_OPERAND_RL5
:
2146 value
= fields
->f_rl5
;
2148 case MEP_OPERAND_RM
:
2149 value
= fields
->f_rm
;
2151 case MEP_OPERAND_RMA
:
2152 value
= fields
->f_rm
;
2154 case MEP_OPERAND_RN
:
2155 value
= fields
->f_rn
;
2157 case MEP_OPERAND_RN3
:
2158 value
= fields
->f_rn3
;
2160 case MEP_OPERAND_RN3C
:
2161 value
= fields
->f_rn3
;
2163 case MEP_OPERAND_RN3L
:
2164 value
= fields
->f_rn3
;
2166 case MEP_OPERAND_RN3S
:
2167 value
= fields
->f_rn3
;
2169 case MEP_OPERAND_RN3UC
:
2170 value
= fields
->f_rn3
;
2172 case MEP_OPERAND_RN3UL
:
2173 value
= fields
->f_rn3
;
2175 case MEP_OPERAND_RN3US
:
2176 value
= fields
->f_rn3
;
2178 case MEP_OPERAND_RNC
:
2179 value
= fields
->f_rn
;
2181 case MEP_OPERAND_RNL
:
2182 value
= fields
->f_rn
;
2184 case MEP_OPERAND_RNS
:
2185 value
= fields
->f_rn
;
2187 case MEP_OPERAND_RNUC
:
2188 value
= fields
->f_rn
;
2190 case MEP_OPERAND_RNUL
:
2191 value
= fields
->f_rn
;
2193 case MEP_OPERAND_RNUS
:
2194 value
= fields
->f_rn
;
2196 case MEP_OPERAND_SAR
:
2199 case MEP_OPERAND_SDISP16
:
2200 value
= fields
->f_16s16
;
2202 case MEP_OPERAND_SIMM16
:
2203 value
= fields
->f_16s16
;
2205 case MEP_OPERAND_SIMM16P0
:
2206 value
= fields
->f_ivc2_simm16p0
;
2208 case MEP_OPERAND_SIMM6
:
2209 value
= fields
->f_6s8
;
2211 case MEP_OPERAND_SIMM8
:
2212 value
= fields
->f_8s8
;
2214 case MEP_OPERAND_SIMM8P0
:
2215 value
= fields
->f_ivc2_8s0
;
2217 case MEP_OPERAND_SIMM8P20
:
2218 value
= fields
->f_ivc2_8s20
;
2220 case MEP_OPERAND_SIMM8P4
:
2221 value
= fields
->f_ivc2_8s4
;
2223 case MEP_OPERAND_SP
:
2226 case MEP_OPERAND_SPR
:
2229 case MEP_OPERAND_TP
:
2232 case MEP_OPERAND_TPR
:
2235 case MEP_OPERAND_UDISP2
:
2236 value
= fields
->f_2u6
;
2238 case MEP_OPERAND_UDISP7
:
2239 value
= fields
->f_7u9
;
2241 case MEP_OPERAND_UDISP7A2
:
2242 value
= fields
->f_7u9a2
;
2244 case MEP_OPERAND_UDISP7A4
:
2245 value
= fields
->f_7u9a4
;
2247 case MEP_OPERAND_UIMM16
:
2248 value
= fields
->f_16u16
;
2250 case MEP_OPERAND_UIMM2
:
2251 value
= fields
->f_2u10
;
2253 case MEP_OPERAND_UIMM24
:
2254 value
= fields
->f_24u8n
;
2256 case MEP_OPERAND_UIMM3
:
2257 value
= fields
->f_3u5
;
2259 case MEP_OPERAND_UIMM4
:
2260 value
= fields
->f_4u8
;
2262 case MEP_OPERAND_UIMM5
:
2263 value
= fields
->f_5u8
;
2265 case MEP_OPERAND_UIMM7A4
:
2266 value
= fields
->f_7u9a4
;
2268 case MEP_OPERAND_ZERO
:
2273 /* xgettext:c-format */
2274 fprintf (stderr
, _("Unrecognized field %d while getting int operand.\n"),
2283 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2285 const CGEN_FIELDS
* fields
)
2291 case MEP_OPERAND_ADDR24A4
:
2292 value
= fields
->f_24u8a4n
;
2294 case MEP_OPERAND_C5RMUIMM20
:
2295 value
= fields
->f_c5_rmuimm20
;
2297 case MEP_OPERAND_C5RNMUIMM24
:
2298 value
= fields
->f_c5_rnmuimm24
;
2300 case MEP_OPERAND_CALLNUM
:
2301 value
= fields
->f_callnum
;
2303 case MEP_OPERAND_CCCC
:
2304 value
= fields
->f_rm
;
2306 case MEP_OPERAND_CCRN
:
2307 value
= fields
->f_ccrn
;
2309 case MEP_OPERAND_CDISP10
:
2310 value
= fields
->f_cdisp10
;
2312 case MEP_OPERAND_CDISP10A2
:
2313 value
= fields
->f_cdisp10
;
2315 case MEP_OPERAND_CDISP10A4
:
2316 value
= fields
->f_cdisp10
;
2318 case MEP_OPERAND_CDISP10A8
:
2319 value
= fields
->f_cdisp10
;
2321 case MEP_OPERAND_CDISP12
:
2322 value
= fields
->f_12s20
;
2324 case MEP_OPERAND_CIMM4
:
2325 value
= fields
->f_rn
;
2327 case MEP_OPERAND_CIMM5
:
2328 value
= fields
->f_5u24
;
2330 case MEP_OPERAND_CODE16
:
2331 value
= fields
->f_16u16
;
2333 case MEP_OPERAND_CODE24
:
2334 value
= fields
->f_24u4n
;
2336 case MEP_OPERAND_CP_FLAG
:
2339 case MEP_OPERAND_CRN
:
2340 value
= fields
->f_crn
;
2342 case MEP_OPERAND_CRN64
:
2343 value
= fields
->f_crn
;
2345 case MEP_OPERAND_CRNX
:
2346 value
= fields
->f_crnx
;
2348 case MEP_OPERAND_CRNX64
:
2349 value
= fields
->f_crnx
;
2351 case MEP_OPERAND_CROC
:
2352 value
= fields
->f_ivc2_5u7
;
2354 case MEP_OPERAND_CROP
:
2355 value
= fields
->f_ivc2_5u23
;
2357 case MEP_OPERAND_CRPC
:
2358 value
= fields
->f_ivc2_5u26
;
2360 case MEP_OPERAND_CRPP
:
2361 value
= fields
->f_ivc2_5u18
;
2363 case MEP_OPERAND_CRQC
:
2364 value
= fields
->f_ivc2_5u21
;
2366 case MEP_OPERAND_CRQP
:
2367 value
= fields
->f_ivc2_5u13
;
2369 case MEP_OPERAND_CSRN
:
2370 value
= fields
->f_csrn
;
2372 case MEP_OPERAND_CSRN_IDX
:
2373 value
= fields
->f_csrn
;
2375 case MEP_OPERAND_DBG
:
2378 case MEP_OPERAND_DEPC
:
2381 case MEP_OPERAND_EPC
:
2384 case MEP_OPERAND_EXC
:
2387 case MEP_OPERAND_HI
:
2390 case MEP_OPERAND_IMM16P0
:
2391 value
= fields
->f_ivc2_imm16p0
;
2393 case MEP_OPERAND_IMM3P12
:
2394 value
= fields
->f_ivc2_3u12
;
2396 case MEP_OPERAND_IMM3P25
:
2397 value
= fields
->f_ivc2_3u25
;
2399 case MEP_OPERAND_IMM3P4
:
2400 value
= fields
->f_ivc2_3u4
;
2402 case MEP_OPERAND_IMM3P5
:
2403 value
= fields
->f_ivc2_3u5
;
2405 case MEP_OPERAND_IMM3P9
:
2406 value
= fields
->f_ivc2_3u9
;
2408 case MEP_OPERAND_IMM4P10
:
2409 value
= fields
->f_ivc2_4u10
;
2411 case MEP_OPERAND_IMM4P4
:
2412 value
= fields
->f_ivc2_4u4
;
2414 case MEP_OPERAND_IMM4P8
:
2415 value
= fields
->f_ivc2_4u8
;
2417 case MEP_OPERAND_IMM5P23
:
2418 value
= fields
->f_ivc2_5u23
;
2420 case MEP_OPERAND_IMM5P3
:
2421 value
= fields
->f_ivc2_5u3
;
2423 case MEP_OPERAND_IMM5P7
:
2424 value
= fields
->f_ivc2_5u7
;
2426 case MEP_OPERAND_IMM5P8
:
2427 value
= fields
->f_ivc2_5u8
;
2429 case MEP_OPERAND_IMM6P2
:
2430 value
= fields
->f_ivc2_6u2
;
2432 case MEP_OPERAND_IMM6P6
:
2433 value
= fields
->f_ivc2_6u6
;
2435 case MEP_OPERAND_IMM8P0
:
2436 value
= fields
->f_ivc2_8u0
;
2438 case MEP_OPERAND_IMM8P20
:
2439 value
= fields
->f_ivc2_8u20
;
2441 case MEP_OPERAND_IMM8P4
:
2442 value
= fields
->f_ivc2_8u4
;
2444 case MEP_OPERAND_IVC_X_0_2
:
2445 value
= fields
->f_ivc2_2u0
;
2447 case MEP_OPERAND_IVC_X_0_3
:
2448 value
= fields
->f_ivc2_3u0
;
2450 case MEP_OPERAND_IVC_X_0_4
:
2451 value
= fields
->f_ivc2_4u0
;
2453 case MEP_OPERAND_IVC_X_0_5
:
2454 value
= fields
->f_ivc2_5u0
;
2456 case MEP_OPERAND_IVC_X_6_1
:
2457 value
= fields
->f_ivc2_1u6
;
2459 case MEP_OPERAND_IVC_X_6_2
:
2460 value
= fields
->f_ivc2_2u6
;
2462 case MEP_OPERAND_IVC_X_6_3
:
2463 value
= fields
->f_ivc2_3u6
;
2465 case MEP_OPERAND_IVC2_ACC0_0
:
2468 case MEP_OPERAND_IVC2_ACC0_1
:
2471 case MEP_OPERAND_IVC2_ACC0_2
:
2474 case MEP_OPERAND_IVC2_ACC0_3
:
2477 case MEP_OPERAND_IVC2_ACC0_4
:
2480 case MEP_OPERAND_IVC2_ACC0_5
:
2483 case MEP_OPERAND_IVC2_ACC0_6
:
2486 case MEP_OPERAND_IVC2_ACC0_7
:
2489 case MEP_OPERAND_IVC2_ACC1_0
:
2492 case MEP_OPERAND_IVC2_ACC1_1
:
2495 case MEP_OPERAND_IVC2_ACC1_2
:
2498 case MEP_OPERAND_IVC2_ACC1_3
:
2501 case MEP_OPERAND_IVC2_ACC1_4
:
2504 case MEP_OPERAND_IVC2_ACC1_5
:
2507 case MEP_OPERAND_IVC2_ACC1_6
:
2510 case MEP_OPERAND_IVC2_ACC1_7
:
2513 case MEP_OPERAND_IVC2_CC
:
2516 case MEP_OPERAND_IVC2_COFA0
:
2519 case MEP_OPERAND_IVC2_COFA1
:
2522 case MEP_OPERAND_IVC2_COFR0
:
2525 case MEP_OPERAND_IVC2_COFR1
:
2528 case MEP_OPERAND_IVC2_CSAR0
:
2531 case MEP_OPERAND_IVC2_CSAR1
:
2534 case MEP_OPERAND_IVC2C3CCRN
:
2535 value
= fields
->f_ivc2_ccrn_c3
;
2537 case MEP_OPERAND_IVC2CCRN
:
2538 value
= fields
->f_ivc2_ccrn
;
2540 case MEP_OPERAND_IVC2CRN
:
2541 value
= fields
->f_ivc2_crnx
;
2543 case MEP_OPERAND_IVC2RM
:
2544 value
= fields
->f_ivc2_crm
;
2546 case MEP_OPERAND_LO
:
2549 case MEP_OPERAND_LP
:
2552 case MEP_OPERAND_MB0
:
2555 case MEP_OPERAND_MB1
:
2558 case MEP_OPERAND_ME0
:
2561 case MEP_OPERAND_ME1
:
2564 case MEP_OPERAND_NPC
:
2567 case MEP_OPERAND_OPT
:
2570 case MEP_OPERAND_PCABS24A2
:
2571 value
= fields
->f_24u5a2n
;
2573 case MEP_OPERAND_PCREL12A2
:
2574 value
= fields
->f_12s4a2
;
2576 case MEP_OPERAND_PCREL17A2
:
2577 value
= fields
->f_17s16a2
;
2579 case MEP_OPERAND_PCREL24A2
:
2580 value
= fields
->f_24s5a2n
;
2582 case MEP_OPERAND_PCREL8A2
:
2583 value
= fields
->f_8s8a2
;
2585 case MEP_OPERAND_PSW
:
2588 case MEP_OPERAND_R0
:
2591 case MEP_OPERAND_R1
:
2594 case MEP_OPERAND_RL
:
2595 value
= fields
->f_rl
;
2597 case MEP_OPERAND_RL5
:
2598 value
= fields
->f_rl5
;
2600 case MEP_OPERAND_RM
:
2601 value
= fields
->f_rm
;
2603 case MEP_OPERAND_RMA
:
2604 value
= fields
->f_rm
;
2606 case MEP_OPERAND_RN
:
2607 value
= fields
->f_rn
;
2609 case MEP_OPERAND_RN3
:
2610 value
= fields
->f_rn3
;
2612 case MEP_OPERAND_RN3C
:
2613 value
= fields
->f_rn3
;
2615 case MEP_OPERAND_RN3L
:
2616 value
= fields
->f_rn3
;
2618 case MEP_OPERAND_RN3S
:
2619 value
= fields
->f_rn3
;
2621 case MEP_OPERAND_RN3UC
:
2622 value
= fields
->f_rn3
;
2624 case MEP_OPERAND_RN3UL
:
2625 value
= fields
->f_rn3
;
2627 case MEP_OPERAND_RN3US
:
2628 value
= fields
->f_rn3
;
2630 case MEP_OPERAND_RNC
:
2631 value
= fields
->f_rn
;
2633 case MEP_OPERAND_RNL
:
2634 value
= fields
->f_rn
;
2636 case MEP_OPERAND_RNS
:
2637 value
= fields
->f_rn
;
2639 case MEP_OPERAND_RNUC
:
2640 value
= fields
->f_rn
;
2642 case MEP_OPERAND_RNUL
:
2643 value
= fields
->f_rn
;
2645 case MEP_OPERAND_RNUS
:
2646 value
= fields
->f_rn
;
2648 case MEP_OPERAND_SAR
:
2651 case MEP_OPERAND_SDISP16
:
2652 value
= fields
->f_16s16
;
2654 case MEP_OPERAND_SIMM16
:
2655 value
= fields
->f_16s16
;
2657 case MEP_OPERAND_SIMM16P0
:
2658 value
= fields
->f_ivc2_simm16p0
;
2660 case MEP_OPERAND_SIMM6
:
2661 value
= fields
->f_6s8
;
2663 case MEP_OPERAND_SIMM8
:
2664 value
= fields
->f_8s8
;
2666 case MEP_OPERAND_SIMM8P0
:
2667 value
= fields
->f_ivc2_8s0
;
2669 case MEP_OPERAND_SIMM8P20
:
2670 value
= fields
->f_ivc2_8s20
;
2672 case MEP_OPERAND_SIMM8P4
:
2673 value
= fields
->f_ivc2_8s4
;
2675 case MEP_OPERAND_SP
:
2678 case MEP_OPERAND_SPR
:
2681 case MEP_OPERAND_TP
:
2684 case MEP_OPERAND_TPR
:
2687 case MEP_OPERAND_UDISP2
:
2688 value
= fields
->f_2u6
;
2690 case MEP_OPERAND_UDISP7
:
2691 value
= fields
->f_7u9
;
2693 case MEP_OPERAND_UDISP7A2
:
2694 value
= fields
->f_7u9a2
;
2696 case MEP_OPERAND_UDISP7A4
:
2697 value
= fields
->f_7u9a4
;
2699 case MEP_OPERAND_UIMM16
:
2700 value
= fields
->f_16u16
;
2702 case MEP_OPERAND_UIMM2
:
2703 value
= fields
->f_2u10
;
2705 case MEP_OPERAND_UIMM24
:
2706 value
= fields
->f_24u8n
;
2708 case MEP_OPERAND_UIMM3
:
2709 value
= fields
->f_3u5
;
2711 case MEP_OPERAND_UIMM4
:
2712 value
= fields
->f_4u8
;
2714 case MEP_OPERAND_UIMM5
:
2715 value
= fields
->f_5u8
;
2717 case MEP_OPERAND_UIMM7A4
:
2718 value
= fields
->f_7u9a4
;
2720 case MEP_OPERAND_ZERO
:
2725 /* xgettext:c-format */
2726 fprintf (stderr
, _("Unrecognized field %d while getting vma operand.\n"),
2734 void mep_cgen_set_int_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, int);
2735 void mep_cgen_set_vma_operand (CGEN_CPU_DESC
, int, CGEN_FIELDS
*, bfd_vma
);
2737 /* Stuffing values in cgen_fields is handled by a collection of functions.
2738 They are distinguished by the type of the VALUE argument they accept.
2739 TODO: floating point, inlining support, remove cases where argument type
2743 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
2745 CGEN_FIELDS
* fields
,
2750 case MEP_OPERAND_ADDR24A4
:
2751 fields
->f_24u8a4n
= value
;
2753 case MEP_OPERAND_C5RMUIMM20
:
2754 fields
->f_c5_rmuimm20
= value
;
2756 case MEP_OPERAND_C5RNMUIMM24
:
2757 fields
->f_c5_rnmuimm24
= value
;
2759 case MEP_OPERAND_CALLNUM
:
2760 fields
->f_callnum
= value
;
2762 case MEP_OPERAND_CCCC
:
2763 fields
->f_rm
= value
;
2765 case MEP_OPERAND_CCRN
:
2766 fields
->f_ccrn
= value
;
2768 case MEP_OPERAND_CDISP10
:
2769 fields
->f_cdisp10
= value
;
2771 case MEP_OPERAND_CDISP10A2
:
2772 fields
->f_cdisp10
= value
;
2774 case MEP_OPERAND_CDISP10A4
:
2775 fields
->f_cdisp10
= value
;
2777 case MEP_OPERAND_CDISP10A8
:
2778 fields
->f_cdisp10
= value
;
2780 case MEP_OPERAND_CDISP12
:
2781 fields
->f_12s20
= value
;
2783 case MEP_OPERAND_CIMM4
:
2784 fields
->f_rn
= value
;
2786 case MEP_OPERAND_CIMM5
:
2787 fields
->f_5u24
= value
;
2789 case MEP_OPERAND_CODE16
:
2790 fields
->f_16u16
= value
;
2792 case MEP_OPERAND_CODE24
:
2793 fields
->f_24u4n
= value
;
2795 case MEP_OPERAND_CP_FLAG
:
2797 case MEP_OPERAND_CRN
:
2798 fields
->f_crn
= value
;
2800 case MEP_OPERAND_CRN64
:
2801 fields
->f_crn
= value
;
2803 case MEP_OPERAND_CRNX
:
2804 fields
->f_crnx
= value
;
2806 case MEP_OPERAND_CRNX64
:
2807 fields
->f_crnx
= value
;
2809 case MEP_OPERAND_CROC
:
2810 fields
->f_ivc2_5u7
= value
;
2812 case MEP_OPERAND_CROP
:
2813 fields
->f_ivc2_5u23
= value
;
2815 case MEP_OPERAND_CRPC
:
2816 fields
->f_ivc2_5u26
= value
;
2818 case MEP_OPERAND_CRPP
:
2819 fields
->f_ivc2_5u18
= value
;
2821 case MEP_OPERAND_CRQC
:
2822 fields
->f_ivc2_5u21
= value
;
2824 case MEP_OPERAND_CRQP
:
2825 fields
->f_ivc2_5u13
= value
;
2827 case MEP_OPERAND_CSRN
:
2828 fields
->f_csrn
= value
;
2830 case MEP_OPERAND_CSRN_IDX
:
2831 fields
->f_csrn
= value
;
2833 case MEP_OPERAND_DBG
:
2835 case MEP_OPERAND_DEPC
:
2837 case MEP_OPERAND_EPC
:
2839 case MEP_OPERAND_EXC
:
2841 case MEP_OPERAND_HI
:
2843 case MEP_OPERAND_IMM16P0
:
2844 fields
->f_ivc2_imm16p0
= value
;
2846 case MEP_OPERAND_IMM3P12
:
2847 fields
->f_ivc2_3u12
= value
;
2849 case MEP_OPERAND_IMM3P25
:
2850 fields
->f_ivc2_3u25
= value
;
2852 case MEP_OPERAND_IMM3P4
:
2853 fields
->f_ivc2_3u4
= value
;
2855 case MEP_OPERAND_IMM3P5
:
2856 fields
->f_ivc2_3u5
= value
;
2858 case MEP_OPERAND_IMM3P9
:
2859 fields
->f_ivc2_3u9
= value
;
2861 case MEP_OPERAND_IMM4P10
:
2862 fields
->f_ivc2_4u10
= value
;
2864 case MEP_OPERAND_IMM4P4
:
2865 fields
->f_ivc2_4u4
= value
;
2867 case MEP_OPERAND_IMM4P8
:
2868 fields
->f_ivc2_4u8
= value
;
2870 case MEP_OPERAND_IMM5P23
:
2871 fields
->f_ivc2_5u23
= value
;
2873 case MEP_OPERAND_IMM5P3
:
2874 fields
->f_ivc2_5u3
= value
;
2876 case MEP_OPERAND_IMM5P7
:
2877 fields
->f_ivc2_5u7
= value
;
2879 case MEP_OPERAND_IMM5P8
:
2880 fields
->f_ivc2_5u8
= value
;
2882 case MEP_OPERAND_IMM6P2
:
2883 fields
->f_ivc2_6u2
= value
;
2885 case MEP_OPERAND_IMM6P6
:
2886 fields
->f_ivc2_6u6
= value
;
2888 case MEP_OPERAND_IMM8P0
:
2889 fields
->f_ivc2_8u0
= value
;
2891 case MEP_OPERAND_IMM8P20
:
2892 fields
->f_ivc2_8u20
= value
;
2894 case MEP_OPERAND_IMM8P4
:
2895 fields
->f_ivc2_8u4
= value
;
2897 case MEP_OPERAND_IVC_X_0_2
:
2898 fields
->f_ivc2_2u0
= value
;
2900 case MEP_OPERAND_IVC_X_0_3
:
2901 fields
->f_ivc2_3u0
= value
;
2903 case MEP_OPERAND_IVC_X_0_4
:
2904 fields
->f_ivc2_4u0
= value
;
2906 case MEP_OPERAND_IVC_X_0_5
:
2907 fields
->f_ivc2_5u0
= value
;
2909 case MEP_OPERAND_IVC_X_6_1
:
2910 fields
->f_ivc2_1u6
= value
;
2912 case MEP_OPERAND_IVC_X_6_2
:
2913 fields
->f_ivc2_2u6
= value
;
2915 case MEP_OPERAND_IVC_X_6_3
:
2916 fields
->f_ivc2_3u6
= value
;
2918 case MEP_OPERAND_IVC2_ACC0_0
:
2920 case MEP_OPERAND_IVC2_ACC0_1
:
2922 case MEP_OPERAND_IVC2_ACC0_2
:
2924 case MEP_OPERAND_IVC2_ACC0_3
:
2926 case MEP_OPERAND_IVC2_ACC0_4
:
2928 case MEP_OPERAND_IVC2_ACC0_5
:
2930 case MEP_OPERAND_IVC2_ACC0_6
:
2932 case MEP_OPERAND_IVC2_ACC0_7
:
2934 case MEP_OPERAND_IVC2_ACC1_0
:
2936 case MEP_OPERAND_IVC2_ACC1_1
:
2938 case MEP_OPERAND_IVC2_ACC1_2
:
2940 case MEP_OPERAND_IVC2_ACC1_3
:
2942 case MEP_OPERAND_IVC2_ACC1_4
:
2944 case MEP_OPERAND_IVC2_ACC1_5
:
2946 case MEP_OPERAND_IVC2_ACC1_6
:
2948 case MEP_OPERAND_IVC2_ACC1_7
:
2950 case MEP_OPERAND_IVC2_CC
:
2952 case MEP_OPERAND_IVC2_COFA0
:
2954 case MEP_OPERAND_IVC2_COFA1
:
2956 case MEP_OPERAND_IVC2_COFR0
:
2958 case MEP_OPERAND_IVC2_COFR1
:
2960 case MEP_OPERAND_IVC2_CSAR0
:
2962 case MEP_OPERAND_IVC2_CSAR1
:
2964 case MEP_OPERAND_IVC2C3CCRN
:
2965 fields
->f_ivc2_ccrn_c3
= value
;
2967 case MEP_OPERAND_IVC2CCRN
:
2968 fields
->f_ivc2_ccrn
= value
;
2970 case MEP_OPERAND_IVC2CRN
:
2971 fields
->f_ivc2_crnx
= value
;
2973 case MEP_OPERAND_IVC2RM
:
2974 fields
->f_ivc2_crm
= value
;
2976 case MEP_OPERAND_LO
:
2978 case MEP_OPERAND_LP
:
2980 case MEP_OPERAND_MB0
:
2982 case MEP_OPERAND_MB1
:
2984 case MEP_OPERAND_ME0
:
2986 case MEP_OPERAND_ME1
:
2988 case MEP_OPERAND_NPC
:
2990 case MEP_OPERAND_OPT
:
2992 case MEP_OPERAND_PCABS24A2
:
2993 fields
->f_24u5a2n
= value
;
2995 case MEP_OPERAND_PCREL12A2
:
2996 fields
->f_12s4a2
= value
;
2998 case MEP_OPERAND_PCREL17A2
:
2999 fields
->f_17s16a2
= value
;
3001 case MEP_OPERAND_PCREL24A2
:
3002 fields
->f_24s5a2n
= value
;
3004 case MEP_OPERAND_PCREL8A2
:
3005 fields
->f_8s8a2
= value
;
3007 case MEP_OPERAND_PSW
:
3009 case MEP_OPERAND_R0
:
3011 case MEP_OPERAND_R1
:
3013 case MEP_OPERAND_RL
:
3014 fields
->f_rl
= value
;
3016 case MEP_OPERAND_RL5
:
3017 fields
->f_rl5
= value
;
3019 case MEP_OPERAND_RM
:
3020 fields
->f_rm
= value
;
3022 case MEP_OPERAND_RMA
:
3023 fields
->f_rm
= value
;
3025 case MEP_OPERAND_RN
:
3026 fields
->f_rn
= value
;
3028 case MEP_OPERAND_RN3
:
3029 fields
->f_rn3
= value
;
3031 case MEP_OPERAND_RN3C
:
3032 fields
->f_rn3
= value
;
3034 case MEP_OPERAND_RN3L
:
3035 fields
->f_rn3
= value
;
3037 case MEP_OPERAND_RN3S
:
3038 fields
->f_rn3
= value
;
3040 case MEP_OPERAND_RN3UC
:
3041 fields
->f_rn3
= value
;
3043 case MEP_OPERAND_RN3UL
:
3044 fields
->f_rn3
= value
;
3046 case MEP_OPERAND_RN3US
:
3047 fields
->f_rn3
= value
;
3049 case MEP_OPERAND_RNC
:
3050 fields
->f_rn
= value
;
3052 case MEP_OPERAND_RNL
:
3053 fields
->f_rn
= value
;
3055 case MEP_OPERAND_RNS
:
3056 fields
->f_rn
= value
;
3058 case MEP_OPERAND_RNUC
:
3059 fields
->f_rn
= value
;
3061 case MEP_OPERAND_RNUL
:
3062 fields
->f_rn
= value
;
3064 case MEP_OPERAND_RNUS
:
3065 fields
->f_rn
= value
;
3067 case MEP_OPERAND_SAR
:
3069 case MEP_OPERAND_SDISP16
:
3070 fields
->f_16s16
= value
;
3072 case MEP_OPERAND_SIMM16
:
3073 fields
->f_16s16
= value
;
3075 case MEP_OPERAND_SIMM16P0
:
3076 fields
->f_ivc2_simm16p0
= value
;
3078 case MEP_OPERAND_SIMM6
:
3079 fields
->f_6s8
= value
;
3081 case MEP_OPERAND_SIMM8
:
3082 fields
->f_8s8
= value
;
3084 case MEP_OPERAND_SIMM8P0
:
3085 fields
->f_ivc2_8s0
= value
;
3087 case MEP_OPERAND_SIMM8P20
:
3088 fields
->f_ivc2_8s20
= value
;
3090 case MEP_OPERAND_SIMM8P4
:
3091 fields
->f_ivc2_8s4
= value
;
3093 case MEP_OPERAND_SP
:
3095 case MEP_OPERAND_SPR
:
3097 case MEP_OPERAND_TP
:
3099 case MEP_OPERAND_TPR
:
3101 case MEP_OPERAND_UDISP2
:
3102 fields
->f_2u6
= value
;
3104 case MEP_OPERAND_UDISP7
:
3105 fields
->f_7u9
= value
;
3107 case MEP_OPERAND_UDISP7A2
:
3108 fields
->f_7u9a2
= value
;
3110 case MEP_OPERAND_UDISP7A4
:
3111 fields
->f_7u9a4
= value
;
3113 case MEP_OPERAND_UIMM16
:
3114 fields
->f_16u16
= value
;
3116 case MEP_OPERAND_UIMM2
:
3117 fields
->f_2u10
= value
;
3119 case MEP_OPERAND_UIMM24
:
3120 fields
->f_24u8n
= value
;
3122 case MEP_OPERAND_UIMM3
:
3123 fields
->f_3u5
= value
;
3125 case MEP_OPERAND_UIMM4
:
3126 fields
->f_4u8
= value
;
3128 case MEP_OPERAND_UIMM5
:
3129 fields
->f_5u8
= value
;
3131 case MEP_OPERAND_UIMM7A4
:
3132 fields
->f_7u9a4
= value
;
3134 case MEP_OPERAND_ZERO
:
3138 /* xgettext:c-format */
3139 fprintf (stderr
, _("Unrecognized field %d while setting int operand.\n"),
3146 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED
,
3148 CGEN_FIELDS
* fields
,
3153 case MEP_OPERAND_ADDR24A4
:
3154 fields
->f_24u8a4n
= value
;
3156 case MEP_OPERAND_C5RMUIMM20
:
3157 fields
->f_c5_rmuimm20
= value
;
3159 case MEP_OPERAND_C5RNMUIMM24
:
3160 fields
->f_c5_rnmuimm24
= value
;
3162 case MEP_OPERAND_CALLNUM
:
3163 fields
->f_callnum
= value
;
3165 case MEP_OPERAND_CCCC
:
3166 fields
->f_rm
= value
;
3168 case MEP_OPERAND_CCRN
:
3169 fields
->f_ccrn
= value
;
3171 case MEP_OPERAND_CDISP10
:
3172 fields
->f_cdisp10
= value
;
3174 case MEP_OPERAND_CDISP10A2
:
3175 fields
->f_cdisp10
= value
;
3177 case MEP_OPERAND_CDISP10A4
:
3178 fields
->f_cdisp10
= value
;
3180 case MEP_OPERAND_CDISP10A8
:
3181 fields
->f_cdisp10
= value
;
3183 case MEP_OPERAND_CDISP12
:
3184 fields
->f_12s20
= value
;
3186 case MEP_OPERAND_CIMM4
:
3187 fields
->f_rn
= value
;
3189 case MEP_OPERAND_CIMM5
:
3190 fields
->f_5u24
= value
;
3192 case MEP_OPERAND_CODE16
:
3193 fields
->f_16u16
= value
;
3195 case MEP_OPERAND_CODE24
:
3196 fields
->f_24u4n
= value
;
3198 case MEP_OPERAND_CP_FLAG
:
3200 case MEP_OPERAND_CRN
:
3201 fields
->f_crn
= value
;
3203 case MEP_OPERAND_CRN64
:
3204 fields
->f_crn
= value
;
3206 case MEP_OPERAND_CRNX
:
3207 fields
->f_crnx
= value
;
3209 case MEP_OPERAND_CRNX64
:
3210 fields
->f_crnx
= value
;
3212 case MEP_OPERAND_CROC
:
3213 fields
->f_ivc2_5u7
= value
;
3215 case MEP_OPERAND_CROP
:
3216 fields
->f_ivc2_5u23
= value
;
3218 case MEP_OPERAND_CRPC
:
3219 fields
->f_ivc2_5u26
= value
;
3221 case MEP_OPERAND_CRPP
:
3222 fields
->f_ivc2_5u18
= value
;
3224 case MEP_OPERAND_CRQC
:
3225 fields
->f_ivc2_5u21
= value
;
3227 case MEP_OPERAND_CRQP
:
3228 fields
->f_ivc2_5u13
= value
;
3230 case MEP_OPERAND_CSRN
:
3231 fields
->f_csrn
= value
;
3233 case MEP_OPERAND_CSRN_IDX
:
3234 fields
->f_csrn
= value
;
3236 case MEP_OPERAND_DBG
:
3238 case MEP_OPERAND_DEPC
:
3240 case MEP_OPERAND_EPC
:
3242 case MEP_OPERAND_EXC
:
3244 case MEP_OPERAND_HI
:
3246 case MEP_OPERAND_IMM16P0
:
3247 fields
->f_ivc2_imm16p0
= value
;
3249 case MEP_OPERAND_IMM3P12
:
3250 fields
->f_ivc2_3u12
= value
;
3252 case MEP_OPERAND_IMM3P25
:
3253 fields
->f_ivc2_3u25
= value
;
3255 case MEP_OPERAND_IMM3P4
:
3256 fields
->f_ivc2_3u4
= value
;
3258 case MEP_OPERAND_IMM3P5
:
3259 fields
->f_ivc2_3u5
= value
;
3261 case MEP_OPERAND_IMM3P9
:
3262 fields
->f_ivc2_3u9
= value
;
3264 case MEP_OPERAND_IMM4P10
:
3265 fields
->f_ivc2_4u10
= value
;
3267 case MEP_OPERAND_IMM4P4
:
3268 fields
->f_ivc2_4u4
= value
;
3270 case MEP_OPERAND_IMM4P8
:
3271 fields
->f_ivc2_4u8
= value
;
3273 case MEP_OPERAND_IMM5P23
:
3274 fields
->f_ivc2_5u23
= value
;
3276 case MEP_OPERAND_IMM5P3
:
3277 fields
->f_ivc2_5u3
= value
;
3279 case MEP_OPERAND_IMM5P7
:
3280 fields
->f_ivc2_5u7
= value
;
3282 case MEP_OPERAND_IMM5P8
:
3283 fields
->f_ivc2_5u8
= value
;
3285 case MEP_OPERAND_IMM6P2
:
3286 fields
->f_ivc2_6u2
= value
;
3288 case MEP_OPERAND_IMM6P6
:
3289 fields
->f_ivc2_6u6
= value
;
3291 case MEP_OPERAND_IMM8P0
:
3292 fields
->f_ivc2_8u0
= value
;
3294 case MEP_OPERAND_IMM8P20
:
3295 fields
->f_ivc2_8u20
= value
;
3297 case MEP_OPERAND_IMM8P4
:
3298 fields
->f_ivc2_8u4
= value
;
3300 case MEP_OPERAND_IVC_X_0_2
:
3301 fields
->f_ivc2_2u0
= value
;
3303 case MEP_OPERAND_IVC_X_0_3
:
3304 fields
->f_ivc2_3u0
= value
;
3306 case MEP_OPERAND_IVC_X_0_4
:
3307 fields
->f_ivc2_4u0
= value
;
3309 case MEP_OPERAND_IVC_X_0_5
:
3310 fields
->f_ivc2_5u0
= value
;
3312 case MEP_OPERAND_IVC_X_6_1
:
3313 fields
->f_ivc2_1u6
= value
;
3315 case MEP_OPERAND_IVC_X_6_2
:
3316 fields
->f_ivc2_2u6
= value
;
3318 case MEP_OPERAND_IVC_X_6_3
:
3319 fields
->f_ivc2_3u6
= value
;
3321 case MEP_OPERAND_IVC2_ACC0_0
:
3323 case MEP_OPERAND_IVC2_ACC0_1
:
3325 case MEP_OPERAND_IVC2_ACC0_2
:
3327 case MEP_OPERAND_IVC2_ACC0_3
:
3329 case MEP_OPERAND_IVC2_ACC0_4
:
3331 case MEP_OPERAND_IVC2_ACC0_5
:
3333 case MEP_OPERAND_IVC2_ACC0_6
:
3335 case MEP_OPERAND_IVC2_ACC0_7
:
3337 case MEP_OPERAND_IVC2_ACC1_0
:
3339 case MEP_OPERAND_IVC2_ACC1_1
:
3341 case MEP_OPERAND_IVC2_ACC1_2
:
3343 case MEP_OPERAND_IVC2_ACC1_3
:
3345 case MEP_OPERAND_IVC2_ACC1_4
:
3347 case MEP_OPERAND_IVC2_ACC1_5
:
3349 case MEP_OPERAND_IVC2_ACC1_6
:
3351 case MEP_OPERAND_IVC2_ACC1_7
:
3353 case MEP_OPERAND_IVC2_CC
:
3355 case MEP_OPERAND_IVC2_COFA0
:
3357 case MEP_OPERAND_IVC2_COFA1
:
3359 case MEP_OPERAND_IVC2_COFR0
:
3361 case MEP_OPERAND_IVC2_COFR1
:
3363 case MEP_OPERAND_IVC2_CSAR0
:
3365 case MEP_OPERAND_IVC2_CSAR1
:
3367 case MEP_OPERAND_IVC2C3CCRN
:
3368 fields
->f_ivc2_ccrn_c3
= value
;
3370 case MEP_OPERAND_IVC2CCRN
:
3371 fields
->f_ivc2_ccrn
= value
;
3373 case MEP_OPERAND_IVC2CRN
:
3374 fields
->f_ivc2_crnx
= value
;
3376 case MEP_OPERAND_IVC2RM
:
3377 fields
->f_ivc2_crm
= value
;
3379 case MEP_OPERAND_LO
:
3381 case MEP_OPERAND_LP
:
3383 case MEP_OPERAND_MB0
:
3385 case MEP_OPERAND_MB1
:
3387 case MEP_OPERAND_ME0
:
3389 case MEP_OPERAND_ME1
:
3391 case MEP_OPERAND_NPC
:
3393 case MEP_OPERAND_OPT
:
3395 case MEP_OPERAND_PCABS24A2
:
3396 fields
->f_24u5a2n
= value
;
3398 case MEP_OPERAND_PCREL12A2
:
3399 fields
->f_12s4a2
= value
;
3401 case MEP_OPERAND_PCREL17A2
:
3402 fields
->f_17s16a2
= value
;
3404 case MEP_OPERAND_PCREL24A2
:
3405 fields
->f_24s5a2n
= value
;
3407 case MEP_OPERAND_PCREL8A2
:
3408 fields
->f_8s8a2
= value
;
3410 case MEP_OPERAND_PSW
:
3412 case MEP_OPERAND_R0
:
3414 case MEP_OPERAND_R1
:
3416 case MEP_OPERAND_RL
:
3417 fields
->f_rl
= value
;
3419 case MEP_OPERAND_RL5
:
3420 fields
->f_rl5
= value
;
3422 case MEP_OPERAND_RM
:
3423 fields
->f_rm
= value
;
3425 case MEP_OPERAND_RMA
:
3426 fields
->f_rm
= value
;
3428 case MEP_OPERAND_RN
:
3429 fields
->f_rn
= value
;
3431 case MEP_OPERAND_RN3
:
3432 fields
->f_rn3
= value
;
3434 case MEP_OPERAND_RN3C
:
3435 fields
->f_rn3
= value
;
3437 case MEP_OPERAND_RN3L
:
3438 fields
->f_rn3
= value
;
3440 case MEP_OPERAND_RN3S
:
3441 fields
->f_rn3
= value
;
3443 case MEP_OPERAND_RN3UC
:
3444 fields
->f_rn3
= value
;
3446 case MEP_OPERAND_RN3UL
:
3447 fields
->f_rn3
= value
;
3449 case MEP_OPERAND_RN3US
:
3450 fields
->f_rn3
= value
;
3452 case MEP_OPERAND_RNC
:
3453 fields
->f_rn
= value
;
3455 case MEP_OPERAND_RNL
:
3456 fields
->f_rn
= value
;
3458 case MEP_OPERAND_RNS
:
3459 fields
->f_rn
= value
;
3461 case MEP_OPERAND_RNUC
:
3462 fields
->f_rn
= value
;
3464 case MEP_OPERAND_RNUL
:
3465 fields
->f_rn
= value
;
3467 case MEP_OPERAND_RNUS
:
3468 fields
->f_rn
= value
;
3470 case MEP_OPERAND_SAR
:
3472 case MEP_OPERAND_SDISP16
:
3473 fields
->f_16s16
= value
;
3475 case MEP_OPERAND_SIMM16
:
3476 fields
->f_16s16
= value
;
3478 case MEP_OPERAND_SIMM16P0
:
3479 fields
->f_ivc2_simm16p0
= value
;
3481 case MEP_OPERAND_SIMM6
:
3482 fields
->f_6s8
= value
;
3484 case MEP_OPERAND_SIMM8
:
3485 fields
->f_8s8
= value
;
3487 case MEP_OPERAND_SIMM8P0
:
3488 fields
->f_ivc2_8s0
= value
;
3490 case MEP_OPERAND_SIMM8P20
:
3491 fields
->f_ivc2_8s20
= value
;
3493 case MEP_OPERAND_SIMM8P4
:
3494 fields
->f_ivc2_8s4
= value
;
3496 case MEP_OPERAND_SP
:
3498 case MEP_OPERAND_SPR
:
3500 case MEP_OPERAND_TP
:
3502 case MEP_OPERAND_TPR
:
3504 case MEP_OPERAND_UDISP2
:
3505 fields
->f_2u6
= value
;
3507 case MEP_OPERAND_UDISP7
:
3508 fields
->f_7u9
= value
;
3510 case MEP_OPERAND_UDISP7A2
:
3511 fields
->f_7u9a2
= value
;
3513 case MEP_OPERAND_UDISP7A4
:
3514 fields
->f_7u9a4
= value
;
3516 case MEP_OPERAND_UIMM16
:
3517 fields
->f_16u16
= value
;
3519 case MEP_OPERAND_UIMM2
:
3520 fields
->f_2u10
= value
;
3522 case MEP_OPERAND_UIMM24
:
3523 fields
->f_24u8n
= value
;
3525 case MEP_OPERAND_UIMM3
:
3526 fields
->f_3u5
= value
;
3528 case MEP_OPERAND_UIMM4
:
3529 fields
->f_4u8
= value
;
3531 case MEP_OPERAND_UIMM5
:
3532 fields
->f_5u8
= value
;
3534 case MEP_OPERAND_UIMM7A4
:
3535 fields
->f_7u9a4
= value
;
3537 case MEP_OPERAND_ZERO
:
3541 /* xgettext:c-format */
3542 fprintf (stderr
, _("Unrecognized field %d while setting vma operand.\n"),
3548 /* Function to call before using the instruction builder tables. */
3551 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd
)
3553 cd
->insert_handlers
= & mep_cgen_insert_handlers
[0];
3554 cd
->extract_handlers
= & mep_cgen_extract_handlers
[0];
3556 cd
->insert_operand
= mep_cgen_insert_operand
;
3557 cd
->extract_operand
= mep_cgen_extract_operand
;
3559 cd
->get_int_operand
= mep_cgen_get_int_operand
;
3560 cd
->set_int_operand
= mep_cgen_set_int_operand
;
3561 cd
->get_vma_operand
= mep_cgen_get_vma_operand
;
3562 cd
->set_vma_operand
= mep_cgen_set_vma_operand
;