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