1 /* tile.h -- Header file for TILE opcode table
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 Contributed by Tilera Corp. */
8 typedef unsigned long long tile_bundle_bits
;
13 TILE_MAX_OPERANDS
= 5 /* mm */
105 TILE_OPC_CRC32_32_SN
,
112 TILE_OPC_DWORD_ALIGN
,
113 TILE_OPC_DWORD_ALIGN_SN
,
162 TILE_OPC_LWADD_NA_SN
,
190 TILE_OPC_MULHH_SS_SN
,
192 TILE_OPC_MULHH_SU_SN
,
194 TILE_OPC_MULHH_UU_SN
,
196 TILE_OPC_MULHHA_SS_SN
,
198 TILE_OPC_MULHHA_SU_SN
,
200 TILE_OPC_MULHHA_UU_SN
,
202 TILE_OPC_MULHHSA_UU_SN
,
204 TILE_OPC_MULHL_SS_SN
,
206 TILE_OPC_MULHL_SU_SN
,
208 TILE_OPC_MULHL_US_SN
,
210 TILE_OPC_MULHL_UU_SN
,
212 TILE_OPC_MULHLA_SS_SN
,
214 TILE_OPC_MULHLA_SU_SN
,
216 TILE_OPC_MULHLA_US_SN
,
218 TILE_OPC_MULHLA_UU_SN
,
220 TILE_OPC_MULHLSA_UU_SN
,
222 TILE_OPC_MULLL_SS_SN
,
224 TILE_OPC_MULLL_SU_SN
,
226 TILE_OPC_MULLL_UU_SN
,
228 TILE_OPC_MULLLA_SS_SN
,
230 TILE_OPC_MULLLA_SU_SN
,
232 TILE_OPC_MULLLA_UU_SN
,
234 TILE_OPC_MULLLSA_UU_SN
,
254 TILE_OPC_PACKBS_U_SN
,
398 TILE_OPC_TBLIDXB0_SN
,
400 TILE_OPC_TBLIDXB1_SN
,
402 TILE_OPC_TBLIDXB2_SN
,
404 TILE_OPC_TBLIDXB3_SN
,
415 /* 64-bit pattern for a { bpt ; nop } bundle. */
416 #define TILE_BPT_BUNDLE 0x400b3cae70166000ULL
419 #define TILE_ELF_MACHINE_CODE EM_TILEPRO
421 #define TILE_ELF_NAME "elf32-tilepro"
424 static __inline
unsigned int
425 get_BrOff_SN(tile_bundle_bits num
)
427 const unsigned int n
= (unsigned int)num
;
428 return (((n
>> 0)) & 0x3ff);
431 static __inline
unsigned int
432 get_BrOff_X1(tile_bundle_bits n
)
434 return (((unsigned int)(n
>> 43)) & 0x00007fff) |
435 (((unsigned int)(n
>> 20)) & 0x00018000);
438 static __inline
unsigned int
439 get_BrType_X1(tile_bundle_bits n
)
441 return (((unsigned int)(n
>> 31)) & 0xf);
444 static __inline
unsigned int
445 get_Dest_Imm8_X1(tile_bundle_bits n
)
447 return (((unsigned int)(n
>> 31)) & 0x0000003f) |
448 (((unsigned int)(n
>> 43)) & 0x000000c0);
451 static __inline
unsigned int
452 get_Dest_SN(tile_bundle_bits num
)
454 const unsigned int n
= (unsigned int)num
;
455 return (((n
>> 2)) & 0x3);
458 static __inline
unsigned int
459 get_Dest_X0(tile_bundle_bits num
)
461 const unsigned int n
= (unsigned int)num
;
462 return (((n
>> 0)) & 0x3f);
465 static __inline
unsigned int
466 get_Dest_X1(tile_bundle_bits n
)
468 return (((unsigned int)(n
>> 31)) & 0x3f);
471 static __inline
unsigned int
472 get_Dest_Y0(tile_bundle_bits num
)
474 const unsigned int n
= (unsigned int)num
;
475 return (((n
>> 0)) & 0x3f);
478 static __inline
unsigned int
479 get_Dest_Y1(tile_bundle_bits n
)
481 return (((unsigned int)(n
>> 31)) & 0x3f);
484 static __inline
unsigned int
485 get_Imm16_X0(tile_bundle_bits num
)
487 const unsigned int n
= (unsigned int)num
;
488 return (((n
>> 12)) & 0xffff);
491 static __inline
unsigned int
492 get_Imm16_X1(tile_bundle_bits n
)
494 return (((unsigned int)(n
>> 43)) & 0xffff);
497 static __inline
unsigned int
498 get_Imm8_SN(tile_bundle_bits num
)
500 const unsigned int n
= (unsigned int)num
;
501 return (((n
>> 0)) & 0xff);
504 static __inline
unsigned int
505 get_Imm8_X0(tile_bundle_bits num
)
507 const unsigned int n
= (unsigned int)num
;
508 return (((n
>> 12)) & 0xff);
511 static __inline
unsigned int
512 get_Imm8_X1(tile_bundle_bits n
)
514 return (((unsigned int)(n
>> 43)) & 0xff);
517 static __inline
unsigned int
518 get_Imm8_Y0(tile_bundle_bits num
)
520 const unsigned int n
= (unsigned int)num
;
521 return (((n
>> 12)) & 0xff);
524 static __inline
unsigned int
525 get_Imm8_Y1(tile_bundle_bits n
)
527 return (((unsigned int)(n
>> 43)) & 0xff);
530 static __inline
unsigned int
531 get_ImmOpcodeExtension_X0(tile_bundle_bits num
)
533 const unsigned int n
= (unsigned int)num
;
534 return (((n
>> 20)) & 0x7f);
537 static __inline
unsigned int
538 get_ImmOpcodeExtension_X1(tile_bundle_bits n
)
540 return (((unsigned int)(n
>> 51)) & 0x7f);
543 static __inline
unsigned int
544 get_ImmRROpcodeExtension_SN(tile_bundle_bits num
)
546 const unsigned int n
= (unsigned int)num
;
547 return (((n
>> 8)) & 0x3);
550 static __inline
unsigned int
551 get_JOffLong_X1(tile_bundle_bits n
)
553 return (((unsigned int)(n
>> 43)) & 0x00007fff) |
554 (((unsigned int)(n
>> 20)) & 0x00018000) |
555 (((unsigned int)(n
>> 14)) & 0x001e0000) |
556 (((unsigned int)(n
>> 16)) & 0x07e00000) |
557 (((unsigned int)(n
>> 31)) & 0x18000000);
560 static __inline
unsigned int
561 get_JOff_X1(tile_bundle_bits n
)
563 return (((unsigned int)(n
>> 43)) & 0x00007fff) |
564 (((unsigned int)(n
>> 20)) & 0x00018000) |
565 (((unsigned int)(n
>> 14)) & 0x001e0000) |
566 (((unsigned int)(n
>> 16)) & 0x07e00000) |
567 (((unsigned int)(n
>> 31)) & 0x08000000);
570 static __inline
unsigned int
571 get_MF_Imm15_X1(tile_bundle_bits n
)
573 return (((unsigned int)(n
>> 37)) & 0x00003fff) |
574 (((unsigned int)(n
>> 44)) & 0x00004000);
577 static __inline
unsigned int
578 get_MMEnd_X0(tile_bundle_bits num
)
580 const unsigned int n
= (unsigned int)num
;
581 return (((n
>> 18)) & 0x1f);
584 static __inline
unsigned int
585 get_MMEnd_X1(tile_bundle_bits n
)
587 return (((unsigned int)(n
>> 49)) & 0x1f);
590 static __inline
unsigned int
591 get_MMStart_X0(tile_bundle_bits num
)
593 const unsigned int n
= (unsigned int)num
;
594 return (((n
>> 23)) & 0x1f);
597 static __inline
unsigned int
598 get_MMStart_X1(tile_bundle_bits n
)
600 return (((unsigned int)(n
>> 54)) & 0x1f);
603 static __inline
unsigned int
604 get_MT_Imm15_X1(tile_bundle_bits n
)
606 return (((unsigned int)(n
>> 31)) & 0x0000003f) |
607 (((unsigned int)(n
>> 37)) & 0x00003fc0) |
608 (((unsigned int)(n
>> 44)) & 0x00004000);
611 static __inline
unsigned int
612 get_Mode(tile_bundle_bits n
)
614 return (((unsigned int)(n
>> 63)) & 0x1);
617 static __inline
unsigned int
618 get_NoRegOpcodeExtension_SN(tile_bundle_bits num
)
620 const unsigned int n
= (unsigned int)num
;
621 return (((n
>> 0)) & 0xf);
624 static __inline
unsigned int
625 get_Opcode_SN(tile_bundle_bits num
)
627 const unsigned int n
= (unsigned int)num
;
628 return (((n
>> 10)) & 0x3f);
631 static __inline
unsigned int
632 get_Opcode_X0(tile_bundle_bits num
)
634 const unsigned int n
= (unsigned int)num
;
635 return (((n
>> 28)) & 0x7);
638 static __inline
unsigned int
639 get_Opcode_X1(tile_bundle_bits n
)
641 return (((unsigned int)(n
>> 59)) & 0xf);
644 static __inline
unsigned int
645 get_Opcode_Y0(tile_bundle_bits num
)
647 const unsigned int n
= (unsigned int)num
;
648 return (((n
>> 27)) & 0xf);
651 static __inline
unsigned int
652 get_Opcode_Y1(tile_bundle_bits n
)
654 return (((unsigned int)(n
>> 59)) & 0xf);
657 static __inline
unsigned int
658 get_Opcode_Y2(tile_bundle_bits n
)
660 return (((unsigned int)(n
>> 56)) & 0x7);
663 static __inline
unsigned int
664 get_RROpcodeExtension_SN(tile_bundle_bits num
)
666 const unsigned int n
= (unsigned int)num
;
667 return (((n
>> 4)) & 0xf);
670 static __inline
unsigned int
671 get_RRROpcodeExtension_X0(tile_bundle_bits num
)
673 const unsigned int n
= (unsigned int)num
;
674 return (((n
>> 18)) & 0x1ff);
677 static __inline
unsigned int
678 get_RRROpcodeExtension_X1(tile_bundle_bits n
)
680 return (((unsigned int)(n
>> 49)) & 0x1ff);
683 static __inline
unsigned int
684 get_RRROpcodeExtension_Y0(tile_bundle_bits num
)
686 const unsigned int n
= (unsigned int)num
;
687 return (((n
>> 18)) & 0x3);
690 static __inline
unsigned int
691 get_RRROpcodeExtension_Y1(tile_bundle_bits n
)
693 return (((unsigned int)(n
>> 49)) & 0x3);
696 static __inline
unsigned int
697 get_RouteOpcodeExtension_SN(tile_bundle_bits num
)
699 const unsigned int n
= (unsigned int)num
;
700 return (((n
>> 0)) & 0x3ff);
703 static __inline
unsigned int
704 get_S_X0(tile_bundle_bits num
)
706 const unsigned int n
= (unsigned int)num
;
707 return (((n
>> 27)) & 0x1);
710 static __inline
unsigned int
711 get_S_X1(tile_bundle_bits n
)
713 return (((unsigned int)(n
>> 58)) & 0x1);
716 static __inline
unsigned int
717 get_ShAmt_X0(tile_bundle_bits num
)
719 const unsigned int n
= (unsigned int)num
;
720 return (((n
>> 12)) & 0x1f);
723 static __inline
unsigned int
724 get_ShAmt_X1(tile_bundle_bits n
)
726 return (((unsigned int)(n
>> 43)) & 0x1f);
729 static __inline
unsigned int
730 get_ShAmt_Y0(tile_bundle_bits num
)
732 const unsigned int n
= (unsigned int)num
;
733 return (((n
>> 12)) & 0x1f);
736 static __inline
unsigned int
737 get_ShAmt_Y1(tile_bundle_bits n
)
739 return (((unsigned int)(n
>> 43)) & 0x1f);
742 static __inline
unsigned int
743 get_SrcA_X0(tile_bundle_bits num
)
745 const unsigned int n
= (unsigned int)num
;
746 return (((n
>> 6)) & 0x3f);
749 static __inline
unsigned int
750 get_SrcA_X1(tile_bundle_bits n
)
752 return (((unsigned int)(n
>> 37)) & 0x3f);
755 static __inline
unsigned int
756 get_SrcA_Y0(tile_bundle_bits num
)
758 const unsigned int n
= (unsigned int)num
;
759 return (((n
>> 6)) & 0x3f);
762 static __inline
unsigned int
763 get_SrcA_Y1(tile_bundle_bits n
)
765 return (((unsigned int)(n
>> 37)) & 0x3f);
768 static __inline
unsigned int
769 get_SrcA_Y2(tile_bundle_bits n
)
771 return (((n
>> 26)) & 0x00000001) |
772 (((unsigned int)(n
>> 50)) & 0x0000003e);
775 static __inline
unsigned int
776 get_SrcBDest_Y2(tile_bundle_bits num
)
778 const unsigned int n
= (unsigned int)num
;
779 return (((n
>> 20)) & 0x3f);
782 static __inline
unsigned int
783 get_SrcB_X0(tile_bundle_bits num
)
785 const unsigned int n
= (unsigned int)num
;
786 return (((n
>> 12)) & 0x3f);
789 static __inline
unsigned int
790 get_SrcB_X1(tile_bundle_bits n
)
792 return (((unsigned int)(n
>> 43)) & 0x3f);
795 static __inline
unsigned int
796 get_SrcB_Y0(tile_bundle_bits num
)
798 const unsigned int n
= (unsigned int)num
;
799 return (((n
>> 12)) & 0x3f);
802 static __inline
unsigned int
803 get_SrcB_Y1(tile_bundle_bits n
)
805 return (((unsigned int)(n
>> 43)) & 0x3f);
808 static __inline
unsigned int
809 get_Src_SN(tile_bundle_bits num
)
811 const unsigned int n
= (unsigned int)num
;
812 return (((n
>> 0)) & 0x3);
815 static __inline
unsigned int
816 get_UnOpcodeExtension_X0(tile_bundle_bits num
)
818 const unsigned int n
= (unsigned int)num
;
819 return (((n
>> 12)) & 0x1f);
822 static __inline
unsigned int
823 get_UnOpcodeExtension_X1(tile_bundle_bits n
)
825 return (((unsigned int)(n
>> 43)) & 0x1f);
828 static __inline
unsigned int
829 get_UnOpcodeExtension_Y0(tile_bundle_bits num
)
831 const unsigned int n
= (unsigned int)num
;
832 return (((n
>> 12)) & 0x1f);
835 static __inline
unsigned int
836 get_UnOpcodeExtension_Y1(tile_bundle_bits n
)
838 return (((unsigned int)(n
>> 43)) & 0x1f);
841 static __inline
unsigned int
842 get_UnShOpcodeExtension_X0(tile_bundle_bits num
)
844 const unsigned int n
= (unsigned int)num
;
845 return (((n
>> 17)) & 0x3ff);
848 static __inline
unsigned int
849 get_UnShOpcodeExtension_X1(tile_bundle_bits n
)
851 return (((unsigned int)(n
>> 48)) & 0x3ff);
854 static __inline
unsigned int
855 get_UnShOpcodeExtension_Y0(tile_bundle_bits num
)
857 const unsigned int n
= (unsigned int)num
;
858 return (((n
>> 17)) & 0x7);
861 static __inline
unsigned int
862 get_UnShOpcodeExtension_Y1(tile_bundle_bits n
)
864 return (((unsigned int)(n
>> 48)) & 0x7);
869 sign_extend(int n
, int num_bits
)
871 int shift
= (int)(sizeof(int) * 8 - num_bits
);
872 return (n
<< shift
) >> shift
;
877 static __inline tile_bundle_bits
878 create_BrOff_SN(int num
)
880 const unsigned int n
= (unsigned int)num
;
881 return ((n
& 0x3ff) << 0);
884 static __inline tile_bundle_bits
885 create_BrOff_X1(int num
)
887 const unsigned int n
= (unsigned int)num
;
888 return (((tile_bundle_bits
)(n
& 0x00007fff)) << 43) |
889 (((tile_bundle_bits
)(n
& 0x00018000)) << 20);
892 static __inline tile_bundle_bits
893 create_BrType_X1(int num
)
895 const unsigned int n
= (unsigned int)num
;
896 return (((tile_bundle_bits
)(n
& 0xf)) << 31);
899 static __inline tile_bundle_bits
900 create_Dest_Imm8_X1(int num
)
902 const unsigned int n
= (unsigned int)num
;
903 return (((tile_bundle_bits
)(n
& 0x0000003f)) << 31) |
904 (((tile_bundle_bits
)(n
& 0x000000c0)) << 43);
907 static __inline tile_bundle_bits
908 create_Dest_SN(int num
)
910 const unsigned int n
= (unsigned int)num
;
911 return ((n
& 0x3) << 2);
914 static __inline tile_bundle_bits
915 create_Dest_X0(int num
)
917 const unsigned int n
= (unsigned int)num
;
918 return ((n
& 0x3f) << 0);
921 static __inline tile_bundle_bits
922 create_Dest_X1(int num
)
924 const unsigned int n
= (unsigned int)num
;
925 return (((tile_bundle_bits
)(n
& 0x3f)) << 31);
928 static __inline tile_bundle_bits
929 create_Dest_Y0(int num
)
931 const unsigned int n
= (unsigned int)num
;
932 return ((n
& 0x3f) << 0);
935 static __inline tile_bundle_bits
936 create_Dest_Y1(int num
)
938 const unsigned int n
= (unsigned int)num
;
939 return (((tile_bundle_bits
)(n
& 0x3f)) << 31);
942 static __inline tile_bundle_bits
943 create_Imm16_X0(int num
)
945 const unsigned int n
= (unsigned int)num
;
946 return ((n
& 0xffff) << 12);
949 static __inline tile_bundle_bits
950 create_Imm16_X1(int num
)
952 const unsigned int n
= (unsigned int)num
;
953 return (((tile_bundle_bits
)(n
& 0xffff)) << 43);
956 static __inline tile_bundle_bits
957 create_Imm8_SN(int num
)
959 const unsigned int n
= (unsigned int)num
;
960 return ((n
& 0xff) << 0);
963 static __inline tile_bundle_bits
964 create_Imm8_X0(int num
)
966 const unsigned int n
= (unsigned int)num
;
967 return ((n
& 0xff) << 12);
970 static __inline tile_bundle_bits
971 create_Imm8_X1(int num
)
973 const unsigned int n
= (unsigned int)num
;
974 return (((tile_bundle_bits
)(n
& 0xff)) << 43);
977 static __inline tile_bundle_bits
978 create_Imm8_Y0(int num
)
980 const unsigned int n
= (unsigned int)num
;
981 return ((n
& 0xff) << 12);
984 static __inline tile_bundle_bits
985 create_Imm8_Y1(int num
)
987 const unsigned int n
= (unsigned int)num
;
988 return (((tile_bundle_bits
)(n
& 0xff)) << 43);
991 static __inline tile_bundle_bits
992 create_ImmOpcodeExtension_X0(int num
)
994 const unsigned int n
= (unsigned int)num
;
995 return ((n
& 0x7f) << 20);
998 static __inline tile_bundle_bits
999 create_ImmOpcodeExtension_X1(int num
)
1001 const unsigned int n
= (unsigned int)num
;
1002 return (((tile_bundle_bits
)(n
& 0x7f)) << 51);
1005 static __inline tile_bundle_bits
1006 create_ImmRROpcodeExtension_SN(int num
)
1008 const unsigned int n
= (unsigned int)num
;
1009 return ((n
& 0x3) << 8);
1012 static __inline tile_bundle_bits
1013 create_JOffLong_X1(int num
)
1015 const unsigned int n
= (unsigned int)num
;
1016 return (((tile_bundle_bits
)(n
& 0x00007fff)) << 43) |
1017 (((tile_bundle_bits
)(n
& 0x00018000)) << 20) |
1018 (((tile_bundle_bits
)(n
& 0x001e0000)) << 14) |
1019 (((tile_bundle_bits
)(n
& 0x07e00000)) << 16) |
1020 (((tile_bundle_bits
)(n
& 0x18000000)) << 31);
1023 static __inline tile_bundle_bits
1024 create_JOff_X1(int num
)
1026 const unsigned int n
= (unsigned int)num
;
1027 return (((tile_bundle_bits
)(n
& 0x00007fff)) << 43) |
1028 (((tile_bundle_bits
)(n
& 0x00018000)) << 20) |
1029 (((tile_bundle_bits
)(n
& 0x001e0000)) << 14) |
1030 (((tile_bundle_bits
)(n
& 0x07e00000)) << 16) |
1031 (((tile_bundle_bits
)(n
& 0x08000000)) << 31);
1034 static __inline tile_bundle_bits
1035 create_MF_Imm15_X1(int num
)
1037 const unsigned int n
= (unsigned int)num
;
1038 return (((tile_bundle_bits
)(n
& 0x00003fff)) << 37) |
1039 (((tile_bundle_bits
)(n
& 0x00004000)) << 44);
1042 static __inline tile_bundle_bits
1043 create_MMEnd_X0(int num
)
1045 const unsigned int n
= (unsigned int)num
;
1046 return ((n
& 0x1f) << 18);
1049 static __inline tile_bundle_bits
1050 create_MMEnd_X1(int num
)
1052 const unsigned int n
= (unsigned int)num
;
1053 return (((tile_bundle_bits
)(n
& 0x1f)) << 49);
1056 static __inline tile_bundle_bits
1057 create_MMStart_X0(int num
)
1059 const unsigned int n
= (unsigned int)num
;
1060 return ((n
& 0x1f) << 23);
1063 static __inline tile_bundle_bits
1064 create_MMStart_X1(int num
)
1066 const unsigned int n
= (unsigned int)num
;
1067 return (((tile_bundle_bits
)(n
& 0x1f)) << 54);
1070 static __inline tile_bundle_bits
1071 create_MT_Imm15_X1(int num
)
1073 const unsigned int n
= (unsigned int)num
;
1074 return (((tile_bundle_bits
)(n
& 0x0000003f)) << 31) |
1075 (((tile_bundle_bits
)(n
& 0x00003fc0)) << 37) |
1076 (((tile_bundle_bits
)(n
& 0x00004000)) << 44);
1079 static __inline tile_bundle_bits
1080 create_Mode(int num
)
1082 const unsigned int n
= (unsigned int)num
;
1083 return (((tile_bundle_bits
)(n
& 0x1)) << 63);
1086 static __inline tile_bundle_bits
1087 create_NoRegOpcodeExtension_SN(int num
)
1089 const unsigned int n
= (unsigned int)num
;
1090 return ((n
& 0xf) << 0);
1093 static __inline tile_bundle_bits
1094 create_Opcode_SN(int num
)
1096 const unsigned int n
= (unsigned int)num
;
1097 return ((n
& 0x3f) << 10);
1100 static __inline tile_bundle_bits
1101 create_Opcode_X0(int num
)
1103 const unsigned int n
= (unsigned int)num
;
1104 return ((n
& 0x7) << 28);
1107 static __inline tile_bundle_bits
1108 create_Opcode_X1(int num
)
1110 const unsigned int n
= (unsigned int)num
;
1111 return (((tile_bundle_bits
)(n
& 0xf)) << 59);
1114 static __inline tile_bundle_bits
1115 create_Opcode_Y0(int num
)
1117 const unsigned int n
= (unsigned int)num
;
1118 return ((n
& 0xf) << 27);
1121 static __inline tile_bundle_bits
1122 create_Opcode_Y1(int num
)
1124 const unsigned int n
= (unsigned int)num
;
1125 return (((tile_bundle_bits
)(n
& 0xf)) << 59);
1128 static __inline tile_bundle_bits
1129 create_Opcode_Y2(int num
)
1131 const unsigned int n
= (unsigned int)num
;
1132 return (((tile_bundle_bits
)(n
& 0x7)) << 56);
1135 static __inline tile_bundle_bits
1136 create_RROpcodeExtension_SN(int num
)
1138 const unsigned int n
= (unsigned int)num
;
1139 return ((n
& 0xf) << 4);
1142 static __inline tile_bundle_bits
1143 create_RRROpcodeExtension_X0(int num
)
1145 const unsigned int n
= (unsigned int)num
;
1146 return ((n
& 0x1ff) << 18);
1149 static __inline tile_bundle_bits
1150 create_RRROpcodeExtension_X1(int num
)
1152 const unsigned int n
= (unsigned int)num
;
1153 return (((tile_bundle_bits
)(n
& 0x1ff)) << 49);
1156 static __inline tile_bundle_bits
1157 create_RRROpcodeExtension_Y0(int num
)
1159 const unsigned int n
= (unsigned int)num
;
1160 return ((n
& 0x3) << 18);
1163 static __inline tile_bundle_bits
1164 create_RRROpcodeExtension_Y1(int num
)
1166 const unsigned int n
= (unsigned int)num
;
1167 return (((tile_bundle_bits
)(n
& 0x3)) << 49);
1170 static __inline tile_bundle_bits
1171 create_RouteOpcodeExtension_SN(int num
)
1173 const unsigned int n
= (unsigned int)num
;
1174 return ((n
& 0x3ff) << 0);
1177 static __inline tile_bundle_bits
1178 create_S_X0(int num
)
1180 const unsigned int n
= (unsigned int)num
;
1181 return ((n
& 0x1) << 27);
1184 static __inline tile_bundle_bits
1185 create_S_X1(int num
)
1187 const unsigned int n
= (unsigned int)num
;
1188 return (((tile_bundle_bits
)(n
& 0x1)) << 58);
1191 static __inline tile_bundle_bits
1192 create_ShAmt_X0(int num
)
1194 const unsigned int n
= (unsigned int)num
;
1195 return ((n
& 0x1f) << 12);
1198 static __inline tile_bundle_bits
1199 create_ShAmt_X1(int num
)
1201 const unsigned int n
= (unsigned int)num
;
1202 return (((tile_bundle_bits
)(n
& 0x1f)) << 43);
1205 static __inline tile_bundle_bits
1206 create_ShAmt_Y0(int num
)
1208 const unsigned int n
= (unsigned int)num
;
1209 return ((n
& 0x1f) << 12);
1212 static __inline tile_bundle_bits
1213 create_ShAmt_Y1(int num
)
1215 const unsigned int n
= (unsigned int)num
;
1216 return (((tile_bundle_bits
)(n
& 0x1f)) << 43);
1219 static __inline tile_bundle_bits
1220 create_SrcA_X0(int num
)
1222 const unsigned int n
= (unsigned int)num
;
1223 return ((n
& 0x3f) << 6);
1226 static __inline tile_bundle_bits
1227 create_SrcA_X1(int num
)
1229 const unsigned int n
= (unsigned int)num
;
1230 return (((tile_bundle_bits
)(n
& 0x3f)) << 37);
1233 static __inline tile_bundle_bits
1234 create_SrcA_Y0(int num
)
1236 const unsigned int n
= (unsigned int)num
;
1237 return ((n
& 0x3f) << 6);
1240 static __inline tile_bundle_bits
1241 create_SrcA_Y1(int num
)
1243 const unsigned int n
= (unsigned int)num
;
1244 return (((tile_bundle_bits
)(n
& 0x3f)) << 37);
1247 static __inline tile_bundle_bits
1248 create_SrcA_Y2(int num
)
1250 const unsigned int n
= (unsigned int)num
;
1251 return ((n
& 0x00000001) << 26) |
1252 (((tile_bundle_bits
)(n
& 0x0000003e)) << 50);
1255 static __inline tile_bundle_bits
1256 create_SrcBDest_Y2(int num
)
1258 const unsigned int n
= (unsigned int)num
;
1259 return ((n
& 0x3f) << 20);
1262 static __inline tile_bundle_bits
1263 create_SrcB_X0(int num
)
1265 const unsigned int n
= (unsigned int)num
;
1266 return ((n
& 0x3f) << 12);
1269 static __inline tile_bundle_bits
1270 create_SrcB_X1(int num
)
1272 const unsigned int n
= (unsigned int)num
;
1273 return (((tile_bundle_bits
)(n
& 0x3f)) << 43);
1276 static __inline tile_bundle_bits
1277 create_SrcB_Y0(int num
)
1279 const unsigned int n
= (unsigned int)num
;
1280 return ((n
& 0x3f) << 12);
1283 static __inline tile_bundle_bits
1284 create_SrcB_Y1(int num
)
1286 const unsigned int n
= (unsigned int)num
;
1287 return (((tile_bundle_bits
)(n
& 0x3f)) << 43);
1290 static __inline tile_bundle_bits
1291 create_Src_SN(int num
)
1293 const unsigned int n
= (unsigned int)num
;
1294 return ((n
& 0x3) << 0);
1297 static __inline tile_bundle_bits
1298 create_UnOpcodeExtension_X0(int num
)
1300 const unsigned int n
= (unsigned int)num
;
1301 return ((n
& 0x1f) << 12);
1304 static __inline tile_bundle_bits
1305 create_UnOpcodeExtension_X1(int num
)
1307 const unsigned int n
= (unsigned int)num
;
1308 return (((tile_bundle_bits
)(n
& 0x1f)) << 43);
1311 static __inline tile_bundle_bits
1312 create_UnOpcodeExtension_Y0(int num
)
1314 const unsigned int n
= (unsigned int)num
;
1315 return ((n
& 0x1f) << 12);
1318 static __inline tile_bundle_bits
1319 create_UnOpcodeExtension_Y1(int num
)
1321 const unsigned int n
= (unsigned int)num
;
1322 return (((tile_bundle_bits
)(n
& 0x1f)) << 43);
1325 static __inline tile_bundle_bits
1326 create_UnShOpcodeExtension_X0(int num
)
1328 const unsigned int n
= (unsigned int)num
;
1329 return ((n
& 0x3ff) << 17);
1332 static __inline tile_bundle_bits
1333 create_UnShOpcodeExtension_X1(int num
)
1335 const unsigned int n
= (unsigned int)num
;
1336 return (((tile_bundle_bits
)(n
& 0x3ff)) << 48);
1339 static __inline tile_bundle_bits
1340 create_UnShOpcodeExtension_Y0(int num
)
1342 const unsigned int n
= (unsigned int)num
;
1343 return ((n
& 0x7) << 17);
1346 static __inline tile_bundle_bits
1347 create_UnShOpcodeExtension_Y1(int num
)
1349 const unsigned int n
= (unsigned int)num
;
1350 return (((tile_bundle_bits
)(n
& 0x7)) << 48);
1364 #define tile_is_x_pipeline(p) ((int)(p) <= (int)TILE_PIPELINE_X1)
1368 TILE_OP_TYPE_REGISTER
,
1369 TILE_OP_TYPE_IMMEDIATE
,
1370 TILE_OP_TYPE_ADDRESS
,
1372 } tile_operand_type
;
1374 /* This is the bit that determines if a bundle is in the Y encoding. */
1375 #define TILE_BUNDLE_Y_ENCODING_MASK ((tile_bundle_bits)1 << 63)
1379 /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */
1380 TILE_MAX_INSTRUCTIONS_PER_BUNDLE
= 3,
1382 /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */
1383 TILE_NUM_PIPELINE_ENCODINGS
= 5,
1385 /* Log base 2 of TILE_BUNDLE_SIZE_IN_BYTES. */
1386 TILE_LOG2_BUNDLE_SIZE_IN_BYTES
= 3,
1388 /* Instructions take this many bytes. */
1389 TILE_BUNDLE_SIZE_IN_BYTES
= 1 << TILE_LOG2_BUNDLE_SIZE_IN_BYTES
,
1391 /* Log base 2 of TILE_BUNDLE_ALIGNMENT_IN_BYTES. */
1392 TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
= 3,
1394 /* Bundles should be aligned modulo this number of bytes. */
1395 TILE_BUNDLE_ALIGNMENT_IN_BYTES
=
1396 (1 << TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES
),
1398 /* Log base 2 of TILE_SN_INSTRUCTION_SIZE_IN_BYTES. */
1399 TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES
= 1,
1401 /* Static network instructions take this many bytes. */
1402 TILE_SN_INSTRUCTION_SIZE_IN_BYTES
=
1403 (1 << TILE_LOG2_SN_INSTRUCTION_SIZE_IN_BYTES
),
1405 /* Number of registers (some are magic, such as network I/O). */
1406 TILE_NUM_REGISTERS
= 64,
1408 /* Number of static network registers. */
1409 TILE_NUM_SN_REGISTERS
= 4
1415 /* Is this operand a register, immediate or address? */
1416 tile_operand_type type
;
1418 /* The default relocation type for this operand. */
1419 signed int default_reloc
: 16;
1421 /* How many bits is this value? (used for range checking) */
1422 unsigned int num_bits
: 5;
1424 /* Is the value signed? (used for range checking) */
1425 unsigned int is_signed
: 1;
1427 /* Is this operand a source register? */
1428 unsigned int is_src_reg
: 1;
1430 /* Is this operand written? (i.e. is it a destination register) */
1431 unsigned int is_dest_reg
: 1;
1433 /* Is this operand PC-relative? */
1434 unsigned int is_pc_relative
: 1;
1436 /* By how many bits do we right shift the value before inserting? */
1437 unsigned int rightshift
: 2;
1439 /* Return the bits for this operand to be ORed into an existing bundle. */
1440 tile_bundle_bits (*insert
) (int op
);
1442 /* Extract this operand and return it. */
1443 unsigned int (*extract
) (tile_bundle_bits bundle
);
1447 extern const struct tile_operand tile_operands
[];
1449 /* One finite-state machine per pipe for rapid instruction decoding. */
1450 extern const unsigned short * const
1451 tile_bundle_decoder_fsms
[TILE_NUM_PIPELINE_ENCODINGS
];
1456 /* The opcode mnemonic, e.g. "add" */
1459 /* The enum value for this mnemonic. */
1460 tile_mnemonic mnemonic
;
1462 /* A bit mask of which of the five pipes this instruction
1469 unsigned char pipes
;
1471 /* How many operands are there? */
1472 unsigned char num_operands
;
1474 /* Which register does this write implicitly, or TREG_ZERO if none? */
1475 unsigned char implicitly_written_register
;
1477 /* Can this be bundled with other instructions (almost always true). */
1478 unsigned char can_bundle
;
1480 /* The description of the operands. Each of these is an
1481 * index into the tile_operands[] table. */
1482 unsigned char operands
[TILE_NUM_PIPELINE_ENCODINGS
][TILE_MAX_OPERANDS
];
1486 extern const struct tile_opcode tile_opcodes
[];
1489 /* Used for non-textual disassembly into structs. */
1490 struct tile_decoded_instruction
1492 const struct tile_opcode
*opcode
;
1493 const struct tile_operand
*operands
[TILE_MAX_OPERANDS
];
1494 int operand_values
[TILE_MAX_OPERANDS
];
1498 /* Disassemble a bundle into a struct for machine processing. */
1499 extern int parse_insn_tile(tile_bundle_bits bits
,
1501 struct tile_decoded_instruction
1502 decoded
[TILE_MAX_INSTRUCTIONS_PER_BUNDLE
]);
1505 /* Given a set of bundle bits and a specific pipe, returns which
1506 * instruction the bundle contains in that pipe.
1508 extern const struct tile_opcode
*
1509 find_opcode(tile_bundle_bits bits
, tile_pipeline pipe
);
1513 #endif /* opcode_tile_h */