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