test-thumb.c 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  1. /*
  2. * arch/arm/probes/kprobes/test-thumb.c
  3. *
  4. * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/module.h>
  12. #include <asm/opcodes.h>
  13. #include <asm/probes.h>
  14. #include "test-core.h"
  15. #define TEST_ISA "16"
  16. #define DONT_TEST_IN_ITBLOCK(tests) \
  17. kprobe_test_flags |= TEST_FLAG_NO_ITBLOCK; \
  18. tests \
  19. kprobe_test_flags &= ~TEST_FLAG_NO_ITBLOCK;
  20. #define CONDITION_INSTRUCTIONS(cc_pos, tests) \
  21. kprobe_test_cc_position = cc_pos; \
  22. DONT_TEST_IN_ITBLOCK(tests) \
  23. kprobe_test_cc_position = 0;
  24. #define TEST_ITBLOCK(code) \
  25. kprobe_test_flags |= TEST_FLAG_FULL_ITBLOCK; \
  26. TESTCASE_START(code) \
  27. TEST_ARG_END("") \
  28. "50: nop \n\t" \
  29. "1: "code" \n\t" \
  30. " mov r1, #0x11 \n\t" \
  31. " mov r2, #0x22 \n\t" \
  32. " mov r3, #0x33 \n\t" \
  33. "2: nop \n\t" \
  34. TESTCASE_END \
  35. kprobe_test_flags &= ~TEST_FLAG_FULL_ITBLOCK;
  36. #define TEST_THUMB_TO_ARM_INTERWORK_P(code1, reg, val, code2) \
  37. TESTCASE_START(code1 #reg code2) \
  38. TEST_ARG_PTR(reg, val) \
  39. TEST_ARG_REG(14, 99f+1) \
  40. TEST_ARG_MEM(15, 3f) \
  41. TEST_ARG_END("") \
  42. " nop \n\t" /* To align 1f */ \
  43. "50: nop \n\t" \
  44. "1: "code1 #reg code2" \n\t" \
  45. " bx lr \n\t" \
  46. ".arm \n\t" \
  47. "3: adr lr, 2f+1 \n\t" \
  48. " bx lr \n\t" \
  49. ".thumb \n\t" \
  50. "2: nop \n\t" \
  51. TESTCASE_END
  52. void kprobe_thumb16_test_cases(void)
  53. {
  54. kprobe_test_flags = TEST_FLAG_NARROW_INSTR;
  55. TEST_GROUP("Shift (immediate), add, subtract, move, and compare")
  56. TEST_R( "lsls r7, r",0,VAL1,", #5")
  57. TEST_R( "lsls r0, r",7,VAL2,", #11")
  58. TEST_R( "lsrs r7, r",0,VAL1,", #5")
  59. TEST_R( "lsrs r0, r",7,VAL2,", #11")
  60. TEST_R( "asrs r7, r",0,VAL1,", #5")
  61. TEST_R( "asrs r0, r",7,VAL2,", #11")
  62. TEST_RR( "adds r2, r",0,VAL1,", r",7,VAL2,"")
  63. TEST_RR( "adds r5, r",7,VAL2,", r",0,VAL2,"")
  64. TEST_RR( "subs r2, r",0,VAL1,", r",7,VAL2,"")
  65. TEST_RR( "subs r5, r",7,VAL2,", r",0,VAL2,"")
  66. TEST_R( "adds r7, r",0,VAL1,", #5")
  67. TEST_R( "adds r0, r",7,VAL2,", #2")
  68. TEST_R( "subs r7, r",0,VAL1,", #5")
  69. TEST_R( "subs r0, r",7,VAL2,", #2")
  70. TEST( "movs.n r0, #0x5f")
  71. TEST( "movs.n r7, #0xa0")
  72. TEST_R( "cmp.n r",0,0x5e, ", #0x5f")
  73. TEST_R( "cmp.n r",5,0x15f,", #0x5f")
  74. TEST_R( "cmp.n r",7,0xa0, ", #0xa0")
  75. TEST_R( "adds.n r",0,VAL1,", #0x5f")
  76. TEST_R( "adds.n r",7,VAL2,", #0xa0")
  77. TEST_R( "subs.n r",0,VAL1,", #0x5f")
  78. TEST_R( "subs.n r",7,VAL2,", #0xa0")
  79. TEST_GROUP("16-bit Thumb data-processing instructions")
  80. #define DATA_PROCESSING16(op,val) \
  81. TEST_RR( op" r",0,VAL1,", r",7,val,"") \
  82. TEST_RR( op" r",7,VAL2,", r",0,val,"")
  83. DATA_PROCESSING16("ands",0xf00f00ff)
  84. DATA_PROCESSING16("eors",0xf00f00ff)
  85. DATA_PROCESSING16("lsls",11)
  86. DATA_PROCESSING16("lsrs",11)
  87. DATA_PROCESSING16("asrs",11)
  88. DATA_PROCESSING16("adcs",VAL2)
  89. DATA_PROCESSING16("sbcs",VAL2)
  90. DATA_PROCESSING16("rors",11)
  91. DATA_PROCESSING16("tst",0xf00f00ff)
  92. TEST_R("rsbs r",0,VAL1,", #0")
  93. TEST_R("rsbs r",7,VAL2,", #0")
  94. DATA_PROCESSING16("cmp",0xf00f00ff)
  95. DATA_PROCESSING16("cmn",0xf00f00ff)
  96. DATA_PROCESSING16("orrs",0xf00f00ff)
  97. DATA_PROCESSING16("muls",VAL2)
  98. DATA_PROCESSING16("bics",0xf00f00ff)
  99. DATA_PROCESSING16("mvns",VAL2)
  100. TEST_GROUP("Special data instructions and branch and exchange")
  101. TEST_RR( "add r",0, VAL1,", r",7,VAL2,"")
  102. TEST_RR( "add r",3, VAL2,", r",8,VAL3,"")
  103. TEST_RR( "add r",8, VAL3,", r",0,VAL1,"")
  104. TEST_R( "add sp" ", r",8,-8, "")
  105. TEST_R( "add r",14,VAL1,", pc")
  106. TEST_BF_R("add pc" ", r",0,2f-1f-8,"")
  107. TEST_UNSUPPORTED(__inst_thumb16(0x44ff) " @ add pc, pc")
  108. TEST_RR( "cmp r",3,VAL1,", r",8,VAL2,"")
  109. TEST_RR( "cmp r",8,VAL2,", r",0,VAL1,"")
  110. TEST_R( "cmp sp" ", r",8,-8, "")
  111. TEST_R( "mov r0, r",7,VAL2,"")
  112. TEST_R( "mov r3, r",8,VAL3,"")
  113. TEST_R( "mov r8, r",0,VAL1,"")
  114. TEST_P( "mov sp, r",8,-8, "")
  115. TEST( "mov lr, pc")
  116. TEST_BF_R("mov pc, r",0,2f, "")
  117. TEST_BF_R("bx r",0, 2f+1,"")
  118. TEST_BF_R("bx r",14,2f+1,"")
  119. TESTCASE_START("bx pc")
  120. TEST_ARG_REG(14, 99f+1)
  121. TEST_ARG_END("")
  122. " nop \n\t" /* To align the bx pc*/
  123. "50: nop \n\t"
  124. "1: bx pc \n\t"
  125. " bx lr \n\t"
  126. ".arm \n\t"
  127. " adr lr, 2f+1 \n\t"
  128. " bx lr \n\t"
  129. ".thumb \n\t"
  130. "2: nop \n\t"
  131. TESTCASE_END
  132. TEST_BF_R("blx r",0, 2f+1,"")
  133. TEST_BB_R("blx r",14,2f+1,"")
  134. TEST_UNSUPPORTED(__inst_thumb16(0x47f8) " @ blx pc")
  135. TEST_GROUP("Load from Literal Pool")
  136. TEST_X( "ldr r0, 3f",
  137. ".align \n\t"
  138. "3: .word "__stringify(VAL1))
  139. TEST_X( "ldr r7, 3f",
  140. ".space 128 \n\t"
  141. ".align \n\t"
  142. "3: .word "__stringify(VAL2))
  143. TEST_GROUP("16-bit Thumb Load/store instructions")
  144. TEST_RPR("str r",0, VAL1,", [r",1, 24,", r",2, 48,"]")
  145. TEST_RPR("str r",7, VAL2,", [r",6, 24,", r",5, 48,"]")
  146. TEST_RPR("strh r",0, VAL1,", [r",1, 24,", r",2, 48,"]")
  147. TEST_RPR("strh r",7, VAL2,", [r",6, 24,", r",5, 48,"]")
  148. TEST_RPR("strb r",0, VAL1,", [r",1, 24,", r",2, 48,"]")
  149. TEST_RPR("strb r",7, VAL2,", [r",6, 24,", r",5, 48,"]")
  150. TEST_PR( "ldrsb r0, [r",1, 24,", r",2, 48,"]")
  151. TEST_PR( "ldrsb r7, [r",6, 24,", r",5, 50,"]")
  152. TEST_PR( "ldr r0, [r",1, 24,", r",2, 48,"]")
  153. TEST_PR( "ldr r7, [r",6, 24,", r",5, 48,"]")
  154. TEST_PR( "ldrh r0, [r",1, 24,", r",2, 48,"]")
  155. TEST_PR( "ldrh r7, [r",6, 24,", r",5, 50,"]")
  156. TEST_PR( "ldrb r0, [r",1, 24,", r",2, 48,"]")
  157. TEST_PR( "ldrb r7, [r",6, 24,", r",5, 50,"]")
  158. TEST_PR( "ldrsh r0, [r",1, 24,", r",2, 48,"]")
  159. TEST_PR( "ldrsh r7, [r",6, 24,", r",5, 50,"]")
  160. TEST_RP("str r",0, VAL1,", [r",1, 24,", #120]")
  161. TEST_RP("str r",7, VAL2,", [r",6, 24,", #120]")
  162. TEST_P( "ldr r0, [r",1, 24,", #120]")
  163. TEST_P( "ldr r7, [r",6, 24,", #120]")
  164. TEST_RP("strb r",0, VAL1,", [r",1, 24,", #30]")
  165. TEST_RP("strb r",7, VAL2,", [r",6, 24,", #30]")
  166. TEST_P( "ldrb r0, [r",1, 24,", #30]")
  167. TEST_P( "ldrb r7, [r",6, 24,", #30]")
  168. TEST_RP("strh r",0, VAL1,", [r",1, 24,", #60]")
  169. TEST_RP("strh r",7, VAL2,", [r",6, 24,", #60]")
  170. TEST_P( "ldrh r0, [r",1, 24,", #60]")
  171. TEST_P( "ldrh r7, [r",6, 24,", #60]")
  172. TEST_R( "str r",0, VAL1,", [sp, #0]")
  173. TEST_R( "str r",7, VAL2,", [sp, #160]")
  174. TEST( "ldr r0, [sp, #0]")
  175. TEST( "ldr r7, [sp, #160]")
  176. TEST_RP("str r",0, VAL1,", [r",0, 24,"]")
  177. TEST_P( "ldr r0, [r",0, 24,"]")
  178. TEST_GROUP("Generate PC-/SP-relative address")
  179. TEST("add r0, pc, #4")
  180. TEST("add r7, pc, #1020")
  181. TEST("add r0, sp, #4")
  182. TEST("add r7, sp, #1020")
  183. TEST_GROUP("Miscellaneous 16-bit instructions")
  184. TEST_UNSUPPORTED( "cpsie i")
  185. TEST_UNSUPPORTED( "cpsid i")
  186. TEST_UNSUPPORTED( "setend le")
  187. TEST_UNSUPPORTED( "setend be")
  188. TEST("add sp, #"__stringify(TEST_MEMORY_SIZE)) /* Assumes TEST_MEMORY_SIZE < 0x400 */
  189. TEST("sub sp, #0x7f*4")
  190. DONT_TEST_IN_ITBLOCK(
  191. TEST_BF_R( "cbnz r",0,0, ", 2f")
  192. TEST_BF_R( "cbz r",2,-1,", 2f")
  193. TEST_BF_RX( "cbnz r",4,1, ", 2f", SPACE_0x20)
  194. TEST_BF_RX( "cbz r",7,0, ", 2f", SPACE_0x40)
  195. )
  196. TEST_R("sxth r0, r",7, HH1,"")
  197. TEST_R("sxth r7, r",0, HH2,"")
  198. TEST_R("sxtb r0, r",7, HH1,"")
  199. TEST_R("sxtb r7, r",0, HH2,"")
  200. TEST_R("uxth r0, r",7, HH1,"")
  201. TEST_R("uxth r7, r",0, HH2,"")
  202. TEST_R("uxtb r0, r",7, HH1,"")
  203. TEST_R("uxtb r7, r",0, HH2,"")
  204. TEST_R("rev r0, r",7, VAL1,"")
  205. TEST_R("rev r7, r",0, VAL2,"")
  206. TEST_R("rev16 r0, r",7, VAL1,"")
  207. TEST_R("rev16 r7, r",0, VAL2,"")
  208. TEST_UNSUPPORTED(__inst_thumb16(0xba80) "")
  209. TEST_UNSUPPORTED(__inst_thumb16(0xbabf) "")
  210. TEST_R("revsh r0, r",7, VAL1,"")
  211. TEST_R("revsh r7, r",0, VAL2,"")
  212. #define TEST_POPPC(code, offset) \
  213. TESTCASE_START(code) \
  214. TEST_ARG_PTR(13, offset) \
  215. TEST_ARG_END("") \
  216. TEST_BRANCH_F(code) \
  217. TESTCASE_END
  218. TEST("push {r0}")
  219. TEST("push {r7}")
  220. TEST("push {r14}")
  221. TEST("push {r0-r7,r14}")
  222. TEST("push {r0,r2,r4,r6,r14}")
  223. TEST("push {r1,r3,r5,r7}")
  224. TEST("pop {r0}")
  225. TEST("pop {r7}")
  226. TEST("pop {r0,r2,r4,r6}")
  227. TEST_POPPC("pop {pc}",15*4)
  228. TEST_POPPC("pop {r0-r7,pc}",7*4)
  229. TEST_POPPC("pop {r1,r3,r5,r7,pc}",11*4)
  230. TEST_THUMB_TO_ARM_INTERWORK_P("pop {pc} @ ",13,15*4,"")
  231. TEST_THUMB_TO_ARM_INTERWORK_P("pop {r0-r7,pc} @ ",13,7*4,"")
  232. TEST_UNSUPPORTED("bkpt.n 0")
  233. TEST_UNSUPPORTED("bkpt.n 255")
  234. TEST_SUPPORTED("yield")
  235. TEST("sev")
  236. TEST("nop")
  237. TEST("wfi")
  238. TEST_SUPPORTED("wfe")
  239. TEST_UNSUPPORTED(__inst_thumb16(0xbf50) "") /* Unassigned hints */
  240. TEST_UNSUPPORTED(__inst_thumb16(0xbff0) "") /* Unassigned hints */
  241. #define TEST_IT(code, code2) \
  242. TESTCASE_START(code) \
  243. TEST_ARG_END("") \
  244. "50: nop \n\t" \
  245. "1: "code" \n\t" \
  246. " "code2" \n\t" \
  247. "2: nop \n\t" \
  248. TESTCASE_END
  249. DONT_TEST_IN_ITBLOCK(
  250. TEST_IT("it eq","moveq r0,#0")
  251. TEST_IT("it vc","movvc r0,#0")
  252. TEST_IT("it le","movle r0,#0")
  253. TEST_IT("ite eq","moveq r0,#0\n\t movne r1,#1")
  254. TEST_IT("itet vc","movvc r0,#0\n\t movvs r1,#1\n\t movvc r2,#2")
  255. TEST_IT("itete le","movle r0,#0\n\t movgt r1,#1\n\t movle r2,#2\n\t movgt r3,#3")
  256. TEST_IT("itttt le","movle r0,#0\n\t movle r1,#1\n\t movle r2,#2\n\t movle r3,#3")
  257. TEST_IT("iteee le","movle r0,#0\n\t movgt r1,#1\n\t movgt r2,#2\n\t movgt r3,#3")
  258. )
  259. TEST_GROUP("Load and store multiple")
  260. TEST_P("ldmia r",4, 16*4,"!, {r0,r7}")
  261. TEST_P("ldmia r",7, 16*4,"!, {r0-r6}")
  262. TEST_P("stmia r",4, 16*4,"!, {r0,r7}")
  263. TEST_P("stmia r",0, 16*4,"!, {r0-r7}")
  264. TEST_GROUP("Conditional branch and Supervisor Call instructions")
  265. CONDITION_INSTRUCTIONS(8,
  266. TEST_BF("beq 2f")
  267. TEST_BB("bne 2b")
  268. TEST_BF("bgt 2f")
  269. TEST_BB("blt 2b")
  270. )
  271. TEST_UNSUPPORTED(__inst_thumb16(0xde00) "")
  272. TEST_UNSUPPORTED(__inst_thumb16(0xdeff) "")
  273. TEST_UNSUPPORTED("svc #0x00")
  274. TEST_UNSUPPORTED("svc #0xff")
  275. TEST_GROUP("Unconditional branch")
  276. TEST_BF( "b 2f")
  277. TEST_BB( "b 2b")
  278. TEST_BF_X("b 2f", SPACE_0x400)
  279. TEST_BB_X("b 2b", SPACE_0x400)
  280. TEST_GROUP("Testing instructions in IT blocks")
  281. TEST_ITBLOCK("subs.n r0, r0")
  282. verbose("\n");
  283. }
  284. void kprobe_thumb32_test_cases(void)
  285. {
  286. kprobe_test_flags = 0;
  287. TEST_GROUP("Load/store multiple")
  288. TEST_UNSUPPORTED("rfedb sp")
  289. TEST_UNSUPPORTED("rfeia sp")
  290. TEST_UNSUPPORTED("rfedb sp!")
  291. TEST_UNSUPPORTED("rfeia sp!")
  292. TEST_P( "stmia r",0, 16*4,", {r0,r8}")
  293. TEST_P( "stmia r",4, 16*4,", {r0-r12,r14}")
  294. TEST_P( "stmia r",7, 16*4,"!, {r8-r12,r14}")
  295. TEST_P( "stmia r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
  296. TEST_P( "ldmia r",0, 16*4,", {r0,r8}")
  297. TEST_P( "ldmia r",4, 0, ", {r0-r12,r14}")
  298. TEST_BF_P("ldmia r",5, 8*4, "!, {r6-r12,r15}")
  299. TEST_P( "ldmia r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
  300. TEST_BF_P("ldmia r",14,14*4,"!, {r4,pc}")
  301. TEST_P( "stmdb r",0, 16*4,", {r0,r8}")
  302. TEST_P( "stmdb r",4, 16*4,", {r0-r12,r14}")
  303. TEST_P( "stmdb r",5, 16*4,"!, {r8-r12,r14}")
  304. TEST_P( "stmdb r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
  305. TEST_P( "ldmdb r",0, 16*4,", {r0,r8}")
  306. TEST_P( "ldmdb r",4, 16*4,", {r0-r12,r14}")
  307. TEST_BF_P("ldmdb r",5, 16*4,"!, {r6-r12,r15}")
  308. TEST_P( "ldmdb r",12,16*4,"!, {r1,r3,r5,r7,r8-r11,r14}")
  309. TEST_BF_P("ldmdb r",14,16*4,"!, {r4,pc}")
  310. TEST_P( "stmdb r",13,16*4,"!, {r3-r12,lr}")
  311. TEST_P( "stmdb r",13,16*4,"!, {r3-r12}")
  312. TEST_P( "stmdb r",2, 16*4,", {r3-r12,lr}")
  313. TEST_P( "stmdb r",13,16*4,"!, {r2-r12,lr}")
  314. TEST_P( "stmdb r",0, 16*4,", {r0-r12}")
  315. TEST_P( "stmdb r",0, 16*4,", {r0-r12,lr}")
  316. TEST_BF_P("ldmia r",13,5*4, "!, {r3-r12,pc}")
  317. TEST_P( "ldmia r",13,5*4, "!, {r3-r12}")
  318. TEST_BF_P("ldmia r",2, 5*4, "!, {r3-r12,pc}")
  319. TEST_BF_P("ldmia r",13,4*4, "!, {r2-r12,pc}")
  320. TEST_P( "ldmia r",0, 16*4,", {r0-r12}")
  321. TEST_P( "ldmia r",0, 16*4,", {r0-r12,lr}")
  322. TEST_THUMB_TO_ARM_INTERWORK_P("ldmia r",0,14*4,", {r12,pc}")
  323. TEST_THUMB_TO_ARM_INTERWORK_P("ldmia r",13,2*4,", {r0-r12,pc}")
  324. TEST_UNSUPPORTED(__inst_thumb32(0xe88f0101) " @ stmia pc, {r0,r8}")
  325. TEST_UNSUPPORTED(__inst_thumb32(0xe92f5f00) " @ stmdb pc!, {r8-r12,r14}")
  326. TEST_UNSUPPORTED(__inst_thumb32(0xe8bdc000) " @ ldmia r13!, {r14,pc}")
  327. TEST_UNSUPPORTED(__inst_thumb32(0xe93ec000) " @ ldmdb r14!, {r14,pc}")
  328. TEST_UNSUPPORTED(__inst_thumb32(0xe8a73f00) " @ stmia r7!, {r8-r12,sp}")
  329. TEST_UNSUPPORTED(__inst_thumb32(0xe8a79f00) " @ stmia r7!, {r8-r12,pc}")
  330. TEST_UNSUPPORTED(__inst_thumb32(0xe93e2010) " @ ldmdb r14!, {r4,sp}")
  331. TEST_GROUP("Load/store double or exclusive, table branch")
  332. TEST_P( "ldrd r0, r1, [r",1, 24,", #-16]")
  333. TEST( "ldrd r12, r14, [sp, #16]")
  334. TEST_P( "ldrd r1, r0, [r",7, 24,", #-16]!")
  335. TEST( "ldrd r14, r12, [sp, #16]!")
  336. TEST_P( "ldrd r1, r0, [r",7, 24,"], #16")
  337. TEST( "ldrd r7, r8, [sp], #-16")
  338. TEST_X( "ldrd r12, r14, 3f",
  339. ".align 3 \n\t"
  340. "3: .word "__stringify(VAL1)" \n\t"
  341. " .word "__stringify(VAL2))
  342. TEST_UNSUPPORTED(__inst_thumb32(0xe9ffec04) " @ ldrd r14, r12, [pc, #16]!")
  343. TEST_UNSUPPORTED(__inst_thumb32(0xe8ffec04) " @ ldrd r14, r12, [pc], #16")
  344. TEST_UNSUPPORTED(__inst_thumb32(0xe9d4d800) " @ ldrd sp, r8, [r4]")
  345. TEST_UNSUPPORTED(__inst_thumb32(0xe9d4f800) " @ ldrd pc, r8, [r4]")
  346. TEST_UNSUPPORTED(__inst_thumb32(0xe9d47d00) " @ ldrd r7, sp, [r4]")
  347. TEST_UNSUPPORTED(__inst_thumb32(0xe9d47f00) " @ ldrd r7, pc, [r4]")
  348. TEST_RRP("strd r",0, VAL1,", r",1, VAL2,", [r",1, 24,", #-16]")
  349. TEST_RR( "strd r",12,VAL2,", r",14,VAL1,", [sp, #16]")
  350. TEST_RRP("strd r",1, VAL1,", r",0, VAL2,", [r",7, 24,", #-16]!")
  351. TEST_RR( "strd r",14,VAL2,", r",12,VAL1,", [sp, #16]!")
  352. TEST_RRP("strd r",1, VAL1,", r",0, VAL2,", [r",7, 24,"], #16")
  353. TEST_RR( "strd r",7, VAL2,", r",8, VAL1,", [sp], #-16")
  354. TEST_RRP("strd r",6, VAL1,", r",7, VAL2,", [r",13, TEST_MEMORY_SIZE,", #-"__stringify(MAX_STACK_SIZE)"]!")
  355. TEST_UNSUPPORTED("strd r6, r7, [r13, #-"__stringify(MAX_STACK_SIZE)"-8]!")
  356. TEST_RRP("strd r",4, VAL1,", r",5, VAL2,", [r",14, TEST_MEMORY_SIZE,", #-"__stringify(MAX_STACK_SIZE)"-8]!")
  357. TEST_UNSUPPORTED(__inst_thumb32(0xe9efec04) " @ strd r14, r12, [pc, #16]!")
  358. TEST_UNSUPPORTED(__inst_thumb32(0xe8efec04) " @ strd r14, r12, [pc], #16")
  359. TEST_RX("tbb [pc, r",0, (9f-(1f+4)),"]",
  360. "9: \n\t"
  361. ".byte (2f-1b-4)>>1 \n\t"
  362. ".byte (3f-1b-4)>>1 \n\t"
  363. "3: mvn r0, r0 \n\t"
  364. "2: nop \n\t")
  365. TEST_RX("tbb [pc, r",4, (9f-(1f+4)+1),"]",
  366. "9: \n\t"
  367. ".byte (2f-1b-4)>>1 \n\t"
  368. ".byte (3f-1b-4)>>1 \n\t"
  369. "3: mvn r0, r0 \n\t"
  370. "2: nop \n\t")
  371. TEST_RRX("tbb [r",1,9f,", r",2,0,"]",
  372. "9: \n\t"
  373. ".byte (2f-1b-4)>>1 \n\t"
  374. ".byte (3f-1b-4)>>1 \n\t"
  375. "3: mvn r0, r0 \n\t"
  376. "2: nop \n\t")
  377. TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]",
  378. "9: \n\t"
  379. ".short (2f-1b-4)>>1 \n\t"
  380. ".short (3f-1b-4)>>1 \n\t"
  381. "3: mvn r0, r0 \n\t"
  382. "2: nop \n\t")
  383. TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]",
  384. "9: \n\t"
  385. ".short (2f-1b-4)>>1 \n\t"
  386. ".short (3f-1b-4)>>1 \n\t"
  387. "3: mvn r0, r0 \n\t"
  388. "2: nop \n\t")
  389. TEST_RRX("tbh [r",1,9f, ", r",14,1,"]",
  390. "9: \n\t"
  391. ".short (2f-1b-4)>>1 \n\t"
  392. ".short (3f-1b-4)>>1 \n\t"
  393. "3: mvn r0, r0 \n\t"
  394. "2: nop \n\t")
  395. TEST_UNSUPPORTED(__inst_thumb32(0xe8d1f01f) " @ tbh [r1, pc]")
  396. TEST_UNSUPPORTED(__inst_thumb32(0xe8d1f01d) " @ tbh [r1, sp]")
  397. TEST_UNSUPPORTED(__inst_thumb32(0xe8ddf012) " @ tbh [sp, r2]")
  398. TEST_UNSUPPORTED("strexb r0, r1, [r2]")
  399. TEST_UNSUPPORTED("strexh r0, r1, [r2]")
  400. TEST_UNSUPPORTED("strexd r0, r1, [r2]")
  401. TEST_UNSUPPORTED("ldrexb r0, [r1]")
  402. TEST_UNSUPPORTED("ldrexh r0, [r1]")
  403. TEST_UNSUPPORTED("ldrexd r0, [r1]")
  404. TEST_GROUP("Data-processing (shifted register) and (modified immediate)")
  405. #define _DATA_PROCESSING32_DNM(op,s,val) \
  406. TEST_RR(op s".w r0, r",1, VAL1,", r",2, val, "") \
  407. TEST_RR(op s" r1, r",1, VAL1,", r",2, val, ", lsl #3") \
  408. TEST_RR(op s" r2, r",3, VAL1,", r",2, val, ", lsr #4") \
  409. TEST_RR(op s" r3, r",3, VAL1,", r",2, val, ", asr #5") \
  410. TEST_RR(op s" r4, r",5, VAL1,", r",2, N(val),", asr #6") \
  411. TEST_RR(op s" r5, r",5, VAL1,", r",2, val, ", ror #7") \
  412. TEST_RR(op s" r8, r",9, VAL1,", r",10,val, ", rrx") \
  413. TEST_R( op s" r0, r",11,VAL1,", #0x00010001") \
  414. TEST_R( op s" r11, r",0, VAL1,", #0xf5000000") \
  415. TEST_R( op s" r7, r",8, VAL2,", #0x000af000")
  416. #define DATA_PROCESSING32_DNM(op,val) \
  417. _DATA_PROCESSING32_DNM(op,"",val) \
  418. _DATA_PROCESSING32_DNM(op,"s",val)
  419. #define DATA_PROCESSING32_NM(op,val) \
  420. TEST_RR(op".w r",1, VAL1,", r",2, val, "") \
  421. TEST_RR(op" r",1, VAL1,", r",2, val, ", lsl #3") \
  422. TEST_RR(op" r",3, VAL1,", r",2, val, ", lsr #4") \
  423. TEST_RR(op" r",3, VAL1,", r",2, val, ", asr #5") \
  424. TEST_RR(op" r",5, VAL1,", r",2, N(val),", asr #6") \
  425. TEST_RR(op" r",5, VAL1,", r",2, val, ", ror #7") \
  426. TEST_RR(op" r",9, VAL1,", r",10,val, ", rrx") \
  427. TEST_R( op" r",11,VAL1,", #0x00010001") \
  428. TEST_R( op" r",0, VAL1,", #0xf5000000") \
  429. TEST_R( op" r",8, VAL2,", #0x000af000")
  430. #define _DATA_PROCESSING32_DM(op,s,val) \
  431. TEST_R( op s".w r0, r",14, val, "") \
  432. TEST_R( op s" r1, r",12, val, ", lsl #3") \
  433. TEST_R( op s" r2, r",11, val, ", lsr #4") \
  434. TEST_R( op s" r3, r",10, val, ", asr #5") \
  435. TEST_R( op s" r4, r",9, N(val),", asr #6") \
  436. TEST_R( op s" r5, r",8, val, ", ror #7") \
  437. TEST_R( op s" r8, r",7,val, ", rrx") \
  438. TEST( op s" r0, #0x00010001") \
  439. TEST( op s" r11, #0xf5000000") \
  440. TEST( op s" r7, #0x000af000") \
  441. TEST( op s" r4, #0x00005a00")
  442. #define DATA_PROCESSING32_DM(op,val) \
  443. _DATA_PROCESSING32_DM(op,"",val) \
  444. _DATA_PROCESSING32_DM(op,"s",val)
  445. DATA_PROCESSING32_DNM("and",0xf00f00ff)
  446. DATA_PROCESSING32_NM("tst",0xf00f00ff)
  447. DATA_PROCESSING32_DNM("bic",0xf00f00ff)
  448. DATA_PROCESSING32_DNM("orr",0xf00f00ff)
  449. DATA_PROCESSING32_DM("mov",VAL2)
  450. DATA_PROCESSING32_DNM("orn",0xf00f00ff)
  451. DATA_PROCESSING32_DM("mvn",VAL2)
  452. DATA_PROCESSING32_DNM("eor",0xf00f00ff)
  453. DATA_PROCESSING32_NM("teq",0xf00f00ff)
  454. DATA_PROCESSING32_DNM("add",VAL2)
  455. DATA_PROCESSING32_NM("cmn",VAL2)
  456. DATA_PROCESSING32_DNM("adc",VAL2)
  457. DATA_PROCESSING32_DNM("sbc",VAL2)
  458. DATA_PROCESSING32_DNM("sub",VAL2)
  459. DATA_PROCESSING32_NM("cmp",VAL2)
  460. DATA_PROCESSING32_DNM("rsb",VAL2)
  461. TEST_RR("pkhbt r0, r",0, HH1,", r",1, HH2,"")
  462. TEST_RR("pkhbt r14,r",12, HH1,", r",10,HH2,", lsl #2")
  463. TEST_RR("pkhtb r0, r",0, HH1,", r",1, HH2,"")
  464. TEST_RR("pkhtb r14,r",12, HH1,", r",10,HH2,", asr #2")
  465. TEST_UNSUPPORTED(__inst_thumb32(0xea170f0d) " @ tst.w r7, sp")
  466. TEST_UNSUPPORTED(__inst_thumb32(0xea170f0f) " @ tst.w r7, pc")
  467. TEST_UNSUPPORTED(__inst_thumb32(0xea1d0f07) " @ tst.w sp, r7")
  468. TEST_UNSUPPORTED(__inst_thumb32(0xea1f0f07) " @ tst.w pc, r7")
  469. TEST_UNSUPPORTED(__inst_thumb32(0xf01d1f08) " @ tst sp, #0x00080008")
  470. TEST_UNSUPPORTED(__inst_thumb32(0xf01f1f08) " @ tst pc, #0x00080008")
  471. TEST_UNSUPPORTED(__inst_thumb32(0xea970f0d) " @ teq.w r7, sp")
  472. TEST_UNSUPPORTED(__inst_thumb32(0xea970f0f) " @ teq.w r7, pc")
  473. TEST_UNSUPPORTED(__inst_thumb32(0xea9d0f07) " @ teq.w sp, r7")
  474. TEST_UNSUPPORTED(__inst_thumb32(0xea9f0f07) " @ teq.w pc, r7")
  475. TEST_UNSUPPORTED(__inst_thumb32(0xf09d1f08) " @ tst sp, #0x00080008")
  476. TEST_UNSUPPORTED(__inst_thumb32(0xf09f1f08) " @ tst pc, #0x00080008")
  477. TEST_UNSUPPORTED(__inst_thumb32(0xeb170f0d) " @ cmn.w r7, sp")
  478. TEST_UNSUPPORTED(__inst_thumb32(0xeb170f0f) " @ cmn.w r7, pc")
  479. TEST_P("cmn.w sp, r",7,0,"")
  480. TEST_UNSUPPORTED(__inst_thumb32(0xeb1f0f07) " @ cmn.w pc, r7")
  481. TEST( "cmn sp, #0x00080008")
  482. TEST_UNSUPPORTED(__inst_thumb32(0xf11f1f08) " @ cmn pc, #0x00080008")
  483. TEST_UNSUPPORTED(__inst_thumb32(0xebb70f0d) " @ cmp.w r7, sp")
  484. TEST_UNSUPPORTED(__inst_thumb32(0xebb70f0f) " @ cmp.w r7, pc")
  485. TEST_P("cmp.w sp, r",7,0,"")
  486. TEST_UNSUPPORTED(__inst_thumb32(0xebbf0f07) " @ cmp.w pc, r7")
  487. TEST( "cmp sp, #0x00080008")
  488. TEST_UNSUPPORTED(__inst_thumb32(0xf1bf1f08) " @ cmp pc, #0x00080008")
  489. TEST_UNSUPPORTED(__inst_thumb32(0xea5f070d) " @ movs.w r7, sp")
  490. TEST_UNSUPPORTED(__inst_thumb32(0xea5f070f) " @ movs.w r7, pc")
  491. TEST_UNSUPPORTED(__inst_thumb32(0xea5f0d07) " @ movs.w sp, r7")
  492. TEST_UNSUPPORTED(__inst_thumb32(0xea4f0f07) " @ mov.w pc, r7")
  493. TEST_UNSUPPORTED(__inst_thumb32(0xf04f1d08) " @ mov sp, #0x00080008")
  494. TEST_UNSUPPORTED(__inst_thumb32(0xf04f1f08) " @ mov pc, #0x00080008")
  495. TEST_R("add.w r0, sp, r",1, 4,"")
  496. TEST_R("adds r0, sp, r",1, 4,", asl #3")
  497. TEST_R("add r0, sp, r",1, 4,", asl #4")
  498. TEST_R("add r0, sp, r",1, 16,", ror #1")
  499. TEST_R("add.w sp, sp, r",1, 4,"")
  500. TEST_R("add sp, sp, r",1, 4,", asl #3")
  501. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d1d01) " @ add sp, sp, r1, asl #4")
  502. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d0d71) " @ add sp, sp, r1, ror #1")
  503. TEST( "add.w r0, sp, #24")
  504. TEST( "add.w sp, sp, #24")
  505. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d0f01) " @ add pc, sp, r1")
  506. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d000f) " @ add r0, sp, pc")
  507. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d000d) " @ add r0, sp, sp")
  508. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d0d0f) " @ add sp, sp, pc")
  509. TEST_UNSUPPORTED(__inst_thumb32(0xeb0d0d0d) " @ add sp, sp, sp")
  510. TEST_R("sub.w r0, sp, r",1, 4,"")
  511. TEST_R("subs r0, sp, r",1, 4,", asl #3")
  512. TEST_R("sub r0, sp, r",1, 4,", asl #4")
  513. TEST_R("sub r0, sp, r",1, 16,", ror #1")
  514. TEST_R("sub.w sp, sp, r",1, 4,"")
  515. TEST_R("sub sp, sp, r",1, 4,", asl #3")
  516. TEST_UNSUPPORTED(__inst_thumb32(0xebad1d01) " @ sub sp, sp, r1, asl #4")
  517. TEST_UNSUPPORTED(__inst_thumb32(0xebad0d71) " @ sub sp, sp, r1, ror #1")
  518. TEST_UNSUPPORTED(__inst_thumb32(0xebad0f01) " @ sub pc, sp, r1")
  519. TEST( "sub.w r0, sp, #24")
  520. TEST( "sub.w sp, sp, #24")
  521. TEST_UNSUPPORTED(__inst_thumb32(0xea02010f) " @ and r1, r2, pc")
  522. TEST_UNSUPPORTED(__inst_thumb32(0xea0f0103) " @ and r1, pc, r3")
  523. TEST_UNSUPPORTED(__inst_thumb32(0xea020f03) " @ and pc, r2, r3")
  524. TEST_UNSUPPORTED(__inst_thumb32(0xea02010d) " @ and r1, r2, sp")
  525. TEST_UNSUPPORTED(__inst_thumb32(0xea0d0103) " @ and r1, sp, r3")
  526. TEST_UNSUPPORTED(__inst_thumb32(0xea020d03) " @ and sp, r2, r3")
  527. TEST_UNSUPPORTED(__inst_thumb32(0xf00d1108) " @ and r1, sp, #0x00080008")
  528. TEST_UNSUPPORTED(__inst_thumb32(0xf00f1108) " @ and r1, pc, #0x00080008")
  529. TEST_UNSUPPORTED(__inst_thumb32(0xf0021d08) " @ and sp, r8, #0x00080008")
  530. TEST_UNSUPPORTED(__inst_thumb32(0xf0021f08) " @ and pc, r8, #0x00080008")
  531. TEST_UNSUPPORTED(__inst_thumb32(0xeb02010f) " @ add r1, r2, pc")
  532. TEST_UNSUPPORTED(__inst_thumb32(0xeb0f0103) " @ add r1, pc, r3")
  533. TEST_UNSUPPORTED(__inst_thumb32(0xeb020f03) " @ add pc, r2, r3")
  534. TEST_UNSUPPORTED(__inst_thumb32(0xeb02010d) " @ add r1, r2, sp")
  535. TEST_SUPPORTED( __inst_thumb32(0xeb0d0103) " @ add r1, sp, r3")
  536. TEST_UNSUPPORTED(__inst_thumb32(0xeb020d03) " @ add sp, r2, r3")
  537. TEST_SUPPORTED( __inst_thumb32(0xf10d1108) " @ add r1, sp, #0x00080008")
  538. TEST_UNSUPPORTED(__inst_thumb32(0xf10d1f08) " @ add pc, sp, #0x00080008")
  539. TEST_UNSUPPORTED(__inst_thumb32(0xf10f1108) " @ add r1, pc, #0x00080008")
  540. TEST_UNSUPPORTED(__inst_thumb32(0xf1021d08) " @ add sp, r8, #0x00080008")
  541. TEST_UNSUPPORTED(__inst_thumb32(0xf1021f08) " @ add pc, r8, #0x00080008")
  542. TEST_UNSUPPORTED(__inst_thumb32(0xeaa00000) "")
  543. TEST_UNSUPPORTED(__inst_thumb32(0xeaf00000) "")
  544. TEST_UNSUPPORTED(__inst_thumb32(0xeb200000) "")
  545. TEST_UNSUPPORTED(__inst_thumb32(0xeb800000) "")
  546. TEST_UNSUPPORTED(__inst_thumb32(0xebe00000) "")
  547. TEST_UNSUPPORTED(__inst_thumb32(0xf0a00000) "")
  548. TEST_UNSUPPORTED(__inst_thumb32(0xf0c00000) "")
  549. TEST_UNSUPPORTED(__inst_thumb32(0xf0f00000) "")
  550. TEST_UNSUPPORTED(__inst_thumb32(0xf1200000) "")
  551. TEST_UNSUPPORTED(__inst_thumb32(0xf1800000) "")
  552. TEST_UNSUPPORTED(__inst_thumb32(0xf1e00000) "")
  553. TEST_GROUP("Coprocessor instructions")
  554. TEST_UNSUPPORTED(__inst_thumb32(0xec000000) "")
  555. TEST_UNSUPPORTED(__inst_thumb32(0xeff00000) "")
  556. TEST_UNSUPPORTED(__inst_thumb32(0xfc000000) "")
  557. TEST_UNSUPPORTED(__inst_thumb32(0xfff00000) "")
  558. TEST_GROUP("Data-processing (plain binary immediate)")
  559. TEST_R("addw r0, r",1, VAL1,", #0x123")
  560. TEST( "addw r14, sp, #0xf5a")
  561. TEST( "addw sp, sp, #0x20")
  562. TEST( "addw r7, pc, #0x888")
  563. TEST_UNSUPPORTED(__inst_thumb32(0xf20f1f20) " @ addw pc, pc, #0x120")
  564. TEST_UNSUPPORTED(__inst_thumb32(0xf20d1f20) " @ addw pc, sp, #0x120")
  565. TEST_UNSUPPORTED(__inst_thumb32(0xf20f1d20) " @ addw sp, pc, #0x120")
  566. TEST_UNSUPPORTED(__inst_thumb32(0xf2001d20) " @ addw sp, r0, #0x120")
  567. TEST_R("subw r0, r",1, VAL1,", #0x123")
  568. TEST( "subw r14, sp, #0xf5a")
  569. TEST( "subw sp, sp, #0x20")
  570. TEST( "subw r7, pc, #0x888")
  571. TEST_UNSUPPORTED(__inst_thumb32(0xf2af1f20) " @ subw pc, pc, #0x120")
  572. TEST_UNSUPPORTED(__inst_thumb32(0xf2ad1f20) " @ subw pc, sp, #0x120")
  573. TEST_UNSUPPORTED(__inst_thumb32(0xf2af1d20) " @ subw sp, pc, #0x120")
  574. TEST_UNSUPPORTED(__inst_thumb32(0xf2a01d20) " @ subw sp, r0, #0x120")
  575. TEST("movw r0, #0")
  576. TEST("movw r0, #0xffff")
  577. TEST("movw lr, #0xffff")
  578. TEST_UNSUPPORTED(__inst_thumb32(0xf2400d00) " @ movw sp, #0")
  579. TEST_UNSUPPORTED(__inst_thumb32(0xf2400f00) " @ movw pc, #0")
  580. TEST_R("movt r",0, VAL1,", #0")
  581. TEST_R("movt r",0, VAL2,", #0xffff")
  582. TEST_R("movt r",14,VAL1,", #0xffff")
  583. TEST_UNSUPPORTED(__inst_thumb32(0xf2c00d00) " @ movt sp, #0")
  584. TEST_UNSUPPORTED(__inst_thumb32(0xf2c00f00) " @ movt pc, #0")
  585. TEST_R( "ssat r0, #24, r",0, VAL1,"")
  586. TEST_R( "ssat r14, #24, r",12, VAL2,"")
  587. TEST_R( "ssat r0, #24, r",0, VAL1,", lsl #8")
  588. TEST_R( "ssat r14, #24, r",12, VAL2,", asr #8")
  589. TEST_UNSUPPORTED(__inst_thumb32(0xf30c0d17) " @ ssat sp, #24, r12")
  590. TEST_UNSUPPORTED(__inst_thumb32(0xf30c0f17) " @ ssat pc, #24, r12")
  591. TEST_UNSUPPORTED(__inst_thumb32(0xf30d0c17) " @ ssat r12, #24, sp")
  592. TEST_UNSUPPORTED(__inst_thumb32(0xf30f0c17) " @ ssat r12, #24, pc")
  593. TEST_R( "usat r0, #24, r",0, VAL1,"")
  594. TEST_R( "usat r14, #24, r",12, VAL2,"")
  595. TEST_R( "usat r0, #24, r",0, VAL1,", lsl #8")
  596. TEST_R( "usat r14, #24, r",12, VAL2,", asr #8")
  597. TEST_UNSUPPORTED(__inst_thumb32(0xf38c0d17) " @ usat sp, #24, r12")
  598. TEST_UNSUPPORTED(__inst_thumb32(0xf38c0f17) " @ usat pc, #24, r12")
  599. TEST_UNSUPPORTED(__inst_thumb32(0xf38d0c17) " @ usat r12, #24, sp")
  600. TEST_UNSUPPORTED(__inst_thumb32(0xf38f0c17) " @ usat r12, #24, pc")
  601. TEST_R( "ssat16 r0, #12, r",0, HH1,"")
  602. TEST_R( "ssat16 r14, #12, r",12, HH2,"")
  603. TEST_UNSUPPORTED(__inst_thumb32(0xf32c0d0b) " @ ssat16 sp, #12, r12")
  604. TEST_UNSUPPORTED(__inst_thumb32(0xf32c0f0b) " @ ssat16 pc, #12, r12")
  605. TEST_UNSUPPORTED(__inst_thumb32(0xf32d0c0b) " @ ssat16 r12, #12, sp")
  606. TEST_UNSUPPORTED(__inst_thumb32(0xf32f0c0b) " @ ssat16 r12, #12, pc")
  607. TEST_R( "usat16 r0, #12, r",0, HH1,"")
  608. TEST_R( "usat16 r14, #12, r",12, HH2,"")
  609. TEST_UNSUPPORTED(__inst_thumb32(0xf3ac0d0b) " @ usat16 sp, #12, r12")
  610. TEST_UNSUPPORTED(__inst_thumb32(0xf3ac0f0b) " @ usat16 pc, #12, r12")
  611. TEST_UNSUPPORTED(__inst_thumb32(0xf3ad0c0b) " @ usat16 r12, #12, sp")
  612. TEST_UNSUPPORTED(__inst_thumb32(0xf3af0c0b) " @ usat16 r12, #12, pc")
  613. TEST_R( "sbfx r0, r",0 , VAL1,", #0, #31")
  614. TEST_R( "sbfx r14, r",12, VAL2,", #8, #16")
  615. TEST_R( "sbfx r4, r",10, VAL1,", #16, #15")
  616. TEST_UNSUPPORTED(__inst_thumb32(0xf34c2d0f) " @ sbfx sp, r12, #8, #16")
  617. TEST_UNSUPPORTED(__inst_thumb32(0xf34c2f0f) " @ sbfx pc, r12, #8, #16")
  618. TEST_UNSUPPORTED(__inst_thumb32(0xf34d2c0f) " @ sbfx r12, sp, #8, #16")
  619. TEST_UNSUPPORTED(__inst_thumb32(0xf34f2c0f) " @ sbfx r12, pc, #8, #16")
  620. TEST_R( "ubfx r0, r",0 , VAL1,", #0, #31")
  621. TEST_R( "ubfx r14, r",12, VAL2,", #8, #16")
  622. TEST_R( "ubfx r4, r",10, VAL1,", #16, #15")
  623. TEST_UNSUPPORTED(__inst_thumb32(0xf3cc2d0f) " @ ubfx sp, r12, #8, #16")
  624. TEST_UNSUPPORTED(__inst_thumb32(0xf3cc2f0f) " @ ubfx pc, r12, #8, #16")
  625. TEST_UNSUPPORTED(__inst_thumb32(0xf3cd2c0f) " @ ubfx r12, sp, #8, #16")
  626. TEST_UNSUPPORTED(__inst_thumb32(0xf3cf2c0f) " @ ubfx r12, pc, #8, #16")
  627. TEST_R( "bfc r",0, VAL1,", #4, #20")
  628. TEST_R( "bfc r",14,VAL2,", #4, #20")
  629. TEST_R( "bfc r",7, VAL1,", #0, #31")
  630. TEST_R( "bfc r",8, VAL2,", #0, #31")
  631. TEST_UNSUPPORTED(__inst_thumb32(0xf36f0d1e) " @ bfc sp, #0, #31")
  632. TEST_UNSUPPORTED(__inst_thumb32(0xf36f0f1e) " @ bfc pc, #0, #31")
  633. TEST_RR( "bfi r",0, VAL1,", r",0 , VAL2,", #0, #31")
  634. TEST_RR( "bfi r",12,VAL1,", r",14 , VAL2,", #4, #20")
  635. TEST_UNSUPPORTED(__inst_thumb32(0xf36e1d17) " @ bfi sp, r14, #4, #20")
  636. TEST_UNSUPPORTED(__inst_thumb32(0xf36e1f17) " @ bfi pc, r14, #4, #20")
  637. TEST_UNSUPPORTED(__inst_thumb32(0xf36d1e17) " @ bfi r14, sp, #4, #20")
  638. TEST_GROUP("Branches and miscellaneous control")
  639. CONDITION_INSTRUCTIONS(22,
  640. TEST_BF("beq.w 2f")
  641. TEST_BB("bne.w 2b")
  642. TEST_BF("bgt.w 2f")
  643. TEST_BB("blt.w 2b")
  644. TEST_BF_X("bpl.w 2f", SPACE_0x1000)
  645. )
  646. TEST_UNSUPPORTED("msr cpsr, r0")
  647. TEST_UNSUPPORTED("msr cpsr_f, r1")
  648. TEST_UNSUPPORTED("msr spsr, r2")
  649. TEST_UNSUPPORTED("cpsie.w i")
  650. TEST_UNSUPPORTED("cpsid.w i")
  651. TEST_UNSUPPORTED("cps 0x13")
  652. TEST_SUPPORTED("yield.w")
  653. TEST("sev.w")
  654. TEST("nop.w")
  655. TEST("wfi.w")
  656. TEST_SUPPORTED("wfe.w")
  657. TEST_UNSUPPORTED("dbg.w #0")
  658. TEST_UNSUPPORTED("clrex")
  659. TEST_UNSUPPORTED("dsb")
  660. TEST_UNSUPPORTED("dmb")
  661. TEST_UNSUPPORTED("isb")
  662. TEST_UNSUPPORTED("bxj r0")
  663. TEST_UNSUPPORTED("subs pc, lr, #4")
  664. TEST_RMASKED("mrs r",0,~PSR_IGNORE_BITS,", cpsr")
  665. TEST_RMASKED("mrs r",14,~PSR_IGNORE_BITS,", cpsr")
  666. TEST_UNSUPPORTED(__inst_thumb32(0xf3ef8d00) " @ mrs sp, spsr")
  667. TEST_UNSUPPORTED(__inst_thumb32(0xf3ef8f00) " @ mrs pc, spsr")
  668. TEST_UNSUPPORTED("mrs r0, spsr")
  669. TEST_UNSUPPORTED("mrs lr, spsr")
  670. TEST_UNSUPPORTED(__inst_thumb32(0xf7f08000) " @ smc #0")
  671. TEST_UNSUPPORTED(__inst_thumb32(0xf7f0a000) " @ undefeined")
  672. TEST_BF( "b.w 2f")
  673. TEST_BB( "b.w 2b")
  674. TEST_BF_X("b.w 2f", SPACE_0x1000)
  675. TEST_BF( "bl.w 2f")
  676. TEST_BB( "bl.w 2b")
  677. TEST_BB_X("bl.w 2b", SPACE_0x1000)
  678. TEST_X( "blx __dummy_arm_subroutine",
  679. ".arm \n\t"
  680. ".align \n\t"
  681. ".type __dummy_arm_subroutine, %%function \n\t"
  682. "__dummy_arm_subroutine: \n\t"
  683. "mov r0, pc \n\t"
  684. "bx lr \n\t"
  685. ".thumb \n\t"
  686. )
  687. TEST( "blx __dummy_arm_subroutine")
  688. TEST_GROUP("Store single data item")
  689. #define SINGLE_STORE(size) \
  690. TEST_RP( "str"size" r",0, VAL1,", [r",11,-1024,", #1024]") \
  691. TEST_RP( "str"size" r",14,VAL2,", [r",1, -1024,", #1080]") \
  692. TEST_RP( "str"size" r",0, VAL1,", [r",11,256, ", #-120]") \
  693. TEST_RP( "str"size" r",14,VAL2,", [r",1, 256, ", #-128]") \
  694. TEST_RP( "str"size" r",0, VAL1,", [r",11,24, "], #120") \
  695. TEST_RP( "str"size" r",14,VAL2,", [r",1, 24, "], #128") \
  696. TEST_RP( "str"size" r",0, VAL1,", [r",11,24, "], #-120") \
  697. TEST_RP( "str"size" r",14,VAL2,", [r",1, 24, "], #-128") \
  698. TEST_RP( "str"size" r",0, VAL1,", [r",11,24, ", #120]!") \
  699. TEST_RP( "str"size" r",14,VAL2,", [r",1, 24, ", #128]!") \
  700. TEST_RP( "str"size" r",0, VAL1,", [r",11,256, ", #-120]!") \
  701. TEST_RP( "str"size" r",14,VAL2,", [r",1, 256, ", #-128]!") \
  702. TEST_RPR("str"size".w r",0, VAL1,", [r",1, 0,", r",2, 4,"]") \
  703. TEST_RPR("str"size" r",14,VAL2,", [r",10,0,", r",11,4,", lsl #1]") \
  704. TEST_UNSUPPORTED("str"size" r0, [r13, r1]") \
  705. TEST_R( "str"size".w r",7, VAL1,", [sp, #24]") \
  706. TEST_RP( "str"size".w r",0, VAL2,", [r",0,0, "]") \
  707. TEST_RP( "str"size" r",6, VAL1,", [r",13, TEST_MEMORY_SIZE,", #-"__stringify(MAX_STACK_SIZE)"]!") \
  708. TEST_UNSUPPORTED("str"size" r6, [r13, #-"__stringify(MAX_STACK_SIZE)"-8]!") \
  709. TEST_RP( "str"size" r",4, VAL2,", [r",12, TEST_MEMORY_SIZE,", #-"__stringify(MAX_STACK_SIZE)"-8]!") \
  710. TEST_UNSUPPORTED("str"size"t r0, [r1, #4]")
  711. SINGLE_STORE("b")
  712. SINGLE_STORE("h")
  713. SINGLE_STORE("")
  714. TEST_UNSUPPORTED(__inst_thumb32(0xf801000d) " @ strb r0, [r1, r13]")
  715. TEST_UNSUPPORTED(__inst_thumb32(0xf821000d) " @ strh r0, [r1, r13]")
  716. TEST_UNSUPPORTED(__inst_thumb32(0xf841000d) " @ str r0, [r1, r13]")
  717. TEST("str sp, [sp]")
  718. TEST_UNSUPPORTED(__inst_thumb32(0xf8cfe000) " @ str r14, [pc]")
  719. TEST_UNSUPPORTED(__inst_thumb32(0xf8cef000) " @ str pc, [r14]")
  720. TEST_GROUP("Advanced SIMD element or structure load/store instructions")
  721. TEST_UNSUPPORTED(__inst_thumb32(0xf9000000) "")
  722. TEST_UNSUPPORTED(__inst_thumb32(0xf92fffff) "")
  723. TEST_UNSUPPORTED(__inst_thumb32(0xf9800000) "")
  724. TEST_UNSUPPORTED(__inst_thumb32(0xf9efffff) "")
  725. TEST_GROUP("Load single data item and memory hints")
  726. #define SINGLE_LOAD(size) \
  727. TEST_P( "ldr"size" r0, [r",11,-1024, ", #1024]") \
  728. TEST_P( "ldr"size" r14, [r",1, -1024,", #1080]") \
  729. TEST_P( "ldr"size" r0, [r",11,256, ", #-120]") \
  730. TEST_P( "ldr"size" r14, [r",1, 256, ", #-128]") \
  731. TEST_P( "ldr"size" r0, [r",11,24, "], #120") \
  732. TEST_P( "ldr"size" r14, [r",1, 24, "], #128") \
  733. TEST_P( "ldr"size" r0, [r",11,24, "], #-120") \
  734. TEST_P( "ldr"size" r14, [r",1,24, "], #-128") \
  735. TEST_P( "ldr"size" r0, [r",11,24, ", #120]!") \
  736. TEST_P( "ldr"size" r14, [r",1, 24, ", #128]!") \
  737. TEST_P( "ldr"size" r0, [r",11,256, ", #-120]!") \
  738. TEST_P( "ldr"size" r14, [r",1, 256, ", #-128]!") \
  739. TEST_PR("ldr"size".w r0, [r",1, 0,", r",2, 4,"]") \
  740. TEST_PR("ldr"size" r14, [r",10,0,", r",11,4,", lsl #1]") \
  741. TEST_X( "ldr"size".w r0, 3f", \
  742. ".align 3 \n\t" \
  743. "3: .word "__stringify(VAL1)) \
  744. TEST_X( "ldr"size".w r14, 3f", \
  745. ".align 3 \n\t" \
  746. "3: .word "__stringify(VAL2)) \
  747. TEST( "ldr"size".w r7, 3b") \
  748. TEST( "ldr"size".w r7, [sp, #24]") \
  749. TEST_P( "ldr"size".w r0, [r",0,0, "]") \
  750. TEST_UNSUPPORTED("ldr"size"t r0, [r1, #4]")
  751. SINGLE_LOAD("b")
  752. SINGLE_LOAD("sb")
  753. SINGLE_LOAD("h")
  754. SINGLE_LOAD("sh")
  755. SINGLE_LOAD("")
  756. TEST_BF_P("ldr pc, [r",14, 15*4,"]")
  757. TEST_P( "ldr sp, [r",14, 13*4,"]")
  758. TEST_BF_R("ldr pc, [sp, r",14, 15*4,"]")
  759. TEST_R( "ldr sp, [sp, r",14, 13*4,"]")
  760. TEST_THUMB_TO_ARM_INTERWORK_P("ldr pc, [r",0,0,", #15*4]")
  761. TEST_SUPPORTED("ldr sp, 99f")
  762. TEST_SUPPORTED("ldr pc, 99f")
  763. TEST_UNSUPPORTED(__inst_thumb32(0xf854700d) " @ ldr r7, [r4, sp]")
  764. TEST_UNSUPPORTED(__inst_thumb32(0xf854700f) " @ ldr r7, [r4, pc]")
  765. TEST_UNSUPPORTED(__inst_thumb32(0xf814700d) " @ ldrb r7, [r4, sp]")
  766. TEST_UNSUPPORTED(__inst_thumb32(0xf814700f) " @ ldrb r7, [r4, pc]")
  767. TEST_UNSUPPORTED(__inst_thumb32(0xf89fd004) " @ ldrb sp, 99f")
  768. TEST_UNSUPPORTED(__inst_thumb32(0xf814d008) " @ ldrb sp, [r4, r8]")
  769. TEST_UNSUPPORTED(__inst_thumb32(0xf894d000) " @ ldrb sp, [r4]")
  770. TEST_UNSUPPORTED(__inst_thumb32(0xf8600000) "") /* Unallocated space */
  771. TEST_UNSUPPORTED(__inst_thumb32(0xf9ffffff) "") /* Unallocated space */
  772. TEST_UNSUPPORTED(__inst_thumb32(0xf9500000) "") /* Unallocated space */
  773. TEST_UNSUPPORTED(__inst_thumb32(0xf95fffff) "") /* Unallocated space */
  774. TEST_UNSUPPORTED(__inst_thumb32(0xf8000800) "") /* Unallocated space */
  775. TEST_UNSUPPORTED(__inst_thumb32(0xf97ffaff) "") /* Unallocated space */
  776. TEST( "pli [pc, #4]")
  777. TEST( "pli [pc, #-4]")
  778. TEST( "pld [pc, #4]")
  779. TEST( "pld [pc, #-4]")
  780. TEST_P( "pld [r",0,-1024,", #1024]")
  781. TEST( __inst_thumb32(0xf8b0f400) " @ pldw [r0, #1024]")
  782. TEST_P( "pli [r",4, 0b,", #1024]")
  783. TEST_P( "pld [r",7, 120,", #-120]")
  784. TEST( __inst_thumb32(0xf837fc78) " @ pldw [r7, #-120]")
  785. TEST_P( "pli [r",11,120,", #-120]")
  786. TEST( "pld [sp, #0]")
  787. TEST_PR("pld [r",7, 24, ", r",0, 16,"]")
  788. TEST_PR("pld [r",8, 24, ", r",12,16,", lsl #3]")
  789. TEST_SUPPORTED(__inst_thumb32(0xf837f000) " @ pldw [r7, r0]")
  790. TEST_SUPPORTED(__inst_thumb32(0xf838f03c) " @ pldw [r8, r12, lsl #3]");
  791. TEST_RR("pli [r",12,0b,", r",0, 16,"]")
  792. TEST_RR("pli [r",0, 0b,", r",12,16,", lsl #3]")
  793. TEST_R( "pld [sp, r",1, 16,"]")
  794. TEST_UNSUPPORTED(__inst_thumb32(0xf817f00d) " @pld [r7, sp]")
  795. TEST_UNSUPPORTED(__inst_thumb32(0xf817f00f) " @pld [r7, pc]")
  796. TEST_GROUP("Data-processing (register)")
  797. #define SHIFTS32(op) \
  798. TEST_RR(op" r0, r",1, VAL1,", r",2, 3, "") \
  799. TEST_RR(op" r14, r",12,VAL2,", r",11,10,"")
  800. SHIFTS32("lsl")
  801. SHIFTS32("lsls")
  802. SHIFTS32("lsr")
  803. SHIFTS32("lsrs")
  804. SHIFTS32("asr")
  805. SHIFTS32("asrs")
  806. SHIFTS32("ror")
  807. SHIFTS32("rors")
  808. TEST_UNSUPPORTED(__inst_thumb32(0xfa01ff02) " @ lsl pc, r1, r2")
  809. TEST_UNSUPPORTED(__inst_thumb32(0xfa01fd02) " @ lsl sp, r1, r2")
  810. TEST_UNSUPPORTED(__inst_thumb32(0xfa0ff002) " @ lsl r0, pc, r2")
  811. TEST_UNSUPPORTED(__inst_thumb32(0xfa0df002) " @ lsl r0, sp, r2")
  812. TEST_UNSUPPORTED(__inst_thumb32(0xfa01f00f) " @ lsl r0, r1, pc")
  813. TEST_UNSUPPORTED(__inst_thumb32(0xfa01f00d) " @ lsl r0, r1, sp")
  814. TEST_RR( "sxtah r0, r",0, HH1,", r",1, HH2,"")
  815. TEST_RR( "sxtah r14,r",12, HH2,", r",10,HH1,", ror #8")
  816. TEST_R( "sxth r8, r",7, HH1,"")
  817. TEST_UNSUPPORTED(__inst_thumb32(0xfa0fff87) " @ sxth pc, r7");
  818. TEST_UNSUPPORTED(__inst_thumb32(0xfa0ffd87) " @ sxth sp, r7");
  819. TEST_UNSUPPORTED(__inst_thumb32(0xfa0ff88f) " @ sxth r8, pc");
  820. TEST_UNSUPPORTED(__inst_thumb32(0xfa0ff88d) " @ sxth r8, sp");
  821. TEST_RR( "uxtah r0, r",0, HH1,", r",1, HH2,"")
  822. TEST_RR( "uxtah r14,r",12, HH2,", r",10,HH1,", ror #8")
  823. TEST_R( "uxth r8, r",7, HH1,"")
  824. TEST_RR( "sxtab16 r0, r",0, HH1,", r",1, HH2,"")
  825. TEST_RR( "sxtab16 r14,r",12, HH2,", r",10,HH1,", ror #8")
  826. TEST_R( "sxtb16 r8, r",7, HH1,"")
  827. TEST_RR( "uxtab16 r0, r",0, HH1,", r",1, HH2,"")
  828. TEST_RR( "uxtab16 r14,r",12, HH2,", r",10,HH1,", ror #8")
  829. TEST_R( "uxtb16 r8, r",7, HH1,"")
  830. TEST_RR( "sxtab r0, r",0, HH1,", r",1, HH2,"")
  831. TEST_RR( "sxtab r14,r",12, HH2,", r",10,HH1,", ror #8")
  832. TEST_R( "sxtb r8, r",7, HH1,"")
  833. TEST_RR( "uxtab r0, r",0, HH1,", r",1, HH2,"")
  834. TEST_RR( "uxtab r14,r",12, HH2,", r",10,HH1,", ror #8")
  835. TEST_R( "uxtb r8, r",7, HH1,"")
  836. TEST_UNSUPPORTED(__inst_thumb32(0xfa6000f0) "")
  837. TEST_UNSUPPORTED(__inst_thumb32(0xfa7fffff) "")
  838. #define PARALLEL_ADD_SUB(op) \
  839. TEST_RR( op"add16 r0, r",0, HH1,", r",1, HH2,"") \
  840. TEST_RR( op"add16 r14, r",12,HH2,", r",10,HH1,"") \
  841. TEST_RR( op"asx r0, r",0, HH1,", r",1, HH2,"") \
  842. TEST_RR( op"asx r14, r",12,HH2,", r",10,HH1,"") \
  843. TEST_RR( op"sax r0, r",0, HH1,", r",1, HH2,"") \
  844. TEST_RR( op"sax r14, r",12,HH2,", r",10,HH1,"") \
  845. TEST_RR( op"sub16 r0, r",0, HH1,", r",1, HH2,"") \
  846. TEST_RR( op"sub16 r14, r",12,HH2,", r",10,HH1,"") \
  847. TEST_RR( op"add8 r0, r",0, HH1,", r",1, HH2,"") \
  848. TEST_RR( op"add8 r14, r",12,HH2,", r",10,HH1,"") \
  849. TEST_RR( op"sub8 r0, r",0, HH1,", r",1, HH2,"") \
  850. TEST_RR( op"sub8 r14, r",12,HH2,", r",10,HH1,"")
  851. TEST_GROUP("Parallel addition and subtraction, signed")
  852. PARALLEL_ADD_SUB("s")
  853. PARALLEL_ADD_SUB("q")
  854. PARALLEL_ADD_SUB("sh")
  855. TEST_GROUP("Parallel addition and subtraction, unsigned")
  856. PARALLEL_ADD_SUB("u")
  857. PARALLEL_ADD_SUB("uq")
  858. PARALLEL_ADD_SUB("uh")
  859. TEST_GROUP("Miscellaneous operations")
  860. TEST_RR("qadd r0, r",1, VAL1,", r",2, VAL2,"")
  861. TEST_RR("qadd lr, r",9, VAL2,", r",8, VAL1,"")
  862. TEST_RR("qsub r0, r",1, VAL1,", r",2, VAL2,"")
  863. TEST_RR("qsub lr, r",9, VAL2,", r",8, VAL1,"")
  864. TEST_RR("qdadd r0, r",1, VAL1,", r",2, VAL2,"")
  865. TEST_RR("qdadd lr, r",9, VAL2,", r",8, VAL1,"")
  866. TEST_RR("qdsub r0, r",1, VAL1,", r",2, VAL2,"")
  867. TEST_RR("qdsub lr, r",9, VAL2,", r",8, VAL1,"")
  868. TEST_R("rev.w r0, r",0, VAL1,"")
  869. TEST_R("rev r14, r",12, VAL2,"")
  870. TEST_R("rev16.w r0, r",0, VAL1,"")
  871. TEST_R("rev16 r14, r",12, VAL2,"")
  872. TEST_R("rbit r0, r",0, VAL1,"")
  873. TEST_R("rbit r14, r",12, VAL2,"")
  874. TEST_R("revsh.w r0, r",0, VAL1,"")
  875. TEST_R("revsh r14, r",12, VAL2,"")
  876. TEST_UNSUPPORTED(__inst_thumb32(0xfa9cff8c) " @ rev pc, r12");
  877. TEST_UNSUPPORTED(__inst_thumb32(0xfa9cfd8c) " @ rev sp, r12");
  878. TEST_UNSUPPORTED(__inst_thumb32(0xfa9ffe8f) " @ rev r14, pc");
  879. TEST_UNSUPPORTED(__inst_thumb32(0xfa9dfe8d) " @ rev r14, sp");
  880. TEST_RR("sel r0, r",0, VAL1,", r",1, VAL2,"")
  881. TEST_RR("sel r14, r",12,VAL1,", r",10, VAL2,"")
  882. TEST_R("clz r0, r",0, 0x0,"")
  883. TEST_R("clz r7, r",14,0x1,"")
  884. TEST_R("clz lr, r",7, 0xffffffff,"")
  885. TEST_UNSUPPORTED(__inst_thumb32(0xfa80f030) "") /* Unallocated space */
  886. TEST_UNSUPPORTED(__inst_thumb32(0xfaffff7f) "") /* Unallocated space */
  887. TEST_UNSUPPORTED(__inst_thumb32(0xfab0f000) "") /* Unallocated space */
  888. TEST_UNSUPPORTED(__inst_thumb32(0xfaffff7f) "") /* Unallocated space */
  889. TEST_GROUP("Multiply, multiply accumulate, and absolute difference operations")
  890. TEST_RR( "mul r0, r",1, VAL1,", r",2, VAL2,"")
  891. TEST_RR( "mul r7, r",8, VAL2,", r",9, VAL2,"")
  892. TEST_UNSUPPORTED(__inst_thumb32(0xfb08ff09) " @ mul pc, r8, r9")
  893. TEST_UNSUPPORTED(__inst_thumb32(0xfb08fd09) " @ mul sp, r8, r9")
  894. TEST_UNSUPPORTED(__inst_thumb32(0xfb0ff709) " @ mul r7, pc, r9")
  895. TEST_UNSUPPORTED(__inst_thumb32(0xfb0df709) " @ mul r7, sp, r9")
  896. TEST_UNSUPPORTED(__inst_thumb32(0xfb08f70f) " @ mul r7, r8, pc")
  897. TEST_UNSUPPORTED(__inst_thumb32(0xfb08f70d) " @ mul r7, r8, sp")
  898. TEST_RRR( "mla r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  899. TEST_RRR( "mla r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  900. TEST_UNSUPPORTED(__inst_thumb32(0xfb08af09) " @ mla pc, r8, r9, r10");
  901. TEST_UNSUPPORTED(__inst_thumb32(0xfb08ad09) " @ mla sp, r8, r9, r10");
  902. TEST_UNSUPPORTED(__inst_thumb32(0xfb0fa709) " @ mla r7, pc, r9, r10");
  903. TEST_UNSUPPORTED(__inst_thumb32(0xfb0da709) " @ mla r7, sp, r9, r10");
  904. TEST_UNSUPPORTED(__inst_thumb32(0xfb08a70f) " @ mla r7, r8, pc, r10");
  905. TEST_UNSUPPORTED(__inst_thumb32(0xfb08a70d) " @ mla r7, r8, sp, r10");
  906. TEST_UNSUPPORTED(__inst_thumb32(0xfb08d709) " @ mla r7, r8, r9, sp");
  907. TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  908. TEST_RRR( "mls r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  909. TEST_RRR( "smlabb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  910. TEST_RRR( "smlabb r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  911. TEST_RRR( "smlatb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  912. TEST_RRR( "smlatb r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  913. TEST_RRR( "smlabt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  914. TEST_RRR( "smlabt r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  915. TEST_RRR( "smlatt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  916. TEST_RRR( "smlatt r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  917. TEST_RR( "smulbb r0, r",1, VAL1,", r",2, VAL2,"")
  918. TEST_RR( "smulbb r7, r",8, VAL3,", r",9, VAL1,"")
  919. TEST_RR( "smultb r0, r",1, VAL1,", r",2, VAL2,"")
  920. TEST_RR( "smultb r7, r",8, VAL3,", r",9, VAL1,"")
  921. TEST_RR( "smulbt r0, r",1, VAL1,", r",2, VAL2,"")
  922. TEST_RR( "smulbt r7, r",8, VAL3,", r",9, VAL1,"")
  923. TEST_RR( "smultt r0, r",1, VAL1,", r",2, VAL2,"")
  924. TEST_RR( "smultt r7, r",8, VAL3,", r",9, VAL1,"")
  925. TEST_RRR( "smlad r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
  926. TEST_RRR( "smlad r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
  927. TEST_RRR( "smladx r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
  928. TEST_RRR( "smladx r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
  929. TEST_RR( "smuad r0, r",0, HH1,", r",1, HH2,"")
  930. TEST_RR( "smuad r14, r",12,HH2,", r",10,HH1,"")
  931. TEST_RR( "smuadx r0, r",0, HH1,", r",1, HH2,"")
  932. TEST_RR( "smuadx r14, r",12,HH2,", r",10,HH1,"")
  933. TEST_RRR( "smlawb r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  934. TEST_RRR( "smlawb r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  935. TEST_RRR( "smlawt r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"")
  936. TEST_RRR( "smlawt r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
  937. TEST_RR( "smulwb r0, r",1, VAL1,", r",2, VAL2,"")
  938. TEST_RR( "smulwb r7, r",8, VAL3,", r",9, VAL1,"")
  939. TEST_RR( "smulwt r0, r",1, VAL1,", r",2, VAL2,"")
  940. TEST_RR( "smulwt r7, r",8, VAL3,", r",9, VAL1,"")
  941. TEST_RRR( "smlsd r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
  942. TEST_RRR( "smlsd r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
  943. TEST_RRR( "smlsdx r0, r",0, HH1,", r",1, HH2,", r",2, VAL1,"")
  944. TEST_RRR( "smlsdx r14, r",12,HH2,", r",10,HH1,", r",8, VAL2,"")
  945. TEST_RR( "smusd r0, r",0, HH1,", r",1, HH2,"")
  946. TEST_RR( "smusd r14, r",12,HH2,", r",10,HH1,"")
  947. TEST_RR( "smusdx r0, r",0, HH1,", r",1, HH2,"")
  948. TEST_RR( "smusdx r14, r",12,HH2,", r",10,HH1,"")
  949. TEST_RRR( "smmla r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
  950. TEST_RRR( "smmla r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
  951. TEST_RRR( "smmlar r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
  952. TEST_RRR( "smmlar r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
  953. TEST_RR( "smmul r0, r",0, VAL1,", r",1, VAL2,"")
  954. TEST_RR( "smmul r14, r",12,VAL2,", r",10,VAL1,"")
  955. TEST_RR( "smmulr r0, r",0, VAL1,", r",1, VAL2,"")
  956. TEST_RR( "smmulr r14, r",12,VAL2,", r",10,VAL1,"")
  957. TEST_RRR( "smmls r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
  958. TEST_RRR( "smmls r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
  959. TEST_RRR( "smmlsr r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL1,"")
  960. TEST_RRR( "smmlsr r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL2,"")
  961. TEST_RRR( "usada8 r0, r",0, VAL1,", r",1, VAL2,", r",2, VAL3,"")
  962. TEST_RRR( "usada8 r14, r",12,VAL2,", r",10,VAL1,", r",8, VAL3,"")
  963. TEST_RR( "usad8 r0, r",0, VAL1,", r",1, VAL2,"")
  964. TEST_RR( "usad8 r14, r",12,VAL2,", r",10,VAL1,"")
  965. TEST_UNSUPPORTED(__inst_thumb32(0xfb00f010) "") /* Unallocated space */
  966. TEST_UNSUPPORTED(__inst_thumb32(0xfb0fff1f) "") /* Unallocated space */
  967. TEST_UNSUPPORTED(__inst_thumb32(0xfb70f010) "") /* Unallocated space */
  968. TEST_UNSUPPORTED(__inst_thumb32(0xfb7fff1f) "") /* Unallocated space */
  969. TEST_UNSUPPORTED(__inst_thumb32(0xfb700010) "") /* Unallocated space */
  970. TEST_UNSUPPORTED(__inst_thumb32(0xfb7fff1f) "") /* Unallocated space */
  971. TEST_GROUP("Long multiply, long multiply accumulate, and divide")
  972. TEST_RR( "smull r0, r1, r",2, VAL1,", r",3, VAL2,"")
  973. TEST_RR( "smull r7, r8, r",9, VAL2,", r",10, VAL1,"")
  974. TEST_UNSUPPORTED(__inst_thumb32(0xfb89f80a) " @ smull pc, r8, r9, r10");
  975. TEST_UNSUPPORTED(__inst_thumb32(0xfb89d80a) " @ smull sp, r8, r9, r10");
  976. TEST_UNSUPPORTED(__inst_thumb32(0xfb897f0a) " @ smull r7, pc, r9, r10");
  977. TEST_UNSUPPORTED(__inst_thumb32(0xfb897d0a) " @ smull r7, sp, r9, r10");
  978. TEST_UNSUPPORTED(__inst_thumb32(0xfb8f780a) " @ smull r7, r8, pc, r10");
  979. TEST_UNSUPPORTED(__inst_thumb32(0xfb8d780a) " @ smull r7, r8, sp, r10");
  980. TEST_UNSUPPORTED(__inst_thumb32(0xfb89780f) " @ smull r7, r8, r9, pc");
  981. TEST_UNSUPPORTED(__inst_thumb32(0xfb89780d) " @ smull r7, r8, r9, sp");
  982. TEST_RR( "umull r0, r1, r",2, VAL1,", r",3, VAL2,"")
  983. TEST_RR( "umull r7, r8, r",9, VAL2,", r",10, VAL1,"")
  984. TEST_RRRR( "smlal r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  985. TEST_RRRR( "smlal r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  986. TEST_RRRR( "smlalbb r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  987. TEST_RRRR( "smlalbb r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  988. TEST_RRRR( "smlalbt r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  989. TEST_RRRR( "smlalbt r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  990. TEST_RRRR( "smlaltb r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  991. TEST_RRRR( "smlaltb r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  992. TEST_RRRR( "smlaltt r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  993. TEST_RRRR( "smlaltt r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  994. TEST_RRRR( "smlald r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
  995. TEST_RRRR( "smlald r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
  996. TEST_RRRR( "smlaldx r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
  997. TEST_RRRR( "smlaldx r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
  998. TEST_RRRR( "smlsld r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
  999. TEST_RRRR( "smlsld r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
  1000. TEST_RRRR( "smlsldx r",0, VAL1,", r",1, VAL2, ", r",0, HH1,", r",1, HH2)
  1001. TEST_RRRR( "smlsldx r",11,VAL2,", r",10,VAL1, ", r",9, HH2,", r",8, HH1)
  1002. TEST_RRRR( "umlal r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  1003. TEST_RRRR( "umlal r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  1004. TEST_RRRR( "umaal r",0, VAL1,", r",1, VAL2,", r",2, VAL3,", r",3, VAL4)
  1005. TEST_RRRR( "umaal r",8, VAL4,", r",9, VAL1,", r",10,VAL2,", r",11,VAL3)
  1006. TEST_GROUP("Coprocessor instructions")
  1007. TEST_UNSUPPORTED(__inst_thumb32(0xfc000000) "")
  1008. TEST_UNSUPPORTED(__inst_thumb32(0xffffffff) "")
  1009. TEST_GROUP("Testing instructions in IT blocks")
  1010. TEST_ITBLOCK("sub.w r0, r0")
  1011. verbose("\n");
  1012. }