1 /* kvx-dis.c -- Kalray MPPA generic disassembler.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc.
3 Contributed by Kalray SA.
5 This file is part of the GNU opcodes library.
7 This library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 It is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING3. If not,
19 see <http://www.gnu.org/licenses/>. */
25 #include "disassemble.h"
26 #include "libiberty.h"
33 #include "opcode/kvx.h"
35 /* Steering values for the kvx VLIW architecture. */
45 typedef uint8_t Steering
;
47 /* BundleIssue enumeration. */
59 typedef uint8_t BundleIssue
;
61 /* An IMMX syllable is associated with the BundleIssue Extension_BundleIssue[extension]. */
62 static const BundleIssue Extension_BundleIssue
[] = {
70 kvx_steering (uint32_t x
)
72 return (((x
) & 0x60000000) >> 29);
76 kvx_extension (uint32_t x
)
78 return (((x
) & 0x18000000) >> 27);
82 kvx_has_parallel_bit (uint32_t x
)
84 return (((x
) & 0x80000000) == 0x80000000);
88 kvx_is_tca_opcode (uint32_t x
)
90 unsigned major
= ((x
) >> 24) & 0x1F;
91 return (major
> 1) && (major
< 8);
95 kvx_is_nop_opcode (uint32_t x
)
97 return ((x
) << 1) == 0xFFFFFFFE;
100 /* A raw instruction. */
104 uint32_t syllables
[KVXMAXSYLLABLES
];
107 typedef struct insn_s insn_t
;
110 static uint32_t bundle_words
[KVXMAXBUNDLEWORDS
];
112 static insn_t bundle_insn
[KVXMAXBUNDLEISSUE
];
114 /* A re-interpreted instruction. */
126 /* Option for "pretty printing", ie, not the usual little endian objdump output. */
127 static int opt_pretty
= 0;
128 /* Option for not emiting a new line between all bundles. */
129 static int opt_compact_assembly
= 0;
132 parse_kvx_dis_option (const char *option
)
134 /* Try to match options that are simple flags. */
135 if (startswith (option
, "pretty"))
141 if (startswith (option
, "compact-assembly"))
143 opt_compact_assembly
= 1;
147 if (startswith (option
, "no-compact-assembly"))
149 opt_compact_assembly
= 0;
153 /* Invalid option. */
154 opcodes_error_handler (_("unrecognised disassembler option: %s"), option
);
158 parse_kvx_dis_options (const char *options
)
160 const char *option_end
;
165 while (*options
!= '\0')
167 /* Skip empty options. */
174 /* We know that *options is neither NUL or a comma. */
175 option_end
= options
+ 1;
176 while (*option_end
!= ',' && *option_end
!= '\0')
179 parse_kvx_dis_option (options
);
181 /* Go on to the next one. If option_end points to a comma, it
182 will be skipped above. */
183 options
= option_end
;
190 struct kvxopc
*opc_table
;
191 struct kvx_Register
*kvx_registers
;
192 const char ***kvx_modifiers
;
193 int *kvx_dec_registers
;
195 unsigned int kvx_max_dec_registers
;
199 static struct kvx_dis_env env
= {
202 .kvx_registers
= NULL
,
203 .kvx_modifiers
= NULL
,
204 .kvx_dec_registers
= NULL
,
205 .kvx_regfiles
= NULL
,
207 .kvx_max_dec_registers
= 0
211 kvx_dis_init (struct disassemble_info
*info
)
213 env
.kvx_arch_size
= 32;
216 case bfd_mach_kv3_1_64
:
217 env
.kvx_arch_size
= 64;
219 case bfd_mach_kv3_1_usr
:
222 env
.opc_table
= kvx_kv3_v1_optab
;
223 env
.kvx_regfiles
= kvx_kv3_v1_regfiles
;
224 env
.kvx_registers
= kvx_kv3_v1_registers
;
225 env
.kvx_modifiers
= kvx_kv3_v1_modifiers
;
226 env
.kvx_dec_registers
= kvx_kv3_v1_dec_registers
;
228 case bfd_mach_kv3_2_64
:
229 env
.kvx_arch_size
= 64;
231 case bfd_mach_kv3_2_usr
:
233 env
.opc_table
= kvx_kv3_v2_optab
;
234 env
.kvx_regfiles
= kvx_kv3_v2_regfiles
;
235 env
.kvx_registers
= kvx_kv3_v2_registers
;
236 env
.kvx_modifiers
= kvx_kv3_v2_modifiers
;
237 env
.kvx_dec_registers
= kvx_kv3_v2_dec_registers
;
239 case bfd_mach_kv4_1_64
:
240 env
.kvx_arch_size
= 64;
242 case bfd_mach_kv4_1_usr
:
244 env
.opc_table
= kvx_kv4_v1_optab
;
245 env
.kvx_regfiles
= kvx_kv4_v1_regfiles
;
246 env
.kvx_registers
= kvx_kv4_v1_registers
;
247 env
.kvx_modifiers
= kvx_kv4_v1_modifiers
;
248 env
.kvx_dec_registers
= kvx_kv4_v1_dec_registers
;
252 env
.kvx_max_dec_registers
= env
.kvx_regfiles
[KVX_REGFILE_DEC_REGISTERS
];
254 if (info
->disassembler_options
)
255 parse_kvx_dis_options (info
->disassembler_options
);
257 env
.initialized_p
= 1;
261 kvx_reassemble_bundle (int wordcount
, int *_insncount
)
264 /* Debugging flag. */
267 /* Available resources. */
276 fprintf (stderr
, "kvx_reassemble_bundle: wordcount = %d\n", wordcount
);
278 if (wordcount
> KVXMAXBUNDLEWORDS
)
281 fprintf (stderr
, "bundle exceeds maximum size\n");
285 struct instr_s instr
[KVXMAXBUNDLEISSUE
];
286 memset (instr
, 0, sizeof (instr
));
287 assert (KVXMAXBUNDLEISSUE
>= BundleIssue__
);
292 for (i
= 0; i
< wordcount
; i
++)
294 uint32_t syllable
= bundle_words
[i
];
295 switch (kvx_steering (syllable
))
298 /* BCU or TCA instruction. */
301 if (kvx_is_tca_opcode (syllable
))
306 fprintf (stderr
, "Too many TCA instructions");
311 "Syllable 0: Set valid on TCA for instr %d with 0x%x\n",
312 BundleIssue_TCA
, syllable
);
313 instr
[BundleIssue_TCA
].valid
= 1;
314 instr
[BundleIssue_TCA
].opcode
= syllable
;
315 instr
[BundleIssue_TCA
].nb_syllables
= 1;
322 "Syllable 0: Set valid on BCU for instr %d with 0x%x\n",
323 BundleIssue_BCU
, syllable
);
325 instr
[BundleIssue_BCU
].valid
= 1;
326 instr
[BundleIssue_BCU
].opcode
= syllable
;
327 instr
[BundleIssue_BCU
].nb_syllables
= 1;
333 if (i
== 1 && bcu_taken
&& kvx_is_tca_opcode (syllable
))
338 fprintf (stderr
, "Too many TCA instructions");
343 "Syllable 0: Set valid on TCA for instr %d with 0x%x\n",
344 BundleIssue_TCA
, syllable
);
345 instr
[BundleIssue_TCA
].valid
= 1;
346 instr
[BundleIssue_TCA
].opcode
= syllable
;
347 instr
[BundleIssue_TCA
].nb_syllables
= 1;
352 /* Not first syllable in bundle, IMMX. */
353 struct instr_s
*instr_p
=
354 &(instr
[Extension_BundleIssue
[kvx_extension (syllable
)]]);
355 int immx_count
= instr_p
->immx_count
;
359 fprintf (stderr
, "Too many IMMX syllables");
362 instr_p
->immx
[immx_count
] = syllable
;
363 instr_p
->immx_valid
[immx_count
] = 1;
364 instr_p
->nb_syllables
++;
367 "Set IMMX[%d] on instr %d for extension %d @ %d\n",
369 Extension_BundleIssue
[kvx_extension (syllable
)],
370 kvx_extension (syllable
), i
);
371 instr_p
->immx_count
= immx_count
+ 1;
380 fprintf (stderr
, "Set valid on ALU0 for instr %d with 0x%x\n",
381 BundleIssue_ALU0
, syllable
);
382 instr
[BundleIssue_ALU0
].valid
= 1;
383 instr
[BundleIssue_ALU0
].opcode
= syllable
;
384 instr
[BundleIssue_ALU0
].nb_syllables
= 1;
387 else if (alu1_taken
== 0)
390 fprintf (stderr
, "Set valid on ALU1 for instr %d with 0x%x\n",
391 BundleIssue_ALU1
, syllable
);
392 instr
[BundleIssue_ALU1
].valid
= 1;
393 instr
[BundleIssue_ALU1
].opcode
= syllable
;
394 instr
[BundleIssue_ALU1
].nb_syllables
= 1;
397 else if (mau_taken
== 0)
401 "Set valid on MAU (ALU) for instr %d with 0x%x\n",
402 BundleIssue_MAU
, syllable
);
403 instr
[BundleIssue_MAU
].valid
= 1;
404 instr
[BundleIssue_MAU
].opcode
= syllable
;
405 instr
[BundleIssue_MAU
].nb_syllables
= 1;
408 else if (lsu_taken
== 0)
412 "Set valid on LSU (ALU) for instr %d with 0x%x\n",
413 BundleIssue_LSU
, syllable
);
414 instr
[BundleIssue_LSU
].valid
= 1;
415 instr
[BundleIssue_LSU
].opcode
= syllable
;
416 instr
[BundleIssue_LSU
].nb_syllables
= 1;
419 else if (kvx_is_nop_opcode (syllable
))
422 fprintf (stderr
, "Ignoring NOP (ALU) syllable\n");
427 fprintf (stderr
, "Too many ALU instructions");
436 fprintf (stderr
, "Too many MAU instructions");
442 fprintf (stderr
, "Set valid on MAU for instr %d with 0x%x\n",
443 BundleIssue_MAU
, syllable
);
444 instr
[BundleIssue_MAU
].valid
= 1;
445 instr
[BundleIssue_MAU
].opcode
= syllable
;
446 instr
[BundleIssue_MAU
].nb_syllables
= 1;
455 fprintf (stderr
, "Too many LSU instructions");
461 fprintf (stderr
, "Set valid on LSU for instr %d with 0x%x\n",
462 BundleIssue_LSU
, syllable
);
463 instr
[BundleIssue_LSU
].valid
= 1;
464 instr
[BundleIssue_LSU
].opcode
= syllable
;
465 instr
[BundleIssue_LSU
].nb_syllables
= 1;
470 fprintf (stderr
, "Continue %d < %d?\n", i
, wordcount
);
473 /* Fill bundle_insn and count read syllables. */
475 for (i
= 0; i
< KVXMAXBUNDLEISSUE
; i
++)
477 if (instr
[i
].valid
== 1)
479 int syllable_idx
= 0;
481 /* First copy opcode. */
482 bundle_insn
[instr_idx
].syllables
[syllable_idx
++] = instr
[i
].opcode
;
483 bundle_insn
[instr_idx
].len
= 1;
485 for (j
= 0; j
< 2; j
++)
487 if (instr
[i
].immx_valid
[j
])
490 fprintf (stderr
, "Instr %d valid immx[%d] is valid\n", i
,
492 bundle_insn
[instr_idx
].syllables
[syllable_idx
++] =
494 bundle_insn
[instr_idx
].len
++;
500 "Instr %d valid, copying in bundle_insn (%d syllables <-> %d)\n",
501 i
, bundle_insn
[instr_idx
].len
, instr
[i
].nb_syllables
);
507 fprintf (stderr
, "End => %d instructions\n", instr_idx
);
509 *_insncount
= instr_idx
;
515 /* The entry in the opc_table. */
517 /* The number of operands. */
519 /* The content of an operands. */
528 /* The value of the operands. */
530 /* If it is an immediate, its sign. */
532 /* If it is an immediate, is it pc relative. */
534 /* The width of the operand. */
536 /* If it is a modifier, the modifier category.
537 An index in the modifier table. */
539 } operands
[KVXMAXOPERANDS
];
543 decode_insn (bfd_vma memaddr
, insn_t
* insn
, struct decoded_insn
*res
)
548 for (struct kvxopc
* op
= env
.opc_table
;
549 op
->as_op
&& (((char) op
->as_op
[0]) != 0); op
++)
551 /* Find the format of this insn. */
552 int opcode_match
= 1;
554 if (op
->wordcount
!= insn
->len
)
557 for (int i
= 0; i
< op
->wordcount
; i
++)
558 if ((op
->codewords
[i
].mask
& insn
->syllables
[i
]) !=
559 op
->codewords
[i
].opcode
)
562 int encoding_space_flags
= env
.kvx_arch_size
== 32
563 ? kvxOPCODE_FLAG_MODE32
: kvxOPCODE_FLAG_MODE64
;
565 for (int i
= 0; i
< op
->wordcount
; i
++)
566 if (!(op
->codewords
[i
].flags
& encoding_space_flags
))
573 for (int i
= 0; op
->format
[i
]; i
++)
575 struct kvx_bitfield
*bf
= op
->format
[i
]->bfield
;
576 int bf_nb
= op
->format
[i
]->bitfields
;
577 int width
= op
->format
[i
]->width
;
578 int type
= op
->format
[i
]->type
;
579 const char *type_name
= op
->format
[i
]->tname
;
580 int flags
= op
->format
[i
]->flags
;
581 int shift
= op
->format
[i
]->shift
;
582 int bias
= op
->format
[i
]->bias
;
585 for (int bf_idx
= 0; bf_idx
< bf_nb
; bf_idx
++)
587 int insn_idx
= (int) bf
[bf_idx
].to_offset
/ 32;
588 int to_offset
= bf
[bf_idx
].to_offset
% 32;
589 uint64_t encoded_value
=
590 insn
->syllables
[insn_idx
] >> to_offset
;
591 encoded_value
&= (1LL << bf
[bf_idx
].size
) - 1;
592 value
|= encoded_value
<< bf
[bf_idx
].from_offset
;
594 if (flags
& kvxSIGNED
)
596 uint64_t signbit
= 1LL << (width
- 1);
597 value
= (value
^ signbit
) - signbit
;
599 value
= (value
<< shift
) + bias
;
601 #define KVX_PRINT_REG(regfile,value) \
602 if(env.kvx_regfiles[regfile]+value < env.kvx_max_dec_registers) { \
603 res->operands[idx].val = env.kvx_dec_registers[env.kvx_regfiles[regfile]+value]; \
604 res->operands[idx].type = CAT_REGISTER; \
607 res->operands[idx].val = ~0; \
608 res->operands[idx].type = CAT_REGISTER; \
612 if (env
.opc_table
== kvx_kv3_v1_optab
)
616 case RegClass_kv3_v1_singleReg
:
617 KVX_PRINT_REG (KVX_REGFILE_DEC_GPR
, value
)
619 case RegClass_kv3_v1_pairedReg
:
620 KVX_PRINT_REG (KVX_REGFILE_DEC_PGR
, value
)
622 case RegClass_kv3_v1_quadReg
:
623 KVX_PRINT_REG (KVX_REGFILE_DEC_QGR
, value
)
625 case RegClass_kv3_v1_systemReg
:
626 case RegClass_kv3_v1_aloneReg
:
627 case RegClass_kv3_v1_onlyraReg
:
628 case RegClass_kv3_v1_onlygetReg
:
629 case RegClass_kv3_v1_onlysetReg
:
630 case RegClass_kv3_v1_onlyfxReg
:
631 KVX_PRINT_REG (KVX_REGFILE_DEC_SFR
, value
)
633 case RegClass_kv3_v1_coproReg0M4
:
634 case RegClass_kv3_v1_coproReg1M4
:
635 case RegClass_kv3_v1_coproReg2M4
:
636 case RegClass_kv3_v1_coproReg3M4
:
637 KVX_PRINT_REG (KVX_REGFILE_DEC_XCR
, value
)
639 case RegClass_kv3_v1_blockRegE
:
640 case RegClass_kv3_v1_blockRegO
:
641 case RegClass_kv3_v1_blockReg0M4
:
642 case RegClass_kv3_v1_blockReg1M4
:
643 case RegClass_kv3_v1_blockReg2M4
:
644 case RegClass_kv3_v1_blockReg3M4
:
645 KVX_PRINT_REG (KVX_REGFILE_DEC_XBR
, value
)
647 case RegClass_kv3_v1_vectorReg
:
648 case RegClass_kv3_v1_vectorRegE
:
649 case RegClass_kv3_v1_vectorRegO
:
650 KVX_PRINT_REG (KVX_REGFILE_DEC_XVR
, value
)
652 case RegClass_kv3_v1_tileReg
:
653 KVX_PRINT_REG (KVX_REGFILE_DEC_XTR
, value
)
655 case RegClass_kv3_v1_matrixReg
:
656 KVX_PRINT_REG (KVX_REGFILE_DEC_XMR
, value
)
658 case Immediate_kv3_v1_sysnumber
:
659 case Immediate_kv3_v1_signed10
:
660 case Immediate_kv3_v1_signed16
:
661 case Immediate_kv3_v1_signed27
:
662 case Immediate_kv3_v1_wrapped32
:
663 case Immediate_kv3_v1_signed37
:
664 case Immediate_kv3_v1_signed43
:
665 case Immediate_kv3_v1_signed54
:
666 case Immediate_kv3_v1_wrapped64
:
667 case Immediate_kv3_v1_unsigned6
:
668 res
->operands
[idx
].val
= value
;
669 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
670 res
->operands
[idx
].width
= width
;
671 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
672 res
->operands
[idx
].pcrel
= 0;
675 case Immediate_kv3_v1_pcrel17
:
676 case Immediate_kv3_v1_pcrel27
:
677 res
->operands
[idx
].val
= value
+ memaddr
;
678 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
679 res
->operands
[idx
].width
= width
;
680 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
681 res
->operands
[idx
].pcrel
= 1;
684 case Modifier_kv3_v1_column
:
685 case Modifier_kv3_v1_comparison
:
686 case Modifier_kv3_v1_doscale
:
687 case Modifier_kv3_v1_exunum
:
688 case Modifier_kv3_v1_floatcomp
:
689 case Modifier_kv3_v1_qindex
:
690 case Modifier_kv3_v1_rectify
:
691 case Modifier_kv3_v1_rounding
:
692 case Modifier_kv3_v1_roundint
:
693 case Modifier_kv3_v1_saturate
:
694 case Modifier_kv3_v1_scalarcond
:
695 case Modifier_kv3_v1_silent
:
696 case Modifier_kv3_v1_simplecond
:
697 case Modifier_kv3_v1_speculate
:
698 case Modifier_kv3_v1_splat32
:
699 case Modifier_kv3_v1_variant
:
702 int mod_idx
= type
- Modifier_kv3_v1_column
;
703 for (sz
= 0; env
.kvx_modifiers
[mod_idx
][sz
]; ++sz
);
704 const char *mod
= value
< (unsigned) sz
705 ? env
.kvx_modifiers
[mod_idx
][value
] : NULL
;
706 if (!mod
) goto retry
;
707 res
->operands
[idx
].val
= value
;
708 res
->operands
[idx
].type
= CAT_MODIFIER
;
709 res
->operands
[idx
].mod_idx
= mod_idx
;
714 fprintf (stderr
, "error: unexpected operand type (%s)\n",
719 else if (env
.opc_table
== kvx_kv3_v2_optab
)
723 case RegClass_kv3_v2_singleReg
:
724 KVX_PRINT_REG (KVX_REGFILE_DEC_GPR
, value
)
726 case RegClass_kv3_v2_pairedReg
:
727 KVX_PRINT_REG (KVX_REGFILE_DEC_PGR
, value
)
729 case RegClass_kv3_v2_quadReg
:
730 KVX_PRINT_REG (KVX_REGFILE_DEC_QGR
, value
)
732 case RegClass_kv3_v2_systemReg
:
733 case RegClass_kv3_v2_aloneReg
:
734 case RegClass_kv3_v2_onlyraReg
:
735 case RegClass_kv3_v2_onlygetReg
:
736 case RegClass_kv3_v2_onlysetReg
:
737 case RegClass_kv3_v2_onlyfxReg
:
738 KVX_PRINT_REG (KVX_REGFILE_DEC_SFR
, value
)
740 case RegClass_kv3_v2_coproReg
:
741 case RegClass_kv3_v2_coproReg0M4
:
742 case RegClass_kv3_v2_coproReg1M4
:
743 case RegClass_kv3_v2_coproReg2M4
:
744 case RegClass_kv3_v2_coproReg3M4
:
745 KVX_PRINT_REG (KVX_REGFILE_DEC_XCR
, value
)
747 case RegClass_kv3_v2_blockReg
:
748 case RegClass_kv3_v2_blockRegE
:
749 case RegClass_kv3_v2_blockRegO
:
750 KVX_PRINT_REG (KVX_REGFILE_DEC_XBR
, value
)
752 case RegClass_kv3_v2_vectorReg
:
753 KVX_PRINT_REG (KVX_REGFILE_DEC_XVR
, value
)
755 case RegClass_kv3_v2_tileReg
:
756 KVX_PRINT_REG (KVX_REGFILE_DEC_XTR
, value
)
758 case RegClass_kv3_v2_matrixReg
:
759 KVX_PRINT_REG (KVX_REGFILE_DEC_XMR
, value
)
761 case RegClass_kv3_v2_buffer2Reg
:
762 KVX_PRINT_REG (KVX_REGFILE_DEC_X2R
, value
)
764 case RegClass_kv3_v2_buffer4Reg
:
765 KVX_PRINT_REG (KVX_REGFILE_DEC_X4R
, value
)
767 case RegClass_kv3_v2_buffer8Reg
:
768 KVX_PRINT_REG (KVX_REGFILE_DEC_X8R
, value
)
770 case RegClass_kv3_v2_buffer16Reg
:
771 KVX_PRINT_REG (KVX_REGFILE_DEC_X16R
, value
)
773 case RegClass_kv3_v2_buffer32Reg
:
774 KVX_PRINT_REG (KVX_REGFILE_DEC_X32R
, value
)
776 case RegClass_kv3_v2_buffer64Reg
:
777 KVX_PRINT_REG (KVX_REGFILE_DEC_X64R
, value
)
779 case Immediate_kv3_v2_brknumber
:
780 case Immediate_kv3_v2_sysnumber
:
781 case Immediate_kv3_v2_signed10
:
782 case Immediate_kv3_v2_signed16
:
783 case Immediate_kv3_v2_signed27
:
784 case Immediate_kv3_v2_wrapped32
:
785 case Immediate_kv3_v2_signed37
:
786 case Immediate_kv3_v2_signed43
:
787 case Immediate_kv3_v2_signed54
:
788 case Immediate_kv3_v2_wrapped64
:
789 case Immediate_kv3_v2_unsigned6
:
790 res
->operands
[idx
].val
= value
;
791 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
792 res
->operands
[idx
].width
= width
;
793 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
794 res
->operands
[idx
].pcrel
= 0;
797 case Immediate_kv3_v2_pcrel27
:
798 case Immediate_kv3_v2_pcrel17
:
799 res
->operands
[idx
].val
= value
+ memaddr
;
800 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
801 res
->operands
[idx
].width
= width
;
802 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
803 res
->operands
[idx
].pcrel
= 1;
806 case Modifier_kv3_v2_accesses
:
807 case Modifier_kv3_v2_boolcas
:
808 case Modifier_kv3_v2_cachelev
:
809 case Modifier_kv3_v2_channel
:
810 case Modifier_kv3_v2_coherency
:
811 case Modifier_kv3_v2_comparison
:
812 case Modifier_kv3_v2_conjugate
:
813 case Modifier_kv3_v2_doscale
:
814 case Modifier_kv3_v2_exunum
:
815 case Modifier_kv3_v2_floatcomp
:
816 case Modifier_kv3_v2_hindex
:
817 case Modifier_kv3_v2_lsomask
:
818 case Modifier_kv3_v2_lsumask
:
819 case Modifier_kv3_v2_lsupack
:
820 case Modifier_kv3_v2_qindex
:
821 case Modifier_kv3_v2_rounding
:
822 case Modifier_kv3_v2_scalarcond
:
823 case Modifier_kv3_v2_shuffleV
:
824 case Modifier_kv3_v2_shuffleX
:
825 case Modifier_kv3_v2_silent
:
826 case Modifier_kv3_v2_simplecond
:
827 case Modifier_kv3_v2_speculate
:
828 case Modifier_kv3_v2_splat32
:
829 case Modifier_kv3_v2_transpose
:
830 case Modifier_kv3_v2_variant
:
833 int mod_idx
= type
- Modifier_kv3_v2_accesses
;
834 for (sz
= 0; env
.kvx_modifiers
[mod_idx
][sz
];
836 const char *mod
= value
< (unsigned) sz
837 ? env
.kvx_modifiers
[mod_idx
][value
] : NULL
;
838 if (!mod
) goto retry
;
839 res
->operands
[idx
].val
= value
;
840 res
->operands
[idx
].type
= CAT_MODIFIER
;
841 res
->operands
[idx
].mod_idx
= mod_idx
;
847 "error: unexpected operand type (%s)\n",
852 else if (env
.opc_table
== kvx_kv4_v1_optab
)
857 case RegClass_kv4_v1_singleReg
:
858 KVX_PRINT_REG (KVX_REGFILE_DEC_GPR
, value
)
860 case RegClass_kv4_v1_pairedReg
:
861 KVX_PRINT_REG (KVX_REGFILE_DEC_PGR
, value
)
863 case RegClass_kv4_v1_quadReg
:
864 KVX_PRINT_REG (KVX_REGFILE_DEC_QGR
, value
)
866 case RegClass_kv4_v1_systemReg
:
867 case RegClass_kv4_v1_aloneReg
:
868 case RegClass_kv4_v1_onlyraReg
:
869 case RegClass_kv4_v1_onlygetReg
:
870 case RegClass_kv4_v1_onlysetReg
:
871 case RegClass_kv4_v1_onlyfxReg
:
872 KVX_PRINT_REG (KVX_REGFILE_DEC_SFR
, value
)
874 case RegClass_kv4_v1_coproReg
:
875 case RegClass_kv4_v1_coproReg0M4
:
876 case RegClass_kv4_v1_coproReg1M4
:
877 case RegClass_kv4_v1_coproReg2M4
:
878 case RegClass_kv4_v1_coproReg3M4
:
879 KVX_PRINT_REG (KVX_REGFILE_DEC_XCR
, value
)
881 case RegClass_kv4_v1_blockReg
:
882 case RegClass_kv4_v1_blockRegE
:
883 case RegClass_kv4_v1_blockRegO
:
884 KVX_PRINT_REG (KVX_REGFILE_DEC_XBR
, value
)
886 case RegClass_kv4_v1_vectorReg
:
887 KVX_PRINT_REG (KVX_REGFILE_DEC_XVR
, value
)
889 case RegClass_kv4_v1_tileReg
:
890 KVX_PRINT_REG (KVX_REGFILE_DEC_XTR
, value
)
892 case RegClass_kv4_v1_matrixReg
:
893 KVX_PRINT_REG (KVX_REGFILE_DEC_XMR
, value
)
895 case RegClass_kv4_v1_buffer2Reg
:
896 KVX_PRINT_REG (KVX_REGFILE_DEC_X2R
, value
)
898 case RegClass_kv4_v1_buffer4Reg
:
899 KVX_PRINT_REG (KVX_REGFILE_DEC_X4R
, value
)
901 case RegClass_kv4_v1_buffer8Reg
:
902 KVX_PRINT_REG (KVX_REGFILE_DEC_X8R
, value
)
904 case RegClass_kv4_v1_buffer16Reg
:
905 KVX_PRINT_REG (KVX_REGFILE_DEC_X16R
, value
)
907 case RegClass_kv4_v1_buffer32Reg
:
908 KVX_PRINT_REG (KVX_REGFILE_DEC_X32R
, value
)
910 case RegClass_kv4_v1_buffer64Reg
:
911 KVX_PRINT_REG (KVX_REGFILE_DEC_X64R
, value
)
913 case Immediate_kv4_v1_brknumber
:
914 case Immediate_kv4_v1_sysnumber
:
915 case Immediate_kv4_v1_signed10
:
916 case Immediate_kv4_v1_signed16
:
917 case Immediate_kv4_v1_signed27
:
918 case Immediate_kv4_v1_wrapped32
:
919 case Immediate_kv4_v1_signed37
:
920 case Immediate_kv4_v1_signed43
:
921 case Immediate_kv4_v1_signed54
:
922 case Immediate_kv4_v1_wrapped64
:
923 case Immediate_kv4_v1_unsigned6
:
924 res
->operands
[idx
].val
= value
;
925 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
926 res
->operands
[idx
].width
= width
;
927 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
928 res
->operands
[idx
].pcrel
= 0;
931 case Immediate_kv4_v1_pcrel27
:
932 case Immediate_kv4_v1_pcrel17
:
933 res
->operands
[idx
].val
= value
+ memaddr
;
934 res
->operands
[idx
].sign
= flags
& kvxSIGNED
;
935 res
->operands
[idx
].width
= width
;
936 res
->operands
[idx
].type
= CAT_IMMEDIATE
;
937 res
->operands
[idx
].pcrel
= 1;
940 case Modifier_kv4_v1_accesses
:
941 case Modifier_kv4_v1_boolcas
:
942 case Modifier_kv4_v1_cachelev
:
943 case Modifier_kv4_v1_channel
:
944 case Modifier_kv4_v1_coherency
:
945 case Modifier_kv4_v1_comparison
:
946 case Modifier_kv4_v1_conjugate
:
947 case Modifier_kv4_v1_doscale
:
948 case Modifier_kv4_v1_exunum
:
949 case Modifier_kv4_v1_floatcomp
:
950 case Modifier_kv4_v1_hindex
:
951 case Modifier_kv4_v1_lsomask
:
952 case Modifier_kv4_v1_lsumask
:
953 case Modifier_kv4_v1_lsupack
:
954 case Modifier_kv4_v1_qindex
:
955 case Modifier_kv4_v1_rounding
:
956 case Modifier_kv4_v1_scalarcond
:
957 case Modifier_kv4_v1_shuffleV
:
958 case Modifier_kv4_v1_shuffleX
:
959 case Modifier_kv4_v1_silent
:
960 case Modifier_kv4_v1_simplecond
:
961 case Modifier_kv4_v1_speculate
:
962 case Modifier_kv4_v1_splat32
:
963 case Modifier_kv4_v1_transpose
:
964 case Modifier_kv4_v1_variant
:
967 int mod_idx
= type
- Modifier_kv4_v1_accesses
;
968 for (sz
= 0; env
.kvx_modifiers
[mod_idx
][sz
]; ++sz
);
969 const char *mod
= value
< (unsigned) sz
970 ? env
.kvx_modifiers
[mod_idx
][value
] : NULL
;
971 if (!mod
) goto retry
;
972 res
->operands
[idx
].val
= value
;
973 res
->operands
[idx
].type
= CAT_MODIFIER
;
974 res
->operands
[idx
].mod_idx
= mod_idx
;
979 fprintf (stderr
, "error: unexpected operand type (%s)\n",
1000 print_insn_kvx (bfd_vma memaddr
, struct disassemble_info
*info
)
1002 static int insnindex
= 0;
1003 static int insncount
= 0;
1007 int invalid_bundle
= 0;
1009 if (!env
.initialized_p
)
1010 kvx_dis_init (info
);
1012 /* Clear instruction information field. */
1013 info
->insn_info_valid
= 0;
1014 info
->branch_delay_insns
= 0;
1015 info
->data_size
= 0;
1016 info
->insn_type
= dis_noninsn
;
1020 /* Set line length. */
1021 info
->bytes_per_line
= 16;
1024 /* If this is the beginning of the bundle, read BUNDLESIZE words and apply
1025 decentrifugate function. */
1029 for (wordcount
= 0; wordcount
< KVXMAXBUNDLEWORDS
; wordcount
++)
1033 (*info
->read_memory_func
) (memaddr
+ 4 * wordcount
,
1034 (bfd_byte
*) (bundle_words
+
1035 wordcount
), 4, info
);
1038 (*info
->memory_error_func
) (status
, memaddr
+ 4 * wordcount
,
1042 if (!kvx_has_parallel_bit (bundle_words
[wordcount
]))
1046 invalid_bundle
= !kvx_reassemble_bundle (wordcount
, &insncount
);
1049 assert (insnindex
< KVXMAXBUNDLEISSUE
);
1050 insn
= &(bundle_insn
[insnindex
]);
1051 readsofar
= insn
->len
* 4;
1056 (*info
->fprintf_func
) (info
->stream
, "[ ");
1057 for (int i
= 0; i
< insn
->len
; i
++)
1058 (*info
->fprintf_func
) (info
->stream
, "%08x ", insn
->syllables
[i
]);
1059 (*info
->fprintf_func
) (info
->stream
, "] ");
1062 /* Check for extension to right iff this is not the end of bundle. */
1064 struct decoded_insn dec
;
1065 memset (&dec
, 0, sizeof dec
);
1066 if (!invalid_bundle
&& (found
= decode_insn (memaddr
, insn
, &dec
)))
1069 (*info
->fprintf_func
) (info
->stream
, "%s", dec
.opc
->as_op
);
1070 const char *fmtp
= dec
.opc
->fmtstring
;
1071 for (int i
= 0; i
< dec
.nb_ops
; ++i
)
1073 /* Print characters in the format string up to the following % or nul. */
1074 while ((ch
= *fmtp
) && ch
!= '%')
1076 (*info
->fprintf_func
) (info
->stream
, "%c", ch
);
1087 switch (dec
.operands
[i
].type
)
1090 (*info
->fprintf_func
) (info
->stream
, "%s",
1091 env
.kvx_registers
[dec
.operands
[i
].val
].name
);
1095 const char *mod
= env
.kvx_modifiers
[dec
.operands
[i
].mod_idx
][dec
.operands
[i
].val
];
1096 (*info
->fprintf_func
) (info
->stream
, "%s", !mod
|| !strcmp (mod
, ".") ? "" : mod
);
1101 if (dec
.operands
[i
].pcrel
)
1103 /* Fill in instruction information. */
1104 info
->insn_info_valid
= 1;
1106 dec
.operands
[i
].width
==
1107 17 ? dis_condbranch
: dis_branch
;
1108 info
->target
= dec
.operands
[i
].val
;
1110 info
->print_address_func (dec
.operands
[i
].val
, info
);
1112 else if (dec
.operands
[i
].sign
)
1114 if (dec
.operands
[i
].width
<= 32)
1116 (*info
->fprintf_func
) (info
->stream
, "%" PRId32
" (0x%" PRIx32
")",
1117 (int32_t) dec
.operands
[i
].val
,
1118 (int32_t) dec
.operands
[i
].val
);
1122 (*info
->fprintf_func
) (info
->stream
, "%" PRId64
" (0x%" PRIx64
")",
1123 dec
.operands
[i
].val
,
1124 dec
.operands
[i
].val
);
1129 if (dec
.operands
[i
].width
<= 32)
1131 (*info
->fprintf_func
) (info
->stream
, "%" PRIu32
" (0x%" PRIx32
")",
1132 (uint32_t) dec
.operands
[i
].
1134 (uint32_t) dec
.operands
[i
].
1139 (*info
->fprintf_func
) (info
->stream
, "%" PRIu64
" (0x%" PRIx64
")",
1154 while ((ch
= *fmtp
))
1156 (*info
->fprintf_styled_func
) (info
->stream
, dis_style_text
, "%c",
1163 (*info
->fprintf_func
) (info
->stream
, "*** invalid opcode ***\n");
1168 if (found
&& (insnindex
== insncount
))
1170 (*info
->fprintf_func
) (info
->stream
, ";;");
1171 if (!opt_compact_assembly
)
1172 (*info
->fprintf_func
) (info
->stream
, "\n");
1179 /* This function searches in the current bundle for the instructions required
1180 by unwinding. For prologue:
1181 (1) addd $r12 = $r12, <res_stack>
1182 (2) get <gpr_ra_reg> = $ra
1183 (3) sd <ofs>[$r12] = <gpr_ra_reg> or sq/so containing <gpr_ra_reg>
1184 (4) sd <ofs>[$r12] = $r14 or sq/so containing r14
1185 (5) addd $r14 = $r12, <fp_ofs> or copyd $r14 = $r12
1186 The only difference seen between the code generated by gcc and clang
1187 is the setting/resetting r14. gcc could also generate copyd $r14=$r12
1188 instead of add addd $r14 = $r12, <ofs> when <ofs> is 0.
1189 Vice-versa, <ofs> is not guaranteed to be 0 for clang, so, clang
1190 could also generate addd instead of copyd
1191 (6) call, icall, goto, igoto, cb., ret
1193 (1) addd $r12 = $r12, <res_stack>
1194 (2) addd $r12 = $r14, <offset> or copyd $r12 = $r14
1195 Same comment as prologue (5).
1197 (4) call, icall, igoto, cb. */
1200 decode_prologue_epilogue_bundle (bfd_vma memaddr
,
1201 struct disassemble_info
*info
,
1202 struct kvx_prologue_epilogue_bundle
*peb
)
1204 int i
, nb_insn
, nb_syl
;
1208 if (info
->arch
!= bfd_arch_kvx
)
1211 if (!env
.initialized_p
)
1212 kvx_dis_init (info
);
1214 /* Read the bundle. */
1215 for (nb_syl
= 0; nb_syl
< KVXMAXBUNDLEWORDS
; nb_syl
++)
1217 if ((*info
->read_memory_func
) (memaddr
+ 4 * nb_syl
,
1218 (bfd_byte
*) &bundle_words
[nb_syl
], 4,
1221 if (!kvx_has_parallel_bit (bundle_words
[nb_syl
]))
1225 if (!kvx_reassemble_bundle (nb_syl
, &nb_insn
))
1228 /* Check for extension to right if this is not the end of bundle
1229 find the format of this insn. */
1230 for (int idx_insn
= 0; idx_insn
< nb_insn
; idx_insn
++)
1232 insn_t
*insn
= &bundle_insn
[idx_insn
];
1233 int is_add
= 0, is_get
= 0, is_a_peb_insn
= 0, is_copyd
= 0;
1235 struct decoded_insn dec
;
1236 memset (&dec
, 0, sizeof dec
);
1237 if (!decode_insn (memaddr
, insn
, &dec
))
1240 const char *op_name
= dec
.opc
->as_op
;
1241 struct kvx_prologue_epilogue_insn
*crt_peb_insn
;
1243 crt_peb_insn
= &peb
->insn
[peb
->nb_insn
];
1244 crt_peb_insn
->nb_gprs
= 0;
1246 if (!strcmp (op_name
, "addd"))
1248 else if (!strcmp (op_name
, "copyd"))
1250 else if (!strcmp (op_name
, "get"))
1252 else if (!strcmp (op_name
, "sd"))
1254 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_SD
;
1257 else if (!strcmp (op_name
, "sq"))
1259 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_SQ
;
1262 else if (!strcmp (op_name
, "so"))
1264 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_SO
;
1267 else if (!strcmp (op_name
, "ret"))
1269 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_RET
;
1272 else if (!strcmp (op_name
, "goto"))
1274 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_GOTO
;
1277 else if (!strcmp (op_name
, "igoto"))
1279 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_IGOTO
;
1282 else if (!strcmp (op_name
, "call") || !strcmp (op_name
, "icall"))
1284 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_CALL
;
1287 else if (!strncmp (op_name
, "cb", 2))
1289 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_CB
;
1295 for (i
= 0; dec
.opc
->format
[i
]; i
++)
1297 struct kvx_operand
*fmt
= dec
.opc
->format
[i
];
1298 struct kvx_bitfield
*bf
= fmt
->bfield
;
1299 int bf_nb
= fmt
->bitfields
;
1300 int width
= fmt
->width
;
1301 int type
= fmt
->type
;
1302 int flags
= fmt
->flags
;
1303 int shift
= fmt
->shift
;
1304 int bias
= fmt
->bias
;
1305 uint64_t encoded_value
, value
= 0;
1307 for (int bf_idx
= 0; bf_idx
< bf_nb
; bf_idx
++)
1309 int insn_idx
= (int) bf
[bf_idx
].to_offset
/ 32;
1310 int to_offset
= bf
[bf_idx
].to_offset
% 32;
1311 encoded_value
= insn
->syllables
[insn_idx
] >> to_offset
;
1312 encoded_value
&= (1LL << bf
[bf_idx
].size
) - 1;
1313 value
|= encoded_value
<< bf
[bf_idx
].from_offset
;
1315 if (flags
& kvxSIGNED
)
1317 uint64_t signbit
= 1LL << (width
- 1);
1318 value
= (value
^ signbit
) - signbit
;
1320 value
= (value
<< shift
) + bias
;
1322 #define chk_type(core_, val_) \
1323 (env.opc_table == kvx_## core_ ##_optab && type == (val_))
1325 if (chk_type (kv3_v1
, RegClass_kv3_v1_singleReg
)
1326 || chk_type (kv3_v2
, RegClass_kv3_v2_singleReg
)
1327 || chk_type (kv4_v1
, RegClass_kv4_v1_singleReg
))
1329 if (env
.kvx_regfiles
[KVX_REGFILE_DEC_GPR
] + value
1330 >= env
.kvx_max_dec_registers
)
1332 if (is_add
&& i
< 2)
1336 if (value
== KVX_GPR_REG_SP
)
1337 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_ADD_SP
;
1338 else if (value
== KVX_GPR_REG_FP
)
1339 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_ADD_FP
;
1345 if (value
== KVX_GPR_REG_SP
)
1347 else if (value
== KVX_GPR_REG_FP
1348 && crt_peb_insn
->insn_type
1349 == KVX_PROL_EPIL_INSN_ADD_SP
)
1351 crt_peb_insn
->insn_type
1352 = KVX_PROL_EPIL_INSN_RESTORE_SP_FROM_FP
;
1359 else if (is_copyd
&& i
< 2)
1363 if (value
== KVX_GPR_REG_FP
)
1365 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_ADD_FP
;
1366 crt_peb_insn
->immediate
= 0;
1368 else if (value
== KVX_GPR_REG_SP
)
1370 crt_peb_insn
->insn_type
1371 = KVX_PROL_EPIL_INSN_RESTORE_SP_FROM_FP
;
1372 crt_peb_insn
->immediate
= 0;
1379 if (value
== KVX_GPR_REG_SP
1380 && crt_peb_insn
->insn_type
1381 == KVX_PROL_EPIL_INSN_ADD_FP
)
1383 else if (value
== KVX_GPR_REG_FP
1384 && crt_peb_insn
->insn_type
1385 == KVX_PROL_EPIL_INSN_RESTORE_SP_FROM_FP
)
1392 crt_peb_insn
->gpr_reg
[crt_peb_insn
->nb_gprs
++] = value
;
1394 else if (chk_type (kv3_v1
, RegClass_kv3_v1_pairedReg
)
1395 || chk_type (kv3_v2
, RegClass_kv3_v2_pairedReg
)
1396 || chk_type (kv4_v1
, RegClass_kv4_v1_pairedReg
))
1397 crt_peb_insn
->gpr_reg
[crt_peb_insn
->nb_gprs
++] = value
* 2;
1398 else if (chk_type (kv3_v1
, RegClass_kv3_v1_quadReg
)
1399 || chk_type (kv3_v2
, RegClass_kv3_v2_quadReg
)
1400 || chk_type (kv4_v1
, RegClass_kv4_v1_quadReg
))
1401 crt_peb_insn
->gpr_reg
[crt_peb_insn
->nb_gprs
++] = value
* 4;
1402 else if (chk_type (kv3_v1
, RegClass_kv3_v1_systemReg
)
1403 || chk_type (kv3_v2
, RegClass_kv3_v2_systemReg
)
1404 || chk_type (kv4_v1
, RegClass_kv4_v1_systemReg
)
1405 || chk_type (kv3_v1
, RegClass_kv3_v1_aloneReg
)
1406 || chk_type (kv3_v2
, RegClass_kv3_v2_aloneReg
)
1407 || chk_type (kv4_v1
, RegClass_kv4_v1_aloneReg
)
1408 || chk_type (kv3_v1
, RegClass_kv3_v1_onlyraReg
)
1409 || chk_type (kv3_v2
, RegClass_kv3_v2_onlyraReg
)
1410 || chk_type (kv4_v1
, RegClass_kv4_v1_onlygetReg
)
1411 || chk_type (kv3_v1
, RegClass_kv3_v1_onlygetReg
)
1412 || chk_type (kv3_v2
, RegClass_kv3_v2_onlygetReg
)
1413 || chk_type (kv4_v1
, RegClass_kv4_v1_onlygetReg
)
1414 || chk_type (kv3_v1
, RegClass_kv3_v1_onlysetReg
)
1415 || chk_type (kv3_v2
, RegClass_kv3_v2_onlysetReg
)
1416 || chk_type (kv4_v1
, RegClass_kv4_v1_onlysetReg
)
1417 || chk_type (kv3_v1
, RegClass_kv3_v1_onlyfxReg
)
1418 || chk_type (kv3_v2
, RegClass_kv3_v2_onlyfxReg
)
1419 || chk_type (kv4_v1
, RegClass_kv4_v1_onlyfxReg
))
1421 if (env
.kvx_regfiles
[KVX_REGFILE_DEC_GPR
] + value
1422 >= env
.kvx_max_dec_registers
)
1424 if (is_get
&& !strcmp (env
.kvx_registers
[env
.kvx_dec_registers
[env
.kvx_regfiles
[KVX_REGFILE_DEC_SFR
] + value
]].name
, "$ra"))
1426 crt_peb_insn
->insn_type
= KVX_PROL_EPIL_INSN_GET_RA
;
1430 else if (chk_type (kv3_v1
, RegClass_kv3_v1_coproReg
)
1431 || chk_type (kv3_v2
, RegClass_kv3_v2_coproReg
)
1432 || chk_type (kv4_v1
, RegClass_kv4_v1_coproReg
)
1433 || chk_type (kv3_v1
, RegClass_kv3_v1_blockReg
)
1434 || chk_type (kv3_v2
, RegClass_kv3_v2_blockReg
)
1435 || chk_type (kv4_v1
, RegClass_kv4_v1_blockReg
)
1436 || chk_type (kv3_v1
, RegClass_kv3_v1_vectorReg
)
1437 || chk_type (kv3_v2
, RegClass_kv3_v2_vectorReg
)
1438 || chk_type (kv4_v1
, RegClass_kv4_v1_vectorReg
)
1439 || chk_type (kv3_v1
, RegClass_kv3_v1_tileReg
)
1440 || chk_type (kv3_v2
, RegClass_kv3_v2_tileReg
)
1441 || chk_type (kv4_v1
, RegClass_kv4_v1_tileReg
)
1442 || chk_type (kv3_v1
, RegClass_kv3_v1_matrixReg
)
1443 || chk_type (kv3_v2
, RegClass_kv3_v2_matrixReg
)
1444 || chk_type (kv4_v1
, RegClass_kv4_v1_matrixReg
)
1445 || chk_type (kv3_v1
, Modifier_kv3_v1_scalarcond
)
1446 || chk_type (kv3_v1
, Modifier_kv3_v1_column
)
1447 || chk_type (kv3_v1
, Modifier_kv3_v1_comparison
)
1448 || chk_type (kv3_v1
, Modifier_kv3_v1_doscale
)
1449 || chk_type (kv3_v1
, Modifier_kv3_v1_exunum
)
1450 || chk_type (kv3_v1
, Modifier_kv3_v1_floatcomp
)
1451 || chk_type (kv3_v1
, Modifier_kv3_v1_qindex
)
1452 || chk_type (kv3_v1
, Modifier_kv3_v1_rectify
)
1453 || chk_type (kv3_v1
, Modifier_kv3_v1_rounding
)
1454 || chk_type (kv3_v1
, Modifier_kv3_v1_roundint
)
1455 || chk_type (kv3_v1
, Modifier_kv3_v1_saturate
)
1456 || chk_type (kv3_v1
, Modifier_kv3_v1_scalarcond
)
1457 || chk_type (kv3_v1
, Modifier_kv3_v1_silent
)
1458 || chk_type (kv3_v1
, Modifier_kv3_v1_simplecond
)
1459 || chk_type (kv3_v1
, Modifier_kv3_v1_speculate
)
1460 || chk_type (kv3_v1
, Modifier_kv3_v1_splat32
)
1461 || chk_type (kv3_v1
, Modifier_kv3_v1_variant
)
1462 || chk_type (kv3_v2
, Modifier_kv3_v2_accesses
)
1463 || chk_type (kv3_v2
, Modifier_kv3_v2_boolcas
)
1464 || chk_type (kv3_v2
, Modifier_kv3_v2_cachelev
)
1465 || chk_type (kv3_v2
, Modifier_kv3_v2_channel
)
1466 || chk_type (kv3_v2
, Modifier_kv3_v2_coherency
)
1467 || chk_type (kv3_v2
, Modifier_kv3_v2_comparison
)
1468 || chk_type (kv3_v2
, Modifier_kv3_v2_conjugate
)
1469 || chk_type (kv3_v2
, Modifier_kv3_v2_doscale
)
1470 || chk_type (kv3_v2
, Modifier_kv3_v2_exunum
)
1471 || chk_type (kv3_v2
, Modifier_kv3_v2_floatcomp
)
1472 || chk_type (kv3_v2
, Modifier_kv3_v2_hindex
)
1473 || chk_type (kv3_v2
, Modifier_kv3_v2_lsomask
)
1474 || chk_type (kv3_v2
, Modifier_kv3_v2_lsumask
)
1475 || chk_type (kv3_v2
, Modifier_kv3_v2_lsupack
)
1476 || chk_type (kv3_v2
, Modifier_kv3_v2_qindex
)
1477 || chk_type (kv3_v2
, Modifier_kv3_v2_rounding
)
1478 || chk_type (kv3_v2
, Modifier_kv3_v2_scalarcond
)
1479 || chk_type (kv3_v2
, Modifier_kv3_v2_shuffleV
)
1480 || chk_type (kv3_v2
, Modifier_kv3_v2_shuffleX
)
1481 || chk_type (kv3_v2
, Modifier_kv3_v2_silent
)
1482 || chk_type (kv3_v2
, Modifier_kv3_v2_simplecond
)
1483 || chk_type (kv3_v2
, Modifier_kv3_v2_speculate
)
1484 || chk_type (kv3_v2
, Modifier_kv3_v2_splat32
)
1485 || chk_type (kv3_v2
, Modifier_kv3_v2_transpose
)
1486 || chk_type (kv3_v2
, Modifier_kv3_v2_variant
)
1487 || chk_type (kv4_v1
, Modifier_kv4_v1_accesses
)
1488 || chk_type (kv4_v1
, Modifier_kv4_v1_boolcas
)
1489 || chk_type (kv4_v1
, Modifier_kv4_v1_cachelev
)
1490 || chk_type (kv4_v1
, Modifier_kv4_v1_channel
)
1491 || chk_type (kv4_v1
, Modifier_kv4_v1_coherency
)
1492 || chk_type (kv4_v1
, Modifier_kv4_v1_comparison
)
1493 || chk_type (kv4_v1
, Modifier_kv4_v1_conjugate
)
1494 || chk_type (kv4_v1
, Modifier_kv4_v1_doscale
)
1495 || chk_type (kv4_v1
, Modifier_kv4_v1_exunum
)
1496 || chk_type (kv4_v1
, Modifier_kv4_v1_floatcomp
)
1497 || chk_type (kv4_v1
, Modifier_kv4_v1_hindex
)
1498 || chk_type (kv4_v1
, Modifier_kv4_v1_lsomask
)
1499 || chk_type (kv4_v1
, Modifier_kv4_v1_lsumask
)
1500 || chk_type (kv4_v1
, Modifier_kv4_v1_lsupack
)
1501 || chk_type (kv4_v1
, Modifier_kv4_v1_qindex
)
1502 || chk_type (kv4_v1
, Modifier_kv4_v1_rounding
)
1503 || chk_type (kv4_v1
, Modifier_kv4_v1_scalarcond
)
1504 || chk_type (kv4_v1
, Modifier_kv4_v1_shuffleV
)
1505 || chk_type (kv4_v1
, Modifier_kv4_v1_shuffleX
)
1506 || chk_type (kv4_v1
, Modifier_kv4_v1_silent
)
1507 || chk_type (kv4_v1
, Modifier_kv4_v1_simplecond
)
1508 || chk_type (kv4_v1
, Modifier_kv4_v1_speculate
)
1509 || chk_type (kv4_v1
, Modifier_kv4_v1_splat32
)
1510 || chk_type (kv4_v1
, Modifier_kv4_v1_transpose
)
1511 || chk_type (kv4_v1
, Modifier_kv4_v1_variant
))
1515 else if (chk_type (kv3_v1
, Immediate_kv3_v1_sysnumber
)
1516 || chk_type (kv3_v2
, Immediate_kv3_v2_sysnumber
)
1517 || chk_type (kv4_v1
, Immediate_kv4_v1_sysnumber
)
1518 || chk_type (kv3_v2
, Immediate_kv3_v2_wrapped8
)
1519 || chk_type (kv4_v1
, Immediate_kv4_v1_wrapped8
)
1520 || chk_type (kv3_v1
, Immediate_kv3_v1_signed10
)
1521 || chk_type (kv3_v2
, Immediate_kv3_v2_signed10
)
1522 || chk_type (kv4_v1
, Immediate_kv4_v1_signed10
)
1523 || chk_type (kv3_v1
, Immediate_kv3_v1_signed16
)
1524 || chk_type (kv3_v2
, Immediate_kv3_v2_signed16
)
1525 || chk_type (kv4_v1
, Immediate_kv4_v1_signed16
)
1526 || chk_type (kv3_v1
, Immediate_kv3_v1_signed27
)
1527 || chk_type (kv3_v2
, Immediate_kv3_v2_signed27
)
1528 || chk_type (kv4_v1
, Immediate_kv4_v1_signed27
)
1529 || chk_type (kv3_v1
, Immediate_kv3_v1_wrapped32
)
1530 || chk_type (kv3_v2
, Immediate_kv3_v2_wrapped32
)
1531 || chk_type (kv4_v1
, Immediate_kv4_v1_wrapped32
)
1532 || chk_type (kv3_v1
, Immediate_kv3_v1_signed37
)
1533 || chk_type (kv3_v2
, Immediate_kv3_v2_signed37
)
1534 || chk_type (kv4_v1
, Immediate_kv4_v1_signed37
)
1535 || chk_type (kv3_v1
, Immediate_kv3_v1_signed43
)
1536 || chk_type (kv3_v2
, Immediate_kv3_v2_signed43
)
1537 || chk_type (kv4_v1
, Immediate_kv4_v1_signed43
)
1538 || chk_type (kv3_v1
, Immediate_kv3_v1_signed54
)
1539 || chk_type (kv3_v2
, Immediate_kv3_v2_signed54
)
1540 || chk_type (kv4_v1
, Immediate_kv4_v1_signed54
)
1541 || chk_type (kv3_v1
, Immediate_kv3_v1_wrapped64
)
1542 || chk_type (kv3_v2
, Immediate_kv3_v2_wrapped64
)
1543 || chk_type (kv4_v1
, Immediate_kv4_v1_wrapped64
)
1544 || chk_type (kv3_v1
, Immediate_kv3_v1_unsigned6
)
1545 || chk_type (kv3_v2
, Immediate_kv3_v2_unsigned6
)
1546 || chk_type (kv4_v1
, Immediate_kv4_v1_unsigned6
))
1547 crt_peb_insn
->immediate
= value
;
1548 else if (chk_type (kv3_v1
, Immediate_kv3_v1_pcrel17
)
1549 || chk_type (kv3_v2
, Immediate_kv3_v2_pcrel17
)
1550 || chk_type (kv4_v1
, Immediate_kv4_v1_pcrel17
)
1551 || chk_type (kv3_v1
, Immediate_kv3_v1_pcrel27
)
1552 || chk_type (kv3_v2
, Immediate_kv3_v2_pcrel27
)
1553 || chk_type (kv4_v1
, Immediate_kv4_v1_pcrel27
))
1554 crt_peb_insn
->immediate
= value
+ memaddr
;
1569 print_kvx_disassembler_options (FILE * stream
)
1571 fprintf (stream
, _("\n\
1572 The following KVX specific disassembler options are supported for use\n\
1573 with the -M switch (multiple options should be separated by commas):\n"));
1575 fprintf (stream
, _("\n\
1576 pretty Print 32-bit words in natural order corresponding to \
1577 re-ordered instruction.\n"));
1579 fprintf (stream
, _("\n\
1580 compact-assembly Do not emit a new line between bundles of instructions.\
1583 fprintf (stream
, _("\n\
1584 no-compact-assembly Emit a new line between bundles of instructions.\n"));
1586 fprintf (stream
, _("\n"));