[gdb/testsuite] Fix re-used exec in gdb.arch/ftrace-insn-reloc.exp
[binutils-gdb.git] / opcodes / mep-ibld.c
blob737c37b18e0adf2042e9d42cd4c0b79654a6b23a
1 /* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */
2 /* Instruction building/extraction support for mep. -*- C -*-
4 THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
5 - the resultant file is machine generated, cgen-ibld.in isn't
7 Copyright (C) 1996-2023 Free Software Foundation, Inc.
9 This file is part of libopcodes.
11 This library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3, or (at your option)
14 any later version.
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.
26 Keep that in mind. */
28 #include "sysdep.h"
29 #include <stdio.h>
30 #include "ansidecl.h"
31 #include "dis-asm.h"
32 #include "bfd.h"
33 #include "symcat.h"
34 #include "mep-desc.h"
35 #include "mep-opc.h"
36 #include "cgen/basic-modes.h"
37 #include "opintl.h"
38 #include "safe-ctype.h"
40 #undef min
41 #define min(a,b) ((a) < (b) ? (a) : (b))
42 #undef max
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);
61 #if CGEN_INT_INSN_P
62 static void put_insn_int_value
63 (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
64 #endif
65 #if ! CGEN_INT_INSN_P
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);
72 #endif
74 /* Operand insertion. */
76 #if ! CGEN_INT_INSN_P
78 /* Subroutine of insert_normal. */
80 static CGEN_INLINE void
81 insert_1 (CGEN_CPU_DESC cd,
82 unsigned long value,
83 int start,
84 int length,
85 int word_length,
86 unsigned char *bufp)
88 unsigned long x, mask;
89 int shift;
91 x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
93 /* Written this way to avoid undefined behaviour. */
94 mask = (1UL << (length - 1) << 1) - 1;
95 if (CGEN_INSN_LSB0_P)
96 shift = (start + 1) - length;
97 else
98 shift = (word_length - (start + length));
99 x = (x & ~(mask << shift)) | ((value & mask) << shift);
101 cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian);
104 #endif /* ! CGEN_INT_INSN_P */
106 /* Default insertion routine.
108 ATTRS is a mask of the boolean attributes.
109 WORD_OFFSET is the offset in bits from the start of the insn of the value.
110 WORD_LENGTH is the length of the word in bits in which the value resides.
111 START is the starting bit number in the word, architecture origin.
112 LENGTH is the length of VALUE in bits.
113 TOTAL_LENGTH is the total length of the insn in bits.
115 The result is an error message or NULL if success. */
117 /* ??? This duplicates functionality with bfd's howto table and
118 bfd_install_relocation. */
119 /* ??? This doesn't handle bfd_vma's. Create another function when
120 necessary. */
122 static const char *
123 insert_normal (CGEN_CPU_DESC cd,
124 long value,
125 unsigned int attrs,
126 unsigned int word_offset,
127 unsigned int start,
128 unsigned int length,
129 unsigned int word_length,
130 unsigned int total_length,
131 CGEN_INSN_BYTES_PTR buffer)
133 static char errbuf[100];
134 unsigned long mask;
136 /* If LENGTH is zero, this operand doesn't contribute to the value. */
137 if (length == 0)
138 return NULL;
140 /* Written this way to avoid undefined behaviour. */
141 mask = (1UL << (length - 1) << 1) - 1;
143 if (word_length > 8 * sizeof (CGEN_INSN_INT))
144 abort ();
146 /* For architectures with insns smaller than the base-insn-bitsize,
147 word_length may be too big. */
148 if (cd->min_insn_bitsize < cd->base_insn_bitsize)
150 if (word_offset == 0
151 && word_length > total_length)
152 word_length = total_length;
155 /* Ensure VALUE will fit. */
156 if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
158 long minval = - (1UL << (length - 1));
159 unsigned long maxval = mask;
161 if ((value > 0 && (unsigned long) value > maxval)
162 || value < minval)
164 /* xgettext:c-format */
165 sprintf (errbuf,
166 _("operand out of range (%ld not between %ld and %lu)"),
167 value, minval, maxval);
168 return errbuf;
171 else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
173 unsigned long maxval = mask;
174 unsigned long val = (unsigned long) value;
176 /* For hosts with a word size > 32 check to see if value has been sign
177 extended beyond 32 bits. If so then ignore these higher sign bits
178 as the user is attempting to store a 32-bit signed value into an
179 unsigned 32-bit field which is allowed. */
180 if (sizeof (unsigned long) > 4 && ((value >> 32) == -1))
181 val &= 0xFFFFFFFF;
183 if (val > maxval)
185 /* xgettext:c-format */
186 sprintf (errbuf,
187 _("operand out of range (0x%lx not between 0 and 0x%lx)"),
188 val, maxval);
189 return errbuf;
192 else
194 if (! cgen_signed_overflow_ok_p (cd))
196 long minval = - (1UL << (length - 1));
197 long maxval = (1UL << (length - 1)) - 1;
199 if (value < minval || value > maxval)
201 sprintf
202 /* xgettext:c-format */
203 (errbuf, _("operand out of range (%ld not between %ld and %ld)"),
204 value, minval, maxval);
205 return errbuf;
210 #if CGEN_INT_INSN_P
213 int shift_within_word, shift_to_word, shift;
215 /* How to shift the value to BIT0 of the word. */
216 shift_to_word = total_length - (word_offset + word_length);
218 /* How to shift the value to the field within the word. */
219 if (CGEN_INSN_LSB0_P)
220 shift_within_word = start + 1 - length;
221 else
222 shift_within_word = word_length - start - length;
224 /* The total SHIFT, then mask in the value. */
225 shift = shift_to_word + shift_within_word;
226 *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
229 #else /* ! CGEN_INT_INSN_P */
232 unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;
234 insert_1 (cd, value, start, length, word_length, bufp);
237 #endif /* ! CGEN_INT_INSN_P */
239 return NULL;
242 /* Default insn builder (insert handler).
243 The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
244 that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
245 recorded in host byte order, otherwise BUFFER is an array of bytes
246 and the value is recorded in target byte order).
247 The result is an error message or NULL if success. */
249 static const char *
250 insert_insn_normal (CGEN_CPU_DESC cd,
251 const CGEN_INSN * insn,
252 CGEN_FIELDS * fields,
253 CGEN_INSN_BYTES_PTR buffer,
254 bfd_vma pc)
256 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
257 unsigned long value;
258 const CGEN_SYNTAX_CHAR_TYPE * syn;
260 CGEN_INIT_INSERT (cd);
261 value = CGEN_INSN_BASE_VALUE (insn);
263 /* If we're recording insns as numbers (rather than a string of bytes),
264 target byte order handling is deferred until later. */
266 #if CGEN_INT_INSN_P
268 put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
269 CGEN_FIELDS_BITSIZE (fields), value);
271 #else
273 cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
274 (unsigned) CGEN_FIELDS_BITSIZE (fields)),
275 value, cd->insn_endian);
277 #endif /* ! CGEN_INT_INSN_P */
279 /* ??? It would be better to scan the format's fields.
280 Still need to be able to insert a value based on the operand though;
281 e.g. storing a branch displacement that got resolved later.
282 Needs more thought first. */
284 for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
286 const char *errmsg;
288 if (CGEN_SYNTAX_CHAR_P (* syn))
289 continue;
291 errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
292 fields, buffer, pc);
293 if (errmsg)
294 return errmsg;
297 return NULL;
300 #if CGEN_INT_INSN_P
301 /* Cover function to store an insn value into an integral insn. Must go here
302 because it needs <prefix>-desc.h for CGEN_INT_INSN_P. */
304 static void
305 put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
306 CGEN_INSN_BYTES_PTR buf,
307 int length,
308 int insn_length,
309 CGEN_INSN_INT value)
311 /* For architectures with insns smaller than the base-insn-bitsize,
312 length may be too big. */
313 if (length > insn_length)
314 *buf = value;
315 else
317 int shift = insn_length - length;
318 /* Written this way to avoid undefined behaviour. */
319 CGEN_INSN_INT mask = length == 0 ? 0 : (1UL << (length - 1) << 1) - 1;
321 *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
324 #endif
326 /* Operand extraction. */
328 #if ! CGEN_INT_INSN_P
330 /* Subroutine of extract_normal.
331 Ensure sufficient bytes are cached in EX_INFO.
332 OFFSET is the offset in bytes from the start of the insn of the value.
333 BYTES is the length of the needed value.
334 Returns 1 for success, 0 for failure. */
336 static CGEN_INLINE int
337 fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
338 CGEN_EXTRACT_INFO *ex_info,
339 int offset,
340 int bytes,
341 bfd_vma pc)
343 /* It's doubtful that the middle part has already been fetched so
344 we don't optimize that case. kiss. */
345 unsigned int mask;
346 disassemble_info *info = (disassemble_info *) ex_info->dis_info;
348 /* First do a quick check. */
349 mask = (1 << bytes) - 1;
350 if (((ex_info->valid >> offset) & mask) == mask)
351 return 1;
353 /* Search for the first byte we need to read. */
354 for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1)
355 if (! (mask & ex_info->valid))
356 break;
358 if (bytes)
360 int status;
362 pc += offset;
363 status = (*info->read_memory_func)
364 (pc, ex_info->insn_bytes + offset, bytes, info);
366 if (status != 0)
368 (*info->memory_error_func) (status, pc, info);
369 return 0;
372 ex_info->valid |= ((1 << bytes) - 1) << offset;
375 return 1;
378 /* Subroutine of extract_normal. */
380 static CGEN_INLINE long
381 extract_1 (CGEN_CPU_DESC cd,
382 CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
383 int start,
384 int length,
385 int word_length,
386 unsigned char *bufp,
387 bfd_vma pc ATTRIBUTE_UNUSED)
389 unsigned long x;
390 int shift;
392 x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
394 if (CGEN_INSN_LSB0_P)
395 shift = (start + 1) - length;
396 else
397 shift = (word_length - (start + length));
398 return x >> shift;
401 #endif /* ! CGEN_INT_INSN_P */
403 /* Default extraction routine.
405 INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
406 or sometimes less for cases like the m32r where the base insn size is 32
407 but some insns are 16 bits.
408 ATTRS is a mask of the boolean attributes. We only need `SIGNED',
409 but for generality we take a bitmask of all of them.
410 WORD_OFFSET is the offset in bits from the start of the insn of the value.
411 WORD_LENGTH is the length of the word in bits in which the value resides.
412 START is the starting bit number in the word, architecture origin.
413 LENGTH is the length of VALUE in bits.
414 TOTAL_LENGTH is the total length of the insn in bits.
416 Returns 1 for success, 0 for failure. */
418 /* ??? The return code isn't properly used. wip. */
420 /* ??? This doesn't handle bfd_vma's. Create another function when
421 necessary. */
423 static int
424 extract_normal (CGEN_CPU_DESC cd,
425 #if ! CGEN_INT_INSN_P
426 CGEN_EXTRACT_INFO *ex_info,
427 #else
428 CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
429 #endif
430 CGEN_INSN_INT insn_value,
431 unsigned int attrs,
432 unsigned int word_offset,
433 unsigned int start,
434 unsigned int length,
435 unsigned int word_length,
436 unsigned int total_length,
437 #if ! CGEN_INT_INSN_P
438 bfd_vma pc,
439 #else
440 bfd_vma pc ATTRIBUTE_UNUSED,
441 #endif
442 long *valuep)
444 long value, mask;
446 /* If LENGTH is zero, this operand doesn't contribute to the value
447 so give it a standard value of zero. */
448 if (length == 0)
450 *valuep = 0;
451 return 1;
454 if (word_length > 8 * sizeof (CGEN_INSN_INT))
455 abort ();
457 /* For architectures with insns smaller than the insn-base-bitsize,
458 word_length may be too big. */
459 if (cd->min_insn_bitsize < cd->base_insn_bitsize)
461 if (word_offset + word_length > total_length)
462 word_length = total_length - word_offset;
465 /* Does the value reside in INSN_VALUE, and at the right alignment? */
467 if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
469 if (CGEN_INSN_LSB0_P)
470 value = insn_value >> ((word_offset + start + 1) - length);
471 else
472 value = insn_value >> (total_length - ( word_offset + start + length));
475 #if ! CGEN_INT_INSN_P
477 else
479 unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;
481 if (word_length > 8 * sizeof (CGEN_INSN_INT))
482 abort ();
484 if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
486 *valuep = 0;
487 return 0;
490 value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
493 #endif /* ! CGEN_INT_INSN_P */
495 /* Written this way to avoid undefined behaviour. */
496 mask = (1UL << (length - 1) << 1) - 1;
498 value &= mask;
499 /* sign extend? */
500 if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
501 && (value & (1UL << (length - 1))))
502 value |= ~mask;
504 *valuep = value;
506 return 1;
509 /* Default insn extractor.
511 INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
512 The extracted fields are stored in FIELDS.
513 EX_INFO is used to handle reading variable length insns.
514 Return the length of the insn in bits, or 0 if no match,
515 or -1 if an error occurs fetching data (memory_error_func will have
516 been called). */
518 static int
519 extract_insn_normal (CGEN_CPU_DESC cd,
520 const CGEN_INSN *insn,
521 CGEN_EXTRACT_INFO *ex_info,
522 CGEN_INSN_INT insn_value,
523 CGEN_FIELDS *fields,
524 bfd_vma pc)
526 const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
527 const CGEN_SYNTAX_CHAR_TYPE *syn;
529 CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);
531 CGEN_INIT_EXTRACT (cd);
533 for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
535 int length;
537 if (CGEN_SYNTAX_CHAR_P (*syn))
538 continue;
540 length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
541 ex_info, insn_value, fields, pc);
542 if (length <= 0)
543 return length;
546 /* We recognized and successfully extracted this insn. */
547 return CGEN_INSN_BITSIZE (insn);
550 /* Machine generated code added here. */
552 const char * mep_cgen_insert_operand
553 (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
555 /* Main entry point for operand insertion.
557 This function is basically just a big switch statement. Earlier versions
558 used tables to look up the function to use, but
559 - if the table contains both assembler and disassembler functions then
560 the disassembler contains much of the assembler and vice-versa,
561 - there's a lot of inlining possibilities as things grow,
562 - using a switch statement avoids the function call overhead.
564 This function could be moved into `parse_insn_normal', but keeping it
565 separate makes clear the interface between `parse_insn_normal' and each of
566 the handlers. It's also needed by GAS to insert operands that couldn't be
567 resolved during parsing. */
569 const char *
570 mep_cgen_insert_operand (CGEN_CPU_DESC cd,
571 int opindex,
572 CGEN_FIELDS * fields,
573 CGEN_INSN_BYTES_PTR buffer,
574 bfd_vma pc ATTRIBUTE_UNUSED)
576 const char * errmsg = NULL;
577 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
579 switch (opindex)
581 case MEP_OPERAND_ADDR24A4 :
584 FLD (f_24u8a4n_hi) = ((UINT) (FLD (f_24u8a4n)) >> (8));
585 FLD (f_24u8a4n_lo) = ((UINT) (((FLD (f_24u8a4n)) & (252))) >> (2));
587 errmsg = insert_normal (cd, fields->f_24u8a4n_hi, 0, 0, 16, 16, 32, total_length, buffer);
588 if (errmsg)
589 break;
590 errmsg = insert_normal (cd, fields->f_24u8a4n_lo, 0, 0, 8, 6, 32, total_length, buffer);
591 if (errmsg)
592 break;
594 break;
595 case MEP_OPERAND_C5RMUIMM20 :
598 FLD (f_c5_rm) = ((UINT) (FLD (f_c5_rmuimm20)) >> (16));
599 FLD (f_c5_16u16) = ((FLD (f_c5_rmuimm20)) & (65535));
601 errmsg = insert_normal (cd, fields->f_c5_rm, 0, 0, 8, 4, 32, total_length, buffer);
602 if (errmsg)
603 break;
604 errmsg = insert_normal (cd, fields->f_c5_16u16, 0, 0, 16, 16, 32, total_length, buffer);
605 if (errmsg)
606 break;
608 break;
609 case MEP_OPERAND_C5RNMUIMM24 :
612 FLD (f_c5_rnm) = ((UINT) (FLD (f_c5_rnmuimm24)) >> (16));
613 FLD (f_c5_16u16) = ((FLD (f_c5_rnmuimm24)) & (65535));
615 errmsg = insert_normal (cd, fields->f_c5_rnm, 0, 0, 4, 8, 32, total_length, buffer);
616 if (errmsg)
617 break;
618 errmsg = insert_normal (cd, fields->f_c5_16u16, 0, 0, 16, 16, 32, total_length, buffer);
619 if (errmsg)
620 break;
622 break;
623 case MEP_OPERAND_CALLNUM :
626 FLD (f_5) = ((((UINT) (FLD (f_callnum)) >> (3))) & (1));
627 FLD (f_6) = ((((UINT) (FLD (f_callnum)) >> (2))) & (1));
628 FLD (f_7) = ((((UINT) (FLD (f_callnum)) >> (1))) & (1));
629 FLD (f_11) = ((FLD (f_callnum)) & (1));
631 errmsg = insert_normal (cd, fields->f_5, 0, 0, 5, 1, 32, total_length, buffer);
632 if (errmsg)
633 break;
634 errmsg = insert_normal (cd, fields->f_6, 0, 0, 6, 1, 32, total_length, buffer);
635 if (errmsg)
636 break;
637 errmsg = insert_normal (cd, fields->f_7, 0, 0, 7, 1, 32, total_length, buffer);
638 if (errmsg)
639 break;
640 errmsg = insert_normal (cd, fields->f_11, 0, 0, 11, 1, 32, total_length, buffer);
641 if (errmsg)
642 break;
644 break;
645 case MEP_OPERAND_CCCC :
646 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
647 break;
648 case MEP_OPERAND_CCRN :
651 FLD (f_ccrn_hi) = ((((UINT) (FLD (f_ccrn)) >> (4))) & (3));
652 FLD (f_ccrn_lo) = ((FLD (f_ccrn)) & (15));
654 errmsg = insert_normal (cd, fields->f_ccrn_hi, 0, 0, 28, 2, 32, total_length, buffer);
655 if (errmsg)
656 break;
657 errmsg = insert_normal (cd, fields->f_ccrn_lo, 0, 0, 4, 4, 32, total_length, buffer);
658 if (errmsg)
659 break;
661 break;
662 case MEP_OPERAND_CDISP10 :
664 long value = fields->f_cdisp10;
665 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
666 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, buffer);
668 break;
669 case MEP_OPERAND_CDISP10A2 :
671 long value = fields->f_cdisp10;
672 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
673 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, buffer);
675 break;
676 case MEP_OPERAND_CDISP10A4 :
678 long value = fields->f_cdisp10;
679 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
680 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, buffer);
682 break;
683 case MEP_OPERAND_CDISP10A8 :
685 long value = fields->f_cdisp10;
686 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
687 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, buffer);
689 break;
690 case MEP_OPERAND_CDISP12 :
691 errmsg = insert_normal (cd, fields->f_12s20, 0|(1<<CGEN_IFLD_SIGNED), 0, 20, 12, 32, total_length, buffer);
692 break;
693 case MEP_OPERAND_CIMM4 :
694 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
695 break;
696 case MEP_OPERAND_CIMM5 :
697 errmsg = insert_normal (cd, fields->f_5u24, 0, 0, 24, 5, 32, total_length, buffer);
698 break;
699 case MEP_OPERAND_CODE16 :
700 errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
701 break;
702 case MEP_OPERAND_CODE24 :
705 FLD (f_24u4n_hi) = ((UINT) (FLD (f_24u4n)) >> (16));
706 FLD (f_24u4n_lo) = ((FLD (f_24u4n)) & (65535));
708 errmsg = insert_normal (cd, fields->f_24u4n_hi, 0, 0, 4, 8, 32, total_length, buffer);
709 if (errmsg)
710 break;
711 errmsg = insert_normal (cd, fields->f_24u4n_lo, 0, 0, 16, 16, 32, total_length, buffer);
712 if (errmsg)
713 break;
715 break;
716 case MEP_OPERAND_CP_FLAG :
717 break;
718 case MEP_OPERAND_CRN :
719 errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
720 break;
721 case MEP_OPERAND_CRN64 :
722 errmsg = insert_normal (cd, fields->f_crn, 0, 0, 4, 4, 32, total_length, buffer);
723 break;
724 case MEP_OPERAND_CRNX :
727 FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
728 FLD (f_crnx_hi) = ((UINT) (FLD (f_crnx)) >> (4));
730 errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
731 if (errmsg)
732 break;
733 errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
734 if (errmsg)
735 break;
737 break;
738 case MEP_OPERAND_CRNX64 :
741 FLD (f_crnx_lo) = ((FLD (f_crnx)) & (15));
742 FLD (f_crnx_hi) = ((UINT) (FLD (f_crnx)) >> (4));
744 errmsg = insert_normal (cd, fields->f_crnx_hi, 0, 0, 28, 1, 32, total_length, buffer);
745 if (errmsg)
746 break;
747 errmsg = insert_normal (cd, fields->f_crnx_lo, 0, 0, 4, 4, 32, total_length, buffer);
748 if (errmsg)
749 break;
751 break;
752 case MEP_OPERAND_CROC :
753 errmsg = insert_normal (cd, fields->f_ivc2_5u7, 0, 0, 7, 5, 32, total_length, buffer);
754 break;
755 case MEP_OPERAND_CROP :
756 errmsg = insert_normal (cd, fields->f_ivc2_5u23, 0, 0, 23, 5, 32, total_length, buffer);
757 break;
758 case MEP_OPERAND_CRPC :
759 errmsg = insert_normal (cd, fields->f_ivc2_5u26, 0, 0, 26, 5, 32, total_length, buffer);
760 break;
761 case MEP_OPERAND_CRPP :
762 errmsg = insert_normal (cd, fields->f_ivc2_5u18, 0, 0, 18, 5, 32, total_length, buffer);
763 break;
764 case MEP_OPERAND_CRQC :
765 errmsg = insert_normal (cd, fields->f_ivc2_5u21, 0, 0, 21, 5, 32, total_length, buffer);
766 break;
767 case MEP_OPERAND_CRQP :
768 errmsg = insert_normal (cd, fields->f_ivc2_5u13, 0, 0, 13, 5, 32, total_length, buffer);
769 break;
770 case MEP_OPERAND_CSRN :
773 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
774 FLD (f_csrn_hi) = ((UINT) (FLD (f_csrn)) >> (4));
776 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
777 if (errmsg)
778 break;
779 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
780 if (errmsg)
781 break;
783 break;
784 case MEP_OPERAND_CSRN_IDX :
787 FLD (f_csrn_lo) = ((FLD (f_csrn)) & (15));
788 FLD (f_csrn_hi) = ((UINT) (FLD (f_csrn)) >> (4));
790 errmsg = insert_normal (cd, fields->f_csrn_hi, 0, 0, 15, 1, 32, total_length, buffer);
791 if (errmsg)
792 break;
793 errmsg = insert_normal (cd, fields->f_csrn_lo, 0, 0, 8, 4, 32, total_length, buffer);
794 if (errmsg)
795 break;
797 break;
798 case MEP_OPERAND_DBG :
799 break;
800 case MEP_OPERAND_DEPC :
801 break;
802 case MEP_OPERAND_EPC :
803 break;
804 case MEP_OPERAND_EXC :
805 break;
806 case MEP_OPERAND_HI :
807 break;
808 case MEP_OPERAND_IMM16P0 :
811 FLD (f_ivc2_8u0) = ((((UINT) (FLD (f_ivc2_imm16p0)) >> (8))) & (255));
812 FLD (f_ivc2_8u20) = ((FLD (f_ivc2_imm16p0)) & (255));
814 errmsg = insert_normal (cd, fields->f_ivc2_8u0, 0, 0, 0, 8, 32, total_length, buffer);
815 if (errmsg)
816 break;
817 errmsg = insert_normal (cd, fields->f_ivc2_8u20, 0, 0, 20, 8, 32, total_length, buffer);
818 if (errmsg)
819 break;
821 break;
822 case MEP_OPERAND_IMM3P12 :
823 errmsg = insert_normal (cd, fields->f_ivc2_3u12, 0, 0, 12, 3, 32, total_length, buffer);
824 break;
825 case MEP_OPERAND_IMM3P25 :
826 errmsg = insert_normal (cd, fields->f_ivc2_3u25, 0, 0, 25, 3, 32, total_length, buffer);
827 break;
828 case MEP_OPERAND_IMM3P4 :
829 errmsg = insert_normal (cd, fields->f_ivc2_3u4, 0, 0, 4, 3, 32, total_length, buffer);
830 break;
831 case MEP_OPERAND_IMM3P5 :
832 errmsg = insert_normal (cd, fields->f_ivc2_3u5, 0, 0, 5, 3, 32, total_length, buffer);
833 break;
834 case MEP_OPERAND_IMM3P9 :
835 errmsg = insert_normal (cd, fields->f_ivc2_3u9, 0, 0, 9, 3, 32, total_length, buffer);
836 break;
837 case MEP_OPERAND_IMM4P10 :
838 errmsg = insert_normal (cd, fields->f_ivc2_4u10, 0, 0, 10, 4, 32, total_length, buffer);
839 break;
840 case MEP_OPERAND_IMM4P4 :
841 errmsg = insert_normal (cd, fields->f_ivc2_4u4, 0, 0, 4, 4, 32, total_length, buffer);
842 break;
843 case MEP_OPERAND_IMM4P8 :
844 errmsg = insert_normal (cd, fields->f_ivc2_4u8, 0, 0, 8, 4, 32, total_length, buffer);
845 break;
846 case MEP_OPERAND_IMM5P23 :
847 errmsg = insert_normal (cd, fields->f_ivc2_5u23, 0, 0, 23, 5, 32, total_length, buffer);
848 break;
849 case MEP_OPERAND_IMM5P3 :
850 errmsg = insert_normal (cd, fields->f_ivc2_5u3, 0, 0, 3, 5, 32, total_length, buffer);
851 break;
852 case MEP_OPERAND_IMM5P7 :
853 errmsg = insert_normal (cd, fields->f_ivc2_5u7, 0, 0, 7, 5, 32, total_length, buffer);
854 break;
855 case MEP_OPERAND_IMM5P8 :
856 errmsg = insert_normal (cd, fields->f_ivc2_5u8, 0, 0, 8, 5, 32, total_length, buffer);
857 break;
858 case MEP_OPERAND_IMM6P2 :
859 errmsg = insert_normal (cd, fields->f_ivc2_6u2, 0, 0, 2, 6, 32, total_length, buffer);
860 break;
861 case MEP_OPERAND_IMM6P6 :
862 errmsg = insert_normal (cd, fields->f_ivc2_6u6, 0, 0, 6, 6, 32, total_length, buffer);
863 break;
864 case MEP_OPERAND_IMM8P0 :
865 errmsg = insert_normal (cd, fields->f_ivc2_8u0, 0, 0, 0, 8, 32, total_length, buffer);
866 break;
867 case MEP_OPERAND_IMM8P20 :
868 errmsg = insert_normal (cd, fields->f_ivc2_8u20, 0, 0, 20, 8, 32, total_length, buffer);
869 break;
870 case MEP_OPERAND_IMM8P4 :
871 errmsg = insert_normal (cd, fields->f_ivc2_8u4, 0, 0, 4, 8, 32, total_length, buffer);
872 break;
873 case MEP_OPERAND_IVC_X_0_2 :
874 errmsg = insert_normal (cd, fields->f_ivc2_2u0, 0, 0, 0, 2, 32, total_length, buffer);
875 break;
876 case MEP_OPERAND_IVC_X_0_3 :
877 errmsg = insert_normal (cd, fields->f_ivc2_3u0, 0, 0, 0, 3, 32, total_length, buffer);
878 break;
879 case MEP_OPERAND_IVC_X_0_4 :
880 errmsg = insert_normal (cd, fields->f_ivc2_4u0, 0, 0, 0, 4, 32, total_length, buffer);
881 break;
882 case MEP_OPERAND_IVC_X_0_5 :
883 errmsg = insert_normal (cd, fields->f_ivc2_5u0, 0, 0, 0, 5, 32, total_length, buffer);
884 break;
885 case MEP_OPERAND_IVC_X_6_1 :
886 errmsg = insert_normal (cd, fields->f_ivc2_1u6, 0, 0, 6, 1, 32, total_length, buffer);
887 break;
888 case MEP_OPERAND_IVC_X_6_2 :
889 errmsg = insert_normal (cd, fields->f_ivc2_2u6, 0, 0, 6, 2, 32, total_length, buffer);
890 break;
891 case MEP_OPERAND_IVC_X_6_3 :
892 errmsg = insert_normal (cd, fields->f_ivc2_3u6, 0, 0, 6, 3, 32, total_length, buffer);
893 break;
894 case MEP_OPERAND_IVC2_ACC0_0 :
895 break;
896 case MEP_OPERAND_IVC2_ACC0_1 :
897 break;
898 case MEP_OPERAND_IVC2_ACC0_2 :
899 break;
900 case MEP_OPERAND_IVC2_ACC0_3 :
901 break;
902 case MEP_OPERAND_IVC2_ACC0_4 :
903 break;
904 case MEP_OPERAND_IVC2_ACC0_5 :
905 break;
906 case MEP_OPERAND_IVC2_ACC0_6 :
907 break;
908 case MEP_OPERAND_IVC2_ACC0_7 :
909 break;
910 case MEP_OPERAND_IVC2_ACC1_0 :
911 break;
912 case MEP_OPERAND_IVC2_ACC1_1 :
913 break;
914 case MEP_OPERAND_IVC2_ACC1_2 :
915 break;
916 case MEP_OPERAND_IVC2_ACC1_3 :
917 break;
918 case MEP_OPERAND_IVC2_ACC1_4 :
919 break;
920 case MEP_OPERAND_IVC2_ACC1_5 :
921 break;
922 case MEP_OPERAND_IVC2_ACC1_6 :
923 break;
924 case MEP_OPERAND_IVC2_ACC1_7 :
925 break;
926 case MEP_OPERAND_IVC2_CC :
927 break;
928 case MEP_OPERAND_IVC2_COFA0 :
929 break;
930 case MEP_OPERAND_IVC2_COFA1 :
931 break;
932 case MEP_OPERAND_IVC2_COFR0 :
933 break;
934 case MEP_OPERAND_IVC2_COFR1 :
935 break;
936 case MEP_OPERAND_IVC2_CSAR0 :
937 break;
938 case MEP_OPERAND_IVC2_CSAR1 :
939 break;
940 case MEP_OPERAND_IVC2C3CCRN :
943 FLD (f_ivc2_ccrn_c3hi) = ((((UINT) (FLD (f_ivc2_ccrn_c3)) >> (4))) & (3));
944 FLD (f_ivc2_ccrn_c3lo) = ((FLD (f_ivc2_ccrn_c3)) & (15));
946 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_c3hi, 0, 0, 28, 2, 32, total_length, buffer);
947 if (errmsg)
948 break;
949 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_c3lo, 0, 0, 4, 4, 32, total_length, buffer);
950 if (errmsg)
951 break;
953 break;
954 case MEP_OPERAND_IVC2CCRN :
957 FLD (f_ivc2_ccrn_h2) = ((((UINT) (FLD (f_ivc2_ccrn)) >> (4))) & (3));
958 FLD (f_ivc2_ccrn_lo) = ((FLD (f_ivc2_ccrn)) & (15));
960 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_h2, 0, 0, 20, 2, 32, total_length, buffer);
961 if (errmsg)
962 break;
963 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_lo, 0, 0, 0, 4, 32, total_length, buffer);
964 if (errmsg)
965 break;
967 break;
968 case MEP_OPERAND_IVC2CRN :
971 FLD (f_ivc2_ccrn_h1) = ((((UINT) (FLD (f_ivc2_crnx)) >> (4))) & (1));
972 FLD (f_ivc2_ccrn_lo) = ((FLD (f_ivc2_crnx)) & (15));
974 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_h1, 0, 0, 20, 1, 32, total_length, buffer);
975 if (errmsg)
976 break;
977 errmsg = insert_normal (cd, fields->f_ivc2_ccrn_lo, 0, 0, 0, 4, 32, total_length, buffer);
978 if (errmsg)
979 break;
981 break;
982 case MEP_OPERAND_IVC2RM :
983 errmsg = insert_normal (cd, fields->f_ivc2_crm, 0, 0, 4, 4, 32, total_length, buffer);
984 break;
985 case MEP_OPERAND_LO :
986 break;
987 case MEP_OPERAND_LP :
988 break;
989 case MEP_OPERAND_MB0 :
990 break;
991 case MEP_OPERAND_MB1 :
992 break;
993 case MEP_OPERAND_ME0 :
994 break;
995 case MEP_OPERAND_ME1 :
996 break;
997 case MEP_OPERAND_NPC :
998 break;
999 case MEP_OPERAND_OPT :
1000 break;
1001 case MEP_OPERAND_PCABS24A2 :
1004 FLD (f_24u5a2n_lo) = ((UINT) (((FLD (f_24u5a2n)) & (255))) >> (1));
1005 FLD (f_24u5a2n_hi) = ((UINT) (FLD (f_24u5a2n)) >> (8));
1007 errmsg = insert_normal (cd, fields->f_24u5a2n_hi, 0, 0, 16, 16, 32, total_length, buffer);
1008 if (errmsg)
1009 break;
1010 errmsg = insert_normal (cd, fields->f_24u5a2n_lo, 0, 0, 5, 7, 32, total_length, buffer);
1011 if (errmsg)
1012 break;
1014 break;
1015 case MEP_OPERAND_PCREL12A2 :
1017 long value = fields->f_12s4a2;
1018 value = ((SI) (((value) - (pc))) >> (1));
1019 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, buffer);
1021 break;
1022 case MEP_OPERAND_PCREL17A2 :
1024 long value = fields->f_17s16a2;
1025 value = ((SI) (((value) - (pc))) >> (1));
1026 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
1028 break;
1029 case MEP_OPERAND_PCREL24A2 :
1032 FLD (f_24s5a2n) = ((FLD (f_24s5a2n)) - (pc));
1033 FLD (f_24s5a2n_lo) = ((UINT) (((FLD (f_24s5a2n)) & (254))) >> (1));
1034 FLD (f_24s5a2n_hi) = ((INT) (FLD (f_24s5a2n)) >> (8));
1036 errmsg = insert_normal (cd, fields->f_24s5a2n_hi, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, buffer);
1037 if (errmsg)
1038 break;
1039 errmsg = insert_normal (cd, fields->f_24s5a2n_lo, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, buffer);
1040 if (errmsg)
1041 break;
1043 break;
1044 case MEP_OPERAND_PCREL8A2 :
1046 long value = fields->f_8s8a2;
1047 value = ((SI) (((value) - (pc))) >> (1));
1048 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, buffer);
1050 break;
1051 case MEP_OPERAND_PSW :
1052 break;
1053 case MEP_OPERAND_R0 :
1054 break;
1055 case MEP_OPERAND_R1 :
1056 break;
1057 case MEP_OPERAND_RL :
1058 errmsg = insert_normal (cd, fields->f_rl, 0, 0, 12, 4, 32, total_length, buffer);
1059 break;
1060 case MEP_OPERAND_RL5 :
1061 errmsg = insert_normal (cd, fields->f_rl5, 0, 0, 20, 4, 32, total_length, buffer);
1062 break;
1063 case MEP_OPERAND_RM :
1064 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
1065 break;
1066 case MEP_OPERAND_RMA :
1067 errmsg = insert_normal (cd, fields->f_rm, 0, 0, 8, 4, 32, total_length, buffer);
1068 break;
1069 case MEP_OPERAND_RN :
1070 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1071 break;
1072 case MEP_OPERAND_RN3 :
1073 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1074 break;
1075 case MEP_OPERAND_RN3C :
1076 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1077 break;
1078 case MEP_OPERAND_RN3L :
1079 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1080 break;
1081 case MEP_OPERAND_RN3S :
1082 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1083 break;
1084 case MEP_OPERAND_RN3UC :
1085 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1086 break;
1087 case MEP_OPERAND_RN3UL :
1088 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1089 break;
1090 case MEP_OPERAND_RN3US :
1091 errmsg = insert_normal (cd, fields->f_rn3, 0, 0, 5, 3, 32, total_length, buffer);
1092 break;
1093 case MEP_OPERAND_RNC :
1094 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1095 break;
1096 case MEP_OPERAND_RNL :
1097 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1098 break;
1099 case MEP_OPERAND_RNS :
1100 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1101 break;
1102 case MEP_OPERAND_RNUC :
1103 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1104 break;
1105 case MEP_OPERAND_RNUL :
1106 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1107 break;
1108 case MEP_OPERAND_RNUS :
1109 errmsg = insert_normal (cd, fields->f_rn, 0, 0, 4, 4, 32, total_length, buffer);
1110 break;
1111 case MEP_OPERAND_SAR :
1112 break;
1113 case MEP_OPERAND_SDISP16 :
1114 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
1115 break;
1116 case MEP_OPERAND_SIMM16 :
1117 errmsg = insert_normal (cd, fields->f_16s16, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, buffer);
1118 break;
1119 case MEP_OPERAND_SIMM16P0 :
1122 FLD (f_ivc2_8u0) = ((((UINT) (FLD (f_ivc2_simm16p0)) >> (8))) & (255));
1123 FLD (f_ivc2_8u20) = ((FLD (f_ivc2_simm16p0)) & (255));
1125 errmsg = insert_normal (cd, fields->f_ivc2_8u0, 0, 0, 0, 8, 32, total_length, buffer);
1126 if (errmsg)
1127 break;
1128 errmsg = insert_normal (cd, fields->f_ivc2_8u20, 0, 0, 20, 8, 32, total_length, buffer);
1129 if (errmsg)
1130 break;
1132 break;
1133 case MEP_OPERAND_SIMM6 :
1134 errmsg = insert_normal (cd, fields->f_6s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, buffer);
1135 break;
1136 case MEP_OPERAND_SIMM8 :
1137 errmsg = insert_normal (cd, fields->f_8s8, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, buffer);
1138 break;
1139 case MEP_OPERAND_SIMM8P0 :
1140 errmsg = insert_normal (cd, fields->f_ivc2_8s0, 0|(1<<CGEN_IFLD_SIGNED), 0, 0, 8, 32, total_length, buffer);
1141 break;
1142 case MEP_OPERAND_SIMM8P20 :
1143 errmsg = insert_normal (cd, fields->f_ivc2_8s20, 0|(1<<CGEN_IFLD_SIGNED), 0, 20, 8, 32, total_length, buffer);
1144 break;
1145 case MEP_OPERAND_SIMM8P4 :
1146 errmsg = insert_normal (cd, fields->f_ivc2_8s4, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 32, total_length, buffer);
1147 break;
1148 case MEP_OPERAND_SP :
1149 break;
1150 case MEP_OPERAND_SPR :
1151 break;
1152 case MEP_OPERAND_TP :
1153 break;
1154 case MEP_OPERAND_TPR :
1155 break;
1156 case MEP_OPERAND_UDISP2 :
1157 errmsg = insert_normal (cd, fields->f_2u6, 0, 0, 6, 2, 32, total_length, buffer);
1158 break;
1159 case MEP_OPERAND_UDISP7 :
1160 errmsg = insert_normal (cd, fields->f_7u9, 0, 0, 9, 7, 32, total_length, buffer);
1161 break;
1162 case MEP_OPERAND_UDISP7A2 :
1164 long value = fields->f_7u9a2;
1165 value = ((USI) (value) >> (1));
1166 errmsg = insert_normal (cd, value, 0, 0, 9, 6, 32, total_length, buffer);
1168 break;
1169 case MEP_OPERAND_UDISP7A4 :
1171 long value = fields->f_7u9a4;
1172 value = ((USI) (value) >> (2));
1173 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
1175 break;
1176 case MEP_OPERAND_UIMM16 :
1177 errmsg = insert_normal (cd, fields->f_16u16, 0, 0, 16, 16, 32, total_length, buffer);
1178 break;
1179 case MEP_OPERAND_UIMM2 :
1180 errmsg = insert_normal (cd, fields->f_2u10, 0, 0, 10, 2, 32, total_length, buffer);
1181 break;
1182 case MEP_OPERAND_UIMM24 :
1185 FLD (f_24u8n_hi) = ((UINT) (FLD (f_24u8n)) >> (8));
1186 FLD (f_24u8n_lo) = ((FLD (f_24u8n)) & (255));
1188 errmsg = insert_normal (cd, fields->f_24u8n_hi, 0, 0, 16, 16, 32, total_length, buffer);
1189 if (errmsg)
1190 break;
1191 errmsg = insert_normal (cd, fields->f_24u8n_lo, 0, 0, 8, 8, 32, total_length, buffer);
1192 if (errmsg)
1193 break;
1195 break;
1196 case MEP_OPERAND_UIMM3 :
1197 errmsg = insert_normal (cd, fields->f_3u5, 0, 0, 5, 3, 32, total_length, buffer);
1198 break;
1199 case MEP_OPERAND_UIMM4 :
1200 errmsg = insert_normal (cd, fields->f_4u8, 0, 0, 8, 4, 32, total_length, buffer);
1201 break;
1202 case MEP_OPERAND_UIMM5 :
1203 errmsg = insert_normal (cd, fields->f_5u8, 0, 0, 8, 5, 32, total_length, buffer);
1204 break;
1205 case MEP_OPERAND_UIMM7A4 :
1207 long value = fields->f_7u9a4;
1208 value = ((USI) (value) >> (2));
1209 errmsg = insert_normal (cd, value, 0, 0, 9, 5, 32, total_length, buffer);
1211 break;
1212 case MEP_OPERAND_ZERO :
1213 break;
1215 default :
1216 /* xgettext:c-format */
1217 opcodes_error_handler
1218 (_("internal error: unrecognized field %d while building insn"),
1219 opindex);
1220 abort ();
1223 return errmsg;
1226 int mep_cgen_extract_operand
1227 (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
1229 /* Main entry point for operand extraction.
1230 The result is <= 0 for error, >0 for success.
1231 ??? Actual values aren't well defined right now.
1233 This function is basically just a big switch statement. Earlier versions
1234 used tables to look up the function to use, but
1235 - if the table contains both assembler and disassembler functions then
1236 the disassembler contains much of the assembler and vice-versa,
1237 - there's a lot of inlining possibilities as things grow,
1238 - using a switch statement avoids the function call overhead.
1240 This function could be moved into `print_insn_normal', but keeping it
1241 separate makes clear the interface between `print_insn_normal' and each of
1242 the handlers. */
1245 mep_cgen_extract_operand (CGEN_CPU_DESC cd,
1246 int opindex,
1247 CGEN_EXTRACT_INFO *ex_info,
1248 CGEN_INSN_INT insn_value,
1249 CGEN_FIELDS * fields,
1250 bfd_vma pc)
1252 /* Assume success (for those operands that are nops). */
1253 int length = 1;
1254 unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);
1256 switch (opindex)
1258 case MEP_OPERAND_ADDR24A4 :
1260 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8a4n_hi);
1261 if (length <= 0) break;
1262 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 6, 32, total_length, pc, & fields->f_24u8a4n_lo);
1263 if (length <= 0) break;
1264 FLD (f_24u8a4n) = ((((FLD (f_24u8a4n_hi)) << (8))) | (((FLD (f_24u8a4n_lo)) << (2))));
1266 break;
1267 case MEP_OPERAND_C5RMUIMM20 :
1269 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_c5_rm);
1270 if (length <= 0) break;
1271 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_c5_16u16);
1272 if (length <= 0) break;
1274 FLD (f_c5_rmuimm20) = ((FLD (f_c5_16u16)) | (((FLD (f_c5_rm)) << (16))));
1277 break;
1278 case MEP_OPERAND_C5RNMUIMM24 :
1280 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_c5_rnm);
1281 if (length <= 0) break;
1282 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_c5_16u16);
1283 if (length <= 0) break;
1285 FLD (f_c5_rnmuimm24) = ((FLD (f_c5_16u16)) | (((FLD (f_c5_rnm)) << (16))));
1288 break;
1289 case MEP_OPERAND_CALLNUM :
1291 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 1, 32, total_length, pc, & fields->f_5);
1292 if (length <= 0) break;
1293 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 1, 32, total_length, pc, & fields->f_6);
1294 if (length <= 0) break;
1295 length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 1, 32, total_length, pc, & fields->f_7);
1296 if (length <= 0) break;
1297 length = extract_normal (cd, ex_info, insn_value, 0, 0, 11, 1, 32, total_length, pc, & fields->f_11);
1298 if (length <= 0) break;
1299 FLD (f_callnum) = ((((FLD (f_5)) << (3))) | (((((FLD (f_6)) << (2))) | (((((FLD (f_7)) << (1))) | (FLD (f_11)))))));
1301 break;
1302 case MEP_OPERAND_CCCC :
1303 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1304 break;
1305 case MEP_OPERAND_CCRN :
1307 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 2, 32, total_length, pc, & fields->f_ccrn_hi);
1308 if (length <= 0) break;
1309 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ccrn_lo);
1310 if (length <= 0) break;
1311 FLD (f_ccrn) = ((((FLD (f_ccrn_hi)) << (4))) | (FLD (f_ccrn_lo)));
1313 break;
1314 case MEP_OPERAND_CDISP10 :
1316 long value;
1317 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, pc, & value);
1318 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
1319 fields->f_cdisp10 = value;
1321 break;
1322 case MEP_OPERAND_CDISP10A2 :
1324 long value;
1325 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, pc, & value);
1326 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
1327 fields->f_cdisp10 = value;
1329 break;
1330 case MEP_OPERAND_CDISP10A4 :
1332 long value;
1333 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, pc, & value);
1334 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
1335 fields->f_cdisp10 = value;
1337 break;
1338 case MEP_OPERAND_CDISP10A8 :
1340 long value;
1341 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 22, 10, 32, total_length, pc, & value);
1342 value = (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (512))) ? (((((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023))) - (1024))) : (((((((((value) & (128))) ? (((value) ^ (768))) : (value)) & (512))) ? ((((((value) & (128))) ? (((value) ^ (768))) : (value)) - (1024))) : ((((value) & (128))) ? (((value) ^ (768))) : (value))) & (1023)));
1343 fields->f_cdisp10 = value;
1345 break;
1346 case MEP_OPERAND_CDISP12 :
1347 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 20, 12, 32, total_length, pc, & fields->f_12s20);
1348 break;
1349 case MEP_OPERAND_CIMM4 :
1350 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1351 break;
1352 case MEP_OPERAND_CIMM5 :
1353 length = extract_normal (cd, ex_info, insn_value, 0, 0, 24, 5, 32, total_length, pc, & fields->f_5u24);
1354 break;
1355 case MEP_OPERAND_CODE16 :
1356 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1357 break;
1358 case MEP_OPERAND_CODE24 :
1360 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_24u4n_hi);
1361 if (length <= 0) break;
1362 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u4n_lo);
1363 if (length <= 0) break;
1364 FLD (f_24u4n) = ((((FLD (f_24u4n_hi)) << (16))) | (FLD (f_24u4n_lo)));
1366 break;
1367 case MEP_OPERAND_CP_FLAG :
1368 break;
1369 case MEP_OPERAND_CRN :
1370 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1371 break;
1372 case MEP_OPERAND_CRN64 :
1373 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crn);
1374 break;
1375 case MEP_OPERAND_CRNX :
1377 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1378 if (length <= 0) break;
1379 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1380 if (length <= 0) break;
1381 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1383 break;
1384 case MEP_OPERAND_CRNX64 :
1386 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 1, 32, total_length, pc, & fields->f_crnx_hi);
1387 if (length <= 0) break;
1388 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_crnx_lo);
1389 if (length <= 0) break;
1390 FLD (f_crnx) = ((((FLD (f_crnx_hi)) << (4))) | (FLD (f_crnx_lo)));
1392 break;
1393 case MEP_OPERAND_CROC :
1394 length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 5, 32, total_length, pc, & fields->f_ivc2_5u7);
1395 break;
1396 case MEP_OPERAND_CROP :
1397 length = extract_normal (cd, ex_info, insn_value, 0, 0, 23, 5, 32, total_length, pc, & fields->f_ivc2_5u23);
1398 break;
1399 case MEP_OPERAND_CRPC :
1400 length = extract_normal (cd, ex_info, insn_value, 0, 0, 26, 5, 32, total_length, pc, & fields->f_ivc2_5u26);
1401 break;
1402 case MEP_OPERAND_CRPP :
1403 length = extract_normal (cd, ex_info, insn_value, 0, 0, 18, 5, 32, total_length, pc, & fields->f_ivc2_5u18);
1404 break;
1405 case MEP_OPERAND_CRQC :
1406 length = extract_normal (cd, ex_info, insn_value, 0, 0, 21, 5, 32, total_length, pc, & fields->f_ivc2_5u21);
1407 break;
1408 case MEP_OPERAND_CRQP :
1409 length = extract_normal (cd, ex_info, insn_value, 0, 0, 13, 5, 32, total_length, pc, & fields->f_ivc2_5u13);
1410 break;
1411 case MEP_OPERAND_CSRN :
1413 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1414 if (length <= 0) break;
1415 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1416 if (length <= 0) break;
1417 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1419 break;
1420 case MEP_OPERAND_CSRN_IDX :
1422 length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 1, 32, total_length, pc, & fields->f_csrn_hi);
1423 if (length <= 0) break;
1424 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_csrn_lo);
1425 if (length <= 0) break;
1426 FLD (f_csrn) = ((((FLD (f_csrn_hi)) << (4))) | (FLD (f_csrn_lo)));
1428 break;
1429 case MEP_OPERAND_DBG :
1430 break;
1431 case MEP_OPERAND_DEPC :
1432 break;
1433 case MEP_OPERAND_EPC :
1434 break;
1435 case MEP_OPERAND_EXC :
1436 break;
1437 case MEP_OPERAND_HI :
1438 break;
1439 case MEP_OPERAND_IMM16P0 :
1441 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 8, 32, total_length, pc, & fields->f_ivc2_8u0);
1442 if (length <= 0) break;
1443 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 8, 32, total_length, pc, & fields->f_ivc2_8u20);
1444 if (length <= 0) break;
1446 FLD (f_ivc2_imm16p0) = ((FLD (f_ivc2_8u20)) | (((FLD (f_ivc2_8u0)) << (8))));
1449 break;
1450 case MEP_OPERAND_IMM3P12 :
1451 length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 3, 32, total_length, pc, & fields->f_ivc2_3u12);
1452 break;
1453 case MEP_OPERAND_IMM3P25 :
1454 length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 3, 32, total_length, pc, & fields->f_ivc2_3u25);
1455 break;
1456 case MEP_OPERAND_IMM3P4 :
1457 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 3, 32, total_length, pc, & fields->f_ivc2_3u4);
1458 break;
1459 case MEP_OPERAND_IMM3P5 :
1460 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_ivc2_3u5);
1461 break;
1462 case MEP_OPERAND_IMM3P9 :
1463 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 3, 32, total_length, pc, & fields->f_ivc2_3u9);
1464 break;
1465 case MEP_OPERAND_IMM4P10 :
1466 length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 4, 32, total_length, pc, & fields->f_ivc2_4u10);
1467 break;
1468 case MEP_OPERAND_IMM4P4 :
1469 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ivc2_4u4);
1470 break;
1471 case MEP_OPERAND_IMM4P8 :
1472 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_ivc2_4u8);
1473 break;
1474 case MEP_OPERAND_IMM5P23 :
1475 length = extract_normal (cd, ex_info, insn_value, 0, 0, 23, 5, 32, total_length, pc, & fields->f_ivc2_5u23);
1476 break;
1477 case MEP_OPERAND_IMM5P3 :
1478 length = extract_normal (cd, ex_info, insn_value, 0, 0, 3, 5, 32, total_length, pc, & fields->f_ivc2_5u3);
1479 break;
1480 case MEP_OPERAND_IMM5P7 :
1481 length = extract_normal (cd, ex_info, insn_value, 0, 0, 7, 5, 32, total_length, pc, & fields->f_ivc2_5u7);
1482 break;
1483 case MEP_OPERAND_IMM5P8 :
1484 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 5, 32, total_length, pc, & fields->f_ivc2_5u8);
1485 break;
1486 case MEP_OPERAND_IMM6P2 :
1487 length = extract_normal (cd, ex_info, insn_value, 0, 0, 2, 6, 32, total_length, pc, & fields->f_ivc2_6u2);
1488 break;
1489 case MEP_OPERAND_IMM6P6 :
1490 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 6, 32, total_length, pc, & fields->f_ivc2_6u6);
1491 break;
1492 case MEP_OPERAND_IMM8P0 :
1493 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 8, 32, total_length, pc, & fields->f_ivc2_8u0);
1494 break;
1495 case MEP_OPERAND_IMM8P20 :
1496 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 8, 32, total_length, pc, & fields->f_ivc2_8u20);
1497 break;
1498 case MEP_OPERAND_IMM8P4 :
1499 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 8, 32, total_length, pc, & fields->f_ivc2_8u4);
1500 break;
1501 case MEP_OPERAND_IVC_X_0_2 :
1502 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 2, 32, total_length, pc, & fields->f_ivc2_2u0);
1503 break;
1504 case MEP_OPERAND_IVC_X_0_3 :
1505 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 3, 32, total_length, pc, & fields->f_ivc2_3u0);
1506 break;
1507 case MEP_OPERAND_IVC_X_0_4 :
1508 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 4, 32, total_length, pc, & fields->f_ivc2_4u0);
1509 break;
1510 case MEP_OPERAND_IVC_X_0_5 :
1511 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 5, 32, total_length, pc, & fields->f_ivc2_5u0);
1512 break;
1513 case MEP_OPERAND_IVC_X_6_1 :
1514 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 1, 32, total_length, pc, & fields->f_ivc2_1u6);
1515 break;
1516 case MEP_OPERAND_IVC_X_6_2 :
1517 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 2, 32, total_length, pc, & fields->f_ivc2_2u6);
1518 break;
1519 case MEP_OPERAND_IVC_X_6_3 :
1520 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 3, 32, total_length, pc, & fields->f_ivc2_3u6);
1521 break;
1522 case MEP_OPERAND_IVC2_ACC0_0 :
1523 break;
1524 case MEP_OPERAND_IVC2_ACC0_1 :
1525 break;
1526 case MEP_OPERAND_IVC2_ACC0_2 :
1527 break;
1528 case MEP_OPERAND_IVC2_ACC0_3 :
1529 break;
1530 case MEP_OPERAND_IVC2_ACC0_4 :
1531 break;
1532 case MEP_OPERAND_IVC2_ACC0_5 :
1533 break;
1534 case MEP_OPERAND_IVC2_ACC0_6 :
1535 break;
1536 case MEP_OPERAND_IVC2_ACC0_7 :
1537 break;
1538 case MEP_OPERAND_IVC2_ACC1_0 :
1539 break;
1540 case MEP_OPERAND_IVC2_ACC1_1 :
1541 break;
1542 case MEP_OPERAND_IVC2_ACC1_2 :
1543 break;
1544 case MEP_OPERAND_IVC2_ACC1_3 :
1545 break;
1546 case MEP_OPERAND_IVC2_ACC1_4 :
1547 break;
1548 case MEP_OPERAND_IVC2_ACC1_5 :
1549 break;
1550 case MEP_OPERAND_IVC2_ACC1_6 :
1551 break;
1552 case MEP_OPERAND_IVC2_ACC1_7 :
1553 break;
1554 case MEP_OPERAND_IVC2_CC :
1555 break;
1556 case MEP_OPERAND_IVC2_COFA0 :
1557 break;
1558 case MEP_OPERAND_IVC2_COFA1 :
1559 break;
1560 case MEP_OPERAND_IVC2_COFR0 :
1561 break;
1562 case MEP_OPERAND_IVC2_COFR1 :
1563 break;
1564 case MEP_OPERAND_IVC2_CSAR0 :
1565 break;
1566 case MEP_OPERAND_IVC2_CSAR1 :
1567 break;
1568 case MEP_OPERAND_IVC2C3CCRN :
1570 length = extract_normal (cd, ex_info, insn_value, 0, 0, 28, 2, 32, total_length, pc, & fields->f_ivc2_ccrn_c3hi);
1571 if (length <= 0) break;
1572 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ivc2_ccrn_c3lo);
1573 if (length <= 0) break;
1574 FLD (f_ivc2_ccrn_c3) = ((((FLD (f_ivc2_ccrn_c3hi)) << (4))) | (FLD (f_ivc2_ccrn_c3lo)));
1576 break;
1577 case MEP_OPERAND_IVC2CCRN :
1579 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 2, 32, total_length, pc, & fields->f_ivc2_ccrn_h2);
1580 if (length <= 0) break;
1581 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 4, 32, total_length, pc, & fields->f_ivc2_ccrn_lo);
1582 if (length <= 0) break;
1583 FLD (f_ivc2_ccrn) = ((((FLD (f_ivc2_ccrn_h2)) << (4))) | (FLD (f_ivc2_ccrn_lo)));
1585 break;
1586 case MEP_OPERAND_IVC2CRN :
1588 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 1, 32, total_length, pc, & fields->f_ivc2_ccrn_h1);
1589 if (length <= 0) break;
1590 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 4, 32, total_length, pc, & fields->f_ivc2_ccrn_lo);
1591 if (length <= 0) break;
1592 FLD (f_ivc2_crnx) = ((((FLD (f_ivc2_ccrn_h1)) << (4))) | (FLD (f_ivc2_ccrn_lo)));
1594 break;
1595 case MEP_OPERAND_IVC2RM :
1596 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_ivc2_crm);
1597 break;
1598 case MEP_OPERAND_LO :
1599 break;
1600 case MEP_OPERAND_LP :
1601 break;
1602 case MEP_OPERAND_MB0 :
1603 break;
1604 case MEP_OPERAND_MB1 :
1605 break;
1606 case MEP_OPERAND_ME0 :
1607 break;
1608 case MEP_OPERAND_ME1 :
1609 break;
1610 case MEP_OPERAND_NPC :
1611 break;
1612 case MEP_OPERAND_OPT :
1613 break;
1614 case MEP_OPERAND_PCABS24A2 :
1616 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u5a2n_hi);
1617 if (length <= 0) break;
1618 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 7, 32, total_length, pc, & fields->f_24u5a2n_lo);
1619 if (length <= 0) break;
1620 FLD (f_24u5a2n) = ((((FLD (f_24u5a2n_hi)) << (8))) | (((FLD (f_24u5a2n_lo)) << (1))));
1622 break;
1623 case MEP_OPERAND_PCREL12A2 :
1625 long value;
1626 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, pc, & value);
1627 value = ((((value) * (2))) + (pc));
1628 fields->f_12s4a2 = value;
1630 break;
1631 case MEP_OPERAND_PCREL17A2 :
1633 long value;
1634 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, pc, & value);
1635 value = ((((value) * (2))) + (pc));
1636 fields->f_17s16a2 = value;
1638 break;
1639 case MEP_OPERAND_PCREL24A2 :
1641 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 16, 16, 32, total_length, pc, & fields->f_24s5a2n_hi);
1642 if (length <= 0) break;
1643 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_PCREL_ADDR), 0, 5, 7, 32, total_length, pc, & fields->f_24s5a2n_lo);
1644 if (length <= 0) break;
1645 FLD (f_24s5a2n) = ((((((FLD (f_24s5a2n_hi)) * (256))) | (((FLD (f_24s5a2n_lo)) << (1))))) + (pc));
1647 break;
1648 case MEP_OPERAND_PCREL8A2 :
1650 long value;
1651 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 8, 7, 32, total_length, pc, & value);
1652 value = ((((value) * (2))) + (pc));
1653 fields->f_8s8a2 = value;
1655 break;
1656 case MEP_OPERAND_PSW :
1657 break;
1658 case MEP_OPERAND_R0 :
1659 break;
1660 case MEP_OPERAND_R1 :
1661 break;
1662 case MEP_OPERAND_RL :
1663 length = extract_normal (cd, ex_info, insn_value, 0, 0, 12, 4, 32, total_length, pc, & fields->f_rl);
1664 break;
1665 case MEP_OPERAND_RL5 :
1666 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 4, 32, total_length, pc, & fields->f_rl5);
1667 break;
1668 case MEP_OPERAND_RM :
1669 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1670 break;
1671 case MEP_OPERAND_RMA :
1672 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_rm);
1673 break;
1674 case MEP_OPERAND_RN :
1675 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1676 break;
1677 case MEP_OPERAND_RN3 :
1678 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1679 break;
1680 case MEP_OPERAND_RN3C :
1681 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1682 break;
1683 case MEP_OPERAND_RN3L :
1684 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1685 break;
1686 case MEP_OPERAND_RN3S :
1687 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1688 break;
1689 case MEP_OPERAND_RN3UC :
1690 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1691 break;
1692 case MEP_OPERAND_RN3UL :
1693 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1694 break;
1695 case MEP_OPERAND_RN3US :
1696 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_rn3);
1697 break;
1698 case MEP_OPERAND_RNC :
1699 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1700 break;
1701 case MEP_OPERAND_RNL :
1702 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1703 break;
1704 case MEP_OPERAND_RNS :
1705 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1706 break;
1707 case MEP_OPERAND_RNUC :
1708 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1709 break;
1710 case MEP_OPERAND_RNUL :
1711 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1712 break;
1713 case MEP_OPERAND_RNUS :
1714 length = extract_normal (cd, ex_info, insn_value, 0, 0, 4, 4, 32, total_length, pc, & fields->f_rn);
1715 break;
1716 case MEP_OPERAND_SAR :
1717 break;
1718 case MEP_OPERAND_SDISP16 :
1719 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1720 break;
1721 case MEP_OPERAND_SIMM16 :
1722 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 16, 16, 32, total_length, pc, & fields->f_16s16);
1723 break;
1724 case MEP_OPERAND_SIMM16P0 :
1726 length = extract_normal (cd, ex_info, insn_value, 0, 0, 0, 8, 32, total_length, pc, & fields->f_ivc2_8u0);
1727 if (length <= 0) break;
1728 length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 8, 32, total_length, pc, & fields->f_ivc2_8u20);
1729 if (length <= 0) break;
1731 FLD (f_ivc2_simm16p0) = ((FLD (f_ivc2_8u20)) | (((FLD (f_ivc2_8u0)) << (8))));
1734 break;
1735 case MEP_OPERAND_SIMM6 :
1736 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 6, 32, total_length, pc, & fields->f_6s8);
1737 break;
1738 case MEP_OPERAND_SIMM8 :
1739 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 8, 8, 32, total_length, pc, & fields->f_8s8);
1740 break;
1741 case MEP_OPERAND_SIMM8P0 :
1742 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 0, 8, 32, total_length, pc, & fields->f_ivc2_8s0);
1743 break;
1744 case MEP_OPERAND_SIMM8P20 :
1745 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 20, 8, 32, total_length, pc, & fields->f_ivc2_8s20);
1746 break;
1747 case MEP_OPERAND_SIMM8P4 :
1748 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 0, 4, 8, 32, total_length, pc, & fields->f_ivc2_8s4);
1749 break;
1750 case MEP_OPERAND_SP :
1751 break;
1752 case MEP_OPERAND_SPR :
1753 break;
1754 case MEP_OPERAND_TP :
1755 break;
1756 case MEP_OPERAND_TPR :
1757 break;
1758 case MEP_OPERAND_UDISP2 :
1759 length = extract_normal (cd, ex_info, insn_value, 0, 0, 6, 2, 32, total_length, pc, & fields->f_2u6);
1760 break;
1761 case MEP_OPERAND_UDISP7 :
1762 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 7, 32, total_length, pc, & fields->f_7u9);
1763 break;
1764 case MEP_OPERAND_UDISP7A2 :
1766 long value;
1767 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 6, 32, total_length, pc, & value);
1768 value = ((value) * (2));
1769 fields->f_7u9a2 = value;
1771 break;
1772 case MEP_OPERAND_UDISP7A4 :
1774 long value;
1775 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1776 value = ((value) << (2));
1777 fields->f_7u9a4 = value;
1779 break;
1780 case MEP_OPERAND_UIMM16 :
1781 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_16u16);
1782 break;
1783 case MEP_OPERAND_UIMM2 :
1784 length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 2, 32, total_length, pc, & fields->f_2u10);
1785 break;
1786 case MEP_OPERAND_UIMM24 :
1788 length = extract_normal (cd, ex_info, insn_value, 0, 0, 16, 16, 32, total_length, pc, & fields->f_24u8n_hi);
1789 if (length <= 0) break;
1790 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 8, 32, total_length, pc, & fields->f_24u8n_lo);
1791 if (length <= 0) break;
1792 FLD (f_24u8n) = ((((FLD (f_24u8n_hi)) << (8))) | (FLD (f_24u8n_lo)));
1794 break;
1795 case MEP_OPERAND_UIMM3 :
1796 length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 3, 32, total_length, pc, & fields->f_3u5);
1797 break;
1798 case MEP_OPERAND_UIMM4 :
1799 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 4, 32, total_length, pc, & fields->f_4u8);
1800 break;
1801 case MEP_OPERAND_UIMM5 :
1802 length = extract_normal (cd, ex_info, insn_value, 0, 0, 8, 5, 32, total_length, pc, & fields->f_5u8);
1803 break;
1804 case MEP_OPERAND_UIMM7A4 :
1806 long value;
1807 length = extract_normal (cd, ex_info, insn_value, 0, 0, 9, 5, 32, total_length, pc, & value);
1808 value = ((value) << (2));
1809 fields->f_7u9a4 = value;
1811 break;
1812 case MEP_OPERAND_ZERO :
1813 break;
1815 default :
1816 /* xgettext:c-format */
1817 opcodes_error_handler
1818 (_("internal error: unrecognized field %d while decoding insn"),
1819 opindex);
1820 abort ();
1823 return length;
1826 cgen_insert_fn * const mep_cgen_insert_handlers[] =
1828 insert_insn_normal,
1831 cgen_extract_fn * const mep_cgen_extract_handlers[] =
1833 extract_insn_normal,
1836 int mep_cgen_get_int_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1837 bfd_vma mep_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
1839 /* Getting values from cgen_fields is handled by a collection of functions.
1840 They are distinguished by the type of the VALUE argument they return.
1841 TODO: floating point, inlining support, remove cases where result type
1842 not appropriate. */
1845 mep_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
1846 int opindex,
1847 const CGEN_FIELDS * fields)
1849 int value;
1851 switch (opindex)
1853 case MEP_OPERAND_ADDR24A4 :
1854 value = fields->f_24u8a4n;
1855 break;
1856 case MEP_OPERAND_C5RMUIMM20 :
1857 value = fields->f_c5_rmuimm20;
1858 break;
1859 case MEP_OPERAND_C5RNMUIMM24 :
1860 value = fields->f_c5_rnmuimm24;
1861 break;
1862 case MEP_OPERAND_CALLNUM :
1863 value = fields->f_callnum;
1864 break;
1865 case MEP_OPERAND_CCCC :
1866 value = fields->f_rm;
1867 break;
1868 case MEP_OPERAND_CCRN :
1869 value = fields->f_ccrn;
1870 break;
1871 case MEP_OPERAND_CDISP10 :
1872 value = fields->f_cdisp10;
1873 break;
1874 case MEP_OPERAND_CDISP10A2 :
1875 value = fields->f_cdisp10;
1876 break;
1877 case MEP_OPERAND_CDISP10A4 :
1878 value = fields->f_cdisp10;
1879 break;
1880 case MEP_OPERAND_CDISP10A8 :
1881 value = fields->f_cdisp10;
1882 break;
1883 case MEP_OPERAND_CDISP12 :
1884 value = fields->f_12s20;
1885 break;
1886 case MEP_OPERAND_CIMM4 :
1887 value = fields->f_rn;
1888 break;
1889 case MEP_OPERAND_CIMM5 :
1890 value = fields->f_5u24;
1891 break;
1892 case MEP_OPERAND_CODE16 :
1893 value = fields->f_16u16;
1894 break;
1895 case MEP_OPERAND_CODE24 :
1896 value = fields->f_24u4n;
1897 break;
1898 case MEP_OPERAND_CP_FLAG :
1899 value = 0;
1900 break;
1901 case MEP_OPERAND_CRN :
1902 value = fields->f_crn;
1903 break;
1904 case MEP_OPERAND_CRN64 :
1905 value = fields->f_crn;
1906 break;
1907 case MEP_OPERAND_CRNX :
1908 value = fields->f_crnx;
1909 break;
1910 case MEP_OPERAND_CRNX64 :
1911 value = fields->f_crnx;
1912 break;
1913 case MEP_OPERAND_CROC :
1914 value = fields->f_ivc2_5u7;
1915 break;
1916 case MEP_OPERAND_CROP :
1917 value = fields->f_ivc2_5u23;
1918 break;
1919 case MEP_OPERAND_CRPC :
1920 value = fields->f_ivc2_5u26;
1921 break;
1922 case MEP_OPERAND_CRPP :
1923 value = fields->f_ivc2_5u18;
1924 break;
1925 case MEP_OPERAND_CRQC :
1926 value = fields->f_ivc2_5u21;
1927 break;
1928 case MEP_OPERAND_CRQP :
1929 value = fields->f_ivc2_5u13;
1930 break;
1931 case MEP_OPERAND_CSRN :
1932 value = fields->f_csrn;
1933 break;
1934 case MEP_OPERAND_CSRN_IDX :
1935 value = fields->f_csrn;
1936 break;
1937 case MEP_OPERAND_DBG :
1938 value = 0;
1939 break;
1940 case MEP_OPERAND_DEPC :
1941 value = 0;
1942 break;
1943 case MEP_OPERAND_EPC :
1944 value = 0;
1945 break;
1946 case MEP_OPERAND_EXC :
1947 value = 0;
1948 break;
1949 case MEP_OPERAND_HI :
1950 value = 0;
1951 break;
1952 case MEP_OPERAND_IMM16P0 :
1953 value = fields->f_ivc2_imm16p0;
1954 break;
1955 case MEP_OPERAND_IMM3P12 :
1956 value = fields->f_ivc2_3u12;
1957 break;
1958 case MEP_OPERAND_IMM3P25 :
1959 value = fields->f_ivc2_3u25;
1960 break;
1961 case MEP_OPERAND_IMM3P4 :
1962 value = fields->f_ivc2_3u4;
1963 break;
1964 case MEP_OPERAND_IMM3P5 :
1965 value = fields->f_ivc2_3u5;
1966 break;
1967 case MEP_OPERAND_IMM3P9 :
1968 value = fields->f_ivc2_3u9;
1969 break;
1970 case MEP_OPERAND_IMM4P10 :
1971 value = fields->f_ivc2_4u10;
1972 break;
1973 case MEP_OPERAND_IMM4P4 :
1974 value = fields->f_ivc2_4u4;
1975 break;
1976 case MEP_OPERAND_IMM4P8 :
1977 value = fields->f_ivc2_4u8;
1978 break;
1979 case MEP_OPERAND_IMM5P23 :
1980 value = fields->f_ivc2_5u23;
1981 break;
1982 case MEP_OPERAND_IMM5P3 :
1983 value = fields->f_ivc2_5u3;
1984 break;
1985 case MEP_OPERAND_IMM5P7 :
1986 value = fields->f_ivc2_5u7;
1987 break;
1988 case MEP_OPERAND_IMM5P8 :
1989 value = fields->f_ivc2_5u8;
1990 break;
1991 case MEP_OPERAND_IMM6P2 :
1992 value = fields->f_ivc2_6u2;
1993 break;
1994 case MEP_OPERAND_IMM6P6 :
1995 value = fields->f_ivc2_6u6;
1996 break;
1997 case MEP_OPERAND_IMM8P0 :
1998 value = fields->f_ivc2_8u0;
1999 break;
2000 case MEP_OPERAND_IMM8P20 :
2001 value = fields->f_ivc2_8u20;
2002 break;
2003 case MEP_OPERAND_IMM8P4 :
2004 value = fields->f_ivc2_8u4;
2005 break;
2006 case MEP_OPERAND_IVC_X_0_2 :
2007 value = fields->f_ivc2_2u0;
2008 break;
2009 case MEP_OPERAND_IVC_X_0_3 :
2010 value = fields->f_ivc2_3u0;
2011 break;
2012 case MEP_OPERAND_IVC_X_0_4 :
2013 value = fields->f_ivc2_4u0;
2014 break;
2015 case MEP_OPERAND_IVC_X_0_5 :
2016 value = fields->f_ivc2_5u0;
2017 break;
2018 case MEP_OPERAND_IVC_X_6_1 :
2019 value = fields->f_ivc2_1u6;
2020 break;
2021 case MEP_OPERAND_IVC_X_6_2 :
2022 value = fields->f_ivc2_2u6;
2023 break;
2024 case MEP_OPERAND_IVC_X_6_3 :
2025 value = fields->f_ivc2_3u6;
2026 break;
2027 case MEP_OPERAND_IVC2_ACC0_0 :
2028 value = 0;
2029 break;
2030 case MEP_OPERAND_IVC2_ACC0_1 :
2031 value = 0;
2032 break;
2033 case MEP_OPERAND_IVC2_ACC0_2 :
2034 value = 0;
2035 break;
2036 case MEP_OPERAND_IVC2_ACC0_3 :
2037 value = 0;
2038 break;
2039 case MEP_OPERAND_IVC2_ACC0_4 :
2040 value = 0;
2041 break;
2042 case MEP_OPERAND_IVC2_ACC0_5 :
2043 value = 0;
2044 break;
2045 case MEP_OPERAND_IVC2_ACC0_6 :
2046 value = 0;
2047 break;
2048 case MEP_OPERAND_IVC2_ACC0_7 :
2049 value = 0;
2050 break;
2051 case MEP_OPERAND_IVC2_ACC1_0 :
2052 value = 0;
2053 break;
2054 case MEP_OPERAND_IVC2_ACC1_1 :
2055 value = 0;
2056 break;
2057 case MEP_OPERAND_IVC2_ACC1_2 :
2058 value = 0;
2059 break;
2060 case MEP_OPERAND_IVC2_ACC1_3 :
2061 value = 0;
2062 break;
2063 case MEP_OPERAND_IVC2_ACC1_4 :
2064 value = 0;
2065 break;
2066 case MEP_OPERAND_IVC2_ACC1_5 :
2067 value = 0;
2068 break;
2069 case MEP_OPERAND_IVC2_ACC1_6 :
2070 value = 0;
2071 break;
2072 case MEP_OPERAND_IVC2_ACC1_7 :
2073 value = 0;
2074 break;
2075 case MEP_OPERAND_IVC2_CC :
2076 value = 0;
2077 break;
2078 case MEP_OPERAND_IVC2_COFA0 :
2079 value = 0;
2080 break;
2081 case MEP_OPERAND_IVC2_COFA1 :
2082 value = 0;
2083 break;
2084 case MEP_OPERAND_IVC2_COFR0 :
2085 value = 0;
2086 break;
2087 case MEP_OPERAND_IVC2_COFR1 :
2088 value = 0;
2089 break;
2090 case MEP_OPERAND_IVC2_CSAR0 :
2091 value = 0;
2092 break;
2093 case MEP_OPERAND_IVC2_CSAR1 :
2094 value = 0;
2095 break;
2096 case MEP_OPERAND_IVC2C3CCRN :
2097 value = fields->f_ivc2_ccrn_c3;
2098 break;
2099 case MEP_OPERAND_IVC2CCRN :
2100 value = fields->f_ivc2_ccrn;
2101 break;
2102 case MEP_OPERAND_IVC2CRN :
2103 value = fields->f_ivc2_crnx;
2104 break;
2105 case MEP_OPERAND_IVC2RM :
2106 value = fields->f_ivc2_crm;
2107 break;
2108 case MEP_OPERAND_LO :
2109 value = 0;
2110 break;
2111 case MEP_OPERAND_LP :
2112 value = 0;
2113 break;
2114 case MEP_OPERAND_MB0 :
2115 value = 0;
2116 break;
2117 case MEP_OPERAND_MB1 :
2118 value = 0;
2119 break;
2120 case MEP_OPERAND_ME0 :
2121 value = 0;
2122 break;
2123 case MEP_OPERAND_ME1 :
2124 value = 0;
2125 break;
2126 case MEP_OPERAND_NPC :
2127 value = 0;
2128 break;
2129 case MEP_OPERAND_OPT :
2130 value = 0;
2131 break;
2132 case MEP_OPERAND_PCABS24A2 :
2133 value = fields->f_24u5a2n;
2134 break;
2135 case MEP_OPERAND_PCREL12A2 :
2136 value = fields->f_12s4a2;
2137 break;
2138 case MEP_OPERAND_PCREL17A2 :
2139 value = fields->f_17s16a2;
2140 break;
2141 case MEP_OPERAND_PCREL24A2 :
2142 value = fields->f_24s5a2n;
2143 break;
2144 case MEP_OPERAND_PCREL8A2 :
2145 value = fields->f_8s8a2;
2146 break;
2147 case MEP_OPERAND_PSW :
2148 value = 0;
2149 break;
2150 case MEP_OPERAND_R0 :
2151 value = 0;
2152 break;
2153 case MEP_OPERAND_R1 :
2154 value = 0;
2155 break;
2156 case MEP_OPERAND_RL :
2157 value = fields->f_rl;
2158 break;
2159 case MEP_OPERAND_RL5 :
2160 value = fields->f_rl5;
2161 break;
2162 case MEP_OPERAND_RM :
2163 value = fields->f_rm;
2164 break;
2165 case MEP_OPERAND_RMA :
2166 value = fields->f_rm;
2167 break;
2168 case MEP_OPERAND_RN :
2169 value = fields->f_rn;
2170 break;
2171 case MEP_OPERAND_RN3 :
2172 value = fields->f_rn3;
2173 break;
2174 case MEP_OPERAND_RN3C :
2175 value = fields->f_rn3;
2176 break;
2177 case MEP_OPERAND_RN3L :
2178 value = fields->f_rn3;
2179 break;
2180 case MEP_OPERAND_RN3S :
2181 value = fields->f_rn3;
2182 break;
2183 case MEP_OPERAND_RN3UC :
2184 value = fields->f_rn3;
2185 break;
2186 case MEP_OPERAND_RN3UL :
2187 value = fields->f_rn3;
2188 break;
2189 case MEP_OPERAND_RN3US :
2190 value = fields->f_rn3;
2191 break;
2192 case MEP_OPERAND_RNC :
2193 value = fields->f_rn;
2194 break;
2195 case MEP_OPERAND_RNL :
2196 value = fields->f_rn;
2197 break;
2198 case MEP_OPERAND_RNS :
2199 value = fields->f_rn;
2200 break;
2201 case MEP_OPERAND_RNUC :
2202 value = fields->f_rn;
2203 break;
2204 case MEP_OPERAND_RNUL :
2205 value = fields->f_rn;
2206 break;
2207 case MEP_OPERAND_RNUS :
2208 value = fields->f_rn;
2209 break;
2210 case MEP_OPERAND_SAR :
2211 value = 0;
2212 break;
2213 case MEP_OPERAND_SDISP16 :
2214 value = fields->f_16s16;
2215 break;
2216 case MEP_OPERAND_SIMM16 :
2217 value = fields->f_16s16;
2218 break;
2219 case MEP_OPERAND_SIMM16P0 :
2220 value = fields->f_ivc2_simm16p0;
2221 break;
2222 case MEP_OPERAND_SIMM6 :
2223 value = fields->f_6s8;
2224 break;
2225 case MEP_OPERAND_SIMM8 :
2226 value = fields->f_8s8;
2227 break;
2228 case MEP_OPERAND_SIMM8P0 :
2229 value = fields->f_ivc2_8s0;
2230 break;
2231 case MEP_OPERAND_SIMM8P20 :
2232 value = fields->f_ivc2_8s20;
2233 break;
2234 case MEP_OPERAND_SIMM8P4 :
2235 value = fields->f_ivc2_8s4;
2236 break;
2237 case MEP_OPERAND_SP :
2238 value = 0;
2239 break;
2240 case MEP_OPERAND_SPR :
2241 value = 0;
2242 break;
2243 case MEP_OPERAND_TP :
2244 value = 0;
2245 break;
2246 case MEP_OPERAND_TPR :
2247 value = 0;
2248 break;
2249 case MEP_OPERAND_UDISP2 :
2250 value = fields->f_2u6;
2251 break;
2252 case MEP_OPERAND_UDISP7 :
2253 value = fields->f_7u9;
2254 break;
2255 case MEP_OPERAND_UDISP7A2 :
2256 value = fields->f_7u9a2;
2257 break;
2258 case MEP_OPERAND_UDISP7A4 :
2259 value = fields->f_7u9a4;
2260 break;
2261 case MEP_OPERAND_UIMM16 :
2262 value = fields->f_16u16;
2263 break;
2264 case MEP_OPERAND_UIMM2 :
2265 value = fields->f_2u10;
2266 break;
2267 case MEP_OPERAND_UIMM24 :
2268 value = fields->f_24u8n;
2269 break;
2270 case MEP_OPERAND_UIMM3 :
2271 value = fields->f_3u5;
2272 break;
2273 case MEP_OPERAND_UIMM4 :
2274 value = fields->f_4u8;
2275 break;
2276 case MEP_OPERAND_UIMM5 :
2277 value = fields->f_5u8;
2278 break;
2279 case MEP_OPERAND_UIMM7A4 :
2280 value = fields->f_7u9a4;
2281 break;
2282 case MEP_OPERAND_ZERO :
2283 value = 0;
2284 break;
2286 default :
2287 /* xgettext:c-format */
2288 opcodes_error_handler
2289 (_("internal error: unrecognized field %d while getting int operand"),
2290 opindex);
2291 abort ();
2294 return value;
2297 bfd_vma
2298 mep_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
2299 int opindex,
2300 const CGEN_FIELDS * fields)
2302 bfd_vma value;
2304 switch (opindex)
2306 case MEP_OPERAND_ADDR24A4 :
2307 value = fields->f_24u8a4n;
2308 break;
2309 case MEP_OPERAND_C5RMUIMM20 :
2310 value = fields->f_c5_rmuimm20;
2311 break;
2312 case MEP_OPERAND_C5RNMUIMM24 :
2313 value = fields->f_c5_rnmuimm24;
2314 break;
2315 case MEP_OPERAND_CALLNUM :
2316 value = fields->f_callnum;
2317 break;
2318 case MEP_OPERAND_CCCC :
2319 value = fields->f_rm;
2320 break;
2321 case MEP_OPERAND_CCRN :
2322 value = fields->f_ccrn;
2323 break;
2324 case MEP_OPERAND_CDISP10 :
2325 value = fields->f_cdisp10;
2326 break;
2327 case MEP_OPERAND_CDISP10A2 :
2328 value = fields->f_cdisp10;
2329 break;
2330 case MEP_OPERAND_CDISP10A4 :
2331 value = fields->f_cdisp10;
2332 break;
2333 case MEP_OPERAND_CDISP10A8 :
2334 value = fields->f_cdisp10;
2335 break;
2336 case MEP_OPERAND_CDISP12 :
2337 value = fields->f_12s20;
2338 break;
2339 case MEP_OPERAND_CIMM4 :
2340 value = fields->f_rn;
2341 break;
2342 case MEP_OPERAND_CIMM5 :
2343 value = fields->f_5u24;
2344 break;
2345 case MEP_OPERAND_CODE16 :
2346 value = fields->f_16u16;
2347 break;
2348 case MEP_OPERAND_CODE24 :
2349 value = fields->f_24u4n;
2350 break;
2351 case MEP_OPERAND_CP_FLAG :
2352 value = 0;
2353 break;
2354 case MEP_OPERAND_CRN :
2355 value = fields->f_crn;
2356 break;
2357 case MEP_OPERAND_CRN64 :
2358 value = fields->f_crn;
2359 break;
2360 case MEP_OPERAND_CRNX :
2361 value = fields->f_crnx;
2362 break;
2363 case MEP_OPERAND_CRNX64 :
2364 value = fields->f_crnx;
2365 break;
2366 case MEP_OPERAND_CROC :
2367 value = fields->f_ivc2_5u7;
2368 break;
2369 case MEP_OPERAND_CROP :
2370 value = fields->f_ivc2_5u23;
2371 break;
2372 case MEP_OPERAND_CRPC :
2373 value = fields->f_ivc2_5u26;
2374 break;
2375 case MEP_OPERAND_CRPP :
2376 value = fields->f_ivc2_5u18;
2377 break;
2378 case MEP_OPERAND_CRQC :
2379 value = fields->f_ivc2_5u21;
2380 break;
2381 case MEP_OPERAND_CRQP :
2382 value = fields->f_ivc2_5u13;
2383 break;
2384 case MEP_OPERAND_CSRN :
2385 value = fields->f_csrn;
2386 break;
2387 case MEP_OPERAND_CSRN_IDX :
2388 value = fields->f_csrn;
2389 break;
2390 case MEP_OPERAND_DBG :
2391 value = 0;
2392 break;
2393 case MEP_OPERAND_DEPC :
2394 value = 0;
2395 break;
2396 case MEP_OPERAND_EPC :
2397 value = 0;
2398 break;
2399 case MEP_OPERAND_EXC :
2400 value = 0;
2401 break;
2402 case MEP_OPERAND_HI :
2403 value = 0;
2404 break;
2405 case MEP_OPERAND_IMM16P0 :
2406 value = fields->f_ivc2_imm16p0;
2407 break;
2408 case MEP_OPERAND_IMM3P12 :
2409 value = fields->f_ivc2_3u12;
2410 break;
2411 case MEP_OPERAND_IMM3P25 :
2412 value = fields->f_ivc2_3u25;
2413 break;
2414 case MEP_OPERAND_IMM3P4 :
2415 value = fields->f_ivc2_3u4;
2416 break;
2417 case MEP_OPERAND_IMM3P5 :
2418 value = fields->f_ivc2_3u5;
2419 break;
2420 case MEP_OPERAND_IMM3P9 :
2421 value = fields->f_ivc2_3u9;
2422 break;
2423 case MEP_OPERAND_IMM4P10 :
2424 value = fields->f_ivc2_4u10;
2425 break;
2426 case MEP_OPERAND_IMM4P4 :
2427 value = fields->f_ivc2_4u4;
2428 break;
2429 case MEP_OPERAND_IMM4P8 :
2430 value = fields->f_ivc2_4u8;
2431 break;
2432 case MEP_OPERAND_IMM5P23 :
2433 value = fields->f_ivc2_5u23;
2434 break;
2435 case MEP_OPERAND_IMM5P3 :
2436 value = fields->f_ivc2_5u3;
2437 break;
2438 case MEP_OPERAND_IMM5P7 :
2439 value = fields->f_ivc2_5u7;
2440 break;
2441 case MEP_OPERAND_IMM5P8 :
2442 value = fields->f_ivc2_5u8;
2443 break;
2444 case MEP_OPERAND_IMM6P2 :
2445 value = fields->f_ivc2_6u2;
2446 break;
2447 case MEP_OPERAND_IMM6P6 :
2448 value = fields->f_ivc2_6u6;
2449 break;
2450 case MEP_OPERAND_IMM8P0 :
2451 value = fields->f_ivc2_8u0;
2452 break;
2453 case MEP_OPERAND_IMM8P20 :
2454 value = fields->f_ivc2_8u20;
2455 break;
2456 case MEP_OPERAND_IMM8P4 :
2457 value = fields->f_ivc2_8u4;
2458 break;
2459 case MEP_OPERAND_IVC_X_0_2 :
2460 value = fields->f_ivc2_2u0;
2461 break;
2462 case MEP_OPERAND_IVC_X_0_3 :
2463 value = fields->f_ivc2_3u0;
2464 break;
2465 case MEP_OPERAND_IVC_X_0_4 :
2466 value = fields->f_ivc2_4u0;
2467 break;
2468 case MEP_OPERAND_IVC_X_0_5 :
2469 value = fields->f_ivc2_5u0;
2470 break;
2471 case MEP_OPERAND_IVC_X_6_1 :
2472 value = fields->f_ivc2_1u6;
2473 break;
2474 case MEP_OPERAND_IVC_X_6_2 :
2475 value = fields->f_ivc2_2u6;
2476 break;
2477 case MEP_OPERAND_IVC_X_6_3 :
2478 value = fields->f_ivc2_3u6;
2479 break;
2480 case MEP_OPERAND_IVC2_ACC0_0 :
2481 value = 0;
2482 break;
2483 case MEP_OPERAND_IVC2_ACC0_1 :
2484 value = 0;
2485 break;
2486 case MEP_OPERAND_IVC2_ACC0_2 :
2487 value = 0;
2488 break;
2489 case MEP_OPERAND_IVC2_ACC0_3 :
2490 value = 0;
2491 break;
2492 case MEP_OPERAND_IVC2_ACC0_4 :
2493 value = 0;
2494 break;
2495 case MEP_OPERAND_IVC2_ACC0_5 :
2496 value = 0;
2497 break;
2498 case MEP_OPERAND_IVC2_ACC0_6 :
2499 value = 0;
2500 break;
2501 case MEP_OPERAND_IVC2_ACC0_7 :
2502 value = 0;
2503 break;
2504 case MEP_OPERAND_IVC2_ACC1_0 :
2505 value = 0;
2506 break;
2507 case MEP_OPERAND_IVC2_ACC1_1 :
2508 value = 0;
2509 break;
2510 case MEP_OPERAND_IVC2_ACC1_2 :
2511 value = 0;
2512 break;
2513 case MEP_OPERAND_IVC2_ACC1_3 :
2514 value = 0;
2515 break;
2516 case MEP_OPERAND_IVC2_ACC1_4 :
2517 value = 0;
2518 break;
2519 case MEP_OPERAND_IVC2_ACC1_5 :
2520 value = 0;
2521 break;
2522 case MEP_OPERAND_IVC2_ACC1_6 :
2523 value = 0;
2524 break;
2525 case MEP_OPERAND_IVC2_ACC1_7 :
2526 value = 0;
2527 break;
2528 case MEP_OPERAND_IVC2_CC :
2529 value = 0;
2530 break;
2531 case MEP_OPERAND_IVC2_COFA0 :
2532 value = 0;
2533 break;
2534 case MEP_OPERAND_IVC2_COFA1 :
2535 value = 0;
2536 break;
2537 case MEP_OPERAND_IVC2_COFR0 :
2538 value = 0;
2539 break;
2540 case MEP_OPERAND_IVC2_COFR1 :
2541 value = 0;
2542 break;
2543 case MEP_OPERAND_IVC2_CSAR0 :
2544 value = 0;
2545 break;
2546 case MEP_OPERAND_IVC2_CSAR1 :
2547 value = 0;
2548 break;
2549 case MEP_OPERAND_IVC2C3CCRN :
2550 value = fields->f_ivc2_ccrn_c3;
2551 break;
2552 case MEP_OPERAND_IVC2CCRN :
2553 value = fields->f_ivc2_ccrn;
2554 break;
2555 case MEP_OPERAND_IVC2CRN :
2556 value = fields->f_ivc2_crnx;
2557 break;
2558 case MEP_OPERAND_IVC2RM :
2559 value = fields->f_ivc2_crm;
2560 break;
2561 case MEP_OPERAND_LO :
2562 value = 0;
2563 break;
2564 case MEP_OPERAND_LP :
2565 value = 0;
2566 break;
2567 case MEP_OPERAND_MB0 :
2568 value = 0;
2569 break;
2570 case MEP_OPERAND_MB1 :
2571 value = 0;
2572 break;
2573 case MEP_OPERAND_ME0 :
2574 value = 0;
2575 break;
2576 case MEP_OPERAND_ME1 :
2577 value = 0;
2578 break;
2579 case MEP_OPERAND_NPC :
2580 value = 0;
2581 break;
2582 case MEP_OPERAND_OPT :
2583 value = 0;
2584 break;
2585 case MEP_OPERAND_PCABS24A2 :
2586 value = fields->f_24u5a2n;
2587 break;
2588 case MEP_OPERAND_PCREL12A2 :
2589 value = fields->f_12s4a2;
2590 break;
2591 case MEP_OPERAND_PCREL17A2 :
2592 value = fields->f_17s16a2;
2593 break;
2594 case MEP_OPERAND_PCREL24A2 :
2595 value = fields->f_24s5a2n;
2596 break;
2597 case MEP_OPERAND_PCREL8A2 :
2598 value = fields->f_8s8a2;
2599 break;
2600 case MEP_OPERAND_PSW :
2601 value = 0;
2602 break;
2603 case MEP_OPERAND_R0 :
2604 value = 0;
2605 break;
2606 case MEP_OPERAND_R1 :
2607 value = 0;
2608 break;
2609 case MEP_OPERAND_RL :
2610 value = fields->f_rl;
2611 break;
2612 case MEP_OPERAND_RL5 :
2613 value = fields->f_rl5;
2614 break;
2615 case MEP_OPERAND_RM :
2616 value = fields->f_rm;
2617 break;
2618 case MEP_OPERAND_RMA :
2619 value = fields->f_rm;
2620 break;
2621 case MEP_OPERAND_RN :
2622 value = fields->f_rn;
2623 break;
2624 case MEP_OPERAND_RN3 :
2625 value = fields->f_rn3;
2626 break;
2627 case MEP_OPERAND_RN3C :
2628 value = fields->f_rn3;
2629 break;
2630 case MEP_OPERAND_RN3L :
2631 value = fields->f_rn3;
2632 break;
2633 case MEP_OPERAND_RN3S :
2634 value = fields->f_rn3;
2635 break;
2636 case MEP_OPERAND_RN3UC :
2637 value = fields->f_rn3;
2638 break;
2639 case MEP_OPERAND_RN3UL :
2640 value = fields->f_rn3;
2641 break;
2642 case MEP_OPERAND_RN3US :
2643 value = fields->f_rn3;
2644 break;
2645 case MEP_OPERAND_RNC :
2646 value = fields->f_rn;
2647 break;
2648 case MEP_OPERAND_RNL :
2649 value = fields->f_rn;
2650 break;
2651 case MEP_OPERAND_RNS :
2652 value = fields->f_rn;
2653 break;
2654 case MEP_OPERAND_RNUC :
2655 value = fields->f_rn;
2656 break;
2657 case MEP_OPERAND_RNUL :
2658 value = fields->f_rn;
2659 break;
2660 case MEP_OPERAND_RNUS :
2661 value = fields->f_rn;
2662 break;
2663 case MEP_OPERAND_SAR :
2664 value = 0;
2665 break;
2666 case MEP_OPERAND_SDISP16 :
2667 value = fields->f_16s16;
2668 break;
2669 case MEP_OPERAND_SIMM16 :
2670 value = fields->f_16s16;
2671 break;
2672 case MEP_OPERAND_SIMM16P0 :
2673 value = fields->f_ivc2_simm16p0;
2674 break;
2675 case MEP_OPERAND_SIMM6 :
2676 value = fields->f_6s8;
2677 break;
2678 case MEP_OPERAND_SIMM8 :
2679 value = fields->f_8s8;
2680 break;
2681 case MEP_OPERAND_SIMM8P0 :
2682 value = fields->f_ivc2_8s0;
2683 break;
2684 case MEP_OPERAND_SIMM8P20 :
2685 value = fields->f_ivc2_8s20;
2686 break;
2687 case MEP_OPERAND_SIMM8P4 :
2688 value = fields->f_ivc2_8s4;
2689 break;
2690 case MEP_OPERAND_SP :
2691 value = 0;
2692 break;
2693 case MEP_OPERAND_SPR :
2694 value = 0;
2695 break;
2696 case MEP_OPERAND_TP :
2697 value = 0;
2698 break;
2699 case MEP_OPERAND_TPR :
2700 value = 0;
2701 break;
2702 case MEP_OPERAND_UDISP2 :
2703 value = fields->f_2u6;
2704 break;
2705 case MEP_OPERAND_UDISP7 :
2706 value = fields->f_7u9;
2707 break;
2708 case MEP_OPERAND_UDISP7A2 :
2709 value = fields->f_7u9a2;
2710 break;
2711 case MEP_OPERAND_UDISP7A4 :
2712 value = fields->f_7u9a4;
2713 break;
2714 case MEP_OPERAND_UIMM16 :
2715 value = fields->f_16u16;
2716 break;
2717 case MEP_OPERAND_UIMM2 :
2718 value = fields->f_2u10;
2719 break;
2720 case MEP_OPERAND_UIMM24 :
2721 value = fields->f_24u8n;
2722 break;
2723 case MEP_OPERAND_UIMM3 :
2724 value = fields->f_3u5;
2725 break;
2726 case MEP_OPERAND_UIMM4 :
2727 value = fields->f_4u8;
2728 break;
2729 case MEP_OPERAND_UIMM5 :
2730 value = fields->f_5u8;
2731 break;
2732 case MEP_OPERAND_UIMM7A4 :
2733 value = fields->f_7u9a4;
2734 break;
2735 case MEP_OPERAND_ZERO :
2736 value = 0;
2737 break;
2739 default :
2740 /* xgettext:c-format */
2741 opcodes_error_handler
2742 (_("internal error: unrecognized field %d while getting vma operand"),
2743 opindex);
2744 abort ();
2747 return value;
2750 void mep_cgen_set_int_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
2751 void mep_cgen_set_vma_operand (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);
2753 /* Stuffing values in cgen_fields is handled by a collection of functions.
2754 They are distinguished by the type of the VALUE argument they accept.
2755 TODO: floating point, inlining support, remove cases where argument type
2756 not appropriate. */
2758 void
2759 mep_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
2760 int opindex,
2761 CGEN_FIELDS * fields,
2762 int value)
2764 switch (opindex)
2766 case MEP_OPERAND_ADDR24A4 :
2767 fields->f_24u8a4n = value;
2768 break;
2769 case MEP_OPERAND_C5RMUIMM20 :
2770 fields->f_c5_rmuimm20 = value;
2771 break;
2772 case MEP_OPERAND_C5RNMUIMM24 :
2773 fields->f_c5_rnmuimm24 = value;
2774 break;
2775 case MEP_OPERAND_CALLNUM :
2776 fields->f_callnum = value;
2777 break;
2778 case MEP_OPERAND_CCCC :
2779 fields->f_rm = value;
2780 break;
2781 case MEP_OPERAND_CCRN :
2782 fields->f_ccrn = value;
2783 break;
2784 case MEP_OPERAND_CDISP10 :
2785 fields->f_cdisp10 = value;
2786 break;
2787 case MEP_OPERAND_CDISP10A2 :
2788 fields->f_cdisp10 = value;
2789 break;
2790 case MEP_OPERAND_CDISP10A4 :
2791 fields->f_cdisp10 = value;
2792 break;
2793 case MEP_OPERAND_CDISP10A8 :
2794 fields->f_cdisp10 = value;
2795 break;
2796 case MEP_OPERAND_CDISP12 :
2797 fields->f_12s20 = value;
2798 break;
2799 case MEP_OPERAND_CIMM4 :
2800 fields->f_rn = value;
2801 break;
2802 case MEP_OPERAND_CIMM5 :
2803 fields->f_5u24 = value;
2804 break;
2805 case MEP_OPERAND_CODE16 :
2806 fields->f_16u16 = value;
2807 break;
2808 case MEP_OPERAND_CODE24 :
2809 fields->f_24u4n = value;
2810 break;
2811 case MEP_OPERAND_CP_FLAG :
2812 break;
2813 case MEP_OPERAND_CRN :
2814 fields->f_crn = value;
2815 break;
2816 case MEP_OPERAND_CRN64 :
2817 fields->f_crn = value;
2818 break;
2819 case MEP_OPERAND_CRNX :
2820 fields->f_crnx = value;
2821 break;
2822 case MEP_OPERAND_CRNX64 :
2823 fields->f_crnx = value;
2824 break;
2825 case MEP_OPERAND_CROC :
2826 fields->f_ivc2_5u7 = value;
2827 break;
2828 case MEP_OPERAND_CROP :
2829 fields->f_ivc2_5u23 = value;
2830 break;
2831 case MEP_OPERAND_CRPC :
2832 fields->f_ivc2_5u26 = value;
2833 break;
2834 case MEP_OPERAND_CRPP :
2835 fields->f_ivc2_5u18 = value;
2836 break;
2837 case MEP_OPERAND_CRQC :
2838 fields->f_ivc2_5u21 = value;
2839 break;
2840 case MEP_OPERAND_CRQP :
2841 fields->f_ivc2_5u13 = value;
2842 break;
2843 case MEP_OPERAND_CSRN :
2844 fields->f_csrn = value;
2845 break;
2846 case MEP_OPERAND_CSRN_IDX :
2847 fields->f_csrn = value;
2848 break;
2849 case MEP_OPERAND_DBG :
2850 break;
2851 case MEP_OPERAND_DEPC :
2852 break;
2853 case MEP_OPERAND_EPC :
2854 break;
2855 case MEP_OPERAND_EXC :
2856 break;
2857 case MEP_OPERAND_HI :
2858 break;
2859 case MEP_OPERAND_IMM16P0 :
2860 fields->f_ivc2_imm16p0 = value;
2861 break;
2862 case MEP_OPERAND_IMM3P12 :
2863 fields->f_ivc2_3u12 = value;
2864 break;
2865 case MEP_OPERAND_IMM3P25 :
2866 fields->f_ivc2_3u25 = value;
2867 break;
2868 case MEP_OPERAND_IMM3P4 :
2869 fields->f_ivc2_3u4 = value;
2870 break;
2871 case MEP_OPERAND_IMM3P5 :
2872 fields->f_ivc2_3u5 = value;
2873 break;
2874 case MEP_OPERAND_IMM3P9 :
2875 fields->f_ivc2_3u9 = value;
2876 break;
2877 case MEP_OPERAND_IMM4P10 :
2878 fields->f_ivc2_4u10 = value;
2879 break;
2880 case MEP_OPERAND_IMM4P4 :
2881 fields->f_ivc2_4u4 = value;
2882 break;
2883 case MEP_OPERAND_IMM4P8 :
2884 fields->f_ivc2_4u8 = value;
2885 break;
2886 case MEP_OPERAND_IMM5P23 :
2887 fields->f_ivc2_5u23 = value;
2888 break;
2889 case MEP_OPERAND_IMM5P3 :
2890 fields->f_ivc2_5u3 = value;
2891 break;
2892 case MEP_OPERAND_IMM5P7 :
2893 fields->f_ivc2_5u7 = value;
2894 break;
2895 case MEP_OPERAND_IMM5P8 :
2896 fields->f_ivc2_5u8 = value;
2897 break;
2898 case MEP_OPERAND_IMM6P2 :
2899 fields->f_ivc2_6u2 = value;
2900 break;
2901 case MEP_OPERAND_IMM6P6 :
2902 fields->f_ivc2_6u6 = value;
2903 break;
2904 case MEP_OPERAND_IMM8P0 :
2905 fields->f_ivc2_8u0 = value;
2906 break;
2907 case MEP_OPERAND_IMM8P20 :
2908 fields->f_ivc2_8u20 = value;
2909 break;
2910 case MEP_OPERAND_IMM8P4 :
2911 fields->f_ivc2_8u4 = value;
2912 break;
2913 case MEP_OPERAND_IVC_X_0_2 :
2914 fields->f_ivc2_2u0 = value;
2915 break;
2916 case MEP_OPERAND_IVC_X_0_3 :
2917 fields->f_ivc2_3u0 = value;
2918 break;
2919 case MEP_OPERAND_IVC_X_0_4 :
2920 fields->f_ivc2_4u0 = value;
2921 break;
2922 case MEP_OPERAND_IVC_X_0_5 :
2923 fields->f_ivc2_5u0 = value;
2924 break;
2925 case MEP_OPERAND_IVC_X_6_1 :
2926 fields->f_ivc2_1u6 = value;
2927 break;
2928 case MEP_OPERAND_IVC_X_6_2 :
2929 fields->f_ivc2_2u6 = value;
2930 break;
2931 case MEP_OPERAND_IVC_X_6_3 :
2932 fields->f_ivc2_3u6 = value;
2933 break;
2934 case MEP_OPERAND_IVC2_ACC0_0 :
2935 break;
2936 case MEP_OPERAND_IVC2_ACC0_1 :
2937 break;
2938 case MEP_OPERAND_IVC2_ACC0_2 :
2939 break;
2940 case MEP_OPERAND_IVC2_ACC0_3 :
2941 break;
2942 case MEP_OPERAND_IVC2_ACC0_4 :
2943 break;
2944 case MEP_OPERAND_IVC2_ACC0_5 :
2945 break;
2946 case MEP_OPERAND_IVC2_ACC0_6 :
2947 break;
2948 case MEP_OPERAND_IVC2_ACC0_7 :
2949 break;
2950 case MEP_OPERAND_IVC2_ACC1_0 :
2951 break;
2952 case MEP_OPERAND_IVC2_ACC1_1 :
2953 break;
2954 case MEP_OPERAND_IVC2_ACC1_2 :
2955 break;
2956 case MEP_OPERAND_IVC2_ACC1_3 :
2957 break;
2958 case MEP_OPERAND_IVC2_ACC1_4 :
2959 break;
2960 case MEP_OPERAND_IVC2_ACC1_5 :
2961 break;
2962 case MEP_OPERAND_IVC2_ACC1_6 :
2963 break;
2964 case MEP_OPERAND_IVC2_ACC1_7 :
2965 break;
2966 case MEP_OPERAND_IVC2_CC :
2967 break;
2968 case MEP_OPERAND_IVC2_COFA0 :
2969 break;
2970 case MEP_OPERAND_IVC2_COFA1 :
2971 break;
2972 case MEP_OPERAND_IVC2_COFR0 :
2973 break;
2974 case MEP_OPERAND_IVC2_COFR1 :
2975 break;
2976 case MEP_OPERAND_IVC2_CSAR0 :
2977 break;
2978 case MEP_OPERAND_IVC2_CSAR1 :
2979 break;
2980 case MEP_OPERAND_IVC2C3CCRN :
2981 fields->f_ivc2_ccrn_c3 = value;
2982 break;
2983 case MEP_OPERAND_IVC2CCRN :
2984 fields->f_ivc2_ccrn = value;
2985 break;
2986 case MEP_OPERAND_IVC2CRN :
2987 fields->f_ivc2_crnx = value;
2988 break;
2989 case MEP_OPERAND_IVC2RM :
2990 fields->f_ivc2_crm = value;
2991 break;
2992 case MEP_OPERAND_LO :
2993 break;
2994 case MEP_OPERAND_LP :
2995 break;
2996 case MEP_OPERAND_MB0 :
2997 break;
2998 case MEP_OPERAND_MB1 :
2999 break;
3000 case MEP_OPERAND_ME0 :
3001 break;
3002 case MEP_OPERAND_ME1 :
3003 break;
3004 case MEP_OPERAND_NPC :
3005 break;
3006 case MEP_OPERAND_OPT :
3007 break;
3008 case MEP_OPERAND_PCABS24A2 :
3009 fields->f_24u5a2n = value;
3010 break;
3011 case MEP_OPERAND_PCREL12A2 :
3012 fields->f_12s4a2 = value;
3013 break;
3014 case MEP_OPERAND_PCREL17A2 :
3015 fields->f_17s16a2 = value;
3016 break;
3017 case MEP_OPERAND_PCREL24A2 :
3018 fields->f_24s5a2n = value;
3019 break;
3020 case MEP_OPERAND_PCREL8A2 :
3021 fields->f_8s8a2 = value;
3022 break;
3023 case MEP_OPERAND_PSW :
3024 break;
3025 case MEP_OPERAND_R0 :
3026 break;
3027 case MEP_OPERAND_R1 :
3028 break;
3029 case MEP_OPERAND_RL :
3030 fields->f_rl = value;
3031 break;
3032 case MEP_OPERAND_RL5 :
3033 fields->f_rl5 = value;
3034 break;
3035 case MEP_OPERAND_RM :
3036 fields->f_rm = value;
3037 break;
3038 case MEP_OPERAND_RMA :
3039 fields->f_rm = value;
3040 break;
3041 case MEP_OPERAND_RN :
3042 fields->f_rn = value;
3043 break;
3044 case MEP_OPERAND_RN3 :
3045 fields->f_rn3 = value;
3046 break;
3047 case MEP_OPERAND_RN3C :
3048 fields->f_rn3 = value;
3049 break;
3050 case MEP_OPERAND_RN3L :
3051 fields->f_rn3 = value;
3052 break;
3053 case MEP_OPERAND_RN3S :
3054 fields->f_rn3 = value;
3055 break;
3056 case MEP_OPERAND_RN3UC :
3057 fields->f_rn3 = value;
3058 break;
3059 case MEP_OPERAND_RN3UL :
3060 fields->f_rn3 = value;
3061 break;
3062 case MEP_OPERAND_RN3US :
3063 fields->f_rn3 = value;
3064 break;
3065 case MEP_OPERAND_RNC :
3066 fields->f_rn = value;
3067 break;
3068 case MEP_OPERAND_RNL :
3069 fields->f_rn = value;
3070 break;
3071 case MEP_OPERAND_RNS :
3072 fields->f_rn = value;
3073 break;
3074 case MEP_OPERAND_RNUC :
3075 fields->f_rn = value;
3076 break;
3077 case MEP_OPERAND_RNUL :
3078 fields->f_rn = value;
3079 break;
3080 case MEP_OPERAND_RNUS :
3081 fields->f_rn = value;
3082 break;
3083 case MEP_OPERAND_SAR :
3084 break;
3085 case MEP_OPERAND_SDISP16 :
3086 fields->f_16s16 = value;
3087 break;
3088 case MEP_OPERAND_SIMM16 :
3089 fields->f_16s16 = value;
3090 break;
3091 case MEP_OPERAND_SIMM16P0 :
3092 fields->f_ivc2_simm16p0 = value;
3093 break;
3094 case MEP_OPERAND_SIMM6 :
3095 fields->f_6s8 = value;
3096 break;
3097 case MEP_OPERAND_SIMM8 :
3098 fields->f_8s8 = value;
3099 break;
3100 case MEP_OPERAND_SIMM8P0 :
3101 fields->f_ivc2_8s0 = value;
3102 break;
3103 case MEP_OPERAND_SIMM8P20 :
3104 fields->f_ivc2_8s20 = value;
3105 break;
3106 case MEP_OPERAND_SIMM8P4 :
3107 fields->f_ivc2_8s4 = value;
3108 break;
3109 case MEP_OPERAND_SP :
3110 break;
3111 case MEP_OPERAND_SPR :
3112 break;
3113 case MEP_OPERAND_TP :
3114 break;
3115 case MEP_OPERAND_TPR :
3116 break;
3117 case MEP_OPERAND_UDISP2 :
3118 fields->f_2u6 = value;
3119 break;
3120 case MEP_OPERAND_UDISP7 :
3121 fields->f_7u9 = value;
3122 break;
3123 case MEP_OPERAND_UDISP7A2 :
3124 fields->f_7u9a2 = value;
3125 break;
3126 case MEP_OPERAND_UDISP7A4 :
3127 fields->f_7u9a4 = value;
3128 break;
3129 case MEP_OPERAND_UIMM16 :
3130 fields->f_16u16 = value;
3131 break;
3132 case MEP_OPERAND_UIMM2 :
3133 fields->f_2u10 = value;
3134 break;
3135 case MEP_OPERAND_UIMM24 :
3136 fields->f_24u8n = value;
3137 break;
3138 case MEP_OPERAND_UIMM3 :
3139 fields->f_3u5 = value;
3140 break;
3141 case MEP_OPERAND_UIMM4 :
3142 fields->f_4u8 = value;
3143 break;
3144 case MEP_OPERAND_UIMM5 :
3145 fields->f_5u8 = value;
3146 break;
3147 case MEP_OPERAND_UIMM7A4 :
3148 fields->f_7u9a4 = value;
3149 break;
3150 case MEP_OPERAND_ZERO :
3151 break;
3153 default :
3154 /* xgettext:c-format */
3155 opcodes_error_handler
3156 (_("internal error: unrecognized field %d while setting int operand"),
3157 opindex);
3158 abort ();
3162 void
3163 mep_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
3164 int opindex,
3165 CGEN_FIELDS * fields,
3166 bfd_vma value)
3168 switch (opindex)
3170 case MEP_OPERAND_ADDR24A4 :
3171 fields->f_24u8a4n = value;
3172 break;
3173 case MEP_OPERAND_C5RMUIMM20 :
3174 fields->f_c5_rmuimm20 = value;
3175 break;
3176 case MEP_OPERAND_C5RNMUIMM24 :
3177 fields->f_c5_rnmuimm24 = value;
3178 break;
3179 case MEP_OPERAND_CALLNUM :
3180 fields->f_callnum = value;
3181 break;
3182 case MEP_OPERAND_CCCC :
3183 fields->f_rm = value;
3184 break;
3185 case MEP_OPERAND_CCRN :
3186 fields->f_ccrn = value;
3187 break;
3188 case MEP_OPERAND_CDISP10 :
3189 fields->f_cdisp10 = value;
3190 break;
3191 case MEP_OPERAND_CDISP10A2 :
3192 fields->f_cdisp10 = value;
3193 break;
3194 case MEP_OPERAND_CDISP10A4 :
3195 fields->f_cdisp10 = value;
3196 break;
3197 case MEP_OPERAND_CDISP10A8 :
3198 fields->f_cdisp10 = value;
3199 break;
3200 case MEP_OPERAND_CDISP12 :
3201 fields->f_12s20 = value;
3202 break;
3203 case MEP_OPERAND_CIMM4 :
3204 fields->f_rn = value;
3205 break;
3206 case MEP_OPERAND_CIMM5 :
3207 fields->f_5u24 = value;
3208 break;
3209 case MEP_OPERAND_CODE16 :
3210 fields->f_16u16 = value;
3211 break;
3212 case MEP_OPERAND_CODE24 :
3213 fields->f_24u4n = value;
3214 break;
3215 case MEP_OPERAND_CP_FLAG :
3216 break;
3217 case MEP_OPERAND_CRN :
3218 fields->f_crn = value;
3219 break;
3220 case MEP_OPERAND_CRN64 :
3221 fields->f_crn = value;
3222 break;
3223 case MEP_OPERAND_CRNX :
3224 fields->f_crnx = value;
3225 break;
3226 case MEP_OPERAND_CRNX64 :
3227 fields->f_crnx = value;
3228 break;
3229 case MEP_OPERAND_CROC :
3230 fields->f_ivc2_5u7 = value;
3231 break;
3232 case MEP_OPERAND_CROP :
3233 fields->f_ivc2_5u23 = value;
3234 break;
3235 case MEP_OPERAND_CRPC :
3236 fields->f_ivc2_5u26 = value;
3237 break;
3238 case MEP_OPERAND_CRPP :
3239 fields->f_ivc2_5u18 = value;
3240 break;
3241 case MEP_OPERAND_CRQC :
3242 fields->f_ivc2_5u21 = value;
3243 break;
3244 case MEP_OPERAND_CRQP :
3245 fields->f_ivc2_5u13 = value;
3246 break;
3247 case MEP_OPERAND_CSRN :
3248 fields->f_csrn = value;
3249 break;
3250 case MEP_OPERAND_CSRN_IDX :
3251 fields->f_csrn = value;
3252 break;
3253 case MEP_OPERAND_DBG :
3254 break;
3255 case MEP_OPERAND_DEPC :
3256 break;
3257 case MEP_OPERAND_EPC :
3258 break;
3259 case MEP_OPERAND_EXC :
3260 break;
3261 case MEP_OPERAND_HI :
3262 break;
3263 case MEP_OPERAND_IMM16P0 :
3264 fields->f_ivc2_imm16p0 = value;
3265 break;
3266 case MEP_OPERAND_IMM3P12 :
3267 fields->f_ivc2_3u12 = value;
3268 break;
3269 case MEP_OPERAND_IMM3P25 :
3270 fields->f_ivc2_3u25 = value;
3271 break;
3272 case MEP_OPERAND_IMM3P4 :
3273 fields->f_ivc2_3u4 = value;
3274 break;
3275 case MEP_OPERAND_IMM3P5 :
3276 fields->f_ivc2_3u5 = value;
3277 break;
3278 case MEP_OPERAND_IMM3P9 :
3279 fields->f_ivc2_3u9 = value;
3280 break;
3281 case MEP_OPERAND_IMM4P10 :
3282 fields->f_ivc2_4u10 = value;
3283 break;
3284 case MEP_OPERAND_IMM4P4 :
3285 fields->f_ivc2_4u4 = value;
3286 break;
3287 case MEP_OPERAND_IMM4P8 :
3288 fields->f_ivc2_4u8 = value;
3289 break;
3290 case MEP_OPERAND_IMM5P23 :
3291 fields->f_ivc2_5u23 = value;
3292 break;
3293 case MEP_OPERAND_IMM5P3 :
3294 fields->f_ivc2_5u3 = value;
3295 break;
3296 case MEP_OPERAND_IMM5P7 :
3297 fields->f_ivc2_5u7 = value;
3298 break;
3299 case MEP_OPERAND_IMM5P8 :
3300 fields->f_ivc2_5u8 = value;
3301 break;
3302 case MEP_OPERAND_IMM6P2 :
3303 fields->f_ivc2_6u2 = value;
3304 break;
3305 case MEP_OPERAND_IMM6P6 :
3306 fields->f_ivc2_6u6 = value;
3307 break;
3308 case MEP_OPERAND_IMM8P0 :
3309 fields->f_ivc2_8u0 = value;
3310 break;
3311 case MEP_OPERAND_IMM8P20 :
3312 fields->f_ivc2_8u20 = value;
3313 break;
3314 case MEP_OPERAND_IMM8P4 :
3315 fields->f_ivc2_8u4 = value;
3316 break;
3317 case MEP_OPERAND_IVC_X_0_2 :
3318 fields->f_ivc2_2u0 = value;
3319 break;
3320 case MEP_OPERAND_IVC_X_0_3 :
3321 fields->f_ivc2_3u0 = value;
3322 break;
3323 case MEP_OPERAND_IVC_X_0_4 :
3324 fields->f_ivc2_4u0 = value;
3325 break;
3326 case MEP_OPERAND_IVC_X_0_5 :
3327 fields->f_ivc2_5u0 = value;
3328 break;
3329 case MEP_OPERAND_IVC_X_6_1 :
3330 fields->f_ivc2_1u6 = value;
3331 break;
3332 case MEP_OPERAND_IVC_X_6_2 :
3333 fields->f_ivc2_2u6 = value;
3334 break;
3335 case MEP_OPERAND_IVC_X_6_3 :
3336 fields->f_ivc2_3u6 = value;
3337 break;
3338 case MEP_OPERAND_IVC2_ACC0_0 :
3339 break;
3340 case MEP_OPERAND_IVC2_ACC0_1 :
3341 break;
3342 case MEP_OPERAND_IVC2_ACC0_2 :
3343 break;
3344 case MEP_OPERAND_IVC2_ACC0_3 :
3345 break;
3346 case MEP_OPERAND_IVC2_ACC0_4 :
3347 break;
3348 case MEP_OPERAND_IVC2_ACC0_5 :
3349 break;
3350 case MEP_OPERAND_IVC2_ACC0_6 :
3351 break;
3352 case MEP_OPERAND_IVC2_ACC0_7 :
3353 break;
3354 case MEP_OPERAND_IVC2_ACC1_0 :
3355 break;
3356 case MEP_OPERAND_IVC2_ACC1_1 :
3357 break;
3358 case MEP_OPERAND_IVC2_ACC1_2 :
3359 break;
3360 case MEP_OPERAND_IVC2_ACC1_3 :
3361 break;
3362 case MEP_OPERAND_IVC2_ACC1_4 :
3363 break;
3364 case MEP_OPERAND_IVC2_ACC1_5 :
3365 break;
3366 case MEP_OPERAND_IVC2_ACC1_6 :
3367 break;
3368 case MEP_OPERAND_IVC2_ACC1_7 :
3369 break;
3370 case MEP_OPERAND_IVC2_CC :
3371 break;
3372 case MEP_OPERAND_IVC2_COFA0 :
3373 break;
3374 case MEP_OPERAND_IVC2_COFA1 :
3375 break;
3376 case MEP_OPERAND_IVC2_COFR0 :
3377 break;
3378 case MEP_OPERAND_IVC2_COFR1 :
3379 break;
3380 case MEP_OPERAND_IVC2_CSAR0 :
3381 break;
3382 case MEP_OPERAND_IVC2_CSAR1 :
3383 break;
3384 case MEP_OPERAND_IVC2C3CCRN :
3385 fields->f_ivc2_ccrn_c3 = value;
3386 break;
3387 case MEP_OPERAND_IVC2CCRN :
3388 fields->f_ivc2_ccrn = value;
3389 break;
3390 case MEP_OPERAND_IVC2CRN :
3391 fields->f_ivc2_crnx = value;
3392 break;
3393 case MEP_OPERAND_IVC2RM :
3394 fields->f_ivc2_crm = value;
3395 break;
3396 case MEP_OPERAND_LO :
3397 break;
3398 case MEP_OPERAND_LP :
3399 break;
3400 case MEP_OPERAND_MB0 :
3401 break;
3402 case MEP_OPERAND_MB1 :
3403 break;
3404 case MEP_OPERAND_ME0 :
3405 break;
3406 case MEP_OPERAND_ME1 :
3407 break;
3408 case MEP_OPERAND_NPC :
3409 break;
3410 case MEP_OPERAND_OPT :
3411 break;
3412 case MEP_OPERAND_PCABS24A2 :
3413 fields->f_24u5a2n = value;
3414 break;
3415 case MEP_OPERAND_PCREL12A2 :
3416 fields->f_12s4a2 = value;
3417 break;
3418 case MEP_OPERAND_PCREL17A2 :
3419 fields->f_17s16a2 = value;
3420 break;
3421 case MEP_OPERAND_PCREL24A2 :
3422 fields->f_24s5a2n = value;
3423 break;
3424 case MEP_OPERAND_PCREL8A2 :
3425 fields->f_8s8a2 = value;
3426 break;
3427 case MEP_OPERAND_PSW :
3428 break;
3429 case MEP_OPERAND_R0 :
3430 break;
3431 case MEP_OPERAND_R1 :
3432 break;
3433 case MEP_OPERAND_RL :
3434 fields->f_rl = value;
3435 break;
3436 case MEP_OPERAND_RL5 :
3437 fields->f_rl5 = value;
3438 break;
3439 case MEP_OPERAND_RM :
3440 fields->f_rm = value;
3441 break;
3442 case MEP_OPERAND_RMA :
3443 fields->f_rm = value;
3444 break;
3445 case MEP_OPERAND_RN :
3446 fields->f_rn = value;
3447 break;
3448 case MEP_OPERAND_RN3 :
3449 fields->f_rn3 = value;
3450 break;
3451 case MEP_OPERAND_RN3C :
3452 fields->f_rn3 = value;
3453 break;
3454 case MEP_OPERAND_RN3L :
3455 fields->f_rn3 = value;
3456 break;
3457 case MEP_OPERAND_RN3S :
3458 fields->f_rn3 = value;
3459 break;
3460 case MEP_OPERAND_RN3UC :
3461 fields->f_rn3 = value;
3462 break;
3463 case MEP_OPERAND_RN3UL :
3464 fields->f_rn3 = value;
3465 break;
3466 case MEP_OPERAND_RN3US :
3467 fields->f_rn3 = value;
3468 break;
3469 case MEP_OPERAND_RNC :
3470 fields->f_rn = value;
3471 break;
3472 case MEP_OPERAND_RNL :
3473 fields->f_rn = value;
3474 break;
3475 case MEP_OPERAND_RNS :
3476 fields->f_rn = value;
3477 break;
3478 case MEP_OPERAND_RNUC :
3479 fields->f_rn = value;
3480 break;
3481 case MEP_OPERAND_RNUL :
3482 fields->f_rn = value;
3483 break;
3484 case MEP_OPERAND_RNUS :
3485 fields->f_rn = value;
3486 break;
3487 case MEP_OPERAND_SAR :
3488 break;
3489 case MEP_OPERAND_SDISP16 :
3490 fields->f_16s16 = value;
3491 break;
3492 case MEP_OPERAND_SIMM16 :
3493 fields->f_16s16 = value;
3494 break;
3495 case MEP_OPERAND_SIMM16P0 :
3496 fields->f_ivc2_simm16p0 = value;
3497 break;
3498 case MEP_OPERAND_SIMM6 :
3499 fields->f_6s8 = value;
3500 break;
3501 case MEP_OPERAND_SIMM8 :
3502 fields->f_8s8 = value;
3503 break;
3504 case MEP_OPERAND_SIMM8P0 :
3505 fields->f_ivc2_8s0 = value;
3506 break;
3507 case MEP_OPERAND_SIMM8P20 :
3508 fields->f_ivc2_8s20 = value;
3509 break;
3510 case MEP_OPERAND_SIMM8P4 :
3511 fields->f_ivc2_8s4 = value;
3512 break;
3513 case MEP_OPERAND_SP :
3514 break;
3515 case MEP_OPERAND_SPR :
3516 break;
3517 case MEP_OPERAND_TP :
3518 break;
3519 case MEP_OPERAND_TPR :
3520 break;
3521 case MEP_OPERAND_UDISP2 :
3522 fields->f_2u6 = value;
3523 break;
3524 case MEP_OPERAND_UDISP7 :
3525 fields->f_7u9 = value;
3526 break;
3527 case MEP_OPERAND_UDISP7A2 :
3528 fields->f_7u9a2 = value;
3529 break;
3530 case MEP_OPERAND_UDISP7A4 :
3531 fields->f_7u9a4 = value;
3532 break;
3533 case MEP_OPERAND_UIMM16 :
3534 fields->f_16u16 = value;
3535 break;
3536 case MEP_OPERAND_UIMM2 :
3537 fields->f_2u10 = value;
3538 break;
3539 case MEP_OPERAND_UIMM24 :
3540 fields->f_24u8n = value;
3541 break;
3542 case MEP_OPERAND_UIMM3 :
3543 fields->f_3u5 = value;
3544 break;
3545 case MEP_OPERAND_UIMM4 :
3546 fields->f_4u8 = value;
3547 break;
3548 case MEP_OPERAND_UIMM5 :
3549 fields->f_5u8 = value;
3550 break;
3551 case MEP_OPERAND_UIMM7A4 :
3552 fields->f_7u9a4 = value;
3553 break;
3554 case MEP_OPERAND_ZERO :
3555 break;
3557 default :
3558 /* xgettext:c-format */
3559 opcodes_error_handler
3560 (_("internal error: unrecognized field %d while setting vma operand"),
3561 opindex);
3562 abort ();
3566 /* Function to call before using the instruction builder tables. */
3568 void
3569 mep_cgen_init_ibld_table (CGEN_CPU_DESC cd)
3571 cd->insert_handlers = & mep_cgen_insert_handlers[0];
3572 cd->extract_handlers = & mep_cgen_extract_handlers[0];
3574 cd->insert_operand = mep_cgen_insert_operand;
3575 cd->extract_operand = mep_cgen_extract_operand;
3577 cd->get_int_operand = mep_cgen_get_int_operand;
3578 cd->set_int_operand = mep_cgen_set_int_operand;
3579 cd->get_vma_operand = mep_cgen_get_vma_operand;
3580 cd->set_vma_operand = mep_cgen_set_vma_operand;