OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [opcodes/] [mep-ibld.c] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.