1 /* This file is automatically generated by aarch64-gen.  Do not edit!  */
2 /* Copyright (C) 2012-2016 Free Software Foundation, Inc.
3    Contributed by ARM Ltd.
4 
5    This file is part of the GNU opcodes library.
6 
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)
10    any later version.
11 
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.
16 
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/>.  */
20 
21 #include "sysdep.h"
22 #include "aarch64-asm.h"
23 
24 
25 const aarch64_opcode *
aarch64_find_real_opcode(const aarch64_opcode * opcode)26 aarch64_find_real_opcode (const aarch64_opcode *opcode)
27 {
28   /* Use the index as the key to locate the real opcode.  */
29   int key = opcode - aarch64_opcode_table;
30   int value;
31   switch (key)
32     {
33     case 3:	/* ngc */
34     case 2:	/* sbc */
35       value = 2;	/* --> sbc.  */
36       break;
37     case 5:	/* ngcs */
38     case 4:	/* sbcs */
39       value = 4;	/* --> sbcs.  */
40       break;
41     case 8:	/* cmn */
42     case 7:	/* adds */
43       value = 7;	/* --> adds.  */
44       break;
45     case 11:	/* cmp */
46     case 10:	/* subs */
47       value = 10;	/* --> subs.  */
48       break;
49     case 13:	/* mov */
50     case 12:	/* add */
51       value = 12;	/* --> add.  */
52       break;
53     case 15:	/* cmn */
54     case 14:	/* adds */
55       value = 14;	/* --> adds.  */
56       break;
57     case 18:	/* cmp */
58     case 17:	/* subs */
59       value = 17;	/* --> subs.  */
60       break;
61     case 21:	/* cmn */
62     case 20:	/* adds */
63       value = 20;	/* --> adds.  */
64       break;
65     case 23:	/* neg */
66     case 22:	/* sub */
67       value = 22;	/* --> sub.  */
68       break;
69     case 26:	/* negs */
70     case 25:	/* cmp */
71     case 24:	/* subs */
72       value = 24;	/* --> subs.  */
73       break;
74     case 150:	/* mov */
75     case 149:	/* umov */
76       value = 149;	/* --> umov.  */
77       break;
78     case 152:	/* mov */
79     case 151:	/* ins */
80       value = 151;	/* --> ins.  */
81       break;
82     case 154:	/* mov */
83     case 153:	/* ins */
84       value = 153;	/* --> ins.  */
85       break;
86     case 236:	/* mvn */
87     case 235:	/* not */
88       value = 235;	/* --> not.  */
89       break;
90     case 311:	/* mov */
91     case 310:	/* orr */
92       value = 310;	/* --> orr.  */
93       break;
94     case 380:	/* sxtl */
95     case 379:	/* sshll */
96       value = 379;	/* --> sshll.  */
97       break;
98     case 382:	/* sxtl2 */
99     case 381:	/* sshll2 */
100       value = 381;	/* --> sshll2.  */
101       break;
102     case 404:	/* uxtl */
103     case 403:	/* ushll */
104       value = 403;	/* --> ushll.  */
105       break;
106     case 406:	/* uxtl2 */
107     case 405:	/* ushll2 */
108       value = 405;	/* --> ushll2.  */
109       break;
110     case 527:	/* mov */
111     case 526:	/* dup */
112       value = 526;	/* --> dup.  */
113       break;
114     case 614:	/* sxtw */
115     case 613:	/* sxth */
116     case 612:	/* sxtb */
117     case 615:	/* asr */
118     case 611:	/* sbfx */
119     case 610:	/* sbfiz */
120     case 609:	/* sbfm */
121       value = 609;	/* --> sbfm.  */
122       break;
123     case 618:	/* bfc */
124     case 619:	/* bfxil */
125     case 617:	/* bfi */
126     case 616:	/* bfm */
127       value = 616;	/* --> bfm.  */
128       break;
129     case 624:	/* uxth */
130     case 623:	/* uxtb */
131     case 626:	/* lsr */
132     case 625:	/* lsl */
133     case 622:	/* ubfx */
134     case 621:	/* ubfiz */
135     case 620:	/* ubfm */
136       value = 620;	/* --> ubfm.  */
137       break;
138     case 644:	/* cset */
139     case 643:	/* cinc */
140     case 642:	/* csinc */
141       value = 642;	/* --> csinc.  */
142       break;
143     case 647:	/* csetm */
144     case 646:	/* cinv */
145     case 645:	/* csinv */
146       value = 645;	/* --> csinv.  */
147       break;
148     case 649:	/* cneg */
149     case 648:	/* csneg */
150       value = 648;	/* --> csneg.  */
151       break;
152     case 667:	/* rev */
153     case 668:	/* rev64 */
154       value = 667;	/* --> rev.  */
155       break;
156     case 675:	/* lsl */
157     case 674:	/* lslv */
158       value = 674;	/* --> lslv.  */
159       break;
160     case 677:	/* lsr */
161     case 676:	/* lsrv */
162       value = 676;	/* --> lsrv.  */
163       break;
164     case 679:	/* asr */
165     case 678:	/* asrv */
166       value = 678;	/* --> asrv.  */
167       break;
168     case 681:	/* ror */
169     case 680:	/* rorv */
170       value = 680;	/* --> rorv.  */
171       break;
172     case 691:	/* mul */
173     case 690:	/* madd */
174       value = 690;	/* --> madd.  */
175       break;
176     case 693:	/* mneg */
177     case 692:	/* msub */
178       value = 692;	/* --> msub.  */
179       break;
180     case 695:	/* smull */
181     case 694:	/* smaddl */
182       value = 694;	/* --> smaddl.  */
183       break;
184     case 697:	/* smnegl */
185     case 696:	/* smsubl */
186       value = 696;	/* --> smsubl.  */
187       break;
188     case 700:	/* umull */
189     case 699:	/* umaddl */
190       value = 699;	/* --> umaddl.  */
191       break;
192     case 702:	/* umnegl */
193     case 701:	/* umsubl */
194       value = 701;	/* --> umsubl.  */
195       break;
196     case 713:	/* ror */
197     case 712:	/* extr */
198       value = 712;	/* --> extr.  */
199       break;
200     case 920:	/* bic */
201     case 919:	/* and */
202       value = 919;	/* --> and.  */
203       break;
204     case 922:	/* mov */
205     case 921:	/* orr */
206       value = 921;	/* --> orr.  */
207       break;
208     case 925:	/* tst */
209     case 924:	/* ands */
210       value = 924;	/* --> ands.  */
211       break;
212     case 930:	/* uxtw */
213     case 929:	/* mov */
214     case 928:	/* orr */
215       value = 928;	/* --> orr.  */
216       break;
217     case 932:	/* mvn */
218     case 931:	/* orn */
219       value = 931;	/* --> orn.  */
220       break;
221     case 936:	/* tst */
222     case 935:	/* ands */
223       value = 935;	/* --> ands.  */
224       break;
225     case 1062:	/* staddb */
226     case 966:	/* ldaddb */
227       value = 966;	/* --> ldaddb.  */
228       break;
229     case 1063:	/* staddh */
230     case 967:	/* ldaddh */
231       value = 967;	/* --> ldaddh.  */
232       break;
233     case 1064:	/* stadd */
234     case 968:	/* ldadd */
235       value = 968;	/* --> ldadd.  */
236       break;
237     case 1065:	/* staddlb */
238     case 970:	/* ldaddlb */
239       value = 970;	/* --> ldaddlb.  */
240       break;
241     case 1066:	/* staddlh */
242     case 973:	/* ldaddlh */
243       value = 973;	/* --> ldaddlh.  */
244       break;
245     case 1067:	/* staddl */
246     case 976:	/* ldaddl */
247       value = 976;	/* --> ldaddl.  */
248       break;
249     case 1068:	/* stclrb */
250     case 978:	/* ldclrb */
251       value = 978;	/* --> ldclrb.  */
252       break;
253     case 1069:	/* stclrh */
254     case 979:	/* ldclrh */
255       value = 979;	/* --> ldclrh.  */
256       break;
257     case 1070:	/* stclr */
258     case 980:	/* ldclr */
259       value = 980;	/* --> ldclr.  */
260       break;
261     case 1071:	/* stclrlb */
262     case 982:	/* ldclrlb */
263       value = 982;	/* --> ldclrlb.  */
264       break;
265     case 1072:	/* stclrlh */
266     case 985:	/* ldclrlh */
267       value = 985;	/* --> ldclrlh.  */
268       break;
269     case 1073:	/* stclrl */
270     case 988:	/* ldclrl */
271       value = 988;	/* --> ldclrl.  */
272       break;
273     case 1074:	/* steorb */
274     case 990:	/* ldeorb */
275       value = 990;	/* --> ldeorb.  */
276       break;
277     case 1075:	/* steorh */
278     case 991:	/* ldeorh */
279       value = 991;	/* --> ldeorh.  */
280       break;
281     case 1076:	/* steor */
282     case 992:	/* ldeor */
283       value = 992;	/* --> ldeor.  */
284       break;
285     case 1077:	/* steorlb */
286     case 994:	/* ldeorlb */
287       value = 994;	/* --> ldeorlb.  */
288       break;
289     case 1078:	/* steorlh */
290     case 997:	/* ldeorlh */
291       value = 997;	/* --> ldeorlh.  */
292       break;
293     case 1079:	/* steorl */
294     case 1000:	/* ldeorl */
295       value = 1000;	/* --> ldeorl.  */
296       break;
297     case 1080:	/* stsetb */
298     case 1002:	/* ldsetb */
299       value = 1002;	/* --> ldsetb.  */
300       break;
301     case 1081:	/* stseth */
302     case 1003:	/* ldseth */
303       value = 1003;	/* --> ldseth.  */
304       break;
305     case 1082:	/* stset */
306     case 1004:	/* ldset */
307       value = 1004;	/* --> ldset.  */
308       break;
309     case 1083:	/* stsetlb */
310     case 1006:	/* ldsetlb */
311       value = 1006;	/* --> ldsetlb.  */
312       break;
313     case 1084:	/* stsetlh */
314     case 1009:	/* ldsetlh */
315       value = 1009;	/* --> ldsetlh.  */
316       break;
317     case 1085:	/* stsetl */
318     case 1012:	/* ldsetl */
319       value = 1012;	/* --> ldsetl.  */
320       break;
321     case 1086:	/* stsmaxb */
322     case 1014:	/* ldsmaxb */
323       value = 1014;	/* --> ldsmaxb.  */
324       break;
325     case 1087:	/* stsmaxh */
326     case 1015:	/* ldsmaxh */
327       value = 1015;	/* --> ldsmaxh.  */
328       break;
329     case 1088:	/* stsmax */
330     case 1016:	/* ldsmax */
331       value = 1016;	/* --> ldsmax.  */
332       break;
333     case 1089:	/* stsmaxlb */
334     case 1018:	/* ldsmaxlb */
335       value = 1018;	/* --> ldsmaxlb.  */
336       break;
337     case 1090:	/* stsmaxlh */
338     case 1021:	/* ldsmaxlh */
339       value = 1021;	/* --> ldsmaxlh.  */
340       break;
341     case 1091:	/* stsmaxl */
342     case 1024:	/* ldsmaxl */
343       value = 1024;	/* --> ldsmaxl.  */
344       break;
345     case 1092:	/* stsminb */
346     case 1026:	/* ldsminb */
347       value = 1026;	/* --> ldsminb.  */
348       break;
349     case 1093:	/* stsminh */
350     case 1027:	/* ldsminh */
351       value = 1027;	/* --> ldsminh.  */
352       break;
353     case 1094:	/* stsmin */
354     case 1028:	/* ldsmin */
355       value = 1028;	/* --> ldsmin.  */
356       break;
357     case 1095:	/* stsminlb */
358     case 1030:	/* ldsminlb */
359       value = 1030;	/* --> ldsminlb.  */
360       break;
361     case 1096:	/* stsminlh */
362     case 1033:	/* ldsminlh */
363       value = 1033;	/* --> ldsminlh.  */
364       break;
365     case 1097:	/* stsminl */
366     case 1036:	/* ldsminl */
367       value = 1036;	/* --> ldsminl.  */
368       break;
369     case 1098:	/* stumaxb */
370     case 1038:	/* ldumaxb */
371       value = 1038;	/* --> ldumaxb.  */
372       break;
373     case 1099:	/* stumaxh */
374     case 1039:	/* ldumaxh */
375       value = 1039;	/* --> ldumaxh.  */
376       break;
377     case 1100:	/* stumax */
378     case 1040:	/* ldumax */
379       value = 1040;	/* --> ldumax.  */
380       break;
381     case 1101:	/* stumaxlb */
382     case 1042:	/* ldumaxlb */
383       value = 1042;	/* --> ldumaxlb.  */
384       break;
385     case 1102:	/* stumaxlh */
386     case 1045:	/* ldumaxlh */
387       value = 1045;	/* --> ldumaxlh.  */
388       break;
389     case 1103:	/* stumaxl */
390     case 1048:	/* ldumaxl */
391       value = 1048;	/* --> ldumaxl.  */
392       break;
393     case 1104:	/* stuminb */
394     case 1050:	/* lduminb */
395       value = 1050;	/* --> lduminb.  */
396       break;
397     case 1105:	/* stuminh */
398     case 1051:	/* lduminh */
399       value = 1051;	/* --> lduminh.  */
400       break;
401     case 1106:	/* stumin */
402     case 1052:	/* ldumin */
403       value = 1052;	/* --> ldumin.  */
404       break;
405     case 1107:	/* stuminlb */
406     case 1054:	/* lduminlb */
407       value = 1054;	/* --> lduminlb.  */
408       break;
409     case 1108:	/* stuminlh */
410     case 1057:	/* lduminlh */
411       value = 1057;	/* --> lduminlh.  */
412       break;
413     case 1109:	/* stuminl */
414     case 1060:	/* lduminl */
415       value = 1060;	/* --> lduminl.  */
416       break;
417     case 1111:	/* mov */
418     case 1110:	/* movn */
419       value = 1110;	/* --> movn.  */
420       break;
421     case 1113:	/* mov */
422     case 1112:	/* movz */
423       value = 1112;	/* --> movz.  */
424       break;
425     case 1126:	/* psb */
426     case 1125:	/* esb */
427     case 1124:	/* sevl */
428     case 1123:	/* sev */
429     case 1122:	/* wfi */
430     case 1121:	/* wfe */
431     case 1120:	/* yield */
432     case 1119:	/* nop */
433     case 1118:	/* hint */
434       value = 1118;	/* --> hint.  */
435       break;
436     case 1135:	/* tlbi */
437     case 1134:	/* ic */
438     case 1133:	/* dc */
439     case 1132:	/* at */
440     case 1131:	/* sys */
441       value = 1131;	/* --> sys.  */
442       break;
443     default: return NULL;
444     }
445 
446   return aarch64_opcode_table + value;
447 }
448 
449 const char*
aarch64_insert_operand(const aarch64_operand * self,const aarch64_opnd_info * info,aarch64_insn * code,const aarch64_inst * inst)450 aarch64_insert_operand (const aarch64_operand *self,
451 			   const aarch64_opnd_info *info,
452 			   aarch64_insn *code, const aarch64_inst *inst)
453 {
454   /* Use the index as the key.  */
455   int key = self - aarch64_operands;
456   switch (key)
457     {
458     case 1:
459     case 2:
460     case 3:
461     case 4:
462     case 5:
463     case 6:
464     case 7:
465     case 8:
466     case 9:
467     case 10:
468     case 14:
469     case 15:
470     case 16:
471     case 17:
472     case 19:
473     case 20:
474     case 21:
475     case 22:
476     case 23:
477     case 24:
478     case 25:
479     case 26:
480     case 27:
481     case 35:
482     case 36:
483       return aarch64_ins_regno (self, info, code, inst);
484     case 12:
485       return aarch64_ins_reg_extended (self, info, code, inst);
486     case 13:
487       return aarch64_ins_reg_shifted (self, info, code, inst);
488     case 18:
489       return aarch64_ins_ft (self, info, code, inst);
490     case 28:
491     case 29:
492     case 30:
493       return aarch64_ins_reglane (self, info, code, inst);
494     case 31:
495       return aarch64_ins_reglist (self, info, code, inst);
496     case 32:
497       return aarch64_ins_ldst_reglist (self, info, code, inst);
498     case 33:
499       return aarch64_ins_ldst_reglist_r (self, info, code, inst);
500     case 34:
501       return aarch64_ins_ldst_elemlist (self, info, code, inst);
502     case 37:
503     case 46:
504     case 47:
505     case 48:
506     case 49:
507     case 50:
508     case 51:
509     case 52:
510     case 53:
511     case 54:
512     case 55:
513     case 56:
514     case 57:
515     case 58:
516     case 67:
517     case 68:
518     case 69:
519     case 70:
520       return aarch64_ins_imm (self, info, code, inst);
521     case 38:
522     case 39:
523       return aarch64_ins_advsimd_imm_shift (self, info, code, inst);
524     case 40:
525     case 41:
526     case 42:
527       return aarch64_ins_advsimd_imm_modified (self, info, code, inst);
528     case 59:
529       return aarch64_ins_limm (self, info, code, inst);
530     case 60:
531       return aarch64_ins_aimm (self, info, code, inst);
532     case 61:
533       return aarch64_ins_imm_half (self, info, code, inst);
534     case 62:
535       return aarch64_ins_fbits (self, info, code, inst);
536     case 64:
537     case 65:
538       return aarch64_ins_cond (self, info, code, inst);
539     case 71:
540     case 77:
541       return aarch64_ins_addr_simple (self, info, code, inst);
542     case 72:
543       return aarch64_ins_addr_regoff (self, info, code, inst);
544     case 73:
545     case 74:
546     case 75:
547       return aarch64_ins_addr_simm (self, info, code, inst);
548     case 76:
549       return aarch64_ins_addr_uimm12 (self, info, code, inst);
550     case 78:
551       return aarch64_ins_simd_addr_post (self, info, code, inst);
552     case 79:
553       return aarch64_ins_sysreg (self, info, code, inst);
554     case 80:
555       return aarch64_ins_pstatefield (self, info, code, inst);
556     case 81:
557     case 82:
558     case 83:
559     case 84:
560       return aarch64_ins_sysins_op (self, info, code, inst);
561     case 85:
562     case 86:
563       return aarch64_ins_barrier (self, info, code, inst);
564     case 87:
565       return aarch64_ins_prfop (self, info, code, inst);
566     case 88:
567       return aarch64_ins_hint (self, info, code, inst);
568     default: assert (0); abort ();
569     }
570 }
571