2
0

arm-dis.c 157 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136
  1. /* Instruction printing code for the ARM
  2. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
  3. 2007, Free Software Foundation, Inc.
  4. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
  5. Modification by James G. Smith (jsmith@cygnus.co.uk)
  6. This file is part of libopcodes.
  7. This program is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your option)
  10. any later version.
  11. This program is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  17. /* Start of qemu specific additions. Mostly this is stub definitions
  18. for things we don't care about. */
  19. #include "dis-asm.h"
  20. #define ATTRIBUTE_UNUSED __attribute__((unused))
  21. #define ISSPACE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n')
  22. #define ARM_EXT_V1 0
  23. #define ARM_EXT_V2 0
  24. #define ARM_EXT_V2S 0
  25. #define ARM_EXT_V3 0
  26. #define ARM_EXT_V3M 0
  27. #define ARM_EXT_V4 0
  28. #define ARM_EXT_V4T 0
  29. #define ARM_EXT_V5 0
  30. #define ARM_EXT_V5T 0
  31. #define ARM_EXT_V5ExP 0
  32. #define ARM_EXT_V5E 0
  33. #define ARM_EXT_V5J 0
  34. #define ARM_EXT_V6 0
  35. #define ARM_EXT_V6K 0
  36. #define ARM_EXT_V6Z 0
  37. #define ARM_EXT_V6T2 0
  38. #define ARM_EXT_V7 0
  39. #define ARM_EXT_DIV 0
  40. /* Co-processor space extensions. */
  41. #define ARM_CEXT_XSCALE 0
  42. #define ARM_CEXT_MAVERICK 0
  43. #define ARM_CEXT_IWMMXT 0
  44. #define FPU_FPA_EXT_V1 0
  45. #define FPU_FPA_EXT_V2 0
  46. #define FPU_VFP_EXT_NONE 0
  47. #define FPU_VFP_EXT_V1xD 0
  48. #define FPU_VFP_EXT_V1 0
  49. #define FPU_VFP_EXT_V2 0
  50. #define FPU_MAVERICK 0
  51. #define FPU_VFP_EXT_V3 0
  52. #define FPU_NEON_EXT_V1 0
  53. /* Assume host uses ieee float. */
  54. static void floatformat_to_double (unsigned char *data, double *dest)
  55. {
  56. union {
  57. uint32_t i;
  58. float f;
  59. } u;
  60. u.i = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
  61. *dest = u.f;
  62. }
  63. /* End of qemu specific additions. */
  64. /* FIXME: Belongs in global header. */
  65. #ifndef strneq
  66. #define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
  67. #endif
  68. #ifndef NUM_ELEM
  69. #define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
  70. #endif
  71. struct opcode32
  72. {
  73. unsigned long arch; /* Architecture defining this insn. */
  74. unsigned long value, mask; /* Recognise insn if (op&mask)==value. */
  75. const char *assembler; /* How to disassemble this insn. */
  76. };
  77. struct opcode16
  78. {
  79. unsigned long arch; /* Architecture defining this insn. */
  80. unsigned short value, mask; /* Recognise insn if (op&mask)==value. */
  81. const char *assembler; /* How to disassemble this insn. */
  82. };
  83. /* print_insn_coprocessor recognizes the following format control codes:
  84. %% %
  85. %c print condition code (always bits 28-31 in ARM mode)
  86. %q print shifter argument
  87. %u print condition code (unconditional in ARM mode)
  88. %A print address for ldc/stc/ldf/stf instruction
  89. %B print vstm/vldm register list
  90. %C print vstr/vldr address operand
  91. %I print cirrus signed shift immediate: bits 0..3|4..6
  92. %F print the COUNT field of a LFM/SFM instruction.
  93. %P print floating point precision in arithmetic insn
  94. %Q print floating point precision in ldf/stf insn
  95. %R print floating point rounding mode
  96. %<bitfield>r print as an ARM register
  97. %<bitfield>d print the bitfield in decimal
  98. %<bitfield>k print immediate for VFPv3 conversion instruction
  99. %<bitfield>x print the bitfield in hex
  100. %<bitfield>X print the bitfield as 1 hex digit without leading "0x"
  101. %<bitfield>f print a floating point constant if >7 else a
  102. floating point register
  103. %<bitfield>w print as an iWMMXt width field - [bhwd]ss/us
  104. %<bitfield>g print as an iWMMXt 64-bit register
  105. %<bitfield>G print as an iWMMXt general purpose or control register
  106. %<bitfield>D print as a NEON D register
  107. %<bitfield>Q print as a NEON Q register
  108. %y<code> print a single precision VFP reg.
  109. Codes: 0=>Sm, 1=>Sd, 2=>Sn, 3=>multi-list, 4=>Sm pair
  110. %z<code> print a double precision VFP reg
  111. Codes: 0=>Dm, 1=>Dd, 2=>Dn, 3=>multi-list
  112. %<bitfield>'c print specified char iff bitfield is all ones
  113. %<bitfield>`c print specified char iff bitfield is all zeroes
  114. %<bitfield>?ab... select from array of values in big endian order
  115. %L print as an iWMMXt N/M width field.
  116. %Z print the Immediate of a WSHUFH instruction.
  117. %l like 'A' except use byte offsets for 'B' & 'H'
  118. versions.
  119. %i print 5-bit immediate in bits 8,3..0
  120. (print "32" when 0)
  121. %r print register offset address for wldt/wstr instruction
  122. */
  123. /* Common coprocessor opcodes shared between Arm and Thumb-2. */
  124. static const struct opcode32 coprocessor_opcodes[] =
  125. {
  126. /* XScale instructions. */
  127. {ARM_CEXT_XSCALE, 0x0e200010, 0x0fff0ff0, "mia%c\tacc0, %0-3r, %12-15r"},
  128. {ARM_CEXT_XSCALE, 0x0e280010, 0x0fff0ff0, "miaph%c\tacc0, %0-3r, %12-15r"},
  129. {ARM_CEXT_XSCALE, 0x0e2c0010, 0x0ffc0ff0, "mia%17'T%17`B%16'T%16`B%c\tacc0, %0-3r, %12-15r"},
  130. {ARM_CEXT_XSCALE, 0x0c400000, 0x0ff00fff, "mar%c\tacc0, %12-15r, %16-19r"},
  131. {ARM_CEXT_XSCALE, 0x0c500000, 0x0ff00fff, "mra%c\t%12-15r, %16-19r, acc0"},
  132. /* Intel Wireless MMX technology instructions. */
  133. #define FIRST_IWMMXT_INSN 0x0e130130
  134. #define IWMMXT_INSN_COUNT 73
  135. {ARM_CEXT_IWMMXT, 0x0e130130, 0x0f3f0fff, "tandc%22-23w%c\t%12-15r"},
  136. {ARM_CEXT_XSCALE, 0x0e400010, 0x0ff00f3f, "tbcst%6-7w%c\t%16-19g, %12-15r"},
  137. {ARM_CEXT_XSCALE, 0x0e130170, 0x0f3f0ff8, "textrc%22-23w%c\t%12-15r, #%0-2d"},
  138. {ARM_CEXT_XSCALE, 0x0e100070, 0x0f300ff0, "textrm%3?su%22-23w%c\t%12-15r, %16-19g, #%0-2d"},
  139. {ARM_CEXT_XSCALE, 0x0e600010, 0x0ff00f38, "tinsr%6-7w%c\t%16-19g, %12-15r, #%0-2d"},
  140. {ARM_CEXT_XSCALE, 0x0e000110, 0x0ff00fff, "tmcr%c\t%16-19G, %12-15r"},
  141. {ARM_CEXT_XSCALE, 0x0c400000, 0x0ff00ff0, "tmcrr%c\t%0-3g, %12-15r, %16-19r"},
  142. {ARM_CEXT_XSCALE, 0x0e2c0010, 0x0ffc0e10, "tmia%17?tb%16?tb%c\t%5-8g, %0-3r, %12-15r"},
  143. {ARM_CEXT_XSCALE, 0x0e200010, 0x0fff0e10, "tmia%c\t%5-8g, %0-3r, %12-15r"},
  144. {ARM_CEXT_XSCALE, 0x0e280010, 0x0fff0e10, "tmiaph%c\t%5-8g, %0-3r, %12-15r"},
  145. {ARM_CEXT_XSCALE, 0x0e100030, 0x0f300fff, "tmovmsk%22-23w%c\t%12-15r, %16-19g"},
  146. {ARM_CEXT_XSCALE, 0x0e100110, 0x0ff00ff0, "tmrc%c\t%12-15r, %16-19G"},
  147. {ARM_CEXT_XSCALE, 0x0c500000, 0x0ff00ff0, "tmrrc%c\t%12-15r, %16-19r, %0-3g"},
  148. {ARM_CEXT_XSCALE, 0x0e130150, 0x0f3f0fff, "torc%22-23w%c\t%12-15r"},
  149. {ARM_CEXT_XSCALE, 0x0e130190, 0x0f3f0fff, "torvsc%22-23w%c\t%12-15r"},
  150. {ARM_CEXT_XSCALE, 0x0e2001c0, 0x0f300fff, "wabs%22-23w%c\t%12-15g, %16-19g"},
  151. {ARM_CEXT_XSCALE, 0x0e0001c0, 0x0f300fff, "wacc%22-23w%c\t%12-15g, %16-19g"},
  152. {ARM_CEXT_XSCALE, 0x0e000180, 0x0f000ff0, "wadd%20-23w%c\t%12-15g, %16-19g, %0-3g"},
  153. {ARM_CEXT_XSCALE, 0x0e2001a0, 0x0f300ff0, "waddbhus%22?ml%c\t%12-15g, %16-19g, %0-3g"},
  154. {ARM_CEXT_XSCALE, 0x0ea001a0, 0x0ff00ff0, "waddsubhx%c\t%12-15g, %16-19g, %0-3g"},
  155. {ARM_CEXT_XSCALE, 0x0e000020, 0x0f800ff0, "waligni%c\t%12-15g, %16-19g, %0-3g, #%20-22d"},
  156. {ARM_CEXT_XSCALE, 0x0e800020, 0x0fc00ff0, "walignr%20-21d%c\t%12-15g, %16-19g, %0-3g"},
  157. {ARM_CEXT_XSCALE, 0x0e200000, 0x0fe00ff0, "wand%20'n%c\t%12-15g, %16-19g, %0-3g"},
  158. {ARM_CEXT_XSCALE, 0x0e800000, 0x0fa00ff0, "wavg2%22?hb%20'r%c\t%12-15g, %16-19g, %0-3g"},
  159. {ARM_CEXT_XSCALE, 0x0e400000, 0x0fe00ff0, "wavg4%20'r%c\t%12-15g, %16-19g, %0-3g"},
  160. {ARM_CEXT_XSCALE, 0x0e000060, 0x0f300ff0, "wcmpeq%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  161. {ARM_CEXT_XSCALE, 0x0e100060, 0x0f100ff0, "wcmpgt%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  162. {ARM_CEXT_XSCALE, 0xfc500100, 0xfe500f00, "wldrd\t%12-15g, %r"},
  163. {ARM_CEXT_XSCALE, 0xfc100100, 0xfe500f00, "wldrw\t%12-15G, %A"},
  164. {ARM_CEXT_XSCALE, 0x0c100000, 0x0e100e00, "wldr%L%c\t%12-15g, %l"},
  165. {ARM_CEXT_XSCALE, 0x0e400100, 0x0fc00ff0, "wmac%21?su%20'z%c\t%12-15g, %16-19g, %0-3g"},
  166. {ARM_CEXT_XSCALE, 0x0e800100, 0x0fc00ff0, "wmadd%21?su%20'x%c\t%12-15g, %16-19g, %0-3g"},
  167. {ARM_CEXT_XSCALE, 0x0ec00100, 0x0fd00ff0, "wmadd%21?sun%c\t%12-15g, %16-19g, %0-3g"},
  168. {ARM_CEXT_XSCALE, 0x0e000160, 0x0f100ff0, "wmax%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  169. {ARM_CEXT_XSCALE, 0x0e000080, 0x0f100fe0, "wmerge%c\t%12-15g, %16-19g, %0-3g, #%21-23d"},
  170. {ARM_CEXT_XSCALE, 0x0e0000a0, 0x0f800ff0, "wmia%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"},
  171. {ARM_CEXT_XSCALE, 0x0e800120, 0x0f800ff0, "wmiaw%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"},
  172. {ARM_CEXT_XSCALE, 0x0e100160, 0x0f100ff0, "wmin%21?su%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  173. {ARM_CEXT_XSCALE, 0x0e000100, 0x0fc00ff0, "wmul%21?su%20?ml%23'r%c\t%12-15g, %16-19g, %0-3g"},
  174. {ARM_CEXT_XSCALE, 0x0ed00100, 0x0fd00ff0, "wmul%21?sumr%c\t%12-15g, %16-19g, %0-3g"},
  175. {ARM_CEXT_XSCALE, 0x0ee000c0, 0x0fe00ff0, "wmulwsm%20`r%c\t%12-15g, %16-19g, %0-3g"},
  176. {ARM_CEXT_XSCALE, 0x0ec000c0, 0x0fe00ff0, "wmulwum%20`r%c\t%12-15g, %16-19g, %0-3g"},
  177. {ARM_CEXT_XSCALE, 0x0eb000c0, 0x0ff00ff0, "wmulwl%c\t%12-15g, %16-19g, %0-3g"},
  178. {ARM_CEXT_XSCALE, 0x0e8000a0, 0x0f800ff0, "wqmia%21?tb%20?tb%22'n%c\t%12-15g, %16-19g, %0-3g"},
  179. {ARM_CEXT_XSCALE, 0x0e100080, 0x0fd00ff0, "wqmulm%21'r%c\t%12-15g, %16-19g, %0-3g"},
  180. {ARM_CEXT_XSCALE, 0x0ec000e0, 0x0fd00ff0, "wqmulwm%21'r%c\t%12-15g, %16-19g, %0-3g"},
  181. {ARM_CEXT_XSCALE, 0x0e000000, 0x0ff00ff0, "wor%c\t%12-15g, %16-19g, %0-3g"},
  182. {ARM_CEXT_XSCALE, 0x0e000080, 0x0f000ff0, "wpack%20-23w%c\t%12-15g, %16-19g, %0-3g"},
  183. {ARM_CEXT_XSCALE, 0xfe300040, 0xff300ef0, "wror%22-23w\t%12-15g, %16-19g, #%i"},
  184. {ARM_CEXT_XSCALE, 0x0e300040, 0x0f300ff0, "wror%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  185. {ARM_CEXT_XSCALE, 0x0e300140, 0x0f300ff0, "wror%22-23wg%c\t%12-15g, %16-19g, %0-3G"},
  186. {ARM_CEXT_XSCALE, 0x0e000120, 0x0fa00ff0, "wsad%22?hb%20'z%c\t%12-15g, %16-19g, %0-3g"},
  187. {ARM_CEXT_XSCALE, 0x0e0001e0, 0x0f000ff0, "wshufh%c\t%12-15g, %16-19g, #%Z"},
  188. {ARM_CEXT_XSCALE, 0xfe100040, 0xff300ef0, "wsll%22-23w\t%12-15g, %16-19g, #%i"},
  189. {ARM_CEXT_XSCALE, 0x0e100040, 0x0f300ff0, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"},
  190. {ARM_CEXT_XSCALE, 0x0e100148, 0x0f300ffc, "wsll%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"},
  191. {ARM_CEXT_XSCALE, 0xfe000040, 0xff300ef0, "wsra%22-23w\t%12-15g, %16-19g, #%i"},
  192. {ARM_CEXT_XSCALE, 0x0e000040, 0x0f300ff0, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"},
  193. {ARM_CEXT_XSCALE, 0x0e000148, 0x0f300ffc, "wsra%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"},
  194. {ARM_CEXT_XSCALE, 0xfe200040, 0xff300ef0, "wsrl%22-23w\t%12-15g, %16-19g, #%i"},
  195. {ARM_CEXT_XSCALE, 0x0e200040, 0x0f300ff0, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3g"},
  196. {ARM_CEXT_XSCALE, 0x0e200148, 0x0f300ffc, "wsrl%22-23w%8'g%c\t%12-15g, %16-19g, %0-3G"},
  197. {ARM_CEXT_XSCALE, 0xfc400100, 0xfe500f00, "wstrd\t%12-15g, %r"},
  198. {ARM_CEXT_XSCALE, 0xfc000100, 0xfe500f00, "wstrw\t%12-15G, %A"},
  199. {ARM_CEXT_XSCALE, 0x0c000000, 0x0e100e00, "wstr%L%c\t%12-15g, %l"},
  200. {ARM_CEXT_XSCALE, 0x0e0001a0, 0x0f000ff0, "wsub%20-23w%c\t%12-15g, %16-19g, %0-3g"},
  201. {ARM_CEXT_XSCALE, 0x0ed001c0, 0x0ff00ff0, "wsubaddhx%c\t%12-15g, %16-19g, %0-3g"},
  202. {ARM_CEXT_XSCALE, 0x0e1001c0, 0x0f300ff0, "wabsdiff%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  203. {ARM_CEXT_XSCALE, 0x0e0000c0, 0x0fd00fff, "wunpckeh%21?sub%c\t%12-15g, %16-19g"},
  204. {ARM_CEXT_XSCALE, 0x0e4000c0, 0x0fd00fff, "wunpckeh%21?suh%c\t%12-15g, %16-19g"},
  205. {ARM_CEXT_XSCALE, 0x0e8000c0, 0x0fd00fff, "wunpckeh%21?suw%c\t%12-15g, %16-19g"},
  206. {ARM_CEXT_XSCALE, 0x0e0000e0, 0x0f100fff, "wunpckel%21?su%22-23w%c\t%12-15g, %16-19g"},
  207. {ARM_CEXT_XSCALE, 0x0e1000c0, 0x0f300ff0, "wunpckih%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  208. {ARM_CEXT_XSCALE, 0x0e1000e0, 0x0f300ff0, "wunpckil%22-23w%c\t%12-15g, %16-19g, %0-3g"},
  209. {ARM_CEXT_XSCALE, 0x0e100000, 0x0ff00ff0, "wxor%c\t%12-15g, %16-19g, %0-3g"},
  210. /* Floating point coprocessor (FPA) instructions */
  211. {FPU_FPA_EXT_V1, 0x0e000100, 0x0ff08f10, "adf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  212. {FPU_FPA_EXT_V1, 0x0e100100, 0x0ff08f10, "muf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  213. {FPU_FPA_EXT_V1, 0x0e200100, 0x0ff08f10, "suf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  214. {FPU_FPA_EXT_V1, 0x0e300100, 0x0ff08f10, "rsf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  215. {FPU_FPA_EXT_V1, 0x0e400100, 0x0ff08f10, "dvf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  216. {FPU_FPA_EXT_V1, 0x0e500100, 0x0ff08f10, "rdf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  217. {FPU_FPA_EXT_V1, 0x0e600100, 0x0ff08f10, "pow%c%P%R\t%12-14f, %16-18f, %0-3f"},
  218. {FPU_FPA_EXT_V1, 0x0e700100, 0x0ff08f10, "rpw%c%P%R\t%12-14f, %16-18f, %0-3f"},
  219. {FPU_FPA_EXT_V1, 0x0e800100, 0x0ff08f10, "rmf%c%P%R\t%12-14f, %16-18f, %0-3f"},
  220. {FPU_FPA_EXT_V1, 0x0e900100, 0x0ff08f10, "fml%c%P%R\t%12-14f, %16-18f, %0-3f"},
  221. {FPU_FPA_EXT_V1, 0x0ea00100, 0x0ff08f10, "fdv%c%P%R\t%12-14f, %16-18f, %0-3f"},
  222. {FPU_FPA_EXT_V1, 0x0eb00100, 0x0ff08f10, "frd%c%P%R\t%12-14f, %16-18f, %0-3f"},
  223. {FPU_FPA_EXT_V1, 0x0ec00100, 0x0ff08f10, "pol%c%P%R\t%12-14f, %16-18f, %0-3f"},
  224. {FPU_FPA_EXT_V1, 0x0e008100, 0x0ff08f10, "mvf%c%P%R\t%12-14f, %0-3f"},
  225. {FPU_FPA_EXT_V1, 0x0e108100, 0x0ff08f10, "mnf%c%P%R\t%12-14f, %0-3f"},
  226. {FPU_FPA_EXT_V1, 0x0e208100, 0x0ff08f10, "abs%c%P%R\t%12-14f, %0-3f"},
  227. {FPU_FPA_EXT_V1, 0x0e308100, 0x0ff08f10, "rnd%c%P%R\t%12-14f, %0-3f"},
  228. {FPU_FPA_EXT_V1, 0x0e408100, 0x0ff08f10, "sqt%c%P%R\t%12-14f, %0-3f"},
  229. {FPU_FPA_EXT_V1, 0x0e508100, 0x0ff08f10, "log%c%P%R\t%12-14f, %0-3f"},
  230. {FPU_FPA_EXT_V1, 0x0e608100, 0x0ff08f10, "lgn%c%P%R\t%12-14f, %0-3f"},
  231. {FPU_FPA_EXT_V1, 0x0e708100, 0x0ff08f10, "exp%c%P%R\t%12-14f, %0-3f"},
  232. {FPU_FPA_EXT_V1, 0x0e808100, 0x0ff08f10, "sin%c%P%R\t%12-14f, %0-3f"},
  233. {FPU_FPA_EXT_V1, 0x0e908100, 0x0ff08f10, "cos%c%P%R\t%12-14f, %0-3f"},
  234. {FPU_FPA_EXT_V1, 0x0ea08100, 0x0ff08f10, "tan%c%P%R\t%12-14f, %0-3f"},
  235. {FPU_FPA_EXT_V1, 0x0eb08100, 0x0ff08f10, "asn%c%P%R\t%12-14f, %0-3f"},
  236. {FPU_FPA_EXT_V1, 0x0ec08100, 0x0ff08f10, "acs%c%P%R\t%12-14f, %0-3f"},
  237. {FPU_FPA_EXT_V1, 0x0ed08100, 0x0ff08f10, "atn%c%P%R\t%12-14f, %0-3f"},
  238. {FPU_FPA_EXT_V1, 0x0ee08100, 0x0ff08f10, "urd%c%P%R\t%12-14f, %0-3f"},
  239. {FPU_FPA_EXT_V1, 0x0ef08100, 0x0ff08f10, "nrm%c%P%R\t%12-14f, %0-3f"},
  240. {FPU_FPA_EXT_V1, 0x0e000110, 0x0ff00f1f, "flt%c%P%R\t%16-18f, %12-15r"},
  241. {FPU_FPA_EXT_V1, 0x0e100110, 0x0fff0f98, "fix%c%R\t%12-15r, %0-2f"},
  242. {FPU_FPA_EXT_V1, 0x0e200110, 0x0fff0fff, "wfs%c\t%12-15r"},
  243. {FPU_FPA_EXT_V1, 0x0e300110, 0x0fff0fff, "rfs%c\t%12-15r"},
  244. {FPU_FPA_EXT_V1, 0x0e400110, 0x0fff0fff, "wfc%c\t%12-15r"},
  245. {FPU_FPA_EXT_V1, 0x0e500110, 0x0fff0fff, "rfc%c\t%12-15r"},
  246. {FPU_FPA_EXT_V1, 0x0e90f110, 0x0ff8fff0, "cmf%c\t%16-18f, %0-3f"},
  247. {FPU_FPA_EXT_V1, 0x0eb0f110, 0x0ff8fff0, "cnf%c\t%16-18f, %0-3f"},
  248. {FPU_FPA_EXT_V1, 0x0ed0f110, 0x0ff8fff0, "cmfe%c\t%16-18f, %0-3f"},
  249. {FPU_FPA_EXT_V1, 0x0ef0f110, 0x0ff8fff0, "cnfe%c\t%16-18f, %0-3f"},
  250. {FPU_FPA_EXT_V1, 0x0c000100, 0x0e100f00, "stf%c%Q\t%12-14f, %A"},
  251. {FPU_FPA_EXT_V1, 0x0c100100, 0x0e100f00, "ldf%c%Q\t%12-14f, %A"},
  252. {FPU_FPA_EXT_V2, 0x0c000200, 0x0e100f00, "sfm%c\t%12-14f, %F, %A"},
  253. {FPU_FPA_EXT_V2, 0x0c100200, 0x0e100f00, "lfm%c\t%12-14f, %F, %A"},
  254. /* Register load/store */
  255. {FPU_NEON_EXT_V1, 0x0d200b00, 0x0fb00f01, "vstmdb%c\t%16-19r%21'!, %B"},
  256. {FPU_NEON_EXT_V1, 0x0d300b00, 0x0fb00f01, "vldmdb%c\t%16-19r%21'!, %B"},
  257. {FPU_NEON_EXT_V1, 0x0c800b00, 0x0f900f01, "vstmia%c\t%16-19r%21'!, %B"},
  258. {FPU_NEON_EXT_V1, 0x0c900b00, 0x0f900f01, "vldmia%c\t%16-19r%21'!, %B"},
  259. {FPU_NEON_EXT_V1, 0x0d000b00, 0x0f300f00, "vstr%c\t%12-15,22D, %C"},
  260. {FPU_NEON_EXT_V1, 0x0d100b00, 0x0f300f00, "vldr%c\t%12-15,22D, %C"},
  261. /* Data transfer between ARM and NEON registers */
  262. {FPU_NEON_EXT_V1, 0x0e800b10, 0x0ff00f70, "vdup%c.32\t%16-19,7D, %12-15r"},
  263. {FPU_NEON_EXT_V1, 0x0e800b30, 0x0ff00f70, "vdup%c.16\t%16-19,7D, %12-15r"},
  264. {FPU_NEON_EXT_V1, 0x0ea00b10, 0x0ff00f70, "vdup%c.32\t%16-19,7Q, %12-15r"},
  265. {FPU_NEON_EXT_V1, 0x0ea00b30, 0x0ff00f70, "vdup%c.16\t%16-19,7Q, %12-15r"},
  266. {FPU_NEON_EXT_V1, 0x0ec00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7D, %12-15r"},
  267. {FPU_NEON_EXT_V1, 0x0ee00b10, 0x0ff00f70, "vdup%c.8\t%16-19,7Q, %12-15r"},
  268. {FPU_NEON_EXT_V1, 0x0c400b10, 0x0ff00fd0, "vmov%c\t%0-3,5D, %12-15r, %16-19r"},
  269. {FPU_NEON_EXT_V1, 0x0c500b10, 0x0ff00fd0, "vmov%c\t%12-15r, %16-19r, %0-3,5D"},
  270. {FPU_NEON_EXT_V1, 0x0e000b10, 0x0fd00f70, "vmov%c.32\t%16-19,7D[%21d], %12-15r"},
  271. {FPU_NEON_EXT_V1, 0x0e100b10, 0x0f500f70, "vmov%c.32\t%12-15r, %16-19,7D[%21d]"},
  272. {FPU_NEON_EXT_V1, 0x0e000b30, 0x0fd00f30, "vmov%c.16\t%16-19,7D[%6,21d], %12-15r"},
  273. {FPU_NEON_EXT_V1, 0x0e100b30, 0x0f500f30, "vmov%c.%23?us16\t%12-15r, %16-19,7D[%6,21d]"},
  274. {FPU_NEON_EXT_V1, 0x0e400b10, 0x0fd00f10, "vmov%c.8\t%16-19,7D[%5,6,21d], %12-15r"},
  275. {FPU_NEON_EXT_V1, 0x0e500b10, 0x0f500f10, "vmov%c.%23?us8\t%12-15r, %16-19,7D[%5,6,21d]"},
  276. /* Floating point coprocessor (VFP) instructions */
  277. {FPU_VFP_EXT_V1xD, 0x0ef1fa10, 0x0fffffff, "fmstat%c"},
  278. {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0fff0fff, "fmxr%c\tfpsid, %12-15r"},
  279. {FPU_VFP_EXT_V1xD, 0x0ee10a10, 0x0fff0fff, "fmxr%c\tfpscr, %12-15r"},
  280. {FPU_VFP_EXT_V1xD, 0x0ee60a10, 0x0fff0fff, "fmxr%c\tmvfr1, %12-15r"},
  281. {FPU_VFP_EXT_V1xD, 0x0ee70a10, 0x0fff0fff, "fmxr%c\tmvfr0, %12-15r"},
  282. {FPU_VFP_EXT_V1xD, 0x0ee80a10, 0x0fff0fff, "fmxr%c\tfpexc, %12-15r"},
  283. {FPU_VFP_EXT_V1xD, 0x0ee90a10, 0x0fff0fff, "fmxr%c\tfpinst, %12-15r\t@ Impl def"},
  284. {FPU_VFP_EXT_V1xD, 0x0eea0a10, 0x0fff0fff, "fmxr%c\tfpinst2, %12-15r\t@ Impl def"},
  285. {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpsid"},
  286. {FPU_VFP_EXT_V1xD, 0x0ef10a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpscr"},
  287. {FPU_VFP_EXT_V1xD, 0x0ef60a10, 0x0fff0fff, "fmrx%c\t%12-15r, mvfr1"},
  288. {FPU_VFP_EXT_V1xD, 0x0ef70a10, 0x0fff0fff, "fmrx%c\t%12-15r, mvfr0"},
  289. {FPU_VFP_EXT_V1xD, 0x0ef80a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpexc"},
  290. {FPU_VFP_EXT_V1xD, 0x0ef90a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst\t@ Impl def"},
  291. {FPU_VFP_EXT_V1xD, 0x0efa0a10, 0x0fff0fff, "fmrx%c\t%12-15r, fpinst2\t@ Impl def"},
  292. {FPU_VFP_EXT_V1, 0x0e000b10, 0x0ff00fff, "fmdlr%c\t%z2, %12-15r"},
  293. {FPU_VFP_EXT_V1, 0x0e100b10, 0x0ff00fff, "fmrdl%c\t%12-15r, %z2"},
  294. {FPU_VFP_EXT_V1, 0x0e200b10, 0x0ff00fff, "fmdhr%c\t%z2, %12-15r"},
  295. {FPU_VFP_EXT_V1, 0x0e300b10, 0x0ff00fff, "fmrdh%c\t%12-15r, %z2"},
  296. {FPU_VFP_EXT_V1xD, 0x0ee00a10, 0x0ff00fff, "fmxr%c\t<impl def %16-19x>, %12-15r"},
  297. {FPU_VFP_EXT_V1xD, 0x0ef00a10, 0x0ff00fff, "fmrx%c\t%12-15r, <impl def %16-19x>"},
  298. {FPU_VFP_EXT_V1xD, 0x0e000a10, 0x0ff00f7f, "fmsr%c\t%y2, %12-15r"},
  299. {FPU_VFP_EXT_V1xD, 0x0e100a10, 0x0ff00f7f, "fmrs%c\t%12-15r, %y2"},
  300. {FPU_VFP_EXT_V1xD, 0x0eb50a40, 0x0fbf0f70, "fcmp%7'ezs%c\t%y1"},
  301. {FPU_VFP_EXT_V1, 0x0eb50b40, 0x0fbf0f70, "fcmp%7'ezd%c\t%z1"},
  302. {FPU_VFP_EXT_V1xD, 0x0eb00a40, 0x0fbf0fd0, "fcpys%c\t%y1, %y0"},
  303. {FPU_VFP_EXT_V1xD, 0x0eb00ac0, 0x0fbf0fd0, "fabss%c\t%y1, %y0"},
  304. {FPU_VFP_EXT_V1, 0x0eb00b40, 0x0fbf0fd0, "fcpyd%c\t%z1, %z0"},
  305. {FPU_VFP_EXT_V1, 0x0eb00bc0, 0x0fbf0fd0, "fabsd%c\t%z1, %z0"},
  306. {FPU_VFP_EXT_V1xD, 0x0eb10a40, 0x0fbf0fd0, "fnegs%c\t%y1, %y0"},
  307. {FPU_VFP_EXT_V1xD, 0x0eb10ac0, 0x0fbf0fd0, "fsqrts%c\t%y1, %y0"},
  308. {FPU_VFP_EXT_V1, 0x0eb10b40, 0x0fbf0fd0, "fnegd%c\t%z1, %z0"},
  309. {FPU_VFP_EXT_V1, 0x0eb10bc0, 0x0fbf0fd0, "fsqrtd%c\t%z1, %z0"},
  310. {FPU_VFP_EXT_V1, 0x0eb70ac0, 0x0fbf0fd0, "fcvtds%c\t%z1, %y0"},
  311. {FPU_VFP_EXT_V1, 0x0eb70bc0, 0x0fbf0fd0, "fcvtsd%c\t%y1, %z0"},
  312. {FPU_VFP_EXT_V1xD, 0x0eb80a40, 0x0fbf0fd0, "fuitos%c\t%y1, %y0"},
  313. {FPU_VFP_EXT_V1xD, 0x0eb80ac0, 0x0fbf0fd0, "fsitos%c\t%y1, %y0"},
  314. {FPU_VFP_EXT_V1, 0x0eb80b40, 0x0fbf0fd0, "fuitod%c\t%z1, %y0"},
  315. {FPU_VFP_EXT_V1, 0x0eb80bc0, 0x0fbf0fd0, "fsitod%c\t%z1, %y0"},
  316. {FPU_VFP_EXT_V1xD, 0x0eb40a40, 0x0fbf0f50, "fcmp%7'es%c\t%y1, %y0"},
  317. {FPU_VFP_EXT_V1, 0x0eb40b40, 0x0fbf0f50, "fcmp%7'ed%c\t%z1, %z0"},
  318. {FPU_VFP_EXT_V3, 0x0eba0a40, 0x0fbe0f50, "f%16?us%7?lhtos%c\t%y1, #%5,0-3k"},
  319. {FPU_VFP_EXT_V3, 0x0eba0b40, 0x0fbe0f50, "f%16?us%7?lhtod%c\t%z1, #%5,0-3k"},
  320. {FPU_VFP_EXT_V1xD, 0x0ebc0a40, 0x0fbe0f50, "fto%16?sui%7'zs%c\t%y1, %y0"},
  321. {FPU_VFP_EXT_V1, 0x0ebc0b40, 0x0fbe0f50, "fto%16?sui%7'zd%c\t%y1, %z0"},
  322. {FPU_VFP_EXT_V3, 0x0ebe0a40, 0x0fbe0f50, "fto%16?us%7?lhs%c\t%y1, #%5,0-3k"},
  323. {FPU_VFP_EXT_V3, 0x0ebe0b40, 0x0fbe0f50, "fto%16?us%7?lhd%c\t%z1, #%5,0-3k"},
  324. {FPU_VFP_EXT_V1, 0x0c500b10, 0x0fb00ff0, "fmrrd%c\t%12-15r, %16-19r, %z0"},
  325. {FPU_VFP_EXT_V3, 0x0eb00a00, 0x0fb00ff0, "fconsts%c\t%y1, #%0-3,16-19d"},
  326. {FPU_VFP_EXT_V3, 0x0eb00b00, 0x0fb00ff0, "fconstd%c\t%z1, #%0-3,16-19d"},
  327. {FPU_VFP_EXT_V2, 0x0c400a10, 0x0ff00fd0, "fmsrr%c\t%y4, %12-15r, %16-19r"},
  328. {FPU_VFP_EXT_V2, 0x0c400b10, 0x0ff00fd0, "fmdrr%c\t%z0, %12-15r, %16-19r"},
  329. {FPU_VFP_EXT_V2, 0x0c500a10, 0x0ff00fd0, "fmrrs%c\t%12-15r, %16-19r, %y4"},
  330. {FPU_VFP_EXT_V1xD, 0x0e000a00, 0x0fb00f50, "fmacs%c\t%y1, %y2, %y0"},
  331. {FPU_VFP_EXT_V1xD, 0x0e000a40, 0x0fb00f50, "fnmacs%c\t%y1, %y2, %y0"},
  332. {FPU_VFP_EXT_V1, 0x0e000b00, 0x0fb00f50, "fmacd%c\t%z1, %z2, %z0"},
  333. {FPU_VFP_EXT_V1, 0x0e000b40, 0x0fb00f50, "fnmacd%c\t%z1, %z2, %z0"},
  334. {FPU_VFP_EXT_V1xD, 0x0e100a00, 0x0fb00f50, "fmscs%c\t%y1, %y2, %y0"},
  335. {FPU_VFP_EXT_V1xD, 0x0e100a40, 0x0fb00f50, "fnmscs%c\t%y1, %y2, %y0"},
  336. {FPU_VFP_EXT_V1, 0x0e100b00, 0x0fb00f50, "fmscd%c\t%z1, %z2, %z0"},
  337. {FPU_VFP_EXT_V1, 0x0e100b40, 0x0fb00f50, "fnmscd%c\t%z1, %z2, %z0"},
  338. {FPU_VFP_EXT_V1xD, 0x0e200a00, 0x0fb00f50, "fmuls%c\t%y1, %y2, %y0"},
  339. {FPU_VFP_EXT_V1xD, 0x0e200a40, 0x0fb00f50, "fnmuls%c\t%y1, %y2, %y0"},
  340. {FPU_VFP_EXT_V1, 0x0e200b00, 0x0fb00f50, "fmuld%c\t%z1, %z2, %z0"},
  341. {FPU_VFP_EXT_V1, 0x0e200b40, 0x0fb00f50, "fnmuld%c\t%z1, %z2, %z0"},
  342. {FPU_VFP_EXT_V1xD, 0x0e300a00, 0x0fb00f50, "fadds%c\t%y1, %y2, %y0"},
  343. {FPU_VFP_EXT_V1xD, 0x0e300a40, 0x0fb00f50, "fsubs%c\t%y1, %y2, %y0"},
  344. {FPU_VFP_EXT_V1, 0x0e300b00, 0x0fb00f50, "faddd%c\t%z1, %z2, %z0"},
  345. {FPU_VFP_EXT_V1, 0x0e300b40, 0x0fb00f50, "fsubd%c\t%z1, %z2, %z0"},
  346. {FPU_VFP_EXT_V1xD, 0x0e800a00, 0x0fb00f50, "fdivs%c\t%y1, %y2, %y0"},
  347. {FPU_VFP_EXT_V1, 0x0e800b00, 0x0fb00f50, "fdivd%c\t%z1, %z2, %z0"},
  348. {FPU_VFP_EXT_V1xD, 0x0d200a00, 0x0fb00f00, "fstmdbs%c\t%16-19r!, %y3"},
  349. {FPU_VFP_EXT_V1xD, 0x0d200b00, 0x0fb00f00, "fstmdb%0?xd%c\t%16-19r!, %z3"},
  350. {FPU_VFP_EXT_V1xD, 0x0d300a00, 0x0fb00f00, "fldmdbs%c\t%16-19r!, %y3"},
  351. {FPU_VFP_EXT_V1xD, 0x0d300b00, 0x0fb00f00, "fldmdb%0?xd%c\t%16-19r!, %z3"},
  352. {FPU_VFP_EXT_V1xD, 0x0d000a00, 0x0f300f00, "fsts%c\t%y1, %A"},
  353. {FPU_VFP_EXT_V1, 0x0d000b00, 0x0f300f00, "fstd%c\t%z1, %A"},
  354. {FPU_VFP_EXT_V1xD, 0x0d100a00, 0x0f300f00, "flds%c\t%y1, %A"},
  355. {FPU_VFP_EXT_V1, 0x0d100b00, 0x0f300f00, "fldd%c\t%z1, %A"},
  356. {FPU_VFP_EXT_V1xD, 0x0c800a00, 0x0f900f00, "fstmias%c\t%16-19r%21'!, %y3"},
  357. {FPU_VFP_EXT_V1xD, 0x0c800b00, 0x0f900f00, "fstmia%0?xd%c\t%16-19r%21'!, %z3"},
  358. {FPU_VFP_EXT_V1xD, 0x0c900a00, 0x0f900f00, "fldmias%c\t%16-19r%21'!, %y3"},
  359. {FPU_VFP_EXT_V1xD, 0x0c900b00, 0x0f900f00, "fldmia%0?xd%c\t%16-19r%21'!, %z3"},
  360. /* Cirrus coprocessor instructions. */
  361. {ARM_CEXT_MAVERICK, 0x0d100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"},
  362. {ARM_CEXT_MAVERICK, 0x0c100400, 0x0f500f00, "cfldrs%c\tmvf%12-15d, %A"},
  363. {ARM_CEXT_MAVERICK, 0x0d500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"},
  364. {ARM_CEXT_MAVERICK, 0x0c500400, 0x0f500f00, "cfldrd%c\tmvd%12-15d, %A"},
  365. {ARM_CEXT_MAVERICK, 0x0d100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"},
  366. {ARM_CEXT_MAVERICK, 0x0c100500, 0x0f500f00, "cfldr32%c\tmvfx%12-15d, %A"},
  367. {ARM_CEXT_MAVERICK, 0x0d500500, 0x0f500f00, "cfldr64%c\tmvdx%12-15d, %A"},
  368. {ARM_CEXT_MAVERICK, 0x0c500500, 0x0f500f00, "cfldr64%c\tmvdx%12-15d, %A"},
  369. {ARM_CEXT_MAVERICK, 0x0d000400, 0x0f500f00, "cfstrs%c\tmvf%12-15d, %A"},
  370. {ARM_CEXT_MAVERICK, 0x0c000400, 0x0f500f00, "cfstrs%c\tmvf%12-15d, %A"},
  371. {ARM_CEXT_MAVERICK, 0x0d400400, 0x0f500f00, "cfstrd%c\tmvd%12-15d, %A"},
  372. {ARM_CEXT_MAVERICK, 0x0c400400, 0x0f500f00, "cfstrd%c\tmvd%12-15d, %A"},
  373. {ARM_CEXT_MAVERICK, 0x0d000500, 0x0f500f00, "cfstr32%c\tmvfx%12-15d, %A"},
  374. {ARM_CEXT_MAVERICK, 0x0c000500, 0x0f500f00, "cfstr32%c\tmvfx%12-15d, %A"},
  375. {ARM_CEXT_MAVERICK, 0x0d400500, 0x0f500f00, "cfstr64%c\tmvdx%12-15d, %A"},
  376. {ARM_CEXT_MAVERICK, 0x0c400500, 0x0f500f00, "cfstr64%c\tmvdx%12-15d, %A"},
  377. {ARM_CEXT_MAVERICK, 0x0e000450, 0x0ff00ff0, "cfmvsr%c\tmvf%16-19d, %12-15r"},
  378. {ARM_CEXT_MAVERICK, 0x0e100450, 0x0ff00ff0, "cfmvrs%c\t%12-15r, mvf%16-19d"},
  379. {ARM_CEXT_MAVERICK, 0x0e000410, 0x0ff00ff0, "cfmvdlr%c\tmvd%16-19d, %12-15r"},
  380. {ARM_CEXT_MAVERICK, 0x0e100410, 0x0ff00ff0, "cfmvrdl%c\t%12-15r, mvd%16-19d"},
  381. {ARM_CEXT_MAVERICK, 0x0e000430, 0x0ff00ff0, "cfmvdhr%c\tmvd%16-19d, %12-15r"},
  382. {ARM_CEXT_MAVERICK, 0x0e100430, 0x0ff00fff, "cfmvrdh%c\t%12-15r, mvd%16-19d"},
  383. {ARM_CEXT_MAVERICK, 0x0e000510, 0x0ff00fff, "cfmv64lr%c\tmvdx%16-19d, %12-15r"},
  384. {ARM_CEXT_MAVERICK, 0x0e100510, 0x0ff00fff, "cfmvr64l%c\t%12-15r, mvdx%16-19d"},
  385. {ARM_CEXT_MAVERICK, 0x0e000530, 0x0ff00fff, "cfmv64hr%c\tmvdx%16-19d, %12-15r"},
  386. {ARM_CEXT_MAVERICK, 0x0e100530, 0x0ff00fff, "cfmvr64h%c\t%12-15r, mvdx%16-19d"},
  387. {ARM_CEXT_MAVERICK, 0x0e200440, 0x0ff00fff, "cfmval32%c\tmvax%12-15d, mvfx%16-19d"},
  388. {ARM_CEXT_MAVERICK, 0x0e100440, 0x0ff00fff, "cfmv32al%c\tmvfx%12-15d, mvax%16-19d"},
  389. {ARM_CEXT_MAVERICK, 0x0e200460, 0x0ff00fff, "cfmvam32%c\tmvax%12-15d, mvfx%16-19d"},
  390. {ARM_CEXT_MAVERICK, 0x0e100460, 0x0ff00fff, "cfmv32am%c\tmvfx%12-15d, mvax%16-19d"},
  391. {ARM_CEXT_MAVERICK, 0x0e200480, 0x0ff00fff, "cfmvah32%c\tmvax%12-15d, mvfx%16-19d"},
  392. {ARM_CEXT_MAVERICK, 0x0e100480, 0x0ff00fff, "cfmv32ah%c\tmvfx%12-15d, mvax%16-19d"},
  393. {ARM_CEXT_MAVERICK, 0x0e2004a0, 0x0ff00fff, "cfmva32%c\tmvax%12-15d, mvfx%16-19d"},
  394. {ARM_CEXT_MAVERICK, 0x0e1004a0, 0x0ff00fff, "cfmv32a%c\tmvfx%12-15d, mvax%16-19d"},
  395. {ARM_CEXT_MAVERICK, 0x0e2004c0, 0x0ff00fff, "cfmva64%c\tmvax%12-15d, mvdx%16-19d"},
  396. {ARM_CEXT_MAVERICK, 0x0e1004c0, 0x0ff00fff, "cfmv64a%c\tmvdx%12-15d, mvax%16-19d"},
  397. {ARM_CEXT_MAVERICK, 0x0e2004e0, 0x0fff0fff, "cfmvsc32%c\tdspsc, mvdx%12-15d"},
  398. {ARM_CEXT_MAVERICK, 0x0e1004e0, 0x0fff0fff, "cfmv32sc%c\tmvdx%12-15d, dspsc"},
  399. {ARM_CEXT_MAVERICK, 0x0e000400, 0x0ff00fff, "cfcpys%c\tmvf%12-15d, mvf%16-19d"},
  400. {ARM_CEXT_MAVERICK, 0x0e000420, 0x0ff00fff, "cfcpyd%c\tmvd%12-15d, mvd%16-19d"},
  401. {ARM_CEXT_MAVERICK, 0x0e000460, 0x0ff00fff, "cfcvtsd%c\tmvd%12-15d, mvf%16-19d"},
  402. {ARM_CEXT_MAVERICK, 0x0e000440, 0x0ff00fff, "cfcvtds%c\tmvf%12-15d, mvd%16-19d"},
  403. {ARM_CEXT_MAVERICK, 0x0e000480, 0x0ff00fff, "cfcvt32s%c\tmvf%12-15d, mvfx%16-19d"},
  404. {ARM_CEXT_MAVERICK, 0x0e0004a0, 0x0ff00fff, "cfcvt32d%c\tmvd%12-15d, mvfx%16-19d"},
  405. {ARM_CEXT_MAVERICK, 0x0e0004c0, 0x0ff00fff, "cfcvt64s%c\tmvf%12-15d, mvdx%16-19d"},
  406. {ARM_CEXT_MAVERICK, 0x0e0004e0, 0x0ff00fff, "cfcvt64d%c\tmvd%12-15d, mvdx%16-19d"},
  407. {ARM_CEXT_MAVERICK, 0x0e100580, 0x0ff00fff, "cfcvts32%c\tmvfx%12-15d, mvf%16-19d"},
  408. {ARM_CEXT_MAVERICK, 0x0e1005a0, 0x0ff00fff, "cfcvtd32%c\tmvfx%12-15d, mvd%16-19d"},
  409. {ARM_CEXT_MAVERICK, 0x0e1005c0, 0x0ff00fff, "cftruncs32%c\tmvfx%12-15d, mvf%16-19d"},
  410. {ARM_CEXT_MAVERICK, 0x0e1005e0, 0x0ff00fff, "cftruncd32%c\tmvfx%12-15d, mvd%16-19d"},
  411. {ARM_CEXT_MAVERICK, 0x0e000550, 0x0ff00ff0, "cfrshl32%c\tmvfx%16-19d, mvfx%0-3d, %12-15r"},
  412. {ARM_CEXT_MAVERICK, 0x0e000570, 0x0ff00ff0, "cfrshl64%c\tmvdx%16-19d, mvdx%0-3d, %12-15r"},
  413. {ARM_CEXT_MAVERICK, 0x0e000500, 0x0ff00f10, "cfsh32%c\tmvfx%12-15d, mvfx%16-19d, #%I"},
  414. {ARM_CEXT_MAVERICK, 0x0e200500, 0x0ff00f10, "cfsh64%c\tmvdx%12-15d, mvdx%16-19d, #%I"},
  415. {ARM_CEXT_MAVERICK, 0x0e100490, 0x0ff00ff0, "cfcmps%c\t%12-15r, mvf%16-19d, mvf%0-3d"},
  416. {ARM_CEXT_MAVERICK, 0x0e1004b0, 0x0ff00ff0, "cfcmpd%c\t%12-15r, mvd%16-19d, mvd%0-3d"},
  417. {ARM_CEXT_MAVERICK, 0x0e100590, 0x0ff00ff0, "cfcmp32%c\t%12-15r, mvfx%16-19d, mvfx%0-3d"},
  418. {ARM_CEXT_MAVERICK, 0x0e1005b0, 0x0ff00ff0, "cfcmp64%c\t%12-15r, mvdx%16-19d, mvdx%0-3d"},
  419. {ARM_CEXT_MAVERICK, 0x0e300400, 0x0ff00fff, "cfabss%c\tmvf%12-15d, mvf%16-19d"},
  420. {ARM_CEXT_MAVERICK, 0x0e300420, 0x0ff00fff, "cfabsd%c\tmvd%12-15d, mvd%16-19d"},
  421. {ARM_CEXT_MAVERICK, 0x0e300440, 0x0ff00fff, "cfnegs%c\tmvf%12-15d, mvf%16-19d"},
  422. {ARM_CEXT_MAVERICK, 0x0e300460, 0x0ff00fff, "cfnegd%c\tmvd%12-15d, mvd%16-19d"},
  423. {ARM_CEXT_MAVERICK, 0x0e300480, 0x0ff00ff0, "cfadds%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"},
  424. {ARM_CEXT_MAVERICK, 0x0e3004a0, 0x0ff00ff0, "cfaddd%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"},
  425. {ARM_CEXT_MAVERICK, 0x0e3004c0, 0x0ff00ff0, "cfsubs%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"},
  426. {ARM_CEXT_MAVERICK, 0x0e3004e0, 0x0ff00ff0, "cfsubd%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"},
  427. {ARM_CEXT_MAVERICK, 0x0e100400, 0x0ff00ff0, "cfmuls%c\tmvf%12-15d, mvf%16-19d, mvf%0-3d"},
  428. {ARM_CEXT_MAVERICK, 0x0e100420, 0x0ff00ff0, "cfmuld%c\tmvd%12-15d, mvd%16-19d, mvd%0-3d"},
  429. {ARM_CEXT_MAVERICK, 0x0e300500, 0x0ff00fff, "cfabs32%c\tmvfx%12-15d, mvfx%16-19d"},
  430. {ARM_CEXT_MAVERICK, 0x0e300520, 0x0ff00fff, "cfabs64%c\tmvdx%12-15d, mvdx%16-19d"},
  431. {ARM_CEXT_MAVERICK, 0x0e300540, 0x0ff00fff, "cfneg32%c\tmvfx%12-15d, mvfx%16-19d"},
  432. {ARM_CEXT_MAVERICK, 0x0e300560, 0x0ff00fff, "cfneg64%c\tmvdx%12-15d, mvdx%16-19d"},
  433. {ARM_CEXT_MAVERICK, 0x0e300580, 0x0ff00ff0, "cfadd32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  434. {ARM_CEXT_MAVERICK, 0x0e3005a0, 0x0ff00ff0, "cfadd64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"},
  435. {ARM_CEXT_MAVERICK, 0x0e3005c0, 0x0ff00ff0, "cfsub32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  436. {ARM_CEXT_MAVERICK, 0x0e3005e0, 0x0ff00ff0, "cfsub64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"},
  437. {ARM_CEXT_MAVERICK, 0x0e100500, 0x0ff00ff0, "cfmul32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  438. {ARM_CEXT_MAVERICK, 0x0e100520, 0x0ff00ff0, "cfmul64%c\tmvdx%12-15d, mvdx%16-19d, mvdx%0-3d"},
  439. {ARM_CEXT_MAVERICK, 0x0e100540, 0x0ff00ff0, "cfmac32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  440. {ARM_CEXT_MAVERICK, 0x0e100560, 0x0ff00ff0, "cfmsc32%c\tmvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  441. {ARM_CEXT_MAVERICK, 0x0e000600, 0x0ff00f10, "cfmadd32%c\tmvax%5-7d, mvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  442. {ARM_CEXT_MAVERICK, 0x0e100600, 0x0ff00f10, "cfmsub32%c\tmvax%5-7d, mvfx%12-15d, mvfx%16-19d, mvfx%0-3d"},
  443. {ARM_CEXT_MAVERICK, 0x0e200600, 0x0ff00f10, "cfmadda32%c\tmvax%5-7d, mvax%12-15d, mvfx%16-19d, mvfx%0-3d"},
  444. {ARM_CEXT_MAVERICK, 0x0e300600, 0x0ff00f10, "cfmsuba32%c\tmvax%5-7d, mvax%12-15d, mvfx%16-19d, mvfx%0-3d"},
  445. /* Generic coprocessor instructions */
  446. {ARM_EXT_V2, 0x0c400000, 0x0ff00000, "mcrr%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
  447. {ARM_EXT_V2, 0x0c500000, 0x0ff00000, "mrrc%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
  448. {ARM_EXT_V2, 0x0e000000, 0x0f000010, "cdp%c\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"},
  449. {ARM_EXT_V2, 0x0e100010, 0x0f100010, "mrc%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
  450. {ARM_EXT_V2, 0x0e000010, 0x0f100010, "mcr%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
  451. {ARM_EXT_V2, 0x0c000000, 0x0e100000, "stc%22'l%c\t%8-11d, cr%12-15d, %A"},
  452. {ARM_EXT_V2, 0x0c100000, 0x0e100000, "ldc%22'l%c\t%8-11d, cr%12-15d, %A"},
  453. /* V6 coprocessor instructions */
  454. {ARM_EXT_V6, 0xfc500000, 0xfff00000, "mrrc2%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
  455. {ARM_EXT_V6, 0xfc400000, 0xfff00000, "mcrr2%c\t%8-11d, %4-7d, %12-15r, %16-19r, cr%0-3d"},
  456. /* V5 coprocessor instructions */
  457. {ARM_EXT_V5, 0xfc100000, 0xfe100000, "ldc2%22'l%c\t%8-11d, cr%12-15d, %A"},
  458. {ARM_EXT_V5, 0xfc000000, 0xfe100000, "stc2%22'l%c\t%8-11d, cr%12-15d, %A"},
  459. {ARM_EXT_V5, 0xfe000000, 0xff000010, "cdp2%c\t%8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}"},
  460. {ARM_EXT_V5, 0xfe000010, 0xff100010, "mcr2%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
  461. {ARM_EXT_V5, 0xfe100010, 0xff100010, "mrc2%c\t%8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}"},
  462. {0, 0, 0, 0}
  463. };
  464. /* Neon opcode table: This does not encode the top byte -- that is
  465. checked by the print_insn_neon routine, as it depends on whether we are
  466. doing thumb32 or arm32 disassembly. */
  467. /* print_insn_neon recognizes the following format control codes:
  468. %% %
  469. %c print condition code
  470. %A print v{st,ld}[1234] operands
  471. %B print v{st,ld}[1234] any one operands
  472. %C print v{st,ld}[1234] single->all operands
  473. %D print scalar
  474. %E print vmov, vmvn, vorr, vbic encoded constant
  475. %F print vtbl,vtbx register list
  476. %<bitfield>r print as an ARM register
  477. %<bitfield>d print the bitfield in decimal
  478. %<bitfield>e print the 2^N - bitfield in decimal
  479. %<bitfield>D print as a NEON D register
  480. %<bitfield>Q print as a NEON Q register
  481. %<bitfield>R print as a NEON D or Q register
  482. %<bitfield>Sn print byte scaled width limited by n
  483. %<bitfield>Tn print short scaled width limited by n
  484. %<bitfield>Un print long scaled width limited by n
  485. %<bitfield>'c print specified char iff bitfield is all ones
  486. %<bitfield>`c print specified char iff bitfield is all zeroes
  487. %<bitfield>?ab... select from array of values in big endian order */
  488. static const struct opcode32 neon_opcodes[] =
  489. {
  490. /* Extract */
  491. {FPU_NEON_EXT_V1, 0xf2b00840, 0xffb00850, "vext%c.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"},
  492. {FPU_NEON_EXT_V1, 0xf2b00000, 0xffb00810, "vext%c.8\t%12-15,22R, %16-19,7R, %0-3,5R, #%8-11d"},
  493. /* Move data element to all lanes */
  494. {FPU_NEON_EXT_V1, 0xf3b40c00, 0xffb70f90, "vdup%c.32\t%12-15,22R, %0-3,5D[%19d]"},
  495. {FPU_NEON_EXT_V1, 0xf3b20c00, 0xffb30f90, "vdup%c.16\t%12-15,22R, %0-3,5D[%18-19d]"},
  496. {FPU_NEON_EXT_V1, 0xf3b10c00, 0xffb10f90, "vdup%c.8\t%12-15,22R, %0-3,5D[%17-19d]"},
  497. /* Table lookup */
  498. {FPU_NEON_EXT_V1, 0xf3b00800, 0xffb00c50, "vtbl%c.8\t%12-15,22D, %F, %0-3,5D"},
  499. {FPU_NEON_EXT_V1, 0xf3b00840, 0xffb00c50, "vtbx%c.8\t%12-15,22D, %F, %0-3,5D"},
  500. /* Two registers, miscellaneous */
  501. {FPU_NEON_EXT_V1, 0xf2880a10, 0xfebf0fd0, "vmovl%c.%24?us8\t%12-15,22Q, %0-3,5D"},
  502. {FPU_NEON_EXT_V1, 0xf2900a10, 0xfebf0fd0, "vmovl%c.%24?us16\t%12-15,22Q, %0-3,5D"},
  503. {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfebf0fd0, "vmovl%c.%24?us32\t%12-15,22Q, %0-3,5D"},
  504. {FPU_NEON_EXT_V1, 0xf3b00500, 0xffbf0f90, "vcnt%c.8\t%12-15,22R, %0-3,5R"},
  505. {FPU_NEON_EXT_V1, 0xf3b00580, 0xffbf0f90, "vmvn%c\t%12-15,22R, %0-3,5R"},
  506. {FPU_NEON_EXT_V1, 0xf3b20000, 0xffbf0f90, "vswp%c\t%12-15,22R, %0-3,5R"},
  507. {FPU_NEON_EXT_V1, 0xf3b20200, 0xffb30fd0, "vmovn%c.i%18-19T2\t%12-15,22D, %0-3,5Q"},
  508. {FPU_NEON_EXT_V1, 0xf3b20240, 0xffb30fd0, "vqmovun%c.s%18-19T2\t%12-15,22D, %0-3,5Q"},
  509. {FPU_NEON_EXT_V1, 0xf3b20280, 0xffb30fd0, "vqmovn%c.s%18-19T2\t%12-15,22D, %0-3,5Q"},
  510. {FPU_NEON_EXT_V1, 0xf3b202c0, 0xffb30fd0, "vqmovn%c.u%18-19T2\t%12-15,22D, %0-3,5Q"},
  511. {FPU_NEON_EXT_V1, 0xf3b20300, 0xffb30fd0, "vshll%c.i%18-19S2\t%12-15,22Q, %0-3,5D, #%18-19S2"},
  512. {FPU_NEON_EXT_V1, 0xf3bb0400, 0xffbf0e90, "vrecpe%c.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"},
  513. {FPU_NEON_EXT_V1, 0xf3bb0480, 0xffbf0e90, "vrsqrte%c.%8?fu%18-19S2\t%12-15,22R, %0-3,5R"},
  514. {FPU_NEON_EXT_V1, 0xf3b00000, 0xffb30f90, "vrev64%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  515. {FPU_NEON_EXT_V1, 0xf3b00080, 0xffb30f90, "vrev32%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  516. {FPU_NEON_EXT_V1, 0xf3b00100, 0xffb30f90, "vrev16%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  517. {FPU_NEON_EXT_V1, 0xf3b00400, 0xffb30f90, "vcls%c.s%18-19S2\t%12-15,22R, %0-3,5R"},
  518. {FPU_NEON_EXT_V1, 0xf3b00480, 0xffb30f90, "vclz%c.i%18-19S2\t%12-15,22R, %0-3,5R"},
  519. {FPU_NEON_EXT_V1, 0xf3b00700, 0xffb30f90, "vqabs%c.s%18-19S2\t%12-15,22R, %0-3,5R"},
  520. {FPU_NEON_EXT_V1, 0xf3b00780, 0xffb30f90, "vqneg%c.s%18-19S2\t%12-15,22R, %0-3,5R"},
  521. {FPU_NEON_EXT_V1, 0xf3b20080, 0xffb30f90, "vtrn%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  522. {FPU_NEON_EXT_V1, 0xf3b20100, 0xffb30f90, "vuzp%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  523. {FPU_NEON_EXT_V1, 0xf3b20180, 0xffb30f90, "vzip%c.%18-19S2\t%12-15,22R, %0-3,5R"},
  524. {FPU_NEON_EXT_V1, 0xf3b10000, 0xffb30b90, "vcgt%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"},
  525. {FPU_NEON_EXT_V1, 0xf3b10080, 0xffb30b90, "vcge%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"},
  526. {FPU_NEON_EXT_V1, 0xf3b10100, 0xffb30b90, "vceq%c.%10?fi%18-19S2\t%12-15,22R, %0-3,5R, #0"},
  527. {FPU_NEON_EXT_V1, 0xf3b10180, 0xffb30b90, "vcle%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"},
  528. {FPU_NEON_EXT_V1, 0xf3b10200, 0xffb30b90, "vclt%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R, #0"},
  529. {FPU_NEON_EXT_V1, 0xf3b10300, 0xffb30b90, "vabs%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"},
  530. {FPU_NEON_EXT_V1, 0xf3b10380, 0xffb30b90, "vneg%c.%10?fs%18-19S2\t%12-15,22R, %0-3,5R"},
  531. {FPU_NEON_EXT_V1, 0xf3b00200, 0xffb30f10, "vpaddl%c.%7?us%18-19S2\t%12-15,22R, %0-3,5R"},
  532. {FPU_NEON_EXT_V1, 0xf3b00600, 0xffb30f10, "vpadal%c.%7?us%18-19S2\t%12-15,22R, %0-3,5R"},
  533. {FPU_NEON_EXT_V1, 0xf3b30600, 0xffb30e10, "vcvt%c.%7-8?usff%18-19Sa.%7-8?ffus%18-19Sa\t%12-15,22R, %0-3,5R"},
  534. /* Three registers of the same length */
  535. {FPU_NEON_EXT_V1, 0xf2000110, 0xffb00f10, "vand%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  536. {FPU_NEON_EXT_V1, 0xf2100110, 0xffb00f10, "vbic%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  537. {FPU_NEON_EXT_V1, 0xf2200110, 0xffb00f10, "vorr%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  538. {FPU_NEON_EXT_V1, 0xf2300110, 0xffb00f10, "vorn%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  539. {FPU_NEON_EXT_V1, 0xf3000110, 0xffb00f10, "veor%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  540. {FPU_NEON_EXT_V1, 0xf3100110, 0xffb00f10, "vbsl%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  541. {FPU_NEON_EXT_V1, 0xf3200110, 0xffb00f10, "vbit%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  542. {FPU_NEON_EXT_V1, 0xf3300110, 0xffb00f10, "vbif%c\t%12-15,22R, %16-19,7R, %0-3,5R"},
  543. {FPU_NEON_EXT_V1, 0xf2000d00, 0xffa00f10, "vadd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  544. {FPU_NEON_EXT_V1, 0xf2000d10, 0xffa00f10, "vmla%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  545. {FPU_NEON_EXT_V1, 0xf2000e00, 0xffa00f10, "vceq%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  546. {FPU_NEON_EXT_V1, 0xf2000f00, 0xffa00f10, "vmax%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  547. {FPU_NEON_EXT_V1, 0xf2000f10, 0xffa00f10, "vrecps%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  548. {FPU_NEON_EXT_V1, 0xf2200d00, 0xffa00f10, "vsub%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  549. {FPU_NEON_EXT_V1, 0xf2200d10, 0xffa00f10, "vmls%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  550. {FPU_NEON_EXT_V1, 0xf2200f00, 0xffa00f10, "vmin%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  551. {FPU_NEON_EXT_V1, 0xf2200f10, 0xffa00f10, "vrsqrts%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  552. {FPU_NEON_EXT_V1, 0xf3000d00, 0xffa00f10, "vpadd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  553. {FPU_NEON_EXT_V1, 0xf3000d10, 0xffa00f10, "vmul%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  554. {FPU_NEON_EXT_V1, 0xf3000e00, 0xffa00f10, "vcge%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  555. {FPU_NEON_EXT_V1, 0xf3000e10, 0xffa00f10, "vacge%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  556. {FPU_NEON_EXT_V1, 0xf3000f00, 0xffa00f10, "vpmax%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  557. {FPU_NEON_EXT_V1, 0xf3200d00, 0xffa00f10, "vabd%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  558. {FPU_NEON_EXT_V1, 0xf3200e00, 0xffa00f10, "vcgt%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  559. {FPU_NEON_EXT_V1, 0xf3200e10, 0xffa00f10, "vacgt%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  560. {FPU_NEON_EXT_V1, 0xf3200f00, 0xffa00f10, "vpmin%c.f%20U0\t%12-15,22R, %16-19,7R, %0-3,5R"},
  561. {FPU_NEON_EXT_V1, 0xf2000800, 0xff800f10, "vadd%c.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"},
  562. {FPU_NEON_EXT_V1, 0xf2000810, 0xff800f10, "vtst%c.%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  563. {FPU_NEON_EXT_V1, 0xf2000900, 0xff800f10, "vmla%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  564. {FPU_NEON_EXT_V1, 0xf2000b00, 0xff800f10, "vqdmulh%c.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"},
  565. {FPU_NEON_EXT_V1, 0xf2000b10, 0xff800f10, "vpadd%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  566. {FPU_NEON_EXT_V1, 0xf3000800, 0xff800f10, "vsub%c.i%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"},
  567. {FPU_NEON_EXT_V1, 0xf3000810, 0xff800f10, "vceq%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  568. {FPU_NEON_EXT_V1, 0xf3000900, 0xff800f10, "vmls%c.i%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  569. {FPU_NEON_EXT_V1, 0xf3000b00, 0xff800f10, "vqrdmulh%c.s%20-21S6\t%12-15,22R, %16-19,7R, %0-3,5R"},
  570. {FPU_NEON_EXT_V1, 0xf2000000, 0xfe800f10, "vhadd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  571. {FPU_NEON_EXT_V1, 0xf2000010, 0xfe800f10, "vqadd%c.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"},
  572. {FPU_NEON_EXT_V1, 0xf2000100, 0xfe800f10, "vrhadd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  573. {FPU_NEON_EXT_V1, 0xf2000200, 0xfe800f10, "vhsub%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  574. {FPU_NEON_EXT_V1, 0xf2000210, 0xfe800f10, "vqsub%c.%24?us%20-21S3\t%12-15,22R, %16-19,7R, %0-3,5R"},
  575. {FPU_NEON_EXT_V1, 0xf2000300, 0xfe800f10, "vcgt%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  576. {FPU_NEON_EXT_V1, 0xf2000310, 0xfe800f10, "vcge%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  577. {FPU_NEON_EXT_V1, 0xf2000400, 0xfe800f10, "vshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"},
  578. {FPU_NEON_EXT_V1, 0xf2000410, 0xfe800f10, "vqshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"},
  579. {FPU_NEON_EXT_V1, 0xf2000500, 0xfe800f10, "vrshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"},
  580. {FPU_NEON_EXT_V1, 0xf2000510, 0xfe800f10, "vqrshl%c.%24?us%20-21S3\t%12-15,22R, %0-3,5R, %16-19,7R"},
  581. {FPU_NEON_EXT_V1, 0xf2000600, 0xfe800f10, "vmax%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  582. {FPU_NEON_EXT_V1, 0xf2000610, 0xfe800f10, "vmin%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  583. {FPU_NEON_EXT_V1, 0xf2000700, 0xfe800f10, "vabd%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  584. {FPU_NEON_EXT_V1, 0xf2000710, 0xfe800f10, "vaba%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  585. {FPU_NEON_EXT_V1, 0xf2000910, 0xfe800f10, "vmul%c.%24?pi%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  586. {FPU_NEON_EXT_V1, 0xf2000a00, 0xfe800f10, "vpmax%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  587. {FPU_NEON_EXT_V1, 0xf2000a10, 0xfe800f10, "vpmin%c.%24?us%20-21S2\t%12-15,22R, %16-19,7R, %0-3,5R"},
  588. /* One register and an immediate value */
  589. {FPU_NEON_EXT_V1, 0xf2800e10, 0xfeb80fb0, "vmov%c.i8\t%12-15,22R, %E"},
  590. {FPU_NEON_EXT_V1, 0xf2800e30, 0xfeb80fb0, "vmov%c.i64\t%12-15,22R, %E"},
  591. {FPU_NEON_EXT_V1, 0xf2800f10, 0xfeb80fb0, "vmov%c.f32\t%12-15,22R, %E"},
  592. {FPU_NEON_EXT_V1, 0xf2800810, 0xfeb80db0, "vmov%c.i16\t%12-15,22R, %E"},
  593. {FPU_NEON_EXT_V1, 0xf2800830, 0xfeb80db0, "vmvn%c.i16\t%12-15,22R, %E"},
  594. {FPU_NEON_EXT_V1, 0xf2800910, 0xfeb80db0, "vorr%c.i16\t%12-15,22R, %E"},
  595. {FPU_NEON_EXT_V1, 0xf2800930, 0xfeb80db0, "vbic%c.i16\t%12-15,22R, %E"},
  596. {FPU_NEON_EXT_V1, 0xf2800c10, 0xfeb80eb0, "vmov%c.i32\t%12-15,22R, %E"},
  597. {FPU_NEON_EXT_V1, 0xf2800c30, 0xfeb80eb0, "vmvn%c.i32\t%12-15,22R, %E"},
  598. {FPU_NEON_EXT_V1, 0xf2800110, 0xfeb809b0, "vorr%c.i32\t%12-15,22R, %E"},
  599. {FPU_NEON_EXT_V1, 0xf2800130, 0xfeb809b0, "vbic%c.i32\t%12-15,22R, %E"},
  600. {FPU_NEON_EXT_V1, 0xf2800010, 0xfeb808b0, "vmov%c.i32\t%12-15,22R, %E"},
  601. {FPU_NEON_EXT_V1, 0xf2800030, 0xfeb808b0, "vmvn%c.i32\t%12-15,22R, %E"},
  602. /* Two registers and a shift amount */
  603. {FPU_NEON_EXT_V1, 0xf2880810, 0xffb80fd0, "vshrn%c.i16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  604. {FPU_NEON_EXT_V1, 0xf2880850, 0xffb80fd0, "vrshrn%c.i16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  605. {FPU_NEON_EXT_V1, 0xf2880810, 0xfeb80fd0, "vqshrun%c.s16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  606. {FPU_NEON_EXT_V1, 0xf2880850, 0xfeb80fd0, "vqrshrun%c.s16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  607. {FPU_NEON_EXT_V1, 0xf2880910, 0xfeb80fd0, "vqshrn%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  608. {FPU_NEON_EXT_V1, 0xf2880950, 0xfeb80fd0, "vqrshrn%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-18e"},
  609. {FPU_NEON_EXT_V1, 0xf2880a10, 0xfeb80fd0, "vshll%c.%24?us8\t%12-15,22D, %0-3,5Q, #%16-18d"},
  610. {FPU_NEON_EXT_V1, 0xf2900810, 0xffb00fd0, "vshrn%c.i32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  611. {FPU_NEON_EXT_V1, 0xf2900850, 0xffb00fd0, "vrshrn%c.i32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  612. {FPU_NEON_EXT_V1, 0xf2880510, 0xffb80f90, "vshl%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"},
  613. {FPU_NEON_EXT_V1, 0xf3880410, 0xffb80f90, "vsri%c.8\t%12-15,22R, %0-3,5R, #%16-18e"},
  614. {FPU_NEON_EXT_V1, 0xf3880510, 0xffb80f90, "vsli%c.8\t%12-15,22R, %0-3,5R, #%16-18d"},
  615. {FPU_NEON_EXT_V1, 0xf3880610, 0xffb80f90, "vqshlu%c.s8\t%12-15,22R, %0-3,5R, #%16-18d"},
  616. {FPU_NEON_EXT_V1, 0xf2900810, 0xfeb00fd0, "vqshrun%c.s32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  617. {FPU_NEON_EXT_V1, 0xf2900850, 0xfeb00fd0, "vqrshrun%c.s32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  618. {FPU_NEON_EXT_V1, 0xf2900910, 0xfeb00fd0, "vqshrn%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  619. {FPU_NEON_EXT_V1, 0xf2900950, 0xfeb00fd0, "vqrshrn%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-19e"},
  620. {FPU_NEON_EXT_V1, 0xf2900a10, 0xfeb00fd0, "vshll%c.%24?us16\t%12-15,22D, %0-3,5Q, #%16-19d"},
  621. {FPU_NEON_EXT_V1, 0xf2880010, 0xfeb80f90, "vshr%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"},
  622. {FPU_NEON_EXT_V1, 0xf2880110, 0xfeb80f90, "vsra%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"},
  623. {FPU_NEON_EXT_V1, 0xf2880210, 0xfeb80f90, "vrshr%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"},
  624. {FPU_NEON_EXT_V1, 0xf2880310, 0xfeb80f90, "vrsra%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18e"},
  625. {FPU_NEON_EXT_V1, 0xf2880710, 0xfeb80f90, "vqshl%c.%24?us8\t%12-15,22R, %0-3,5R, #%16-18d"},
  626. {FPU_NEON_EXT_V1, 0xf2a00810, 0xffa00fd0, "vshrn%c.i64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  627. {FPU_NEON_EXT_V1, 0xf2a00850, 0xffa00fd0, "vrshrn%c.i64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  628. {FPU_NEON_EXT_V1, 0xf2900510, 0xffb00f90, "vshl%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"},
  629. {FPU_NEON_EXT_V1, 0xf3900410, 0xffb00f90, "vsri%c.16\t%12-15,22R, %0-3,5R, #%16-19e"},
  630. {FPU_NEON_EXT_V1, 0xf3900510, 0xffb00f90, "vsli%c.16\t%12-15,22R, %0-3,5R, #%16-19d"},
  631. {FPU_NEON_EXT_V1, 0xf3900610, 0xffb00f90, "vqshlu%c.s16\t%12-15,22R, %0-3,5R, #%16-19d"},
  632. {FPU_NEON_EXT_V1, 0xf2a00a10, 0xfea00fd0, "vshll%c.%24?us32\t%12-15,22D, %0-3,5Q, #%16-20d"},
  633. {FPU_NEON_EXT_V1, 0xf2900010, 0xfeb00f90, "vshr%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"},
  634. {FPU_NEON_EXT_V1, 0xf2900110, 0xfeb00f90, "vsra%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"},
  635. {FPU_NEON_EXT_V1, 0xf2900210, 0xfeb00f90, "vrshr%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"},
  636. {FPU_NEON_EXT_V1, 0xf2900310, 0xfeb00f90, "vrsra%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19e"},
  637. {FPU_NEON_EXT_V1, 0xf2900710, 0xfeb00f90, "vqshl%c.%24?us16\t%12-15,22R, %0-3,5R, #%16-19d"},
  638. {FPU_NEON_EXT_V1, 0xf2800810, 0xfec00fd0, "vqshrun%c.s64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  639. {FPU_NEON_EXT_V1, 0xf2800850, 0xfec00fd0, "vqrshrun%c.s64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  640. {FPU_NEON_EXT_V1, 0xf2800910, 0xfec00fd0, "vqshrn%c.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  641. {FPU_NEON_EXT_V1, 0xf2800950, 0xfec00fd0, "vqrshrn%c.%24?us64\t%12-15,22D, %0-3,5Q, #%16-20e"},
  642. {FPU_NEON_EXT_V1, 0xf2a00510, 0xffa00f90, "vshl%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"},
  643. {FPU_NEON_EXT_V1, 0xf3a00410, 0xffa00f90, "vsri%c.32\t%12-15,22R, %0-3,5R, #%16-20e"},
  644. {FPU_NEON_EXT_V1, 0xf3a00510, 0xffa00f90, "vsli%c.32\t%12-15,22R, %0-3,5R, #%16-20d"},
  645. {FPU_NEON_EXT_V1, 0xf3a00610, 0xffa00f90, "vqshlu%c.s32\t%12-15,22R, %0-3,5R, #%16-20d"},
  646. {FPU_NEON_EXT_V1, 0xf2a00010, 0xfea00f90, "vshr%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"},
  647. {FPU_NEON_EXT_V1, 0xf2a00110, 0xfea00f90, "vsra%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"},
  648. {FPU_NEON_EXT_V1, 0xf2a00210, 0xfea00f90, "vrshr%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"},
  649. {FPU_NEON_EXT_V1, 0xf2a00310, 0xfea00f90, "vrsra%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20e"},
  650. {FPU_NEON_EXT_V1, 0xf2a00710, 0xfea00f90, "vqshl%c.%24?us32\t%12-15,22R, %0-3,5R, #%16-20d"},
  651. {FPU_NEON_EXT_V1, 0xf2800590, 0xff800f90, "vshl%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"},
  652. {FPU_NEON_EXT_V1, 0xf3800490, 0xff800f90, "vsri%c.64\t%12-15,22R, %0-3,5R, #%16-21e"},
  653. {FPU_NEON_EXT_V1, 0xf3800590, 0xff800f90, "vsli%c.64\t%12-15,22R, %0-3,5R, #%16-21d"},
  654. {FPU_NEON_EXT_V1, 0xf3800690, 0xff800f90, "vqshlu%c.s64\t%12-15,22R, %0-3,5R, #%16-21d"},
  655. {FPU_NEON_EXT_V1, 0xf2800090, 0xfe800f90, "vshr%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"},
  656. {FPU_NEON_EXT_V1, 0xf2800190, 0xfe800f90, "vsra%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"},
  657. {FPU_NEON_EXT_V1, 0xf2800290, 0xfe800f90, "vrshr%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"},
  658. {FPU_NEON_EXT_V1, 0xf2800390, 0xfe800f90, "vrsra%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21e"},
  659. {FPU_NEON_EXT_V1, 0xf2800790, 0xfe800f90, "vqshl%c.%24?us64\t%12-15,22R, %0-3,5R, #%16-21d"},
  660. {FPU_NEON_EXT_V1, 0xf2a00e10, 0xfea00e90, "vcvt%c.%24,8?usff32.%24,8?ffus32\t%12-15,22R, %0-3,5R, #%16-20e"},
  661. /* Three registers of different lengths */
  662. {FPU_NEON_EXT_V1, 0xf2800e00, 0xfea00f50, "vmull%c.p%20S0\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  663. {FPU_NEON_EXT_V1, 0xf2800400, 0xff800f50, "vaddhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"},
  664. {FPU_NEON_EXT_V1, 0xf2800600, 0xff800f50, "vsubhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"},
  665. {FPU_NEON_EXT_V1, 0xf2800900, 0xff800f50, "vqdmlal%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  666. {FPU_NEON_EXT_V1, 0xf2800b00, 0xff800f50, "vqdmlsl%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  667. {FPU_NEON_EXT_V1, 0xf2800d00, 0xff800f50, "vqdmull%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  668. {FPU_NEON_EXT_V1, 0xf3800400, 0xff800f50, "vraddhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"},
  669. {FPU_NEON_EXT_V1, 0xf3800600, 0xff800f50, "vrsubhn%c.i%20-21T2\t%12-15,22D, %16-19,7Q, %0-3,5Q"},
  670. {FPU_NEON_EXT_V1, 0xf2800000, 0xfe800f50, "vaddl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  671. {FPU_NEON_EXT_V1, 0xf2800100, 0xfe800f50, "vaddw%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"},
  672. {FPU_NEON_EXT_V1, 0xf2800200, 0xfe800f50, "vsubl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  673. {FPU_NEON_EXT_V1, 0xf2800300, 0xfe800f50, "vsubw%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7Q, %0-3,5D"},
  674. {FPU_NEON_EXT_V1, 0xf2800500, 0xfe800f50, "vabal%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  675. {FPU_NEON_EXT_V1, 0xf2800700, 0xfe800f50, "vabdl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  676. {FPU_NEON_EXT_V1, 0xf2800800, 0xfe800f50, "vmlal%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  677. {FPU_NEON_EXT_V1, 0xf2800a00, 0xfe800f50, "vmlsl%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  678. {FPU_NEON_EXT_V1, 0xf2800c00, 0xfe800f50, "vmull%c.%24?us%20-21S2\t%12-15,22Q, %16-19,7D, %0-3,5D"},
  679. /* Two registers and a scalar */
  680. {FPU_NEON_EXT_V1, 0xf2800040, 0xff800f50, "vmla%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  681. {FPU_NEON_EXT_V1, 0xf2800140, 0xff800f50, "vmla%c.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"},
  682. {FPU_NEON_EXT_V1, 0xf2800340, 0xff800f50, "vqdmlal%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  683. {FPU_NEON_EXT_V1, 0xf2800440, 0xff800f50, "vmls%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  684. {FPU_NEON_EXT_V1, 0xf2800540, 0xff800f50, "vmls%c.f%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  685. {FPU_NEON_EXT_V1, 0xf2800740, 0xff800f50, "vqdmlsl%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  686. {FPU_NEON_EXT_V1, 0xf2800840, 0xff800f50, "vmul%c.i%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  687. {FPU_NEON_EXT_V1, 0xf2800940, 0xff800f50, "vmul%c.f%20-21Sa\t%12-15,22D, %16-19,7D, %D"},
  688. {FPU_NEON_EXT_V1, 0xf2800b40, 0xff800f50, "vqdmull%c.s%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  689. {FPU_NEON_EXT_V1, 0xf2800c40, 0xff800f50, "vqdmulh%c.s%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  690. {FPU_NEON_EXT_V1, 0xf2800d40, 0xff800f50, "vqrdmulh%c.s%20-21S6\t%12-15,22D, %16-19,7D, %D"},
  691. {FPU_NEON_EXT_V1, 0xf3800040, 0xff800f50, "vmla%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"},
  692. {FPU_NEON_EXT_V1, 0xf3800140, 0xff800f50, "vmla%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"},
  693. {FPU_NEON_EXT_V1, 0xf3800440, 0xff800f50, "vmls%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"},
  694. {FPU_NEON_EXT_V1, 0xf3800540, 0xff800f50, "vmls%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"},
  695. {FPU_NEON_EXT_V1, 0xf3800840, 0xff800f50, "vmul%c.i%20-21S6\t%12-15,22Q, %16-19,7Q, %D"},
  696. {FPU_NEON_EXT_V1, 0xf3800940, 0xff800f50, "vmul%c.f%20-21Sa\t%12-15,22Q, %16-19,7Q, %D"},
  697. {FPU_NEON_EXT_V1, 0xf3800c40, 0xff800f50, "vqdmulh%c.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"},
  698. {FPU_NEON_EXT_V1, 0xf3800d40, 0xff800f50, "vqrdmulh%c.s%20-21S6\t%12-15,22Q, %16-19,7Q, %D"},
  699. {FPU_NEON_EXT_V1, 0xf2800240, 0xfe800f50, "vmlal%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  700. {FPU_NEON_EXT_V1, 0xf2800640, 0xfe800f50, "vmlsl%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  701. {FPU_NEON_EXT_V1, 0xf2800a40, 0xfe800f50, "vmull%c.%24?us%20-21S6\t%12-15,22Q, %16-19,7D, %D"},
  702. /* Element and structure load/store */
  703. {FPU_NEON_EXT_V1, 0xf4a00fc0, 0xffb00fc0, "vld4%c.32\t%C"},
  704. {FPU_NEON_EXT_V1, 0xf4a00c00, 0xffb00f00, "vld1%c.%6-7S2\t%C"},
  705. {FPU_NEON_EXT_V1, 0xf4a00d00, 0xffb00f00, "vld2%c.%6-7S2\t%C"},
  706. {FPU_NEON_EXT_V1, 0xf4a00e00, 0xffb00f00, "vld3%c.%6-7S2\t%C"},
  707. {FPU_NEON_EXT_V1, 0xf4a00f00, 0xffb00f00, "vld4%c.%6-7S2\t%C"},
  708. {FPU_NEON_EXT_V1, 0xf4000200, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"},
  709. {FPU_NEON_EXT_V1, 0xf4000300, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"},
  710. {FPU_NEON_EXT_V1, 0xf4000400, 0xff900f00, "v%21?ls%21?dt3%c.%6-7S2\t%A"},
  711. {FPU_NEON_EXT_V1, 0xf4000500, 0xff900f00, "v%21?ls%21?dt3%c.%6-7S2\t%A"},
  712. {FPU_NEON_EXT_V1, 0xf4000600, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"},
  713. {FPU_NEON_EXT_V1, 0xf4000700, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"},
  714. {FPU_NEON_EXT_V1, 0xf4000800, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"},
  715. {FPU_NEON_EXT_V1, 0xf4000900, 0xff900f00, "v%21?ls%21?dt2%c.%6-7S2\t%A"},
  716. {FPU_NEON_EXT_V1, 0xf4000a00, 0xff900f00, "v%21?ls%21?dt1%c.%6-7S3\t%A"},
  717. {FPU_NEON_EXT_V1, 0xf4000000, 0xff900e00, "v%21?ls%21?dt4%c.%6-7S2\t%A"},
  718. {FPU_NEON_EXT_V1, 0xf4800000, 0xff900300, "v%21?ls%21?dt1%c.%10-11S2\t%B"},
  719. {FPU_NEON_EXT_V1, 0xf4800100, 0xff900300, "v%21?ls%21?dt2%c.%10-11S2\t%B"},
  720. {FPU_NEON_EXT_V1, 0xf4800200, 0xff900300, "v%21?ls%21?dt3%c.%10-11S2\t%B"},
  721. {FPU_NEON_EXT_V1, 0xf4800300, 0xff900300, "v%21?ls%21?dt4%c.%10-11S2\t%B"},
  722. {0,0 ,0, 0}
  723. };
  724. /* Opcode tables: ARM, 16-bit Thumb, 32-bit Thumb. All three are partially
  725. ordered: they must be searched linearly from the top to obtain a correct
  726. match. */
  727. /* print_insn_arm recognizes the following format control codes:
  728. %% %
  729. %a print address for ldr/str instruction
  730. %s print address for ldr/str halfword/signextend instruction
  731. %b print branch destination
  732. %c print condition code (always bits 28-31)
  733. %m print register mask for ldm/stm instruction
  734. %o print operand2 (immediate or register + shift)
  735. %p print 'p' iff bits 12-15 are 15
  736. %t print 't' iff bit 21 set and bit 24 clear
  737. %B print arm BLX(1) destination
  738. %C print the PSR sub type.
  739. %U print barrier type.
  740. %P print address for pli instruction.
  741. %<bitfield>r print as an ARM register
  742. %<bitfield>d print the bitfield in decimal
  743. %<bitfield>W print the bitfield plus one in decimal
  744. %<bitfield>x print the bitfield in hex
  745. %<bitfield>X print the bitfield as 1 hex digit without leading "0x"
  746. %<bitfield>'c print specified char iff bitfield is all ones
  747. %<bitfield>`c print specified char iff bitfield is all zeroes
  748. %<bitfield>?ab... select from array of values in big endian order
  749. %e print arm SMI operand (bits 0..7,8..19).
  750. %E print the LSB and WIDTH fields of a BFI or BFC instruction.
  751. %V print the 16-bit immediate field of a MOVT or MOVW instruction. */
  752. static const struct opcode32 arm_opcodes[] =
  753. {
  754. /* ARM instructions. */
  755. {ARM_EXT_V1, 0xe1a00000, 0xffffffff, "nop\t\t\t(mov r0,r0)"},
  756. {ARM_EXT_V4T | ARM_EXT_V5, 0x012FFF10, 0x0ffffff0, "bx%c\t%0-3r"},
  757. {ARM_EXT_V2, 0x00000090, 0x0fe000f0, "mul%20's%c\t%16-19r, %0-3r, %8-11r"},
  758. {ARM_EXT_V2, 0x00200090, 0x0fe000f0, "mla%20's%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  759. {ARM_EXT_V2S, 0x01000090, 0x0fb00ff0, "swp%22'b%c\t%12-15r, %0-3r, [%16-19r]"},
  760. {ARM_EXT_V3M, 0x00800090, 0x0fa000f0, "%22?sumull%20's%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  761. {ARM_EXT_V3M, 0x00a00090, 0x0fa000f0, "%22?sumlal%20's%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  762. /* V7 instructions. */
  763. {ARM_EXT_V7, 0xf450f000, 0xfd70f000, "pli\t%P"},
  764. {ARM_EXT_V7, 0x0320f0f0, 0x0ffffff0, "dbg%c\t#%0-3d"},
  765. {ARM_EXT_V7, 0xf57ff050, 0xfffffff0, "dmb\t%U"},
  766. {ARM_EXT_V7, 0xf57ff040, 0xfffffff0, "dsb\t%U"},
  767. {ARM_EXT_V7, 0xf57ff060, 0xfffffff0, "isb\t%U"},
  768. /* ARM V6T2 instructions. */
  769. {ARM_EXT_V6T2, 0x07c0001f, 0x0fe0007f, "bfc%c\t%12-15r, %E"},
  770. {ARM_EXT_V6T2, 0x07c00010, 0x0fe00070, "bfi%c\t%12-15r, %0-3r, %E"},
  771. {ARM_EXT_V6T2, 0x00600090, 0x0ff000f0, "mls%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  772. {ARM_EXT_V6T2, 0x006000b0, 0x0f7000f0, "strht%c\t%12-15r, %s"},
  773. {ARM_EXT_V6T2, 0x00300090, 0x0f300090, "ldr%6's%5?hbt%c\t%12-15r, %s"},
  774. {ARM_EXT_V6T2, 0x03000000, 0x0ff00000, "movw%c\t%12-15r, %V"},
  775. {ARM_EXT_V6T2, 0x03400000, 0x0ff00000, "movt%c\t%12-15r, %V"},
  776. {ARM_EXT_V6T2, 0x06ff0f30, 0x0fff0ff0, "rbit%c\t%12-15r, %0-3r"},
  777. {ARM_EXT_V6T2, 0x07a00050, 0x0fa00070, "%22?usbfx%c\t%12-15r, %0-3r, #%7-11d, #%16-20W"},
  778. /* ARM V6Z instructions. */
  779. {ARM_EXT_V6Z, 0x01600070, 0x0ff000f0, "smc%c\t%e"},
  780. /* ARM V6K instructions. */
  781. {ARM_EXT_V6K, 0xf57ff01f, 0xffffffff, "clrex"},
  782. {ARM_EXT_V6K, 0x01d00f9f, 0x0ff00fff, "ldrexb%c\t%12-15r, [%16-19r]"},
  783. {ARM_EXT_V6K, 0x01b00f9f, 0x0ff00fff, "ldrexd%c\t%12-15r, [%16-19r]"},
  784. {ARM_EXT_V6K, 0x01f00f9f, 0x0ff00fff, "ldrexh%c\t%12-15r, [%16-19r]"},
  785. {ARM_EXT_V6K, 0x01c00f90, 0x0ff00ff0, "strexb%c\t%12-15r, %0-3r, [%16-19r]"},
  786. {ARM_EXT_V6K, 0x01a00f90, 0x0ff00ff0, "strexd%c\t%12-15r, %0-3r, [%16-19r]"},
  787. {ARM_EXT_V6K, 0x01e00f90, 0x0ff00ff0, "strexh%c\t%12-15r, %0-3r, [%16-19r]"},
  788. /* ARM V6K NOP hints. */
  789. {ARM_EXT_V6K, 0x0320f001, 0x0fffffff, "yield%c"},
  790. {ARM_EXT_V6K, 0x0320f002, 0x0fffffff, "wfe%c"},
  791. {ARM_EXT_V6K, 0x0320f003, 0x0fffffff, "wfi%c"},
  792. {ARM_EXT_V6K, 0x0320f004, 0x0fffffff, "sev%c"},
  793. {ARM_EXT_V6K, 0x0320f000, 0x0fffff00, "nop%c\t{%0-7d}"},
  794. /* ARM V6 instructions. */
  795. {ARM_EXT_V6, 0xf1080000, 0xfffffe3f, "cpsie\t%8'a%7'i%6'f"},
  796. {ARM_EXT_V6, 0xf10a0000, 0xfffffe20, "cpsie\t%8'a%7'i%6'f,#%0-4d"},
  797. {ARM_EXT_V6, 0xf10C0000, 0xfffffe3f, "cpsid\t%8'a%7'i%6'f"},
  798. {ARM_EXT_V6, 0xf10e0000, 0xfffffe20, "cpsid\t%8'a%7'i%6'f,#%0-4d"},
  799. {ARM_EXT_V6, 0xf1000000, 0xfff1fe20, "cps\t#%0-4d"},
  800. {ARM_EXT_V6, 0x06800010, 0x0ff00ff0, "pkhbt%c\t%12-15r, %16-19r, %0-3r"},
  801. {ARM_EXT_V6, 0x06800010, 0x0ff00070, "pkhbt%c\t%12-15r, %16-19r, %0-3r, lsl #%7-11d"},
  802. {ARM_EXT_V6, 0x06800050, 0x0ff00ff0, "pkhtb%c\t%12-15r, %16-19r, %0-3r, asr #32"},
  803. {ARM_EXT_V6, 0x06800050, 0x0ff00070, "pkhtb%c\t%12-15r, %16-19r, %0-3r, asr #%7-11d"},
  804. {ARM_EXT_V6, 0x01900f9f, 0x0ff00fff, "ldrex%c\tr%12-15d, [%16-19r]"},
  805. {ARM_EXT_V6, 0x06200f10, 0x0ff00ff0, "qadd16%c\t%12-15r, %16-19r, %0-3r"},
  806. {ARM_EXT_V6, 0x06200f90, 0x0ff00ff0, "qadd8%c\t%12-15r, %16-19r, %0-3r"},
  807. {ARM_EXT_V6, 0x06200f30, 0x0ff00ff0, "qaddsubx%c\t%12-15r, %16-19r, %0-3r"},
  808. {ARM_EXT_V6, 0x06200f70, 0x0ff00ff0, "qsub16%c\t%12-15r, %16-19r, %0-3r"},
  809. {ARM_EXT_V6, 0x06200ff0, 0x0ff00ff0, "qsub8%c\t%12-15r, %16-19r, %0-3r"},
  810. {ARM_EXT_V6, 0x06200f50, 0x0ff00ff0, "qsubaddx%c\t%12-15r, %16-19r, %0-3r"},
  811. {ARM_EXT_V6, 0x06100f10, 0x0ff00ff0, "sadd16%c\t%12-15r, %16-19r, %0-3r"},
  812. {ARM_EXT_V6, 0x06100f90, 0x0ff00ff0, "sadd8%c\t%12-15r, %16-19r, %0-3r"},
  813. {ARM_EXT_V6, 0x06100f30, 0x0ff00ff0, "saddaddx%c\t%12-15r, %16-19r, %0-3r"},
  814. {ARM_EXT_V6, 0x06300f10, 0x0ff00ff0, "shadd16%c\t%12-15r, %16-19r, %0-3r"},
  815. {ARM_EXT_V6, 0x06300f90, 0x0ff00ff0, "shadd8%c\t%12-15r, %16-19r, %0-3r"},
  816. {ARM_EXT_V6, 0x06300f30, 0x0ff00ff0, "shaddsubx%c\t%12-15r, %16-19r, %0-3r"},
  817. {ARM_EXT_V6, 0x06300f70, 0x0ff00ff0, "shsub16%c\t%12-15r, %16-19r, %0-3r"},
  818. {ARM_EXT_V6, 0x06300ff0, 0x0ff00ff0, "shsub8%c\t%12-15r, %16-19r, %0-3r"},
  819. {ARM_EXT_V6, 0x06300f50, 0x0ff00ff0, "shsubaddx%c\t%12-15r, %16-19r, %0-3r"},
  820. {ARM_EXT_V6, 0x06100f70, 0x0ff00ff0, "ssub16%c\t%12-15r, %16-19r, %0-3r"},
  821. {ARM_EXT_V6, 0x06100ff0, 0x0ff00ff0, "ssub8%c\t%12-15r, %16-19r, %0-3r"},
  822. {ARM_EXT_V6, 0x06100f50, 0x0ff00ff0, "ssubaddx%c\t%12-15r, %16-19r, %0-3r"},
  823. {ARM_EXT_V6, 0x06500f10, 0x0ff00ff0, "uadd16%c\t%12-15r, %16-19r, %0-3r"},
  824. {ARM_EXT_V6, 0x06500f90, 0x0ff00ff0, "uadd8%c\t%12-15r, %16-19r, %0-3r"},
  825. {ARM_EXT_V6, 0x06500f30, 0x0ff00ff0, "uaddsubx%c\t%12-15r, %16-19r, %0-3r"},
  826. {ARM_EXT_V6, 0x06700f10, 0x0ff00ff0, "uhadd16%c\t%12-15r, %16-19r, %0-3r"},
  827. {ARM_EXT_V6, 0x06700f90, 0x0ff00ff0, "uhadd8%c\t%12-15r, %16-19r, %0-3r"},
  828. {ARM_EXT_V6, 0x06700f30, 0x0ff00ff0, "uhaddsubx%c\t%12-15r, %16-19r, %0-3r"},
  829. {ARM_EXT_V6, 0x06700f70, 0x0ff00ff0, "uhsub16%c\t%12-15r, %16-19r, %0-3r"},
  830. {ARM_EXT_V6, 0x06700ff0, 0x0ff00ff0, "uhsub8%c\t%12-15r, %16-19r, %0-3r"},
  831. {ARM_EXT_V6, 0x06700f50, 0x0ff00ff0, "uhsubaddx%c\t%12-15r, %16-19r, %0-3r"},
  832. {ARM_EXT_V6, 0x06600f10, 0x0ff00ff0, "uqadd16%c\t%12-15r, %16-19r, %0-3r"},
  833. {ARM_EXT_V6, 0x06600f90, 0x0ff00ff0, "uqadd8%c\t%12-15r, %16-19r, %0-3r"},
  834. {ARM_EXT_V6, 0x06600f30, 0x0ff00ff0, "uqaddsubx%c\t%12-15r, %16-19r, %0-3r"},
  835. {ARM_EXT_V6, 0x06600f70, 0x0ff00ff0, "uqsub16%c\t%12-15r, %16-19r, %0-3r"},
  836. {ARM_EXT_V6, 0x06600ff0, 0x0ff00ff0, "uqsub8%c\t%12-15r, %16-19r, %0-3r"},
  837. {ARM_EXT_V6, 0x06600f50, 0x0ff00ff0, "uqsubaddx%c\t%12-15r, %16-19r, %0-3r"},
  838. {ARM_EXT_V6, 0x06500f70, 0x0ff00ff0, "usub16%c\t%12-15r, %16-19r, %0-3r"},
  839. {ARM_EXT_V6, 0x06500ff0, 0x0ff00ff0, "usub8%c\t%12-15r, %16-19r, %0-3r"},
  840. {ARM_EXT_V6, 0x06500f50, 0x0ff00ff0, "usubaddx%c\t%12-15r, %16-19r, %0-3r"},
  841. {ARM_EXT_V6, 0x06bf0f30, 0x0fff0ff0, "rev%c\t\%12-15r, %0-3r"},
  842. {ARM_EXT_V6, 0x06bf0fb0, 0x0fff0ff0, "rev16%c\t\%12-15r, %0-3r"},
  843. {ARM_EXT_V6, 0x06ff0fb0, 0x0fff0ff0, "revsh%c\t\%12-15r, %0-3r"},
  844. {ARM_EXT_V6, 0xf8100a00, 0xfe50ffff, "rfe%23?id%24?ba\t\%16-19r%21'!"},
  845. {ARM_EXT_V6, 0x06bf0070, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r"},
  846. {ARM_EXT_V6, 0x06bf0470, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #8"},
  847. {ARM_EXT_V6, 0x06bf0870, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #16"},
  848. {ARM_EXT_V6, 0x06bf0c70, 0x0fff0ff0, "sxth%c\t%12-15r, %0-3r, ror #24"},
  849. {ARM_EXT_V6, 0x068f0070, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r"},
  850. {ARM_EXT_V6, 0x068f0470, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #8"},
  851. {ARM_EXT_V6, 0x068f0870, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #16"},
  852. {ARM_EXT_V6, 0x068f0c70, 0x0fff0ff0, "sxtb16%c\t%12-15r, %0-3r, ror #24"},
  853. {ARM_EXT_V6, 0x06af0070, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r"},
  854. {ARM_EXT_V6, 0x06af0470, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #8"},
  855. {ARM_EXT_V6, 0x06af0870, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #16"},
  856. {ARM_EXT_V6, 0x06af0c70, 0x0fff0ff0, "sxtb%c\t%12-15r, %0-3r, ror #24"},
  857. {ARM_EXT_V6, 0x06ff0070, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r"},
  858. {ARM_EXT_V6, 0x06ff0470, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #8"},
  859. {ARM_EXT_V6, 0x06ff0870, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #16"},
  860. {ARM_EXT_V6, 0x06ff0c70, 0x0fff0ff0, "uxth%c\t%12-15r, %0-3r, ror #24"},
  861. {ARM_EXT_V6, 0x06cf0070, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r"},
  862. {ARM_EXT_V6, 0x06cf0470, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #8"},
  863. {ARM_EXT_V6, 0x06cf0870, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #16"},
  864. {ARM_EXT_V6, 0x06cf0c70, 0x0fff0ff0, "uxtb16%c\t%12-15r, %0-3r, ror #24"},
  865. {ARM_EXT_V6, 0x06ef0070, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r"},
  866. {ARM_EXT_V6, 0x06ef0470, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #8"},
  867. {ARM_EXT_V6, 0x06ef0870, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #16"},
  868. {ARM_EXT_V6, 0x06ef0c70, 0x0fff0ff0, "uxtb%c\t%12-15r, %0-3r, ror #24"},
  869. {ARM_EXT_V6, 0x06b00070, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r"},
  870. {ARM_EXT_V6, 0x06b00470, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  871. {ARM_EXT_V6, 0x06b00870, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  872. {ARM_EXT_V6, 0x06b00c70, 0x0ff00ff0, "sxtah%c\t%12-15r, %16-19r, %0-3r, ror #24"},
  873. {ARM_EXT_V6, 0x06800070, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r"},
  874. {ARM_EXT_V6, 0x06800470, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  875. {ARM_EXT_V6, 0x06800870, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  876. {ARM_EXT_V6, 0x06800c70, 0x0ff00ff0, "sxtab16%c\t%12-15r, %16-19r, %0-3r, ror #24"},
  877. {ARM_EXT_V6, 0x06a00070, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r"},
  878. {ARM_EXT_V6, 0x06a00470, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  879. {ARM_EXT_V6, 0x06a00870, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  880. {ARM_EXT_V6, 0x06a00c70, 0x0ff00ff0, "sxtab%c\t%12-15r, %16-19r, %0-3r, ror #24"},
  881. {ARM_EXT_V6, 0x06f00070, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r"},
  882. {ARM_EXT_V6, 0x06f00470, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  883. {ARM_EXT_V6, 0x06f00870, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  884. {ARM_EXT_V6, 0x06f00c70, 0x0ff00ff0, "uxtah%c\t%12-15r, %16-19r, %0-3r, ror #24"},
  885. {ARM_EXT_V6, 0x06c00070, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r"},
  886. {ARM_EXT_V6, 0x06c00470, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  887. {ARM_EXT_V6, 0x06c00870, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  888. {ARM_EXT_V6, 0x06c00c70, 0x0ff00ff0, "uxtab16%c\t%12-15r, %16-19r, %0-3r, ROR #24"},
  889. {ARM_EXT_V6, 0x06e00070, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r"},
  890. {ARM_EXT_V6, 0x06e00470, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #8"},
  891. {ARM_EXT_V6, 0x06e00870, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #16"},
  892. {ARM_EXT_V6, 0x06e00c70, 0x0ff00ff0, "uxtab%c\t%12-15r, %16-19r, %0-3r, ror #24"},
  893. {ARM_EXT_V6, 0x06800fb0, 0x0ff00ff0, "sel%c\t%12-15r, %16-19r, %0-3r"},
  894. {ARM_EXT_V6, 0xf1010000, 0xfffffc00, "setend\t%9?ble"},
  895. {ARM_EXT_V6, 0x0700f010, 0x0ff0f0d0, "smuad%5'x%c\t%16-19r, %0-3r, %8-11r"},
  896. {ARM_EXT_V6, 0x0700f050, 0x0ff0f0d0, "smusd%5'x%c\t%16-19r, %0-3r, %8-11r"},
  897. {ARM_EXT_V6, 0x07000010, 0x0ff000d0, "smlad%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  898. {ARM_EXT_V6, 0x07400010, 0x0ff000d0, "smlald%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  899. {ARM_EXT_V6, 0x07000050, 0x0ff000d0, "smlsd%5'x%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  900. {ARM_EXT_V6, 0x07400050, 0x0ff000d0, "smlsld%5'x%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  901. {ARM_EXT_V6, 0x0750f010, 0x0ff0f0d0, "smmul%5'r%c\t%16-19r, %0-3r, %8-11r"},
  902. {ARM_EXT_V6, 0x07500010, 0x0ff000d0, "smmla%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  903. {ARM_EXT_V6, 0x075000d0, 0x0ff000d0, "smmls%5'r%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  904. {ARM_EXT_V6, 0xf84d0500, 0xfe5fffe0, "srs%23?id%24?ba\t%16-19r%21'!, #%0-4d"},
  905. {ARM_EXT_V6, 0x06a00010, 0x0fe00ff0, "ssat%c\t%12-15r, #%16-20W, %0-3r"},
  906. {ARM_EXT_V6, 0x06a00010, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, lsl #%7-11d"},
  907. {ARM_EXT_V6, 0x06a00050, 0x0fe00070, "ssat%c\t%12-15r, #%16-20W, %0-3r, asr #%7-11d"},
  908. {ARM_EXT_V6, 0x06a00f30, 0x0ff00ff0, "ssat16%c\t%12-15r, #%16-19W, %0-3r"},
  909. {ARM_EXT_V6, 0x01800f90, 0x0ff00ff0, "strex%c\t%12-15r, %0-3r, [%16-19r]"},
  910. {ARM_EXT_V6, 0x00400090, 0x0ff000f0, "umaal%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  911. {ARM_EXT_V6, 0x0780f010, 0x0ff0f0f0, "usad8%c\t%16-19r, %0-3r, %8-11r"},
  912. {ARM_EXT_V6, 0x07800010, 0x0ff000f0, "usada8%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  913. {ARM_EXT_V6, 0x06e00010, 0x0fe00ff0, "usat%c\t%12-15r, #%16-20d, %0-3r"},
  914. {ARM_EXT_V6, 0x06e00010, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, lsl #%7-11d"},
  915. {ARM_EXT_V6, 0x06e00050, 0x0fe00070, "usat%c\t%12-15r, #%16-20d, %0-3r, asr #%7-11d"},
  916. {ARM_EXT_V6, 0x06e00f30, 0x0ff00ff0, "usat16%c\t%12-15r, #%16-19d, %0-3r"},
  917. /* V5J instruction. */
  918. {ARM_EXT_V5J, 0x012fff20, 0x0ffffff0, "bxj%c\t%0-3r"},
  919. /* V5 Instructions. */
  920. {ARM_EXT_V5, 0xe1200070, 0xfff000f0, "bkpt\t0x%16-19X%12-15X%8-11X%0-3X"},
  921. {ARM_EXT_V5, 0xfa000000, 0xfe000000, "blx\t%B"},
  922. {ARM_EXT_V5, 0x012fff30, 0x0ffffff0, "blx%c\t%0-3r"},
  923. {ARM_EXT_V5, 0x016f0f10, 0x0fff0ff0, "clz%c\t%12-15r, %0-3r"},
  924. /* V5E "El Segundo" Instructions. */
  925. {ARM_EXT_V5E, 0x000000d0, 0x0e1000f0, "ldrd%c\t%12-15r, %s"},
  926. {ARM_EXT_V5E, 0x000000f0, 0x0e1000f0, "strd%c\t%12-15r, %s"},
  927. {ARM_EXT_V5E, 0xf450f000, 0xfc70f000, "pld\t%a"},
  928. {ARM_EXT_V5ExP, 0x01000080, 0x0ff000f0, "smlabb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  929. {ARM_EXT_V5ExP, 0x010000a0, 0x0ff000f0, "smlatb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  930. {ARM_EXT_V5ExP, 0x010000c0, 0x0ff000f0, "smlabt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  931. {ARM_EXT_V5ExP, 0x010000e0, 0x0ff000f0, "smlatt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  932. {ARM_EXT_V5ExP, 0x01200080, 0x0ff000f0, "smlawb%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  933. {ARM_EXT_V5ExP, 0x012000c0, 0x0ff000f0, "smlawt%c\t%16-19r, %0-3r, %8-11r, %12-15r"},
  934. {ARM_EXT_V5ExP, 0x01400080, 0x0ff000f0, "smlalbb%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  935. {ARM_EXT_V5ExP, 0x014000a0, 0x0ff000f0, "smlaltb%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  936. {ARM_EXT_V5ExP, 0x014000c0, 0x0ff000f0, "smlalbt%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  937. {ARM_EXT_V5ExP, 0x014000e0, 0x0ff000f0, "smlaltt%c\t%12-15r, %16-19r, %0-3r, %8-11r"},
  938. {ARM_EXT_V5ExP, 0x01600080, 0x0ff0f0f0, "smulbb%c\t%16-19r, %0-3r, %8-11r"},
  939. {ARM_EXT_V5ExP, 0x016000a0, 0x0ff0f0f0, "smultb%c\t%16-19r, %0-3r, %8-11r"},
  940. {ARM_EXT_V5ExP, 0x016000c0, 0x0ff0f0f0, "smulbt%c\t%16-19r, %0-3r, %8-11r"},
  941. {ARM_EXT_V5ExP, 0x016000e0, 0x0ff0f0f0, "smultt%c\t%16-19r, %0-3r, %8-11r"},
  942. {ARM_EXT_V5ExP, 0x012000a0, 0x0ff0f0f0, "smulwb%c\t%16-19r, %0-3r, %8-11r"},
  943. {ARM_EXT_V5ExP, 0x012000e0, 0x0ff0f0f0, "smulwt%c\t%16-19r, %0-3r, %8-11r"},
  944. {ARM_EXT_V5ExP, 0x01000050, 0x0ff00ff0, "qadd%c\t%12-15r, %0-3r, %16-19r"},
  945. {ARM_EXT_V5ExP, 0x01400050, 0x0ff00ff0, "qdadd%c\t%12-15r, %0-3r, %16-19r"},
  946. {ARM_EXT_V5ExP, 0x01200050, 0x0ff00ff0, "qsub%c\t%12-15r, %0-3r, %16-19r"},
  947. {ARM_EXT_V5ExP, 0x01600050, 0x0ff00ff0, "qdsub%c\t%12-15r, %0-3r, %16-19r"},
  948. /* ARM Instructions. */
  949. {ARM_EXT_V1, 0x00000090, 0x0e100090, "str%6's%5?hb%c\t%12-15r, %s"},
  950. {ARM_EXT_V1, 0x00100090, 0x0e100090, "ldr%6's%5?hb%c\t%12-15r, %s"},
  951. {ARM_EXT_V1, 0x00000000, 0x0de00000, "and%20's%c\t%12-15r, %16-19r, %o"},
  952. {ARM_EXT_V1, 0x00200000, 0x0de00000, "eor%20's%c\t%12-15r, %16-19r, %o"},
  953. {ARM_EXT_V1, 0x00400000, 0x0de00000, "sub%20's%c\t%12-15r, %16-19r, %o"},
  954. {ARM_EXT_V1, 0x00600000, 0x0de00000, "rsb%20's%c\t%12-15r, %16-19r, %o"},
  955. {ARM_EXT_V1, 0x00800000, 0x0de00000, "add%20's%c\t%12-15r, %16-19r, %o"},
  956. {ARM_EXT_V1, 0x00a00000, 0x0de00000, "adc%20's%c\t%12-15r, %16-19r, %o"},
  957. {ARM_EXT_V1, 0x00c00000, 0x0de00000, "sbc%20's%c\t%12-15r, %16-19r, %o"},
  958. {ARM_EXT_V1, 0x00e00000, 0x0de00000, "rsc%20's%c\t%12-15r, %16-19r, %o"},
  959. {ARM_EXT_V3, 0x0120f000, 0x0db0f000, "msr%c\t%22?SCPSR%C, %o"},
  960. {ARM_EXT_V3, 0x010f0000, 0x0fbf0fff, "mrs%c\t%12-15r, %22?SCPSR"},
  961. {ARM_EXT_V1, 0x01000000, 0x0de00000, "tst%p%c\t%16-19r, %o"},
  962. {ARM_EXT_V1, 0x01200000, 0x0de00000, "teq%p%c\t%16-19r, %o"},
  963. {ARM_EXT_V1, 0x01400000, 0x0de00000, "cmp%p%c\t%16-19r, %o"},
  964. {ARM_EXT_V1, 0x01600000, 0x0de00000, "cmn%p%c\t%16-19r, %o"},
  965. {ARM_EXT_V1, 0x01800000, 0x0de00000, "orr%20's%c\t%12-15r, %16-19r, %o"},
  966. {ARM_EXT_V1, 0x03a00000, 0x0fef0000, "mov%20's%c\t%12-15r, %o"},
  967. {ARM_EXT_V1, 0x01a00000, 0x0def0ff0, "mov%20's%c\t%12-15r, %0-3r"},
  968. {ARM_EXT_V1, 0x01a00000, 0x0def0060, "lsl%20's%c\t%12-15r, %q"},
  969. {ARM_EXT_V1, 0x01a00020, 0x0def0060, "lsr%20's%c\t%12-15r, %q"},
  970. {ARM_EXT_V1, 0x01a00040, 0x0def0060, "asr%20's%c\t%12-15r, %q"},
  971. {ARM_EXT_V1, 0x01a00060, 0x0def0ff0, "rrx%20's%c\t%12-15r, %0-3r"},
  972. {ARM_EXT_V1, 0x01a00060, 0x0def0060, "ror%20's%c\t%12-15r, %q"},
  973. {ARM_EXT_V1, 0x01c00000, 0x0de00000, "bic%20's%c\t%12-15r, %16-19r, %o"},
  974. {ARM_EXT_V1, 0x01e00000, 0x0de00000, "mvn%20's%c\t%12-15r, %o"},
  975. {ARM_EXT_V1, 0x052d0004, 0x0fff0fff, "push%c\t{%12-15r}\t\t; (str%c %12-15r, %a)"},
  976. {ARM_EXT_V1, 0x04000000, 0x0e100000, "str%22'b%t%c\t%12-15r, %a"},
  977. {ARM_EXT_V1, 0x06000000, 0x0e100ff0, "str%22'b%t%c\t%12-15r, %a"},
  978. {ARM_EXT_V1, 0x04000000, 0x0c100010, "str%22'b%t%c\t%12-15r, %a"},
  979. {ARM_EXT_V1, 0x06000010, 0x0e000010, "undefined"},
  980. {ARM_EXT_V1, 0x049d0004, 0x0fff0fff, "pop%c\t{%12-15r}\t\t; (ldr%c %12-15r, %a)"},
  981. {ARM_EXT_V1, 0x04100000, 0x0c100000, "ldr%22'b%t%c\t%12-15r, %a"},
  982. {ARM_EXT_V1, 0x092d0000, 0x0fff0000, "push%c\t%m"},
  983. {ARM_EXT_V1, 0x08800000, 0x0ff00000, "stm%c\t%16-19r%21'!, %m%22'^"},
  984. {ARM_EXT_V1, 0x08000000, 0x0e100000, "stm%23?id%24?ba%c\t%16-19r%21'!, %m%22'^"},
  985. {ARM_EXT_V1, 0x08bd0000, 0x0fff0000, "pop%c\t%m"},
  986. {ARM_EXT_V1, 0x08900000, 0x0f900000, "ldm%c\t%16-19r%21'!, %m%22'^"},
  987. {ARM_EXT_V1, 0x08100000, 0x0e100000, "ldm%23?id%24?ba%c\t%16-19r%21'!, %m%22'^"},
  988. {ARM_EXT_V1, 0x0a000000, 0x0e000000, "b%24'l%c\t%b"},
  989. {ARM_EXT_V1, 0x0f000000, 0x0f000000, "svc%c\t%0-23x"},
  990. /* The rest. */
  991. {ARM_EXT_V1, 0x00000000, 0x00000000, "undefined instruction %0-31x"},
  992. {0, 0x00000000, 0x00000000, 0}
  993. };
  994. /* print_insn_thumb16 recognizes the following format control codes:
  995. %S print Thumb register (bits 3..5 as high number if bit 6 set)
  996. %D print Thumb register (bits 0..2 as high number if bit 7 set)
  997. %<bitfield>I print bitfield as a signed decimal
  998. (top bit of range being the sign bit)
  999. %N print Thumb register mask (with LR)
  1000. %O print Thumb register mask (with PC)
  1001. %M print Thumb register mask
  1002. %b print CZB's 6-bit unsigned branch destination
  1003. %s print Thumb right-shift immediate (6..10; 0 == 32).
  1004. %c print the condition code
  1005. %C print the condition code, or "s" if not conditional
  1006. %x print warning if conditional an not at end of IT block"
  1007. %X print "\t; unpredictable <IT:code>" if conditional
  1008. %I print IT instruction suffix and operands
  1009. %<bitfield>r print bitfield as an ARM register
  1010. %<bitfield>d print bitfield as a decimal
  1011. %<bitfield>H print (bitfield * 2) as a decimal
  1012. %<bitfield>W print (bitfield * 4) as a decimal
  1013. %<bitfield>a print (bitfield * 4) as a pc-rel offset + decoded symbol
  1014. %<bitfield>B print Thumb branch destination (signed displacement)
  1015. %<bitfield>c print bitfield as a condition code
  1016. %<bitnum>'c print specified char iff bit is one
  1017. %<bitnum>?ab print a if bit is one else print b. */
  1018. static const struct opcode16 thumb_opcodes[] =
  1019. {
  1020. /* Thumb instructions. */
  1021. /* ARM V6K no-argument instructions. */
  1022. {ARM_EXT_V6K, 0xbf00, 0xffff, "nop%c"},
  1023. {ARM_EXT_V6K, 0xbf10, 0xffff, "yield%c"},
  1024. {ARM_EXT_V6K, 0xbf20, 0xffff, "wfe%c"},
  1025. {ARM_EXT_V6K, 0xbf30, 0xffff, "wfi%c"},
  1026. {ARM_EXT_V6K, 0xbf40, 0xffff, "sev%c"},
  1027. {ARM_EXT_V6K, 0xbf00, 0xff0f, "nop%c\t{%4-7d}"},
  1028. /* ARM V6T2 instructions. */
  1029. {ARM_EXT_V6T2, 0xb900, 0xfd00, "cbnz\t%0-2r, %b%X"},
  1030. {ARM_EXT_V6T2, 0xb100, 0xfd00, "cbz\t%0-2r, %b%X"},
  1031. {ARM_EXT_V6T2, 0xbf00, 0xff00, "it%I%X"},
  1032. /* ARM V6. */
  1033. {ARM_EXT_V6, 0xb660, 0xfff8, "cpsie\t%2'a%1'i%0'f%X"},
  1034. {ARM_EXT_V6, 0xb670, 0xfff8, "cpsid\t%2'a%1'i%0'f%X"},
  1035. {ARM_EXT_V6, 0x4600, 0xffc0, "mov%c\t%0-2r, %3-5r"},
  1036. {ARM_EXT_V6, 0xba00, 0xffc0, "rev%c\t%0-2r, %3-5r"},
  1037. {ARM_EXT_V6, 0xba40, 0xffc0, "rev16%c\t%0-2r, %3-5r"},
  1038. {ARM_EXT_V6, 0xbac0, 0xffc0, "revsh%c\t%0-2r, %3-5r"},
  1039. {ARM_EXT_V6, 0xb650, 0xfff7, "setend\t%3?ble%X"},
  1040. {ARM_EXT_V6, 0xb200, 0xffc0, "sxth%c\t%0-2r, %3-5r"},
  1041. {ARM_EXT_V6, 0xb240, 0xffc0, "sxtb%c\t%0-2r, %3-5r"},
  1042. {ARM_EXT_V6, 0xb280, 0xffc0, "uxth%c\t%0-2r, %3-5r"},
  1043. {ARM_EXT_V6, 0xb2c0, 0xffc0, "uxtb%c\t%0-2r, %3-5r"},
  1044. /* ARM V5 ISA extends Thumb. */
  1045. {ARM_EXT_V5T, 0xbe00, 0xff00, "bkpt\t%0-7x"}, /* Is always unconditional. */
  1046. /* This is BLX(2). BLX(1) is a 32-bit instruction. */
  1047. {ARM_EXT_V5T, 0x4780, 0xff87, "blx%c\t%3-6r%x"}, /* note: 4 bit register number. */
  1048. /* ARM V4T ISA (Thumb v1). */
  1049. {ARM_EXT_V4T, 0x46C0, 0xFFFF, "nop%c\t\t\t(mov r8, r8)"},
  1050. /* Format 4. */
  1051. {ARM_EXT_V4T, 0x4000, 0xFFC0, "and%C\t%0-2r, %3-5r"},
  1052. {ARM_EXT_V4T, 0x4040, 0xFFC0, "eor%C\t%0-2r, %3-5r"},
  1053. {ARM_EXT_V4T, 0x4080, 0xFFC0, "lsl%C\t%0-2r, %3-5r"},
  1054. {ARM_EXT_V4T, 0x40C0, 0xFFC0, "lsr%C\t%0-2r, %3-5r"},
  1055. {ARM_EXT_V4T, 0x4100, 0xFFC0, "asr%C\t%0-2r, %3-5r"},
  1056. {ARM_EXT_V4T, 0x4140, 0xFFC0, "adc%C\t%0-2r, %3-5r"},
  1057. {ARM_EXT_V4T, 0x4180, 0xFFC0, "sbc%C\t%0-2r, %3-5r"},
  1058. {ARM_EXT_V4T, 0x41C0, 0xFFC0, "ror%C\t%0-2r, %3-5r"},
  1059. {ARM_EXT_V4T, 0x4200, 0xFFC0, "tst%c\t%0-2r, %3-5r"},
  1060. {ARM_EXT_V4T, 0x4240, 0xFFC0, "neg%C\t%0-2r, %3-5r"},
  1061. {ARM_EXT_V4T, 0x4280, 0xFFC0, "cmp%c\t%0-2r, %3-5r"},
  1062. {ARM_EXT_V4T, 0x42C0, 0xFFC0, "cmn%c\t%0-2r, %3-5r"},
  1063. {ARM_EXT_V4T, 0x4300, 0xFFC0, "orr%C\t%0-2r, %3-5r"},
  1064. {ARM_EXT_V4T, 0x4340, 0xFFC0, "mul%C\t%0-2r, %3-5r"},
  1065. {ARM_EXT_V4T, 0x4380, 0xFFC0, "bic%C\t%0-2r, %3-5r"},
  1066. {ARM_EXT_V4T, 0x43C0, 0xFFC0, "mvn%C\t%0-2r, %3-5r"},
  1067. /* format 13 */
  1068. {ARM_EXT_V4T, 0xB000, 0xFF80, "add%c\tsp, #%0-6W"},
  1069. {ARM_EXT_V4T, 0xB080, 0xFF80, "sub%c\tsp, #%0-6W"},
  1070. /* format 5 */
  1071. {ARM_EXT_V4T, 0x4700, 0xFF80, "bx%c\t%S%x"},
  1072. {ARM_EXT_V4T, 0x4400, 0xFF00, "add%c\t%D, %S"},
  1073. {ARM_EXT_V4T, 0x4500, 0xFF00, "cmp%c\t%D, %S"},
  1074. {ARM_EXT_V4T, 0x4600, 0xFF00, "mov%c\t%D, %S"},
  1075. /* format 14 */
  1076. {ARM_EXT_V4T, 0xB400, 0xFE00, "push%c\t%N"},
  1077. {ARM_EXT_V4T, 0xBC00, 0xFE00, "pop%c\t%O"},
  1078. /* format 2 */
  1079. {ARM_EXT_V4T, 0x1800, 0xFE00, "add%C\t%0-2r, %3-5r, %6-8r"},
  1080. {ARM_EXT_V4T, 0x1A00, 0xFE00, "sub%C\t%0-2r, %3-5r, %6-8r"},
  1081. {ARM_EXT_V4T, 0x1C00, 0xFE00, "add%C\t%0-2r, %3-5r, #%6-8d"},
  1082. {ARM_EXT_V4T, 0x1E00, 0xFE00, "sub%C\t%0-2r, %3-5r, #%6-8d"},
  1083. /* format 8 */
  1084. {ARM_EXT_V4T, 0x5200, 0xFE00, "strh%c\t%0-2r, [%3-5r, %6-8r]"},
  1085. {ARM_EXT_V4T, 0x5A00, 0xFE00, "ldrh%c\t%0-2r, [%3-5r, %6-8r]"},
  1086. {ARM_EXT_V4T, 0x5600, 0xF600, "ldrs%11?hb%c\t%0-2r, [%3-5r, %6-8r]"},
  1087. /* format 7 */
  1088. {ARM_EXT_V4T, 0x5000, 0xFA00, "str%10'b%c\t%0-2r, [%3-5r, %6-8r]"},
  1089. {ARM_EXT_V4T, 0x5800, 0xFA00, "ldr%10'b%c\t%0-2r, [%3-5r, %6-8r]"},
  1090. /* format 1 */
  1091. {ARM_EXT_V4T, 0x0000, 0xF800, "lsl%C\t%0-2r, %3-5r, #%6-10d"},
  1092. {ARM_EXT_V4T, 0x0800, 0xF800, "lsr%C\t%0-2r, %3-5r, %s"},
  1093. {ARM_EXT_V4T, 0x1000, 0xF800, "asr%C\t%0-2r, %3-5r, %s"},
  1094. /* format 3 */
  1095. {ARM_EXT_V4T, 0x2000, 0xF800, "mov%C\t%8-10r, #%0-7d"},
  1096. {ARM_EXT_V4T, 0x2800, 0xF800, "cmp%c\t%8-10r, #%0-7d"},
  1097. {ARM_EXT_V4T, 0x3000, 0xF800, "add%C\t%8-10r, #%0-7d"},
  1098. {ARM_EXT_V4T, 0x3800, 0xF800, "sub%C\t%8-10r, #%0-7d"},
  1099. /* format 6 */
  1100. {ARM_EXT_V4T, 0x4800, 0xF800, "ldr%c\t%8-10r, [pc, #%0-7W]\t(%0-7a)"}, /* TODO: Disassemble PC relative "LDR rD,=<symbolic>" */
  1101. /* format 9 */
  1102. {ARM_EXT_V4T, 0x6000, 0xF800, "str%c\t%0-2r, [%3-5r, #%6-10W]"},
  1103. {ARM_EXT_V4T, 0x6800, 0xF800, "ldr%c\t%0-2r, [%3-5r, #%6-10W]"},
  1104. {ARM_EXT_V4T, 0x7000, 0xF800, "strb%c\t%0-2r, [%3-5r, #%6-10d]"},
  1105. {ARM_EXT_V4T, 0x7800, 0xF800, "ldrb%c\t%0-2r, [%3-5r, #%6-10d]"},
  1106. /* format 10 */
  1107. {ARM_EXT_V4T, 0x8000, 0xF800, "strh%c\t%0-2r, [%3-5r, #%6-10H]"},
  1108. {ARM_EXT_V4T, 0x8800, 0xF800, "ldrh%c\t%0-2r, [%3-5r, #%6-10H]"},
  1109. /* format 11 */
  1110. {ARM_EXT_V4T, 0x9000, 0xF800, "str%c\t%8-10r, [sp, #%0-7W]"},
  1111. {ARM_EXT_V4T, 0x9800, 0xF800, "ldr%c\t%8-10r, [sp, #%0-7W]"},
  1112. /* format 12 */
  1113. {ARM_EXT_V4T, 0xA000, 0xF800, "add%c\t%8-10r, pc, #%0-7W\t(adr %8-10r, %0-7a)"},
  1114. {ARM_EXT_V4T, 0xA800, 0xF800, "add%c\t%8-10r, sp, #%0-7W"},
  1115. /* format 15 */
  1116. {ARM_EXT_V4T, 0xC000, 0xF800, "stmia%c\t%8-10r!, %M"},
  1117. {ARM_EXT_V4T, 0xC800, 0xF800, "ldmia%c\t%8-10r!, %M"},
  1118. /* format 17 */
  1119. {ARM_EXT_V4T, 0xDF00, 0xFF00, "svc%c\t%0-7d"},
  1120. /* format 16 */
  1121. {ARM_EXT_V4T, 0xDE00, 0xFE00, "undefined"},
  1122. {ARM_EXT_V4T, 0xD000, 0xF000, "b%8-11c.n\t%0-7B%X"},
  1123. /* format 18 */
  1124. {ARM_EXT_V4T, 0xE000, 0xF800, "b%c.n\t%0-10B%x"},
  1125. /* The E800 .. FFFF range is unconditionally redirected to the
  1126. 32-bit table, because even in pre-V6T2 ISAs, BL and BLX(1) pairs
  1127. are processed via that table. Thus, we can never encounter a
  1128. bare "second half of BL/BLX(1)" instruction here. */
  1129. {ARM_EXT_V1, 0x0000, 0x0000, "undefined"},
  1130. {0, 0, 0, 0}
  1131. };
  1132. /* Thumb32 opcodes use the same table structure as the ARM opcodes.
  1133. We adopt the convention that hw1 is the high 16 bits of .value and
  1134. .mask, hw2 the low 16 bits.
  1135. print_insn_thumb32 recognizes the following format control codes:
  1136. %% %
  1137. %I print a 12-bit immediate from hw1[10],hw2[14:12,7:0]
  1138. %M print a modified 12-bit immediate (same location)
  1139. %J print a 16-bit immediate from hw1[3:0,10],hw2[14:12,7:0]
  1140. %K print a 16-bit immediate from hw2[3:0],hw1[3:0],hw2[11:4]
  1141. %S print a possibly-shifted Rm
  1142. %a print the address of a plain load/store
  1143. %w print the width and signedness of a core load/store
  1144. %m print register mask for ldm/stm
  1145. %E print the lsb and width fields of a bfc/bfi instruction
  1146. %F print the lsb and width fields of a sbfx/ubfx instruction
  1147. %b print a conditional branch offset
  1148. %B print an unconditional branch offset
  1149. %s print the shift field of an SSAT instruction
  1150. %R print the rotation field of an SXT instruction
  1151. %U print barrier type.
  1152. %P print address for pli instruction.
  1153. %c print the condition code
  1154. %x print warning if conditional an not at end of IT block"
  1155. %X print "\t; unpredictable <IT:code>" if conditional
  1156. %<bitfield>d print bitfield in decimal
  1157. %<bitfield>W print bitfield*4 in decimal
  1158. %<bitfield>r print bitfield as an ARM register
  1159. %<bitfield>c print bitfield as a condition code
  1160. %<bitfield>'c print specified char iff bitfield is all ones
  1161. %<bitfield>`c print specified char iff bitfield is all zeroes
  1162. %<bitfield>?ab... select from array of values in big endian order
  1163. With one exception at the bottom (done because BL and BLX(1) need
  1164. to come dead last), this table was machine-sorted first in
  1165. decreasing order of number of bits set in the mask, then in
  1166. increasing numeric order of mask, then in increasing numeric order
  1167. of opcode. This order is not the clearest for a human reader, but
  1168. is guaranteed never to catch a special-case bit pattern with a more
  1169. general mask, which is important, because this instruction encoding
  1170. makes heavy use of special-case bit patterns. */
  1171. static const struct opcode32 thumb32_opcodes[] =
  1172. {
  1173. /* V7 instructions. */
  1174. {ARM_EXT_V7, 0xf910f000, 0xff70f000, "pli%c\t%a"},
  1175. {ARM_EXT_V7, 0xf3af80f0, 0xfffffff0, "dbg%c\t#%0-3d"},
  1176. {ARM_EXT_V7, 0xf3bf8f50, 0xfffffff0, "dmb%c\t%U"},
  1177. {ARM_EXT_V7, 0xf3bf8f40, 0xfffffff0, "dsb%c\t%U"},
  1178. {ARM_EXT_V7, 0xf3bf8f60, 0xfffffff0, "isb%c\t%U"},
  1179. {ARM_EXT_DIV, 0xfb90f0f0, 0xfff0f0f0, "sdiv%c\t%8-11r, %16-19r, %0-3r"},
  1180. {ARM_EXT_DIV, 0xfbb0f0f0, 0xfff0f0f0, "udiv%c\t%8-11r, %16-19r, %0-3r"},
  1181. /* Instructions defined in the basic V6T2 set. */
  1182. {ARM_EXT_V6T2, 0xf3af8000, 0xffffffff, "nop%c.w"},
  1183. {ARM_EXT_V6T2, 0xf3af8001, 0xffffffff, "yield%c.w"},
  1184. {ARM_EXT_V6T2, 0xf3af8002, 0xffffffff, "wfe%c.w"},
  1185. {ARM_EXT_V6T2, 0xf3af8003, 0xffffffff, "wfi%c.w"},
  1186. {ARM_EXT_V6T2, 0xf3af9004, 0xffffffff, "sev%c.w"},
  1187. {ARM_EXT_V6T2, 0xf3af8000, 0xffffff00, "nop%c.w\t{%0-7d}"},
  1188. {ARM_EXT_V6T2, 0xf3bf8f2f, 0xffffffff, "clrex%c"},
  1189. {ARM_EXT_V6T2, 0xf3af8400, 0xffffff1f, "cpsie.w\t%7'a%6'i%5'f%X"},
  1190. {ARM_EXT_V6T2, 0xf3af8600, 0xffffff1f, "cpsid.w\t%7'a%6'i%5'f%X"},
  1191. {ARM_EXT_V6T2, 0xf3c08f00, 0xfff0ffff, "bxj%c\t%16-19r%x"},
  1192. {ARM_EXT_V6T2, 0xe810c000, 0xffd0ffff, "rfedb%c\t%16-19r%21'!"},
  1193. {ARM_EXT_V6T2, 0xe990c000, 0xffd0ffff, "rfeia%c\t%16-19r%21'!"},
  1194. {ARM_EXT_V6T2, 0xf3ef8000, 0xffeff000, "mrs%c\t%8-11r, %D"},
  1195. {ARM_EXT_V6T2, 0xf3af8100, 0xffffffe0, "cps\t#%0-4d%X"},
  1196. {ARM_EXT_V6T2, 0xe8d0f000, 0xfff0fff0, "tbb%c\t[%16-19r, %0-3r]%x"},
  1197. {ARM_EXT_V6T2, 0xe8d0f010, 0xfff0fff0, "tbh%c\t[%16-19r, %0-3r, lsl #1]%x"},
  1198. {ARM_EXT_V6T2, 0xf3af8500, 0xffffff00, "cpsie\t%7'a%6'i%5'f, #%0-4d%X"},
  1199. {ARM_EXT_V6T2, 0xf3af8700, 0xffffff00, "cpsid\t%7'a%6'i%5'f, #%0-4d%X"},
  1200. {ARM_EXT_V6T2, 0xf3de8f00, 0xffffff00, "subs%c\tpc, lr, #%0-7d"},
  1201. {ARM_EXT_V6T2, 0xf3808000, 0xffe0f000, "msr%c\t%C, %16-19r"},
  1202. {ARM_EXT_V6T2, 0xe8500f00, 0xfff00fff, "ldrex%c\t%12-15r, [%16-19r]"},
  1203. {ARM_EXT_V6T2, 0xe8d00f4f, 0xfff00fef, "ldrex%4?hb%c\t%12-15r, [%16-19r]"},
  1204. {ARM_EXT_V6T2, 0xe800c000, 0xffd0ffe0, "srsdb%c\t%16-19r%21'!, #%0-4d"},
  1205. {ARM_EXT_V6T2, 0xe980c000, 0xffd0ffe0, "srsia%c\t%16-19r%21'!, #%0-4d"},
  1206. {ARM_EXT_V6T2, 0xfa0ff080, 0xfffff0c0, "sxth%c.w\t%8-11r, %0-3r%R"},
  1207. {ARM_EXT_V6T2, 0xfa1ff080, 0xfffff0c0, "uxth%c.w\t%8-11r, %0-3r%R"},
  1208. {ARM_EXT_V6T2, 0xfa2ff080, 0xfffff0c0, "sxtb16%c\t%8-11r, %0-3r%R"},
  1209. {ARM_EXT_V6T2, 0xfa3ff080, 0xfffff0c0, "uxtb16%c\t%8-11r, %0-3r%R"},
  1210. {ARM_EXT_V6T2, 0xfa4ff080, 0xfffff0c0, "sxtb%c.w\t%8-11r, %0-3r%R"},
  1211. {ARM_EXT_V6T2, 0xfa5ff080, 0xfffff0c0, "uxtb%c.w\t%8-11r, %0-3r%R"},
  1212. {ARM_EXT_V6T2, 0xe8400000, 0xfff000ff, "strex%c\t%8-11r, %12-15r, [%16-19r]"},
  1213. {ARM_EXT_V6T2, 0xe8d0007f, 0xfff000ff, "ldrexd%c\t%12-15r, %8-11r, [%16-19r]"},
  1214. {ARM_EXT_V6T2, 0xfa80f000, 0xfff0f0f0, "sadd8%c\t%8-11r, %16-19r, %0-3r"},
  1215. {ARM_EXT_V6T2, 0xfa80f010, 0xfff0f0f0, "qadd8%c\t%8-11r, %16-19r, %0-3r"},
  1216. {ARM_EXT_V6T2, 0xfa80f020, 0xfff0f0f0, "shadd8%c\t%8-11r, %16-19r, %0-3r"},
  1217. {ARM_EXT_V6T2, 0xfa80f040, 0xfff0f0f0, "uadd8%c\t%8-11r, %16-19r, %0-3r"},
  1218. {ARM_EXT_V6T2, 0xfa80f050, 0xfff0f0f0, "uqadd8%c\t%8-11r, %16-19r, %0-3r"},
  1219. {ARM_EXT_V6T2, 0xfa80f060, 0xfff0f0f0, "uhadd8%c\t%8-11r, %16-19r, %0-3r"},
  1220. {ARM_EXT_V6T2, 0xfa80f080, 0xfff0f0f0, "qadd%c\t%8-11r, %0-3r, %16-19r"},
  1221. {ARM_EXT_V6T2, 0xfa80f090, 0xfff0f0f0, "qdadd%c\t%8-11r, %0-3r, %16-19r"},
  1222. {ARM_EXT_V6T2, 0xfa80f0a0, 0xfff0f0f0, "qsub%c\t%8-11r, %0-3r, %16-19r"},
  1223. {ARM_EXT_V6T2, 0xfa80f0b0, 0xfff0f0f0, "qdsub%c\t%8-11r, %0-3r, %16-19r"},
  1224. {ARM_EXT_V6T2, 0xfa90f000, 0xfff0f0f0, "sadd16%c\t%8-11r, %16-19r, %0-3r"},
  1225. {ARM_EXT_V6T2, 0xfa90f010, 0xfff0f0f0, "qadd16%c\t%8-11r, %16-19r, %0-3r"},
  1226. {ARM_EXT_V6T2, 0xfa90f020, 0xfff0f0f0, "shadd16%c\t%8-11r, %16-19r, %0-3r"},
  1227. {ARM_EXT_V6T2, 0xfa90f040, 0xfff0f0f0, "uadd16%c\t%8-11r, %16-19r, %0-3r"},
  1228. {ARM_EXT_V6T2, 0xfa90f050, 0xfff0f0f0, "uqadd16%c\t%8-11r, %16-19r, %0-3r"},
  1229. {ARM_EXT_V6T2, 0xfa90f060, 0xfff0f0f0, "uhadd16%c\t%8-11r, %16-19r, %0-3r"},
  1230. {ARM_EXT_V6T2, 0xfa90f080, 0xfff0f0f0, "rev%c.w\t%8-11r, %16-19r"},
  1231. {ARM_EXT_V6T2, 0xfa90f090, 0xfff0f0f0, "rev16%c.w\t%8-11r, %16-19r"},
  1232. {ARM_EXT_V6T2, 0xfa90f0a0, 0xfff0f0f0, "rbit%c\t%8-11r, %16-19r"},
  1233. {ARM_EXT_V6T2, 0xfa90f0b0, 0xfff0f0f0, "revsh%c.w\t%8-11r, %16-19r"},
  1234. {ARM_EXT_V6T2, 0xfaa0f000, 0xfff0f0f0, "saddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1235. {ARM_EXT_V6T2, 0xfaa0f010, 0xfff0f0f0, "qaddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1236. {ARM_EXT_V6T2, 0xfaa0f020, 0xfff0f0f0, "shaddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1237. {ARM_EXT_V6T2, 0xfaa0f040, 0xfff0f0f0, "uaddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1238. {ARM_EXT_V6T2, 0xfaa0f050, 0xfff0f0f0, "uqaddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1239. {ARM_EXT_V6T2, 0xfaa0f060, 0xfff0f0f0, "uhaddsubx%c\t%8-11r, %16-19r, %0-3r"},
  1240. {ARM_EXT_V6T2, 0xfaa0f080, 0xfff0f0f0, "sel%c\t%8-11r, %16-19r, %0-3r"},
  1241. {ARM_EXT_V6T2, 0xfab0f080, 0xfff0f0f0, "clz%c\t%8-11r, %16-19r"},
  1242. {ARM_EXT_V6T2, 0xfac0f000, 0xfff0f0f0, "ssub8%c\t%8-11r, %16-19r, %0-3r"},
  1243. {ARM_EXT_V6T2, 0xfac0f010, 0xfff0f0f0, "qsub8%c\t%8-11r, %16-19r, %0-3r"},
  1244. {ARM_EXT_V6T2, 0xfac0f020, 0xfff0f0f0, "shsub8%c\t%8-11r, %16-19r, %0-3r"},
  1245. {ARM_EXT_V6T2, 0xfac0f040, 0xfff0f0f0, "usub8%c\t%8-11r, %16-19r, %0-3r"},
  1246. {ARM_EXT_V6T2, 0xfac0f050, 0xfff0f0f0, "uqsub8%c\t%8-11r, %16-19r, %0-3r"},
  1247. {ARM_EXT_V6T2, 0xfac0f060, 0xfff0f0f0, "uhsub8%c\t%8-11r, %16-19r, %0-3r"},
  1248. {ARM_EXT_V6T2, 0xfad0f000, 0xfff0f0f0, "ssub16%c\t%8-11r, %16-19r, %0-3r"},
  1249. {ARM_EXT_V6T2, 0xfad0f010, 0xfff0f0f0, "qsub16%c\t%8-11r, %16-19r, %0-3r"},
  1250. {ARM_EXT_V6T2, 0xfad0f020, 0xfff0f0f0, "shsub16%c\t%8-11r, %16-19r, %0-3r"},
  1251. {ARM_EXT_V6T2, 0xfad0f040, 0xfff0f0f0, "usub16%c\t%8-11r, %16-19r, %0-3r"},
  1252. {ARM_EXT_V6T2, 0xfad0f050, 0xfff0f0f0, "uqsub16%c\t%8-11r, %16-19r, %0-3r"},
  1253. {ARM_EXT_V6T2, 0xfad0f060, 0xfff0f0f0, "uhsub16%c\t%8-11r, %16-19r, %0-3r"},
  1254. {ARM_EXT_V6T2, 0xfae0f000, 0xfff0f0f0, "ssubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1255. {ARM_EXT_V6T2, 0xfae0f010, 0xfff0f0f0, "qsubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1256. {ARM_EXT_V6T2, 0xfae0f020, 0xfff0f0f0, "shsubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1257. {ARM_EXT_V6T2, 0xfae0f040, 0xfff0f0f0, "usubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1258. {ARM_EXT_V6T2, 0xfae0f050, 0xfff0f0f0, "uqsubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1259. {ARM_EXT_V6T2, 0xfae0f060, 0xfff0f0f0, "uhsubaddx%c\t%8-11r, %16-19r, %0-3r"},
  1260. {ARM_EXT_V6T2, 0xfb00f000, 0xfff0f0f0, "mul%c.w\t%8-11r, %16-19r, %0-3r"},
  1261. {ARM_EXT_V6T2, 0xfb70f000, 0xfff0f0f0, "usad8%c\t%8-11r, %16-19r, %0-3r"},
  1262. {ARM_EXT_V6T2, 0xfa00f000, 0xffe0f0f0, "lsl%20's%c.w\t%8-11r, %16-19r, %0-3r"},
  1263. {ARM_EXT_V6T2, 0xfa20f000, 0xffe0f0f0, "lsr%20's%c.w\t%8-11r, %16-19r, %0-3r"},
  1264. {ARM_EXT_V6T2, 0xfa40f000, 0xffe0f0f0, "asr%20's%c.w\t%8-11r, %16-19r, %0-3r"},
  1265. {ARM_EXT_V6T2, 0xfa60f000, 0xffe0f0f0, "ror%20's%c.w\t%8-11r, %16-19r, %0-3r"},
  1266. {ARM_EXT_V6T2, 0xe8c00f40, 0xfff00fe0, "strex%4?hb%c\t%0-3r, %12-15r, [%16-19r]"},
  1267. {ARM_EXT_V6T2, 0xf3200000, 0xfff0f0e0, "ssat16%c\t%8-11r, #%0-4d, %16-19r"},
  1268. {ARM_EXT_V6T2, 0xf3a00000, 0xfff0f0e0, "usat16%c\t%8-11r, #%0-4d, %16-19r"},
  1269. {ARM_EXT_V6T2, 0xfb20f000, 0xfff0f0e0, "smuad%4'x%c\t%8-11r, %16-19r, %0-3r"},
  1270. {ARM_EXT_V6T2, 0xfb30f000, 0xfff0f0e0, "smulw%4?tb%c\t%8-11r, %16-19r, %0-3r"},
  1271. {ARM_EXT_V6T2, 0xfb40f000, 0xfff0f0e0, "smusd%4'x%c\t%8-11r, %16-19r, %0-3r"},
  1272. {ARM_EXT_V6T2, 0xfb50f000, 0xfff0f0e0, "smmul%4'r%c\t%8-11r, %16-19r, %0-3r"},
  1273. {ARM_EXT_V6T2, 0xfa00f080, 0xfff0f0c0, "sxtah%c\t%8-11r, %16-19r, %0-3r%R"},
  1274. {ARM_EXT_V6T2, 0xfa10f080, 0xfff0f0c0, "uxtah%c\t%8-11r, %16-19r, %0-3r%R"},
  1275. {ARM_EXT_V6T2, 0xfa20f080, 0xfff0f0c0, "sxtab16%c\t%8-11r, %16-19r, %0-3r%R"},
  1276. {ARM_EXT_V6T2, 0xfa30f080, 0xfff0f0c0, "uxtab16%c\t%8-11r, %16-19r, %0-3r%R"},
  1277. {ARM_EXT_V6T2, 0xfa40f080, 0xfff0f0c0, "sxtab%c\t%8-11r, %16-19r, %0-3r%R"},
  1278. {ARM_EXT_V6T2, 0xfa50f080, 0xfff0f0c0, "uxtab%c\t%8-11r, %16-19r, %0-3r%R"},
  1279. {ARM_EXT_V6T2, 0xfb10f000, 0xfff0f0c0, "smul%5?tb%4?tb%c\t%8-11r, %16-19r, %0-3r"},
  1280. {ARM_EXT_V6T2, 0xf36f0000, 0xffff8020, "bfc%c\t%8-11r, %E"},
  1281. {ARM_EXT_V6T2, 0xea100f00, 0xfff08f00, "tst%c.w\t%16-19r, %S"},
  1282. {ARM_EXT_V6T2, 0xea900f00, 0xfff08f00, "teq%c\t%16-19r, %S"},
  1283. {ARM_EXT_V6T2, 0xeb100f00, 0xfff08f00, "cmn%c.w\t%16-19r, %S"},
  1284. {ARM_EXT_V6T2, 0xebb00f00, 0xfff08f00, "cmp%c.w\t%16-19r, %S"},
  1285. {ARM_EXT_V6T2, 0xf0100f00, 0xfbf08f00, "tst%c.w\t%16-19r, %M"},
  1286. {ARM_EXT_V6T2, 0xf0900f00, 0xfbf08f00, "teq%c\t%16-19r, %M"},
  1287. {ARM_EXT_V6T2, 0xf1100f00, 0xfbf08f00, "cmn%c.w\t%16-19r, %M"},
  1288. {ARM_EXT_V6T2, 0xf1b00f00, 0xfbf08f00, "cmp%c.w\t%16-19r, %M"},
  1289. {ARM_EXT_V6T2, 0xea4f0000, 0xffef8000, "mov%20's%c.w\t%8-11r, %S"},
  1290. {ARM_EXT_V6T2, 0xea6f0000, 0xffef8000, "mvn%20's%c.w\t%8-11r, %S"},
  1291. {ARM_EXT_V6T2, 0xe8c00070, 0xfff000f0, "strexd%c\t%0-3r, %12-15r, %8-11r, [%16-19r]"},
  1292. {ARM_EXT_V6T2, 0xfb000000, 0xfff000f0, "mla%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1293. {ARM_EXT_V6T2, 0xfb000010, 0xfff000f0, "mls%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1294. {ARM_EXT_V6T2, 0xfb700000, 0xfff000f0, "usada8%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1295. {ARM_EXT_V6T2, 0xfb800000, 0xfff000f0, "smull%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1296. {ARM_EXT_V6T2, 0xfba00000, 0xfff000f0, "umull%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1297. {ARM_EXT_V6T2, 0xfbc00000, 0xfff000f0, "smlal%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1298. {ARM_EXT_V6T2, 0xfbe00000, 0xfff000f0, "umlal%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1299. {ARM_EXT_V6T2, 0xfbe00060, 0xfff000f0, "umaal%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1300. {ARM_EXT_V6T2, 0xe8500f00, 0xfff00f00, "ldrex%c\t%12-15r, [%16-19r, #%0-7W]"},
  1301. {ARM_EXT_V6T2, 0xf7f08000, 0xfff0f000, "smc%c\t%K"},
  1302. {ARM_EXT_V6T2, 0xf04f0000, 0xfbef8000, "mov%20's%c.w\t%8-11r, %M"},
  1303. {ARM_EXT_V6T2, 0xf06f0000, 0xfbef8000, "mvn%20's%c.w\t%8-11r, %M"},
  1304. {ARM_EXT_V6T2, 0xf810f000, 0xff70f000, "pld%c\t%a"},
  1305. {ARM_EXT_V6T2, 0xfb200000, 0xfff000e0, "smlad%4'x%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1306. {ARM_EXT_V6T2, 0xfb300000, 0xfff000e0, "smlaw%4?tb%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1307. {ARM_EXT_V6T2, 0xfb400000, 0xfff000e0, "smlsd%4'x%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1308. {ARM_EXT_V6T2, 0xfb500000, 0xfff000e0, "smmla%4'r%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1309. {ARM_EXT_V6T2, 0xfb600000, 0xfff000e0, "smmls%4'r%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1310. {ARM_EXT_V6T2, 0xfbc000c0, 0xfff000e0, "smlald%4'x%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1311. {ARM_EXT_V6T2, 0xfbd000c0, 0xfff000e0, "smlsld%4'x%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1312. {ARM_EXT_V6T2, 0xeac00000, 0xfff08030, "pkhbt%c\t%8-11r, %16-19r, %S"},
  1313. {ARM_EXT_V6T2, 0xeac00020, 0xfff08030, "pkhtb%c\t%8-11r, %16-19r, %S"},
  1314. {ARM_EXT_V6T2, 0xf3400000, 0xfff08020, "sbfx%c\t%8-11r, %16-19r, %F"},
  1315. {ARM_EXT_V6T2, 0xf3c00000, 0xfff08020, "ubfx%c\t%8-11r, %16-19r, %F"},
  1316. {ARM_EXT_V6T2, 0xf8000e00, 0xff900f00, "str%wt%c\t%12-15r, %a"},
  1317. {ARM_EXT_V6T2, 0xfb100000, 0xfff000c0, "smla%5?tb%4?tb%c\t%8-11r, %16-19r, %0-3r, %12-15r"},
  1318. {ARM_EXT_V6T2, 0xfbc00080, 0xfff000c0, "smlal%5?tb%4?tb%c\t%12-15r, %8-11r, %16-19r, %0-3r"},
  1319. {ARM_EXT_V6T2, 0xf3600000, 0xfff08020, "bfi%c\t%8-11r, %16-19r, %E"},
  1320. {ARM_EXT_V6T2, 0xf8100e00, 0xfe900f00, "ldr%wt%c\t%12-15r, %a"},
  1321. {ARM_EXT_V6T2, 0xf3000000, 0xffd08020, "ssat%c\t%8-11r, #%0-4d, %16-19r%s"},
  1322. {ARM_EXT_V6T2, 0xf3800000, 0xffd08020, "usat%c\t%8-11r, #%0-4d, %16-19r%s"},
  1323. {ARM_EXT_V6T2, 0xf2000000, 0xfbf08000, "addw%c\t%8-11r, %16-19r, %I"},
  1324. {ARM_EXT_V6T2, 0xf2400000, 0xfbf08000, "movw%c\t%8-11r, %J"},
  1325. {ARM_EXT_V6T2, 0xf2a00000, 0xfbf08000, "subw%c\t%8-11r, %16-19r, %I"},
  1326. {ARM_EXT_V6T2, 0xf2c00000, 0xfbf08000, "movt%c\t%8-11r, %J"},
  1327. {ARM_EXT_V6T2, 0xea000000, 0xffe08000, "and%20's%c.w\t%8-11r, %16-19r, %S"},
  1328. {ARM_EXT_V6T2, 0xea200000, 0xffe08000, "bic%20's%c.w\t%8-11r, %16-19r, %S"},
  1329. {ARM_EXT_V6T2, 0xea400000, 0xffe08000, "orr%20's%c.w\t%8-11r, %16-19r, %S"},
  1330. {ARM_EXT_V6T2, 0xea600000, 0xffe08000, "orn%20's%c\t%8-11r, %16-19r, %S"},
  1331. {ARM_EXT_V6T2, 0xea800000, 0xffe08000, "eor%20's%c.w\t%8-11r, %16-19r, %S"},
  1332. {ARM_EXT_V6T2, 0xeb000000, 0xffe08000, "add%20's%c.w\t%8-11r, %16-19r, %S"},
  1333. {ARM_EXT_V6T2, 0xeb400000, 0xffe08000, "adc%20's%c.w\t%8-11r, %16-19r, %S"},
  1334. {ARM_EXT_V6T2, 0xeb600000, 0xffe08000, "sbc%20's%c.w\t%8-11r, %16-19r, %S"},
  1335. {ARM_EXT_V6T2, 0xeba00000, 0xffe08000, "sub%20's%c.w\t%8-11r, %16-19r, %S"},
  1336. {ARM_EXT_V6T2, 0xebc00000, 0xffe08000, "rsb%20's%c\t%8-11r, %16-19r, %S"},
  1337. {ARM_EXT_V6T2, 0xe8400000, 0xfff00000, "strex%c\t%8-11r, %12-15r, [%16-19r, #%0-7W]"},
  1338. {ARM_EXT_V6T2, 0xf0000000, 0xfbe08000, "and%20's%c.w\t%8-11r, %16-19r, %M"},
  1339. {ARM_EXT_V6T2, 0xf0200000, 0xfbe08000, "bic%20's%c.w\t%8-11r, %16-19r, %M"},
  1340. {ARM_EXT_V6T2, 0xf0400000, 0xfbe08000, "orr%20's%c.w\t%8-11r, %16-19r, %M"},
  1341. {ARM_EXT_V6T2, 0xf0600000, 0xfbe08000, "orn%20's%c\t%8-11r, %16-19r, %M"},
  1342. {ARM_EXT_V6T2, 0xf0800000, 0xfbe08000, "eor%20's%c.w\t%8-11r, %16-19r, %M"},
  1343. {ARM_EXT_V6T2, 0xf1000000, 0xfbe08000, "add%20's%c.w\t%8-11r, %16-19r, %M"},
  1344. {ARM_EXT_V6T2, 0xf1400000, 0xfbe08000, "adc%20's%c.w\t%8-11r, %16-19r, %M"},
  1345. {ARM_EXT_V6T2, 0xf1600000, 0xfbe08000, "sbc%20's%c.w\t%8-11r, %16-19r, %M"},
  1346. {ARM_EXT_V6T2, 0xf1a00000, 0xfbe08000, "sub%20's%c.w\t%8-11r, %16-19r, %M"},
  1347. {ARM_EXT_V6T2, 0xf1c00000, 0xfbe08000, "rsb%20's%c\t%8-11r, %16-19r, %M"},
  1348. {ARM_EXT_V6T2, 0xe8800000, 0xffd00000, "stmia%c.w\t%16-19r%21'!, %m"},
  1349. {ARM_EXT_V6T2, 0xe8900000, 0xffd00000, "ldmia%c.w\t%16-19r%21'!, %m"},
  1350. {ARM_EXT_V6T2, 0xe9000000, 0xffd00000, "stmdb%c\t%16-19r%21'!, %m"},
  1351. {ARM_EXT_V6T2, 0xe9100000, 0xffd00000, "ldmdb%c\t%16-19r%21'!, %m"},
  1352. {ARM_EXT_V6T2, 0xe9c00000, 0xffd000ff, "strd%c\t%12-15r, %8-11r, [%16-19r]"},
  1353. {ARM_EXT_V6T2, 0xe9d00000, 0xffd000ff, "ldrd%c\t%12-15r, %8-11r, [%16-19r]"},
  1354. {ARM_EXT_V6T2, 0xe9400000, 0xff500000, "strd%c\t%12-15r, %8-11r, [%16-19r, #%23`-%0-7W]%21'!"},
  1355. {ARM_EXT_V6T2, 0xe9500000, 0xff500000, "ldrd%c\t%12-15r, %8-11r, [%16-19r, #%23`-%0-7W]%21'!"},
  1356. {ARM_EXT_V6T2, 0xe8600000, 0xff700000, "strd%c\t%12-15r, %8-11r, [%16-19r], #%23`-%0-7W"},
  1357. {ARM_EXT_V6T2, 0xe8700000, 0xff700000, "ldrd%c\t%12-15r, %8-11r, [%16-19r], #%23`-%0-7W"},
  1358. {ARM_EXT_V6T2, 0xf8000000, 0xff100000, "str%w%c.w\t%12-15r, %a"},
  1359. {ARM_EXT_V6T2, 0xf8100000, 0xfe100000, "ldr%w%c.w\t%12-15r, %a"},
  1360. /* Filter out Bcc with cond=E or F, which are used for other instructions. */
  1361. {ARM_EXT_V6T2, 0xf3c08000, 0xfbc0d000, "undefined (bcc, cond=0xF)"},
  1362. {ARM_EXT_V6T2, 0xf3808000, 0xfbc0d000, "undefined (bcc, cond=0xE)"},
  1363. {ARM_EXT_V6T2, 0xf0008000, 0xf800d000, "b%22-25c.w\t%b%X"},
  1364. {ARM_EXT_V6T2, 0xf0009000, 0xf800d000, "b%c.w\t%B%x"},
  1365. /* These have been 32-bit since the invention of Thumb. */
  1366. {ARM_EXT_V4T, 0xf000c000, 0xf800d000, "blx%c\t%B%x"},
  1367. {ARM_EXT_V4T, 0xf000d000, 0xf800d000, "bl%c\t%B%x"},
  1368. /* Fallback. */
  1369. {ARM_EXT_V1, 0x00000000, 0x00000000, "undefined"},
  1370. {0, 0, 0, 0}
  1371. };
  1372. static const char *const arm_conditional[] =
  1373. {"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc",
  1374. "hi", "ls", "ge", "lt", "gt", "le", "al", "<und>", ""};
  1375. static const char *const arm_fp_const[] =
  1376. {"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0"};
  1377. static const char *const arm_shift[] =
  1378. {"lsl", "lsr", "asr", "ror"};
  1379. typedef struct
  1380. {
  1381. const char *name;
  1382. const char *description;
  1383. const char *reg_names[16];
  1384. }
  1385. arm_regname;
  1386. static const arm_regname regnames[] =
  1387. {
  1388. { "raw" , "Select raw register names",
  1389. { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}},
  1390. { "gcc", "Select register names used by GCC",
  1391. { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc" }},
  1392. { "std", "Select register names used in ARM's ISA documentation",
  1393. { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc" }},
  1394. { "apcs", "Select register names used in the APCS",
  1395. { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "sl", "fp", "ip", "sp", "lr", "pc" }},
  1396. { "atpcs", "Select register names used in the ATPCS",
  1397. { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "IP", "SP", "LR", "PC" }},
  1398. { "special-atpcs", "Select special register names used in the ATPCS",
  1399. { "a1", "a2", "a3", "a4", "v1", "v2", "v3", "WR", "v5", "SB", "SL", "FP", "IP", "SP", "LR", "PC" }},
  1400. };
  1401. static const char *const iwmmxt_wwnames[] =
  1402. {"b", "h", "w", "d"};
  1403. static const char *const iwmmxt_wwssnames[] =
  1404. {"b", "bus", "bc", "bss",
  1405. "h", "hus", "hc", "hss",
  1406. "w", "wus", "wc", "wss",
  1407. "d", "dus", "dc", "dss"
  1408. };
  1409. static const char *const iwmmxt_regnames[] =
  1410. { "wr0", "wr1", "wr2", "wr3", "wr4", "wr5", "wr6", "wr7",
  1411. "wr8", "wr9", "wr10", "wr11", "wr12", "wr13", "wr14", "wr15"
  1412. };
  1413. static const char *const iwmmxt_cregnames[] =
  1414. { "wcid", "wcon", "wcssf", "wcasf", "reserved", "reserved", "reserved", "reserved",
  1415. "wcgr0", "wcgr1", "wcgr2", "wcgr3", "reserved", "reserved", "reserved", "reserved"
  1416. };
  1417. /* Default to GCC register name set. */
  1418. static unsigned int regname_selected = 1;
  1419. #define NUM_ARM_REGNAMES NUM_ELEM (regnames)
  1420. #define arm_regnames regnames[regname_selected].reg_names
  1421. static bfd_boolean force_thumb = false;
  1422. /* Current IT instruction state. This contains the same state as the IT
  1423. bits in the CPSR. */
  1424. static unsigned int ifthen_state;
  1425. /* IT state for the next instruction. */
  1426. static unsigned int ifthen_next_state;
  1427. /* The address of the insn for which the IT state is valid. */
  1428. static bfd_vma ifthen_address;
  1429. #define IFTHEN_COND ((ifthen_state >> 4) & 0xf)
  1430. /* Cached mapping symbol state. */
  1431. enum map_type {
  1432. MAP_ARM,
  1433. MAP_THUMB,
  1434. MAP_DATA
  1435. };
  1436. enum map_type last_type;
  1437. int last_mapping_sym = -1;
  1438. bfd_vma last_mapping_addr = 0;
  1439. /* Decode a bitfield of the form matching regexp (N(-N)?,)*N(-N)?.
  1440. Returns pointer to following character of the format string and
  1441. fills in *VALUEP and *WIDTHP with the extracted value and number of
  1442. bits extracted. WIDTHP can be NULL. */
  1443. static const char *
  1444. arm_decode_bitfield (const char *ptr, unsigned long insn,
  1445. unsigned long *valuep, int *widthp)
  1446. {
  1447. unsigned long value = 0;
  1448. int width = 0;
  1449. do
  1450. {
  1451. int start, end;
  1452. int bits;
  1453. for (start = 0; *ptr >= '0' && *ptr <= '9'; ptr++)
  1454. start = start * 10 + *ptr - '0';
  1455. if (*ptr == '-')
  1456. for (end = 0, ptr++; *ptr >= '0' && *ptr <= '9'; ptr++)
  1457. end = end * 10 + *ptr - '0';
  1458. else
  1459. end = start;
  1460. bits = end - start;
  1461. if (bits < 0)
  1462. abort ();
  1463. value |= ((insn >> start) & ((2ul << bits) - 1)) << width;
  1464. width += bits + 1;
  1465. }
  1466. while (*ptr++ == ',');
  1467. *valuep = value;
  1468. if (widthp)
  1469. *widthp = width;
  1470. return ptr - 1;
  1471. }
  1472. static void
  1473. arm_decode_shift (long given, fprintf_function func, void *stream,
  1474. int print_shift)
  1475. {
  1476. func (stream, "%s", arm_regnames[given & 0xf]);
  1477. if ((given & 0xff0) != 0)
  1478. {
  1479. if ((given & 0x10) == 0)
  1480. {
  1481. int amount = (given & 0xf80) >> 7;
  1482. int shift = (given & 0x60) >> 5;
  1483. if (amount == 0)
  1484. {
  1485. if (shift == 3)
  1486. {
  1487. func (stream, ", rrx");
  1488. return;
  1489. }
  1490. amount = 32;
  1491. }
  1492. if (print_shift)
  1493. func (stream, ", %s #%d", arm_shift[shift], amount);
  1494. else
  1495. func (stream, ", #%d", amount);
  1496. }
  1497. else if (print_shift)
  1498. func (stream, ", %s %s", arm_shift[(given & 0x60) >> 5],
  1499. arm_regnames[(given & 0xf00) >> 8]);
  1500. else
  1501. func (stream, ", %s", arm_regnames[(given & 0xf00) >> 8]);
  1502. }
  1503. }
  1504. /* Print one coprocessor instruction on INFO->STREAM.
  1505. Return true if the instruction matched, false if this is not a
  1506. recognised coprocessor instruction. */
  1507. static bfd_boolean
  1508. print_insn_coprocessor (bfd_vma pc, struct disassemble_info *info, long given,
  1509. bfd_boolean thumb)
  1510. {
  1511. const struct opcode32 *insn;
  1512. void *stream = info->stream;
  1513. fprintf_function func = info->fprintf_func;
  1514. unsigned long mask;
  1515. unsigned long value;
  1516. int cond;
  1517. for (insn = coprocessor_opcodes; insn->assembler; insn++)
  1518. {
  1519. if (insn->value == FIRST_IWMMXT_INSN
  1520. && info->mach != bfd_mach_arm_XScale
  1521. && info->mach != bfd_mach_arm_iWMMXt
  1522. && info->mach != bfd_mach_arm_iWMMXt2)
  1523. insn = insn + IWMMXT_INSN_COUNT;
  1524. mask = insn->mask;
  1525. value = insn->value;
  1526. if (thumb)
  1527. {
  1528. /* The high 4 bits are 0xe for Arm conditional instructions, and
  1529. 0xe for arm unconditional instructions. The rest of the
  1530. encoding is the same. */
  1531. mask |= 0xf0000000;
  1532. value |= 0xe0000000;
  1533. if (ifthen_state)
  1534. cond = IFTHEN_COND;
  1535. else
  1536. cond = 16;
  1537. }
  1538. else
  1539. {
  1540. /* Only match unconditional instuctions against unconditional
  1541. patterns. */
  1542. if ((given & 0xf0000000) == 0xf0000000)
  1543. {
  1544. mask |= 0xf0000000;
  1545. cond = 16;
  1546. }
  1547. else
  1548. {
  1549. cond = (given >> 28) & 0xf;
  1550. if (cond == 0xe)
  1551. cond = 16;
  1552. }
  1553. }
  1554. if ((given & mask) == value)
  1555. {
  1556. const char *c;
  1557. for (c = insn->assembler; *c; c++)
  1558. {
  1559. if (*c == '%')
  1560. {
  1561. switch (*++c)
  1562. {
  1563. case '%':
  1564. func (stream, "%%");
  1565. break;
  1566. case 'A':
  1567. func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]);
  1568. if ((given & (1 << 24)) != 0)
  1569. {
  1570. int offset = given & 0xff;
  1571. if (offset)
  1572. func (stream, ", #%s%d]%s",
  1573. ((given & 0x00800000) == 0 ? "-" : ""),
  1574. offset * 4,
  1575. ((given & 0x00200000) != 0 ? "!" : ""));
  1576. else
  1577. func (stream, "]");
  1578. }
  1579. else
  1580. {
  1581. int offset = given & 0xff;
  1582. func (stream, "]");
  1583. if (given & (1 << 21))
  1584. {
  1585. if (offset)
  1586. func (stream, ", #%s%d",
  1587. ((given & 0x00800000) == 0 ? "-" : ""),
  1588. offset * 4);
  1589. }
  1590. else
  1591. func (stream, ", {%d}", offset);
  1592. }
  1593. break;
  1594. case 'B':
  1595. {
  1596. int regno = ((given >> 12) & 0xf) | ((given >> (22 - 4)) & 0x10);
  1597. int offset = (given >> 1) & 0x3f;
  1598. if (offset == 1)
  1599. func (stream, "{d%d}", regno);
  1600. else if (regno + offset > 32)
  1601. func (stream, "{d%d-<overflow reg d%d>}", regno, regno + offset - 1);
  1602. else
  1603. func (stream, "{d%d-d%d}", regno, regno + offset - 1);
  1604. }
  1605. break;
  1606. case 'C':
  1607. {
  1608. int rn = (given >> 16) & 0xf;
  1609. int offset = (given & 0xff) * 4;
  1610. int add = (given >> 23) & 1;
  1611. func (stream, "[%s", arm_regnames[rn]);
  1612. if (offset)
  1613. {
  1614. if (!add)
  1615. offset = -offset;
  1616. func (stream, ", #%d", offset);
  1617. }
  1618. func (stream, "]");
  1619. if (rn == 15)
  1620. {
  1621. func (stream, "\t; ");
  1622. /* FIXME: Unsure if info->bytes_per_chunk is the
  1623. right thing to use here. */
  1624. info->print_address_func (offset + pc
  1625. + info->bytes_per_chunk * 2, info);
  1626. }
  1627. }
  1628. break;
  1629. case 'c':
  1630. func (stream, "%s", arm_conditional[cond]);
  1631. break;
  1632. case 'I':
  1633. /* Print a Cirrus/DSP shift immediate. */
  1634. /* Immediates are 7bit signed ints with bits 0..3 in
  1635. bits 0..3 of opcode and bits 4..6 in bits 5..7
  1636. of opcode. */
  1637. {
  1638. int imm;
  1639. imm = (given & 0xf) | ((given & 0xe0) >> 1);
  1640. /* Is ``imm'' a negative number? */
  1641. if (imm & 0x40)
  1642. imm |= (-1 << 7);
  1643. func (stream, "%d", imm);
  1644. }
  1645. break;
  1646. case 'F':
  1647. switch (given & 0x00408000)
  1648. {
  1649. case 0:
  1650. func (stream, "4");
  1651. break;
  1652. case 0x8000:
  1653. func (stream, "1");
  1654. break;
  1655. case 0x00400000:
  1656. func (stream, "2");
  1657. break;
  1658. default:
  1659. func (stream, "3");
  1660. }
  1661. break;
  1662. case 'P':
  1663. switch (given & 0x00080080)
  1664. {
  1665. case 0:
  1666. func (stream, "s");
  1667. break;
  1668. case 0x80:
  1669. func (stream, "d");
  1670. break;
  1671. case 0x00080000:
  1672. func (stream, "e");
  1673. break;
  1674. default:
  1675. func (stream, _("<illegal precision>"));
  1676. break;
  1677. }
  1678. break;
  1679. case 'Q':
  1680. switch (given & 0x00408000)
  1681. {
  1682. case 0:
  1683. func (stream, "s");
  1684. break;
  1685. case 0x8000:
  1686. func (stream, "d");
  1687. break;
  1688. case 0x00400000:
  1689. func (stream, "e");
  1690. break;
  1691. default:
  1692. func (stream, "p");
  1693. break;
  1694. }
  1695. break;
  1696. case 'R':
  1697. switch (given & 0x60)
  1698. {
  1699. case 0:
  1700. break;
  1701. case 0x20:
  1702. func (stream, "p");
  1703. break;
  1704. case 0x40:
  1705. func (stream, "m");
  1706. break;
  1707. default:
  1708. func (stream, "z");
  1709. break;
  1710. }
  1711. break;
  1712. case '0': case '1': case '2': case '3': case '4':
  1713. case '5': case '6': case '7': case '8': case '9':
  1714. {
  1715. int width;
  1716. unsigned long value;
  1717. c = arm_decode_bitfield (c, given, &value, &width);
  1718. switch (*c)
  1719. {
  1720. case 'r':
  1721. func (stream, "%s", arm_regnames[value]);
  1722. break;
  1723. case 'D':
  1724. func (stream, "d%ld", value);
  1725. break;
  1726. case 'Q':
  1727. if (value & 1)
  1728. func (stream, "<illegal reg q%ld.5>", value >> 1);
  1729. else
  1730. func (stream, "q%ld", value >> 1);
  1731. break;
  1732. case 'd':
  1733. func (stream, "%ld", value);
  1734. break;
  1735. case 'k':
  1736. {
  1737. int from = (given & (1 << 7)) ? 32 : 16;
  1738. func (stream, "%ld", from - value);
  1739. }
  1740. break;
  1741. case 'f':
  1742. if (value > 7)
  1743. func (stream, "#%s", arm_fp_const[value & 7]);
  1744. else
  1745. func (stream, "f%ld", value);
  1746. break;
  1747. case 'w':
  1748. if (width == 2)
  1749. func (stream, "%s", iwmmxt_wwnames[value]);
  1750. else
  1751. func (stream, "%s", iwmmxt_wwssnames[value]);
  1752. break;
  1753. case 'g':
  1754. func (stream, "%s", iwmmxt_regnames[value]);
  1755. break;
  1756. case 'G':
  1757. func (stream, "%s", iwmmxt_cregnames[value]);
  1758. break;
  1759. case 'x':
  1760. func (stream, "0x%lx", value);
  1761. break;
  1762. case '`':
  1763. c++;
  1764. if (value == 0)
  1765. func (stream, "%c", *c);
  1766. break;
  1767. case '\'':
  1768. c++;
  1769. if (value == ((1ul << width) - 1))
  1770. func (stream, "%c", *c);
  1771. break;
  1772. case '?':
  1773. func (stream, "%c", c[(1 << width) - (int)value]);
  1774. c += 1 << width;
  1775. break;
  1776. default:
  1777. abort ();
  1778. }
  1779. break;
  1780. case 'y':
  1781. case 'z':
  1782. {
  1783. int single = *c++ == 'y';
  1784. int regno;
  1785. switch (*c)
  1786. {
  1787. case '4': /* Sm pair */
  1788. func (stream, "{");
  1789. /* Fall through. */
  1790. case '0': /* Sm, Dm */
  1791. regno = given & 0x0000000f;
  1792. if (single)
  1793. {
  1794. regno <<= 1;
  1795. regno += (given >> 5) & 1;
  1796. }
  1797. else
  1798. regno += ((given >> 5) & 1) << 4;
  1799. break;
  1800. case '1': /* Sd, Dd */
  1801. regno = (given >> 12) & 0x0000000f;
  1802. if (single)
  1803. {
  1804. regno <<= 1;
  1805. regno += (given >> 22) & 1;
  1806. }
  1807. else
  1808. regno += ((given >> 22) & 1) << 4;
  1809. break;
  1810. case '2': /* Sn, Dn */
  1811. regno = (given >> 16) & 0x0000000f;
  1812. if (single)
  1813. {
  1814. regno <<= 1;
  1815. regno += (given >> 7) & 1;
  1816. }
  1817. else
  1818. regno += ((given >> 7) & 1) << 4;
  1819. break;
  1820. case '3': /* List */
  1821. func (stream, "{");
  1822. regno = (given >> 12) & 0x0000000f;
  1823. if (single)
  1824. {
  1825. regno <<= 1;
  1826. regno += (given >> 22) & 1;
  1827. }
  1828. else
  1829. regno += ((given >> 22) & 1) << 4;
  1830. break;
  1831. default:
  1832. abort ();
  1833. }
  1834. func (stream, "%c%d", single ? 's' : 'd', regno);
  1835. if (*c == '3')
  1836. {
  1837. int count = given & 0xff;
  1838. if (single == 0)
  1839. count >>= 1;
  1840. if (--count)
  1841. {
  1842. func (stream, "-%c%d",
  1843. single ? 's' : 'd',
  1844. regno + count);
  1845. }
  1846. func (stream, "}");
  1847. }
  1848. else if (*c == '4')
  1849. func (stream, ", %c%d}", single ? 's' : 'd',
  1850. regno + 1);
  1851. }
  1852. break;
  1853. case 'L':
  1854. switch (given & 0x00400100)
  1855. {
  1856. case 0x00000000: func (stream, "b"); break;
  1857. case 0x00400000: func (stream, "h"); break;
  1858. case 0x00000100: func (stream, "w"); break;
  1859. case 0x00400100: func (stream, "d"); break;
  1860. default:
  1861. break;
  1862. }
  1863. break;
  1864. case 'Z':
  1865. {
  1866. int value;
  1867. /* given (20, 23) | given (0, 3) */
  1868. value = ((given >> 16) & 0xf0) | (given & 0xf);
  1869. func (stream, "%d", value);
  1870. }
  1871. break;
  1872. case 'l':
  1873. /* This is like the 'A' operator, except that if
  1874. the width field "M" is zero, then the offset is
  1875. *not* multiplied by four. */
  1876. {
  1877. int offset = given & 0xff;
  1878. int multiplier = (given & 0x00000100) ? 4 : 1;
  1879. func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]);
  1880. if (offset)
  1881. {
  1882. if ((given & 0x01000000) != 0)
  1883. func (stream, ", #%s%d]%s",
  1884. ((given & 0x00800000) == 0 ? "-" : ""),
  1885. offset * multiplier,
  1886. ((given & 0x00200000) != 0 ? "!" : ""));
  1887. else
  1888. func (stream, "], #%s%d",
  1889. ((given & 0x00800000) == 0 ? "-" : ""),
  1890. offset * multiplier);
  1891. }
  1892. else
  1893. func (stream, "]");
  1894. }
  1895. break;
  1896. case 'r':
  1897. {
  1898. int imm4 = (given >> 4) & 0xf;
  1899. int puw_bits = ((given >> 22) & 6) | ((given >> 21) & 1);
  1900. int ubit = (given >> 23) & 1;
  1901. const char *rm = arm_regnames [given & 0xf];
  1902. const char *rn = arm_regnames [(given >> 16) & 0xf];
  1903. switch (puw_bits)
  1904. {
  1905. case 1:
  1906. /* fall through */
  1907. case 3:
  1908. func (stream, "[%s], %c%s", rn, ubit ? '+' : '-', rm);
  1909. if (imm4)
  1910. func (stream, ", lsl #%d", imm4);
  1911. break;
  1912. case 4:
  1913. /* fall through */
  1914. case 5:
  1915. /* fall through */
  1916. case 6:
  1917. /* fall through */
  1918. case 7:
  1919. func (stream, "[%s, %c%s", rn, ubit ? '+' : '-', rm);
  1920. if (imm4 > 0)
  1921. func (stream, ", lsl #%d", imm4);
  1922. func (stream, "]");
  1923. if (puw_bits == 5 || puw_bits == 7)
  1924. func (stream, "!");
  1925. break;
  1926. default:
  1927. func (stream, "INVALID");
  1928. }
  1929. }
  1930. break;
  1931. case 'i':
  1932. {
  1933. long imm5;
  1934. imm5 = ((given & 0x100) >> 4) | (given & 0xf);
  1935. func (stream, "%ld", (imm5 == 0) ? 32 : imm5);
  1936. }
  1937. break;
  1938. default:
  1939. abort ();
  1940. }
  1941. }
  1942. }
  1943. else
  1944. func (stream, "%c", *c);
  1945. }
  1946. return true;
  1947. }
  1948. }
  1949. return false;
  1950. }
  1951. static void
  1952. print_arm_address (bfd_vma pc, struct disassemble_info *info, long given)
  1953. {
  1954. void *stream = info->stream;
  1955. fprintf_function func = info->fprintf_func;
  1956. if (((given & 0x000f0000) == 0x000f0000)
  1957. && ((given & 0x02000000) == 0))
  1958. {
  1959. int offset = given & 0xfff;
  1960. func (stream, "[pc");
  1961. if (given & 0x01000000)
  1962. {
  1963. if ((given & 0x00800000) == 0)
  1964. offset = - offset;
  1965. /* Pre-indexed. */
  1966. func (stream, ", #%d]", offset);
  1967. offset += pc + 8;
  1968. /* Cope with the possibility of write-back
  1969. being used. Probably a very dangerous thing
  1970. for the programmer to do, but who are we to
  1971. argue ? */
  1972. if (given & 0x00200000)
  1973. func (stream, "!");
  1974. }
  1975. else
  1976. {
  1977. /* Post indexed. */
  1978. func (stream, "], #%d", offset);
  1979. /* ie ignore the offset. */
  1980. offset = pc + 8;
  1981. }
  1982. func (stream, "\t; ");
  1983. info->print_address_func (offset, info);
  1984. }
  1985. else
  1986. {
  1987. func (stream, "[%s",
  1988. arm_regnames[(given >> 16) & 0xf]);
  1989. if ((given & 0x01000000) != 0)
  1990. {
  1991. if ((given & 0x02000000) == 0)
  1992. {
  1993. int offset = given & 0xfff;
  1994. if (offset)
  1995. func (stream, ", #%s%d",
  1996. (((given & 0x00800000) == 0)
  1997. ? "-" : ""), offset);
  1998. }
  1999. else
  2000. {
  2001. func (stream, ", %s",
  2002. (((given & 0x00800000) == 0)
  2003. ? "-" : ""));
  2004. arm_decode_shift (given, func, stream, 1);
  2005. }
  2006. func (stream, "]%s",
  2007. ((given & 0x00200000) != 0) ? "!" : "");
  2008. }
  2009. else
  2010. {
  2011. if ((given & 0x02000000) == 0)
  2012. {
  2013. int offset = given & 0xfff;
  2014. if (offset)
  2015. func (stream, "], #%s%d",
  2016. (((given & 0x00800000) == 0)
  2017. ? "-" : ""), offset);
  2018. else
  2019. func (stream, "]");
  2020. }
  2021. else
  2022. {
  2023. func (stream, "], %s",
  2024. (((given & 0x00800000) == 0)
  2025. ? "-" : ""));
  2026. arm_decode_shift (given, func, stream, 1);
  2027. }
  2028. }
  2029. }
  2030. }
  2031. /* Print one neon instruction on INFO->STREAM.
  2032. Return true if the instruction matched, false if this is not a
  2033. recognised neon instruction. */
  2034. static bfd_boolean
  2035. print_insn_neon (struct disassemble_info *info, long given, bfd_boolean thumb)
  2036. {
  2037. const struct opcode32 *insn;
  2038. void *stream = info->stream;
  2039. fprintf_function func = info->fprintf_func;
  2040. if (thumb)
  2041. {
  2042. if ((given & 0xef000000) == 0xef000000)
  2043. {
  2044. /* move bit 28 to bit 24 to translate Thumb2 to ARM encoding. */
  2045. unsigned long bit28 = given & (1 << 28);
  2046. given &= 0x00ffffff;
  2047. if (bit28)
  2048. given |= 0xf3000000;
  2049. else
  2050. given |= 0xf2000000;
  2051. }
  2052. else if ((given & 0xff000000) == 0xf9000000)
  2053. given ^= 0xf9000000 ^ 0xf4000000;
  2054. else
  2055. return false;
  2056. }
  2057. for (insn = neon_opcodes; insn->assembler; insn++)
  2058. {
  2059. if ((given & insn->mask) == insn->value)
  2060. {
  2061. const char *c;
  2062. for (c = insn->assembler; *c; c++)
  2063. {
  2064. if (*c == '%')
  2065. {
  2066. switch (*++c)
  2067. {
  2068. case '%':
  2069. func (stream, "%%");
  2070. break;
  2071. case 'c':
  2072. if (thumb && ifthen_state)
  2073. func (stream, "%s", arm_conditional[IFTHEN_COND]);
  2074. break;
  2075. case 'A':
  2076. {
  2077. static const unsigned char enc[16] =
  2078. {
  2079. 0x4, 0x14, /* st4 0,1 */
  2080. 0x4, /* st1 2 */
  2081. 0x4, /* st2 3 */
  2082. 0x3, /* st3 4 */
  2083. 0x13, /* st3 5 */
  2084. 0x3, /* st1 6 */
  2085. 0x1, /* st1 7 */
  2086. 0x2, /* st2 8 */
  2087. 0x12, /* st2 9 */
  2088. 0x2, /* st1 10 */
  2089. 0, 0, 0, 0, 0
  2090. };
  2091. int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4);
  2092. int rn = ((given >> 16) & 0xf);
  2093. int rm = ((given >> 0) & 0xf);
  2094. int align = ((given >> 4) & 0x3);
  2095. int type = ((given >> 8) & 0xf);
  2096. int n = enc[type] & 0xf;
  2097. int stride = (enc[type] >> 4) + 1;
  2098. int ix;
  2099. func (stream, "{");
  2100. if (stride > 1)
  2101. for (ix = 0; ix != n; ix++)
  2102. func (stream, "%sd%d", ix ? "," : "", rd + ix * stride);
  2103. else if (n == 1)
  2104. func (stream, "d%d", rd);
  2105. else
  2106. func (stream, "d%d-d%d", rd, rd + n - 1);
  2107. func (stream, "}, [%s", arm_regnames[rn]);
  2108. if (align)
  2109. func (stream, ", :%d", 32 << align);
  2110. func (stream, "]");
  2111. if (rm == 0xd)
  2112. func (stream, "!");
  2113. else if (rm != 0xf)
  2114. func (stream, ", %s", arm_regnames[rm]);
  2115. }
  2116. break;
  2117. case 'B':
  2118. {
  2119. int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4);
  2120. int rn = ((given >> 16) & 0xf);
  2121. int rm = ((given >> 0) & 0xf);
  2122. int idx_align = ((given >> 4) & 0xf);
  2123. int align = 0;
  2124. int size = ((given >> 10) & 0x3);
  2125. int idx = idx_align >> (size + 1);
  2126. int length = ((given >> 8) & 3) + 1;
  2127. int stride = 1;
  2128. int i;
  2129. if (length > 1 && size > 0)
  2130. stride = (idx_align & (1 << size)) ? 2 : 1;
  2131. switch (length)
  2132. {
  2133. case 1:
  2134. {
  2135. int amask = (1 << size) - 1;
  2136. if ((idx_align & (1 << size)) != 0)
  2137. return false;
  2138. if (size > 0)
  2139. {
  2140. if ((idx_align & amask) == amask)
  2141. align = 8 << size;
  2142. else if ((idx_align & amask) != 0)
  2143. return false;
  2144. }
  2145. }
  2146. break;
  2147. case 2:
  2148. if (size == 2 && (idx_align & 2) != 0)
  2149. return false;
  2150. align = (idx_align & 1) ? 16 << size : 0;
  2151. break;
  2152. case 3:
  2153. if ((size == 2 && (idx_align & 3) != 0)
  2154. || (idx_align & 1) != 0)
  2155. return false;
  2156. break;
  2157. case 4:
  2158. if (size == 2)
  2159. {
  2160. if ((idx_align & 3) == 3)
  2161. return false;
  2162. align = (idx_align & 3) * 64;
  2163. }
  2164. else
  2165. align = (idx_align & 1) ? 32 << size : 0;
  2166. break;
  2167. default:
  2168. abort ();
  2169. }
  2170. func (stream, "{");
  2171. for (i = 0; i < length; i++)
  2172. func (stream, "%sd%d[%d]", (i == 0) ? "" : ",",
  2173. rd + i * stride, idx);
  2174. func (stream, "}, [%s", arm_regnames[rn]);
  2175. if (align)
  2176. func (stream, ", :%d", align);
  2177. func (stream, "]");
  2178. if (rm == 0xd)
  2179. func (stream, "!");
  2180. else if (rm != 0xf)
  2181. func (stream, ", %s", arm_regnames[rm]);
  2182. }
  2183. break;
  2184. case 'C':
  2185. {
  2186. int rd = ((given >> 12) & 0xf) | (((given >> 22) & 1) << 4);
  2187. int rn = ((given >> 16) & 0xf);
  2188. int rm = ((given >> 0) & 0xf);
  2189. int align = ((given >> 4) & 0x1);
  2190. int size = ((given >> 6) & 0x3);
  2191. int type = ((given >> 8) & 0x3);
  2192. int n = type + 1;
  2193. int stride = ((given >> 5) & 0x1);
  2194. int ix;
  2195. if (stride && (n == 1))
  2196. n++;
  2197. else
  2198. stride++;
  2199. func (stream, "{");
  2200. if (stride > 1)
  2201. for (ix = 0; ix != n; ix++)
  2202. func (stream, "%sd%d[]", ix ? "," : "", rd + ix * stride);
  2203. else if (n == 1)
  2204. func (stream, "d%d[]", rd);
  2205. else
  2206. func (stream, "d%d[]-d%d[]", rd, rd + n - 1);
  2207. func (stream, "}, [%s", arm_regnames[rn]);
  2208. if (align)
  2209. {
  2210. int align = (8 * (type + 1)) << size;
  2211. if (type == 3)
  2212. align = (size > 1) ? align >> 1 : align;
  2213. if (type == 2 || (type == 0 && !size))
  2214. func (stream, ", :<bad align %d>", align);
  2215. else
  2216. func (stream, ", :%d", align);
  2217. }
  2218. func (stream, "]");
  2219. if (rm == 0xd)
  2220. func (stream, "!");
  2221. else if (rm != 0xf)
  2222. func (stream, ", %s", arm_regnames[rm]);
  2223. }
  2224. break;
  2225. case 'D':
  2226. {
  2227. int raw_reg = (given & 0xf) | ((given >> 1) & 0x10);
  2228. int size = (given >> 20) & 3;
  2229. int reg = raw_reg & ((4 << size) - 1);
  2230. int ix = raw_reg >> size >> 2;
  2231. func (stream, "d%d[%d]", reg, ix);
  2232. }
  2233. break;
  2234. case 'E':
  2235. /* Neon encoded constant for mov, mvn, vorr, vbic */
  2236. {
  2237. int bits = 0;
  2238. int cmode = (given >> 8) & 0xf;
  2239. int op = (given >> 5) & 0x1;
  2240. unsigned long value = 0, hival = 0;
  2241. unsigned shift;
  2242. int size = 0;
  2243. int isfloat = 0;
  2244. bits |= ((given >> 24) & 1) << 7;
  2245. bits |= ((given >> 16) & 7) << 4;
  2246. bits |= ((given >> 0) & 15) << 0;
  2247. if (cmode < 8)
  2248. {
  2249. shift = (cmode >> 1) & 3;
  2250. value = (unsigned long)bits << (8 * shift);
  2251. size = 32;
  2252. }
  2253. else if (cmode < 12)
  2254. {
  2255. shift = (cmode >> 1) & 1;
  2256. value = (unsigned long)bits << (8 * shift);
  2257. size = 16;
  2258. }
  2259. else if (cmode < 14)
  2260. {
  2261. shift = (cmode & 1) + 1;
  2262. value = (unsigned long)bits << (8 * shift);
  2263. value |= (1ul << (8 * shift)) - 1;
  2264. size = 32;
  2265. }
  2266. else if (cmode == 14)
  2267. {
  2268. if (op)
  2269. {
  2270. /* bit replication into bytes */
  2271. int ix;
  2272. unsigned long mask;
  2273. value = 0;
  2274. hival = 0;
  2275. for (ix = 7; ix >= 0; ix--)
  2276. {
  2277. mask = ((bits >> ix) & 1) ? 0xff : 0;
  2278. if (ix <= 3)
  2279. value = (value << 8) | mask;
  2280. else
  2281. hival = (hival << 8) | mask;
  2282. }
  2283. size = 64;
  2284. }
  2285. else
  2286. {
  2287. /* byte replication */
  2288. value = (unsigned long)bits;
  2289. size = 8;
  2290. }
  2291. }
  2292. else if (!op)
  2293. {
  2294. /* floating point encoding */
  2295. int tmp;
  2296. value = (unsigned long)(bits & 0x7f) << 19;
  2297. value |= (unsigned long)(bits & 0x80) << 24;
  2298. tmp = bits & 0x40 ? 0x3c : 0x40;
  2299. value |= (unsigned long)tmp << 24;
  2300. size = 32;
  2301. isfloat = 1;
  2302. }
  2303. else
  2304. {
  2305. func (stream, "<illegal constant %.8x:%x:%x>",
  2306. bits, cmode, op);
  2307. break;
  2308. }
  2309. switch (size)
  2310. {
  2311. case 8:
  2312. func (stream, "#%ld\t; 0x%.2lx", value, value);
  2313. break;
  2314. case 16:
  2315. func (stream, "#%ld\t; 0x%.4lx", value, value);
  2316. break;
  2317. case 32:
  2318. if (isfloat)
  2319. {
  2320. unsigned char valbytes[4];
  2321. double fvalue;
  2322. /* Do this a byte at a time so we don't have to
  2323. worry about the host's endianness. */
  2324. valbytes[0] = value & 0xff;
  2325. valbytes[1] = (value >> 8) & 0xff;
  2326. valbytes[2] = (value >> 16) & 0xff;
  2327. valbytes[3] = (value >> 24) & 0xff;
  2328. floatformat_to_double (valbytes, &fvalue);
  2329. func (stream, "#%.7g\t; 0x%.8lx", fvalue,
  2330. value);
  2331. }
  2332. else
  2333. func (stream, "#%ld\t; 0x%.8lx",
  2334. (long) ((value & 0x80000000)
  2335. ? value | ~0xffffffffl : value), value);
  2336. break;
  2337. case 64:
  2338. func (stream, "#0x%.8lx%.8lx", hival, value);
  2339. break;
  2340. default:
  2341. abort ();
  2342. }
  2343. }
  2344. break;
  2345. case 'F':
  2346. {
  2347. int regno = ((given >> 16) & 0xf) | ((given >> (7 - 4)) & 0x10);
  2348. int num = (given >> 8) & 0x3;
  2349. if (!num)
  2350. func (stream, "{d%d}", regno);
  2351. else if (num + regno >= 32)
  2352. func (stream, "{d%d-<overflow reg d%d}", regno, regno + num);
  2353. else
  2354. func (stream, "{d%d-d%d}", regno, regno + num);
  2355. }
  2356. break;
  2357. case '0': case '1': case '2': case '3': case '4':
  2358. case '5': case '6': case '7': case '8': case '9':
  2359. {
  2360. int width;
  2361. unsigned long value;
  2362. c = arm_decode_bitfield (c, given, &value, &width);
  2363. switch (*c)
  2364. {
  2365. case 'r':
  2366. func (stream, "%s", arm_regnames[value]);
  2367. break;
  2368. case 'd':
  2369. func (stream, "%ld", value);
  2370. break;
  2371. case 'e':
  2372. func (stream, "%ld", (1ul << width) - value);
  2373. break;
  2374. case 'S':
  2375. case 'T':
  2376. case 'U':
  2377. /* various width encodings */
  2378. {
  2379. int base = 8 << (*c - 'S'); /* 8,16 or 32 */
  2380. int limit;
  2381. unsigned low, high;
  2382. c++;
  2383. if (*c >= '0' && *c <= '9')
  2384. limit = *c - '0';
  2385. else if (*c >= 'a' && *c <= 'f')
  2386. limit = *c - 'a' + 10;
  2387. else
  2388. abort ();
  2389. low = limit >> 2;
  2390. high = limit & 3;
  2391. if (value < low || value > high)
  2392. func (stream, "<illegal width %d>", base << value);
  2393. else
  2394. func (stream, "%d", base << value);
  2395. }
  2396. break;
  2397. case 'R':
  2398. if (given & (1 << 6))
  2399. goto Q;
  2400. /* FALLTHROUGH */
  2401. case 'D':
  2402. func (stream, "d%ld", value);
  2403. break;
  2404. case 'Q':
  2405. Q:
  2406. if (value & 1)
  2407. func (stream, "<illegal reg q%ld.5>", value >> 1);
  2408. else
  2409. func (stream, "q%ld", value >> 1);
  2410. break;
  2411. case '`':
  2412. c++;
  2413. if (value == 0)
  2414. func (stream, "%c", *c);
  2415. break;
  2416. case '\'':
  2417. c++;
  2418. if (value == ((1ul << width) - 1))
  2419. func (stream, "%c", *c);
  2420. break;
  2421. case '?':
  2422. func (stream, "%c", c[(1 << width) - (int)value]);
  2423. c += 1 << width;
  2424. break;
  2425. default:
  2426. abort ();
  2427. }
  2428. break;
  2429. default:
  2430. abort ();
  2431. }
  2432. }
  2433. }
  2434. else
  2435. func (stream, "%c", *c);
  2436. }
  2437. return true;
  2438. }
  2439. }
  2440. return false;
  2441. }
  2442. /* Print one ARM instruction from PC on INFO->STREAM. */
  2443. static void
  2444. print_insn_arm_internal (bfd_vma pc, struct disassemble_info *info, long given)
  2445. {
  2446. const struct opcode32 *insn;
  2447. void *stream = info->stream;
  2448. fprintf_function func = info->fprintf_func;
  2449. if (print_insn_coprocessor (pc, info, given, false))
  2450. return;
  2451. if (print_insn_neon (info, given, false))
  2452. return;
  2453. for (insn = arm_opcodes; insn->assembler; insn++)
  2454. {
  2455. if (insn->value == FIRST_IWMMXT_INSN
  2456. && info->mach != bfd_mach_arm_XScale
  2457. && info->mach != bfd_mach_arm_iWMMXt)
  2458. insn = insn + IWMMXT_INSN_COUNT;
  2459. if ((given & insn->mask) == insn->value
  2460. /* Special case: an instruction with all bits set in the condition field
  2461. (0xFnnn_nnnn) is only matched if all those bits are set in insn->mask,
  2462. or by the catchall at the end of the table. */
  2463. && ((given & 0xF0000000) != 0xF0000000
  2464. || (insn->mask & 0xF0000000) == 0xF0000000
  2465. || (insn->mask == 0 && insn->value == 0)))
  2466. {
  2467. const char *c;
  2468. for (c = insn->assembler; *c; c++)
  2469. {
  2470. if (*c == '%')
  2471. {
  2472. switch (*++c)
  2473. {
  2474. case '%':
  2475. func (stream, "%%");
  2476. break;
  2477. case 'a':
  2478. print_arm_address (pc, info, given);
  2479. break;
  2480. case 'P':
  2481. /* Set P address bit and use normal address
  2482. printing routine. */
  2483. print_arm_address (pc, info, given | (1 << 24));
  2484. break;
  2485. case 's':
  2486. if ((given & 0x004f0000) == 0x004f0000)
  2487. {
  2488. /* PC relative with immediate offset. */
  2489. int offset = ((given & 0xf00) >> 4) | (given & 0xf);
  2490. if ((given & 0x00800000) == 0)
  2491. offset = -offset;
  2492. func (stream, "[pc, #%d]\t; ", offset);
  2493. info->print_address_func (offset + pc + 8, info);
  2494. }
  2495. else
  2496. {
  2497. func (stream, "[%s",
  2498. arm_regnames[(given >> 16) & 0xf]);
  2499. if ((given & 0x01000000) != 0)
  2500. {
  2501. /* Pre-indexed. */
  2502. if ((given & 0x00400000) == 0x00400000)
  2503. {
  2504. /* Immediate. */
  2505. int offset = ((given & 0xf00) >> 4) | (given & 0xf);
  2506. if (offset)
  2507. func (stream, ", #%s%d",
  2508. (((given & 0x00800000) == 0)
  2509. ? "-" : ""), offset);
  2510. }
  2511. else
  2512. {
  2513. /* Register. */
  2514. func (stream, ", %s%s",
  2515. (((given & 0x00800000) == 0)
  2516. ? "-" : ""),
  2517. arm_regnames[given & 0xf]);
  2518. }
  2519. func (stream, "]%s",
  2520. ((given & 0x00200000) != 0) ? "!" : "");
  2521. }
  2522. else
  2523. {
  2524. /* Post-indexed. */
  2525. if ((given & 0x00400000) == 0x00400000)
  2526. {
  2527. /* Immediate. */
  2528. int offset = ((given & 0xf00) >> 4) | (given & 0xf);
  2529. if (offset)
  2530. func (stream, "], #%s%d",
  2531. (((given & 0x00800000) == 0)
  2532. ? "-" : ""), offset);
  2533. else
  2534. func (stream, "]");
  2535. }
  2536. else
  2537. {
  2538. /* Register. */
  2539. func (stream, "], %s%s",
  2540. (((given & 0x00800000) == 0)
  2541. ? "-" : ""),
  2542. arm_regnames[given & 0xf]);
  2543. }
  2544. }
  2545. }
  2546. break;
  2547. case 'b':
  2548. {
  2549. int disp = (((given & 0xffffff) ^ 0x800000) - 0x800000);
  2550. info->print_address_func (disp*4 + pc + 8, info);
  2551. }
  2552. break;
  2553. case 'c':
  2554. if (((given >> 28) & 0xf) != 0xe)
  2555. func (stream, "%s",
  2556. arm_conditional [(given >> 28) & 0xf]);
  2557. break;
  2558. case 'm':
  2559. {
  2560. int started = 0;
  2561. int reg;
  2562. func (stream, "{");
  2563. for (reg = 0; reg < 16; reg++)
  2564. if ((given & (1 << reg)) != 0)
  2565. {
  2566. if (started)
  2567. func (stream, ", ");
  2568. started = 1;
  2569. func (stream, "%s", arm_regnames[reg]);
  2570. }
  2571. func (stream, "}");
  2572. }
  2573. break;
  2574. case 'q':
  2575. arm_decode_shift (given, func, stream, 0);
  2576. break;
  2577. case 'o':
  2578. if ((given & 0x02000000) != 0)
  2579. {
  2580. int rotate = (given & 0xf00) >> 7;
  2581. int immed = (given & 0xff);
  2582. immed = (((immed << (32 - rotate))
  2583. | (immed >> rotate)) & 0xffffffff);
  2584. func (stream, "#%d\t; 0x%x", immed, immed);
  2585. }
  2586. else
  2587. arm_decode_shift (given, func, stream, 1);
  2588. break;
  2589. case 'p':
  2590. if ((given & 0x0000f000) == 0x0000f000)
  2591. func (stream, "p");
  2592. break;
  2593. case 't':
  2594. if ((given & 0x01200000) == 0x00200000)
  2595. func (stream, "t");
  2596. break;
  2597. case 'A':
  2598. func (stream, "[%s", arm_regnames [(given >> 16) & 0xf]);
  2599. if ((given & (1 << 24)) != 0)
  2600. {
  2601. int offset = given & 0xff;
  2602. if (offset)
  2603. func (stream, ", #%s%d]%s",
  2604. ((given & 0x00800000) == 0 ? "-" : ""),
  2605. offset * 4,
  2606. ((given & 0x00200000) != 0 ? "!" : ""));
  2607. else
  2608. func (stream, "]");
  2609. }
  2610. else
  2611. {
  2612. int offset = given & 0xff;
  2613. func (stream, "]");
  2614. if (given & (1 << 21))
  2615. {
  2616. if (offset)
  2617. func (stream, ", #%s%d",
  2618. ((given & 0x00800000) == 0 ? "-" : ""),
  2619. offset * 4);
  2620. }
  2621. else
  2622. func (stream, ", {%d}", offset);
  2623. }
  2624. break;
  2625. case 'B':
  2626. /* Print ARM V5 BLX(1) address: pc+25 bits. */
  2627. {
  2628. bfd_vma address;
  2629. bfd_vma offset = 0;
  2630. if (given & 0x00800000)
  2631. /* Is signed, hi bits should be ones. */
  2632. offset = (-1) ^ 0x00ffffff;
  2633. /* Offset is (SignExtend(offset field)<<2). */
  2634. offset += given & 0x00ffffff;
  2635. offset <<= 2;
  2636. address = offset + pc + 8;
  2637. if (given & 0x01000000)
  2638. /* H bit allows addressing to 2-byte boundaries. */
  2639. address += 2;
  2640. info->print_address_func (address, info);
  2641. }
  2642. break;
  2643. case 'C':
  2644. func (stream, "_");
  2645. if (given & 0x80000)
  2646. func (stream, "f");
  2647. if (given & 0x40000)
  2648. func (stream, "s");
  2649. if (given & 0x20000)
  2650. func (stream, "x");
  2651. if (given & 0x10000)
  2652. func (stream, "c");
  2653. break;
  2654. case 'U':
  2655. switch (given & 0xf)
  2656. {
  2657. case 0xf: func(stream, "sy"); break;
  2658. case 0x7: func(stream, "un"); break;
  2659. case 0xe: func(stream, "st"); break;
  2660. case 0x6: func(stream, "unst"); break;
  2661. default:
  2662. func(stream, "#%d", (int)given & 0xf);
  2663. break;
  2664. }
  2665. break;
  2666. case '0': case '1': case '2': case '3': case '4':
  2667. case '5': case '6': case '7': case '8': case '9':
  2668. {
  2669. int width;
  2670. unsigned long value;
  2671. c = arm_decode_bitfield (c, given, &value, &width);
  2672. switch (*c)
  2673. {
  2674. case 'r':
  2675. func (stream, "%s", arm_regnames[value]);
  2676. break;
  2677. case 'd':
  2678. func (stream, "%ld", value);
  2679. break;
  2680. case 'b':
  2681. func (stream, "%ld", value * 8);
  2682. break;
  2683. case 'W':
  2684. func (stream, "%ld", value + 1);
  2685. break;
  2686. case 'x':
  2687. func (stream, "0x%08lx", value);
  2688. /* Some SWI instructions have special
  2689. meanings. */
  2690. if ((given & 0x0fffffff) == 0x0FF00000)
  2691. func (stream, "\t; IMB");
  2692. else if ((given & 0x0fffffff) == 0x0FF00001)
  2693. func (stream, "\t; IMBRange");
  2694. break;
  2695. case 'X':
  2696. func (stream, "%01lx", value & 0xf);
  2697. break;
  2698. case '`':
  2699. c++;
  2700. if (value == 0)
  2701. func (stream, "%c", *c);
  2702. break;
  2703. case '\'':
  2704. c++;
  2705. if (value == ((1ul << width) - 1))
  2706. func (stream, "%c", *c);
  2707. break;
  2708. case '?':
  2709. func (stream, "%c", c[(1 << width) - (int)value]);
  2710. c += 1 << width;
  2711. break;
  2712. default:
  2713. abort ();
  2714. }
  2715. break;
  2716. case 'e':
  2717. {
  2718. int imm;
  2719. imm = (given & 0xf) | ((given & 0xfff00) >> 4);
  2720. func (stream, "%d", imm);
  2721. }
  2722. break;
  2723. case 'E':
  2724. /* LSB and WIDTH fields of BFI or BFC. The machine-
  2725. language instruction encodes LSB and MSB. */
  2726. {
  2727. long msb = (given & 0x001f0000) >> 16;
  2728. long lsb = (given & 0x00000f80) >> 7;
  2729. long width = msb - lsb + 1;
  2730. if (width > 0)
  2731. func (stream, "#%lu, #%lu", lsb, width);
  2732. else
  2733. func (stream, "(invalid: %lu:%lu)", lsb, msb);
  2734. }
  2735. break;
  2736. case 'V':
  2737. /* 16-bit unsigned immediate from a MOVT or MOVW
  2738. instruction, encoded in bits 0:11 and 15:19. */
  2739. {
  2740. long hi = (given & 0x000f0000) >> 4;
  2741. long lo = (given & 0x00000fff);
  2742. long imm16 = hi | lo;
  2743. func (stream, "#%lu\t; 0x%lx", imm16, imm16);
  2744. }
  2745. break;
  2746. default:
  2747. abort ();
  2748. }
  2749. }
  2750. }
  2751. else
  2752. func (stream, "%c", *c);
  2753. }
  2754. return;
  2755. }
  2756. }
  2757. abort ();
  2758. }
  2759. /* Print one 16-bit Thumb instruction from PC on INFO->STREAM. */
  2760. static void
  2761. print_insn_thumb16 (bfd_vma pc, struct disassemble_info *info, long given)
  2762. {
  2763. const struct opcode16 *insn;
  2764. void *stream = info->stream;
  2765. fprintf_function func = info->fprintf_func;
  2766. for (insn = thumb_opcodes; insn->assembler; insn++)
  2767. if ((given & insn->mask) == insn->value)
  2768. {
  2769. const char *c = insn->assembler;
  2770. for (; *c; c++)
  2771. {
  2772. int domaskpc = 0;
  2773. int domasklr = 0;
  2774. if (*c != '%')
  2775. {
  2776. func (stream, "%c", *c);
  2777. continue;
  2778. }
  2779. switch (*++c)
  2780. {
  2781. case '%':
  2782. func (stream, "%%");
  2783. break;
  2784. case 'c':
  2785. if (ifthen_state)
  2786. func (stream, "%s", arm_conditional[IFTHEN_COND]);
  2787. break;
  2788. case 'C':
  2789. if (ifthen_state)
  2790. func (stream, "%s", arm_conditional[IFTHEN_COND]);
  2791. else
  2792. func (stream, "s");
  2793. break;
  2794. case 'I':
  2795. {
  2796. unsigned int tmp;
  2797. ifthen_next_state = given & 0xff;
  2798. for (tmp = given << 1; tmp & 0xf; tmp <<= 1)
  2799. func (stream, ((given ^ tmp) & 0x10) ? "e" : "t");
  2800. func (stream, "\t%s", arm_conditional[(given >> 4) & 0xf]);
  2801. }
  2802. break;
  2803. case 'x':
  2804. if (ifthen_next_state)
  2805. func (stream, "\t; unpredictable branch in IT block\n");
  2806. break;
  2807. case 'X':
  2808. if (ifthen_state)
  2809. func (stream, "\t; unpredictable <IT:%s>",
  2810. arm_conditional[IFTHEN_COND]);
  2811. break;
  2812. case 'S':
  2813. {
  2814. long reg;
  2815. reg = (given >> 3) & 0x7;
  2816. if (given & (1 << 6))
  2817. reg += 8;
  2818. func (stream, "%s", arm_regnames[reg]);
  2819. }
  2820. break;
  2821. case 'D':
  2822. {
  2823. long reg;
  2824. reg = given & 0x7;
  2825. if (given & (1 << 7))
  2826. reg += 8;
  2827. func (stream, "%s", arm_regnames[reg]);
  2828. }
  2829. break;
  2830. case 'N':
  2831. if (given & (1 << 8))
  2832. domasklr = 1;
  2833. /* Fall through. */
  2834. case 'O':
  2835. if (*c == 'O' && (given & (1 << 8)))
  2836. domaskpc = 1;
  2837. /* Fall through. */
  2838. case 'M':
  2839. {
  2840. int started = 0;
  2841. int reg;
  2842. func (stream, "{");
  2843. /* It would be nice if we could spot
  2844. ranges, and generate the rS-rE format: */
  2845. for (reg = 0; (reg < 8); reg++)
  2846. if ((given & (1 << reg)) != 0)
  2847. {
  2848. if (started)
  2849. func (stream, ", ");
  2850. started = 1;
  2851. func (stream, "%s", arm_regnames[reg]);
  2852. }
  2853. if (domasklr)
  2854. {
  2855. if (started)
  2856. func (stream, ", ");
  2857. started = 1;
  2858. func (stream, "%s", arm_regnames[14] /* "lr" */);
  2859. }
  2860. if (domaskpc)
  2861. {
  2862. if (started)
  2863. func (stream, ", ");
  2864. func (stream, "%s", arm_regnames[15] /* "pc" */);
  2865. }
  2866. func (stream, "}");
  2867. }
  2868. break;
  2869. case 'b':
  2870. /* Print ARM V6T2 CZB address: pc+4+6 bits. */
  2871. {
  2872. bfd_vma address = (pc + 4
  2873. + ((given & 0x00f8) >> 2)
  2874. + ((given & 0x0200) >> 3));
  2875. info->print_address_func (address, info);
  2876. }
  2877. break;
  2878. case 's':
  2879. /* Right shift immediate -- bits 6..10; 1-31 print
  2880. as themselves, 0 prints as 32. */
  2881. {
  2882. long imm = (given & 0x07c0) >> 6;
  2883. if (imm == 0)
  2884. imm = 32;
  2885. func (stream, "#%ld", imm);
  2886. }
  2887. break;
  2888. case '0': case '1': case '2': case '3': case '4':
  2889. case '5': case '6': case '7': case '8': case '9':
  2890. {
  2891. int bitstart = *c++ - '0';
  2892. int bitend = 0;
  2893. while (*c >= '0' && *c <= '9')
  2894. bitstart = (bitstart * 10) + *c++ - '0';
  2895. switch (*c)
  2896. {
  2897. case '-':
  2898. {
  2899. long reg;
  2900. c++;
  2901. while (*c >= '0' && *c <= '9')
  2902. bitend = (bitend * 10) + *c++ - '0';
  2903. if (!bitend)
  2904. abort ();
  2905. reg = given >> bitstart;
  2906. reg &= (2 << (bitend - bitstart)) - 1;
  2907. switch (*c)
  2908. {
  2909. case 'r':
  2910. func (stream, "%s", arm_regnames[reg]);
  2911. break;
  2912. case 'd':
  2913. func (stream, "%ld", reg);
  2914. break;
  2915. case 'H':
  2916. func (stream, "%ld", reg << 1);
  2917. break;
  2918. case 'W':
  2919. func (stream, "%ld", reg << 2);
  2920. break;
  2921. case 'a':
  2922. /* PC-relative address -- the bottom two
  2923. bits of the address are dropped
  2924. before the calculation. */
  2925. info->print_address_func
  2926. (((pc + 4) & ~3) + (reg << 2), info);
  2927. break;
  2928. case 'x':
  2929. func (stream, "0x%04lx", reg);
  2930. break;
  2931. case 'B':
  2932. reg = ((reg ^ (1 << bitend)) - (1 << bitend));
  2933. info->print_address_func (reg * 2 + pc + 4, info);
  2934. break;
  2935. case 'c':
  2936. func (stream, "%s", arm_conditional [reg]);
  2937. break;
  2938. default:
  2939. abort ();
  2940. }
  2941. }
  2942. break;
  2943. case '\'':
  2944. c++;
  2945. if ((given & (1 << bitstart)) != 0)
  2946. func (stream, "%c", *c);
  2947. break;
  2948. case '?':
  2949. ++c;
  2950. if ((given & (1 << bitstart)) != 0)
  2951. func (stream, "%c", *c++);
  2952. else
  2953. func (stream, "%c", *++c);
  2954. break;
  2955. default:
  2956. abort ();
  2957. }
  2958. }
  2959. break;
  2960. default:
  2961. abort ();
  2962. }
  2963. }
  2964. return;
  2965. }
  2966. /* No match. */
  2967. abort ();
  2968. }
  2969. /* Return the name of an V7M special register. */
  2970. static const char *
  2971. psr_name (int regno)
  2972. {
  2973. switch (regno)
  2974. {
  2975. case 0: return "APSR";
  2976. case 1: return "IAPSR";
  2977. case 2: return "EAPSR";
  2978. case 3: return "PSR";
  2979. case 5: return "IPSR";
  2980. case 6: return "EPSR";
  2981. case 7: return "IEPSR";
  2982. case 8: return "MSP";
  2983. case 9: return "PSP";
  2984. case 16: return "PRIMASK";
  2985. case 17: return "BASEPRI";
  2986. case 18: return "BASEPRI_MASK";
  2987. case 19: return "FAULTMASK";
  2988. case 20: return "CONTROL";
  2989. default: return "<unknown>";
  2990. }
  2991. }
  2992. /* Print one 32-bit Thumb instruction from PC on INFO->STREAM. */
  2993. static void
  2994. print_insn_thumb32 (bfd_vma pc, struct disassemble_info *info, long given)
  2995. {
  2996. const struct opcode32 *insn;
  2997. void *stream = info->stream;
  2998. fprintf_function func = info->fprintf_func;
  2999. if (print_insn_coprocessor (pc, info, given, true))
  3000. return;
  3001. if (print_insn_neon (info, given, true))
  3002. return;
  3003. for (insn = thumb32_opcodes; insn->assembler; insn++)
  3004. if ((given & insn->mask) == insn->value)
  3005. {
  3006. const char *c = insn->assembler;
  3007. for (; *c; c++)
  3008. {
  3009. if (*c != '%')
  3010. {
  3011. func (stream, "%c", *c);
  3012. continue;
  3013. }
  3014. switch (*++c)
  3015. {
  3016. case '%':
  3017. func (stream, "%%");
  3018. break;
  3019. case 'c':
  3020. if (ifthen_state)
  3021. func (stream, "%s", arm_conditional[IFTHEN_COND]);
  3022. break;
  3023. case 'x':
  3024. if (ifthen_next_state)
  3025. func (stream, "\t; unpredictable branch in IT block\n");
  3026. break;
  3027. case 'X':
  3028. if (ifthen_state)
  3029. func (stream, "\t; unpredictable <IT:%s>",
  3030. arm_conditional[IFTHEN_COND]);
  3031. break;
  3032. case 'I':
  3033. {
  3034. unsigned int imm12 = 0;
  3035. imm12 |= (given & 0x000000ffu);
  3036. imm12 |= (given & 0x00007000u) >> 4;
  3037. imm12 |= (given & 0x04000000u) >> 15;
  3038. func (stream, "#%u\t; 0x%x", imm12, imm12);
  3039. }
  3040. break;
  3041. case 'M':
  3042. {
  3043. unsigned int bits = 0, imm, imm8, mod;
  3044. bits |= (given & 0x000000ffu);
  3045. bits |= (given & 0x00007000u) >> 4;
  3046. bits |= (given & 0x04000000u) >> 15;
  3047. imm8 = (bits & 0x0ff);
  3048. mod = (bits & 0xf00) >> 8;
  3049. switch (mod)
  3050. {
  3051. case 0: imm = imm8; break;
  3052. case 1: imm = ((imm8<<16) | imm8); break;
  3053. case 2: imm = ((imm8<<24) | (imm8 << 8)); break;
  3054. case 3: imm = ((imm8<<24) | (imm8 << 16) | (imm8 << 8) | imm8); break;
  3055. default:
  3056. mod = (bits & 0xf80) >> 7;
  3057. imm8 = (bits & 0x07f) | 0x80;
  3058. imm = (((imm8 << (32 - mod)) | (imm8 >> mod)) & 0xffffffff);
  3059. }
  3060. func (stream, "#%u\t; 0x%x", imm, imm);
  3061. }
  3062. break;
  3063. case 'J':
  3064. {
  3065. unsigned int imm = 0;
  3066. imm |= (given & 0x000000ffu);
  3067. imm |= (given & 0x00007000u) >> 4;
  3068. imm |= (given & 0x04000000u) >> 15;
  3069. imm |= (given & 0x000f0000u) >> 4;
  3070. func (stream, "#%u\t; 0x%x", imm, imm);
  3071. }
  3072. break;
  3073. case 'K':
  3074. {
  3075. unsigned int imm = 0;
  3076. imm |= (given & 0x000f0000u) >> 16;
  3077. imm |= (given & 0x00000ff0u) >> 0;
  3078. imm |= (given & 0x0000000fu) << 12;
  3079. func (stream, "#%u\t; 0x%x", imm, imm);
  3080. }
  3081. break;
  3082. case 'S':
  3083. {
  3084. unsigned int reg = (given & 0x0000000fu);
  3085. unsigned int stp = (given & 0x00000030u) >> 4;
  3086. unsigned int imm = 0;
  3087. imm |= (given & 0x000000c0u) >> 6;
  3088. imm |= (given & 0x00007000u) >> 10;
  3089. func (stream, "%s", arm_regnames[reg]);
  3090. switch (stp)
  3091. {
  3092. case 0:
  3093. if (imm > 0)
  3094. func (stream, ", lsl #%u", imm);
  3095. break;
  3096. case 1:
  3097. if (imm == 0)
  3098. imm = 32;
  3099. func (stream, ", lsr #%u", imm);
  3100. break;
  3101. case 2:
  3102. if (imm == 0)
  3103. imm = 32;
  3104. func (stream, ", asr #%u", imm);
  3105. break;
  3106. case 3:
  3107. if (imm == 0)
  3108. func (stream, ", rrx");
  3109. else
  3110. func (stream, ", ror #%u", imm);
  3111. }
  3112. }
  3113. break;
  3114. case 'a':
  3115. {
  3116. unsigned int Rn = (given & 0x000f0000) >> 16;
  3117. unsigned int U = (given & 0x00800000) >> 23;
  3118. unsigned int op = (given & 0x00000f00) >> 8;
  3119. unsigned int i12 = (given & 0x00000fff);
  3120. unsigned int i8 = (given & 0x000000ff);
  3121. bfd_boolean writeback = false, postind = false;
  3122. int offset = 0;
  3123. func (stream, "[%s", arm_regnames[Rn]);
  3124. if (U) /* 12-bit positive immediate offset */
  3125. offset = i12;
  3126. else if (Rn == 15) /* 12-bit negative immediate offset */
  3127. offset = -(int)i12;
  3128. else if (op == 0x0) /* shifted register offset */
  3129. {
  3130. unsigned int Rm = (i8 & 0x0f);
  3131. unsigned int sh = (i8 & 0x30) >> 4;
  3132. func (stream, ", %s", arm_regnames[Rm]);
  3133. if (sh)
  3134. func (stream, ", lsl #%u", sh);
  3135. func (stream, "]");
  3136. break;
  3137. }
  3138. else switch (op)
  3139. {
  3140. case 0xE: /* 8-bit positive immediate offset */
  3141. offset = i8;
  3142. break;
  3143. case 0xC: /* 8-bit negative immediate offset */
  3144. offset = -i8;
  3145. break;
  3146. case 0xF: /* 8-bit + preindex with wb */
  3147. offset = i8;
  3148. writeback = true;
  3149. break;
  3150. case 0xD: /* 8-bit - preindex with wb */
  3151. offset = -i8;
  3152. writeback = true;
  3153. break;
  3154. case 0xB: /* 8-bit + postindex */
  3155. offset = i8;
  3156. postind = true;
  3157. break;
  3158. case 0x9: /* 8-bit - postindex */
  3159. offset = -i8;
  3160. postind = true;
  3161. break;
  3162. default:
  3163. func (stream, ", <undefined>]");
  3164. goto skip;
  3165. }
  3166. if (postind)
  3167. func (stream, "], #%d", offset);
  3168. else
  3169. {
  3170. if (offset)
  3171. func (stream, ", #%d", offset);
  3172. func (stream, writeback ? "]!" : "]");
  3173. }
  3174. if (Rn == 15)
  3175. {
  3176. func (stream, "\t; ");
  3177. info->print_address_func (((pc + 4) & ~3) + offset, info);
  3178. }
  3179. }
  3180. skip:
  3181. break;
  3182. case 'A':
  3183. {
  3184. unsigned int P = (given & 0x01000000) >> 24;
  3185. unsigned int U = (given & 0x00800000) >> 23;
  3186. unsigned int W = (given & 0x00400000) >> 21;
  3187. unsigned int Rn = (given & 0x000f0000) >> 16;
  3188. unsigned int off = (given & 0x000000ff);
  3189. func (stream, "[%s", arm_regnames[Rn]);
  3190. if (P)
  3191. {
  3192. if (off || !U)
  3193. func (stream, ", #%c%u", U ? '+' : '-', off * 4);
  3194. func (stream, "]");
  3195. if (W)
  3196. func (stream, "!");
  3197. }
  3198. else
  3199. {
  3200. func (stream, "], ");
  3201. if (W)
  3202. func (stream, "#%c%u", U ? '+' : '-', off * 4);
  3203. else
  3204. func (stream, "{%u}", off);
  3205. }
  3206. }
  3207. break;
  3208. case 'w':
  3209. {
  3210. unsigned int Sbit = (given & 0x01000000) >> 24;
  3211. unsigned int type = (given & 0x00600000) >> 21;
  3212. switch (type)
  3213. {
  3214. case 0: func (stream, Sbit ? "sb" : "b"); break;
  3215. case 1: func (stream, Sbit ? "sh" : "h"); break;
  3216. case 2:
  3217. if (Sbit)
  3218. func (stream, "??");
  3219. break;
  3220. case 3:
  3221. func (stream, "??");
  3222. break;
  3223. }
  3224. }
  3225. break;
  3226. case 'm':
  3227. {
  3228. int started = 0;
  3229. int reg;
  3230. func (stream, "{");
  3231. for (reg = 0; reg < 16; reg++)
  3232. if ((given & (1 << reg)) != 0)
  3233. {
  3234. if (started)
  3235. func (stream, ", ");
  3236. started = 1;
  3237. func (stream, "%s", arm_regnames[reg]);
  3238. }
  3239. func (stream, "}");
  3240. }
  3241. break;
  3242. case 'E':
  3243. {
  3244. unsigned int msb = (given & 0x0000001f);
  3245. unsigned int lsb = 0;
  3246. lsb |= (given & 0x000000c0u) >> 6;
  3247. lsb |= (given & 0x00007000u) >> 10;
  3248. func (stream, "#%u, #%u", lsb, msb - lsb + 1);
  3249. }
  3250. break;
  3251. case 'F':
  3252. {
  3253. unsigned int width = (given & 0x0000001f) + 1;
  3254. unsigned int lsb = 0;
  3255. lsb |= (given & 0x000000c0u) >> 6;
  3256. lsb |= (given & 0x00007000u) >> 10;
  3257. func (stream, "#%u, #%u", lsb, width);
  3258. }
  3259. break;
  3260. case 'b':
  3261. {
  3262. unsigned int S = (given & 0x04000000u) >> 26;
  3263. unsigned int J1 = (given & 0x00002000u) >> 13;
  3264. unsigned int J2 = (given & 0x00000800u) >> 11;
  3265. int offset = 0;
  3266. offset |= !S << 20;
  3267. offset |= J2 << 19;
  3268. offset |= J1 << 18;
  3269. offset |= (given & 0x003f0000) >> 4;
  3270. offset |= (given & 0x000007ff) << 1;
  3271. offset -= (1 << 20);
  3272. info->print_address_func (pc + 4 + offset, info);
  3273. }
  3274. break;
  3275. case 'B':
  3276. {
  3277. unsigned int S = (given & 0x04000000u) >> 26;
  3278. unsigned int I1 = (given & 0x00002000u) >> 13;
  3279. unsigned int I2 = (given & 0x00000800u) >> 11;
  3280. int offset = 0;
  3281. offset |= !S << 24;
  3282. offset |= !(I1 ^ S) << 23;
  3283. offset |= !(I2 ^ S) << 22;
  3284. offset |= (given & 0x03ff0000u) >> 4;
  3285. offset |= (given & 0x000007ffu) << 1;
  3286. offset -= (1 << 24);
  3287. offset += pc + 4;
  3288. /* BLX target addresses are always word aligned. */
  3289. if ((given & 0x00001000u) == 0)
  3290. offset &= ~2u;
  3291. info->print_address_func (offset, info);
  3292. }
  3293. break;
  3294. case 's':
  3295. {
  3296. unsigned int shift = 0;
  3297. shift |= (given & 0x000000c0u) >> 6;
  3298. shift |= (given & 0x00007000u) >> 10;
  3299. if (given & 0x00200000u)
  3300. func (stream, ", asr #%u", shift);
  3301. else if (shift)
  3302. func (stream, ", lsl #%u", shift);
  3303. /* else print nothing - lsl #0 */
  3304. }
  3305. break;
  3306. case 'R':
  3307. {
  3308. unsigned int rot = (given & 0x00000030) >> 4;
  3309. if (rot)
  3310. func (stream, ", ror #%u", rot * 8);
  3311. }
  3312. break;
  3313. case 'U':
  3314. switch (given & 0xf)
  3315. {
  3316. case 0xf: func(stream, "sy"); break;
  3317. case 0x7: func(stream, "un"); break;
  3318. case 0xe: func(stream, "st"); break;
  3319. case 0x6: func(stream, "unst"); break;
  3320. default:
  3321. func(stream, "#%d", (int)given & 0xf);
  3322. break;
  3323. }
  3324. break;
  3325. case 'C':
  3326. if ((given & 0xff) == 0)
  3327. {
  3328. func (stream, "%cPSR_", (given & 0x100000) ? 'S' : 'C');
  3329. if (given & 0x800)
  3330. func (stream, "f");
  3331. if (given & 0x400)
  3332. func (stream, "s");
  3333. if (given & 0x200)
  3334. func (stream, "x");
  3335. if (given & 0x100)
  3336. func (stream, "c");
  3337. }
  3338. else
  3339. {
  3340. func (stream, "%s", psr_name (given & 0xff));
  3341. }
  3342. break;
  3343. case 'D':
  3344. if ((given & 0xff) == 0)
  3345. func (stream, "%cPSR", (given & 0x100000) ? 'S' : 'C');
  3346. else
  3347. func (stream, "%s", psr_name (given & 0xff));
  3348. break;
  3349. case '0': case '1': case '2': case '3': case '4':
  3350. case '5': case '6': case '7': case '8': case '9':
  3351. {
  3352. int width;
  3353. unsigned long val;
  3354. c = arm_decode_bitfield (c, given, &val, &width);
  3355. switch (*c)
  3356. {
  3357. case 'd': func (stream, "%lu", val); break;
  3358. case 'W': func (stream, "%lu", val * 4); break;
  3359. case 'r': func (stream, "%s", arm_regnames[val]); break;
  3360. case 'c':
  3361. func (stream, "%s", arm_conditional[val]);
  3362. break;
  3363. case '\'':
  3364. c++;
  3365. if (val == ((1ul << width) - 1))
  3366. func (stream, "%c", *c);
  3367. break;
  3368. case '`':
  3369. c++;
  3370. if (val == 0)
  3371. func (stream, "%c", *c);
  3372. break;
  3373. case '?':
  3374. func (stream, "%c", c[(1 << width) - (int)val]);
  3375. c += 1 << width;
  3376. break;
  3377. default:
  3378. abort ();
  3379. }
  3380. }
  3381. break;
  3382. default:
  3383. abort ();
  3384. }
  3385. }
  3386. return;
  3387. }
  3388. /* No match. */
  3389. abort ();
  3390. }
  3391. /* Print data bytes on INFO->STREAM. */
  3392. static void
  3393. print_insn_data (bfd_vma pc ATTRIBUTE_UNUSED, struct disassemble_info *info,
  3394. long given)
  3395. {
  3396. switch (info->bytes_per_chunk)
  3397. {
  3398. case 1:
  3399. info->fprintf_func (info->stream, ".byte\t0x%02lx", given);
  3400. break;
  3401. case 2:
  3402. info->fprintf_func (info->stream, ".short\t0x%04lx", given);
  3403. break;
  3404. case 4:
  3405. info->fprintf_func (info->stream, ".word\t0x%08lx", given);
  3406. break;
  3407. default:
  3408. abort ();
  3409. }
  3410. }
  3411. /* Search back through the insn stream to determine if this instruction is
  3412. conditionally executed. */
  3413. static void
  3414. find_ifthen_state (bfd_vma pc, struct disassemble_info *info,
  3415. bfd_boolean little)
  3416. {
  3417. unsigned char b[2];
  3418. unsigned int insn;
  3419. int status;
  3420. /* COUNT is twice the number of instructions seen. It will be odd if we
  3421. just crossed an instruction boundary. */
  3422. int count;
  3423. int it_count;
  3424. unsigned int seen_it;
  3425. bfd_vma addr;
  3426. ifthen_address = pc;
  3427. ifthen_state = 0;
  3428. addr = pc;
  3429. count = 1;
  3430. it_count = 0;
  3431. seen_it = 0;
  3432. /* Scan backwards looking for IT instructions, keeping track of where
  3433. instruction boundaries are. We don't know if something is actually an
  3434. IT instruction until we find a definite instruction boundary. */
  3435. for (;;)
  3436. {
  3437. if (addr == 0 || info->symbol_at_address_func(addr, info))
  3438. {
  3439. /* A symbol must be on an instruction boundary, and will not
  3440. be within an IT block. */
  3441. if (seen_it && (count & 1))
  3442. break;
  3443. return;
  3444. }
  3445. addr -= 2;
  3446. status = info->read_memory_func (addr, (bfd_byte *)b, 2, info);
  3447. if (status)
  3448. return;
  3449. if (little)
  3450. insn = (b[0]) | (b[1] << 8);
  3451. else
  3452. insn = (b[1]) | (b[0] << 8);
  3453. if (seen_it)
  3454. {
  3455. if ((insn & 0xf800) < 0xe800)
  3456. {
  3457. /* Addr + 2 is an instruction boundary. See if this matches
  3458. the expected boundary based on the position of the last
  3459. IT candidate. */
  3460. if (count & 1)
  3461. break;
  3462. seen_it = 0;
  3463. }
  3464. }
  3465. if ((insn & 0xff00) == 0xbf00 && (insn & 0xf) != 0)
  3466. {
  3467. /* This could be an IT instruction. */
  3468. seen_it = insn;
  3469. it_count = count >> 1;
  3470. }
  3471. if ((insn & 0xf800) >= 0xe800)
  3472. count++;
  3473. else
  3474. count = (count + 2) | 1;
  3475. /* IT blocks contain at most 4 instructions. */
  3476. if (count >= 8 && !seen_it)
  3477. return;
  3478. }
  3479. /* We found an IT instruction. */
  3480. ifthen_state = (seen_it & 0xe0) | ((seen_it << it_count) & 0x1f);
  3481. if ((ifthen_state & 0xf) == 0)
  3482. ifthen_state = 0;
  3483. }
  3484. /* NOTE: There are no checks in these routines that
  3485. the relevant number of data bytes exist. */
  3486. int
  3487. print_insn_arm (bfd_vma pc, struct disassemble_info *info)
  3488. {
  3489. unsigned char b[4];
  3490. long given;
  3491. int status;
  3492. int is_thumb = false;
  3493. int is_data = false;
  3494. unsigned int size = 4;
  3495. void (*printer) (bfd_vma, struct disassemble_info *, long);
  3496. #if 0
  3497. bfd_boolean found = false;
  3498. if (info->disassembler_options)
  3499. {
  3500. parse_disassembler_options (info->disassembler_options);
  3501. /* To avoid repeated parsing of these options, we remove them here. */
  3502. info->disassembler_options = NULL;
  3503. }
  3504. /* First check the full symtab for a mapping symbol, even if there
  3505. are no usable non-mapping symbols for this address. */
  3506. if (info->symtab != NULL
  3507. && bfd_asymbol_flavour (*info->symtab) == bfd_target_elf_flavour)
  3508. {
  3509. bfd_vma addr;
  3510. int n;
  3511. int last_sym = -1;
  3512. enum map_type type = MAP_ARM;
  3513. if (pc <= last_mapping_addr)
  3514. last_mapping_sym = -1;
  3515. is_thumb = (last_type == MAP_THUMB);
  3516. found = false;
  3517. /* Start scanning at the start of the function, or wherever
  3518. we finished last time. */
  3519. n = info->symtab_pos + 1;
  3520. if (n < last_mapping_sym)
  3521. n = last_mapping_sym;
  3522. /* Scan up to the location being disassembled. */
  3523. for (; n < info->symtab_size; n++)
  3524. {
  3525. addr = bfd_asymbol_value (info->symtab[n]);
  3526. if (addr > pc)
  3527. break;
  3528. if ((info->section == NULL
  3529. || info->section == info->symtab[n]->section)
  3530. && get_sym_code_type (info, n, &type))
  3531. {
  3532. last_sym = n;
  3533. found = true;
  3534. }
  3535. }
  3536. if (!found)
  3537. {
  3538. n = info->symtab_pos;
  3539. if (n < last_mapping_sym - 1)
  3540. n = last_mapping_sym - 1;
  3541. /* No mapping symbol found at this address. Look backwards
  3542. for a preceding one. */
  3543. for (; n >= 0; n--)
  3544. {
  3545. if (get_sym_code_type (info, n, &type))
  3546. {
  3547. last_sym = n;
  3548. found = true;
  3549. break;
  3550. }
  3551. }
  3552. }
  3553. last_mapping_sym = last_sym;
  3554. last_type = type;
  3555. is_thumb = (last_type == MAP_THUMB);
  3556. is_data = (last_type == MAP_DATA);
  3557. /* Look a little bit ahead to see if we should print out
  3558. two or four bytes of data. If there's a symbol,
  3559. mapping or otherwise, after two bytes then don't
  3560. print more. */
  3561. if (is_data)
  3562. {
  3563. size = 4 - (pc & 3);
  3564. for (n = last_sym + 1; n < info->symtab_size; n++)
  3565. {
  3566. addr = bfd_asymbol_value (info->symtab[n]);
  3567. if (addr > pc)
  3568. {
  3569. if (addr - pc < size)
  3570. size = addr - pc;
  3571. break;
  3572. }
  3573. }
  3574. /* If the next symbol is after three bytes, we need to
  3575. print only part of the data, so that we can use either
  3576. .byte or .short. */
  3577. if (size == 3)
  3578. size = (pc & 1) ? 1 : 2;
  3579. }
  3580. }
  3581. if (info->symbols != NULL)
  3582. {
  3583. if (bfd_asymbol_flavour (*info->symbols) == bfd_target_coff_flavour)
  3584. {
  3585. coff_symbol_type * cs;
  3586. cs = coffsymbol (*info->symbols);
  3587. is_thumb = ( cs->native->u.syment.n_sclass == C_THUMBEXT
  3588. || cs->native->u.syment.n_sclass == C_THUMBSTAT
  3589. || cs->native->u.syment.n_sclass == C_THUMBLABEL
  3590. || cs->native->u.syment.n_sclass == C_THUMBEXTFUNC
  3591. || cs->native->u.syment.n_sclass == C_THUMBSTATFUNC);
  3592. }
  3593. else if (bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
  3594. && !found)
  3595. {
  3596. /* If no mapping symbol has been found then fall back to the type
  3597. of the function symbol. */
  3598. elf_symbol_type * es;
  3599. unsigned int type;
  3600. es = *(elf_symbol_type **)(info->symbols);
  3601. type = ELF_ST_TYPE (es->internal_elf_sym.st_info);
  3602. is_thumb = (type == STT_ARM_TFUNC) || (type == STT_ARM_16BIT);
  3603. }
  3604. }
  3605. #else
  3606. int little;
  3607. little = (info->endian == BFD_ENDIAN_LITTLE);
  3608. is_thumb |= (pc & 1);
  3609. pc &= ~(bfd_vma)1;
  3610. #endif
  3611. if (force_thumb)
  3612. is_thumb = true;
  3613. info->bytes_per_line = 4;
  3614. if (is_data)
  3615. {
  3616. int i;
  3617. /* size was already set above. */
  3618. info->bytes_per_chunk = size;
  3619. printer = print_insn_data;
  3620. status = info->read_memory_func (pc, (bfd_byte *)b, size, info);
  3621. given = 0;
  3622. if (little)
  3623. for (i = size - 1; i >= 0; i--)
  3624. given = b[i] | (given << 8);
  3625. else
  3626. for (i = 0; i < (int) size; i++)
  3627. given = b[i] | (given << 8);
  3628. }
  3629. else if (!is_thumb)
  3630. {
  3631. /* In ARM mode endianness is a straightforward issue: the instruction
  3632. is four bytes long and is either ordered 0123 or 3210. */
  3633. printer = print_insn_arm_internal;
  3634. info->bytes_per_chunk = 4;
  3635. size = 4;
  3636. status = info->read_memory_func (pc, (bfd_byte *)b, 4, info);
  3637. if (little)
  3638. given = (b[0]) | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
  3639. else
  3640. given = (b[3]) | (b[2] << 8) | (b[1] << 16) | (b[0] << 24);
  3641. }
  3642. else
  3643. {
  3644. /* In Thumb mode we have the additional wrinkle of two
  3645. instruction lengths. Fortunately, the bits that determine
  3646. the length of the current instruction are always to be found
  3647. in the first two bytes. */
  3648. printer = print_insn_thumb16;
  3649. info->bytes_per_chunk = 2;
  3650. size = 2;
  3651. status = info->read_memory_func (pc, (bfd_byte *)b, 2, info);
  3652. if (little)
  3653. given = (b[0]) | (b[1] << 8);
  3654. else
  3655. given = (b[1]) | (b[0] << 8);
  3656. if (!status)
  3657. {
  3658. /* These bit patterns signal a four-byte Thumb
  3659. instruction. */
  3660. if ((given & 0xF800) == 0xF800
  3661. || (given & 0xF800) == 0xF000
  3662. || (given & 0xF800) == 0xE800)
  3663. {
  3664. status = info->read_memory_func (pc + 2, (bfd_byte *)b, 2, info);
  3665. if (little)
  3666. given = (b[0]) | (b[1] << 8) | (given << 16);
  3667. else
  3668. given = (b[1]) | (b[0] << 8) | (given << 16);
  3669. printer = print_insn_thumb32;
  3670. size = 4;
  3671. }
  3672. }
  3673. if (ifthen_address != pc)
  3674. find_ifthen_state(pc, info, little);
  3675. if (ifthen_state)
  3676. {
  3677. if ((ifthen_state & 0xf) == 0x8)
  3678. ifthen_next_state = 0;
  3679. else
  3680. ifthen_next_state = (ifthen_state & 0xe0)
  3681. | ((ifthen_state & 0xf) << 1);
  3682. }
  3683. }
  3684. if (status)
  3685. {
  3686. info->memory_error_func (status, pc, info);
  3687. return -1;
  3688. }
  3689. if (info->flags & INSN_HAS_RELOC)
  3690. /* If the instruction has a reloc associated with it, then
  3691. the offset field in the instruction will actually be the
  3692. addend for the reloc. (We are using REL type relocs).
  3693. In such cases, we can ignore the pc when computing
  3694. addresses, since the addend is not currently pc-relative. */
  3695. pc = 0;
  3696. /* We include the hexdump of the instruction. The format here
  3697. matches that used by objdump and the ARM ARM (in particular,
  3698. 32 bit Thumb instructions are displayed as pairs of halfwords,
  3699. not as a single word.) */
  3700. if (is_thumb)
  3701. {
  3702. if (size == 2)
  3703. {
  3704. info->fprintf_func(info->stream, "%04lx ",
  3705. ((unsigned long)given) & 0xffff);
  3706. }
  3707. else
  3708. {
  3709. info->fprintf_func(info->stream, "%04lx %04lx ",
  3710. (((unsigned long)given) >> 16) & 0xffff,
  3711. ((unsigned long)given) & 0xffff);
  3712. }
  3713. }
  3714. else
  3715. {
  3716. info->fprintf_func(info->stream, "%08lx ",
  3717. ((unsigned long)given) & 0xffffffff);
  3718. }
  3719. printer (pc, info, given);
  3720. if (is_thumb)
  3721. {
  3722. ifthen_state = ifthen_next_state;
  3723. ifthen_address += size;
  3724. }
  3725. return size;
  3726. }