asmtest.S 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. # gas comment with ``gnu'' style quotes
  2. /* some directive tests */
  3. .byte 0xff
  4. .byte 1, 2, 3
  5. .short 1, 2, 3
  6. .word 1, 2, 3
  7. .long 1, 2, 3
  8. .int 1, 2, 3
  9. .align 8
  10. .byte 1
  11. /* .align 16, 0x90 gas is too clever for us with 0x90 fill */
  12. .balign 4, 0x92
  13. .align 16, 0x91 /* 0x91 tests the non-clever behaviour */
  14. .skip 3
  15. .skip 15, 0x90
  16. .string "hello\0world"
  17. /* Macro expansion should work like with C, the #n shouldn't be parsed
  18. as asm line comment */
  19. #define __stringify(n) #n
  20. #define stringify(n) __stringify(n)
  21. .skip 8,0x90
  22. .asciz stringify(BLA)
  23. .skip 8,0x90
  24. # 28 "asmtest.S" # a line directive (and a line comment)
  25. movl %eax, %ebx # some more asm comment
  26. /* some label tests */
  27. L1:
  28. movl %eax, %ebx
  29. mov 0x10000, %eax
  30. L2:
  31. movl $L2 - L1, %ecx
  32. var1:
  33. nop ; nop ; nop ; nop
  34. mov var1, %eax
  35. /* instruction tests */
  36. movl %eax, %ebx
  37. mov 0x10000, %eax
  38. mov 0x10000, %ax
  39. mov 0x10000, %al
  40. mov %al, 0x10000
  41. mov $1, %edx
  42. mov $1, %dx
  43. mov $1, %cl
  44. movb $2, 0x100(%ebx,%edx,2)
  45. movw $2, 0x100(%ebx,%edx,2)
  46. movl $2, 0x100(%ebx,%edx,2)
  47. movl %eax, 0x100(%ebx,%edx,2)
  48. movl 0x100(%ebx,%edx,2), %edx
  49. movw %ax, 0x100(%ebx,%edx,2)
  50. movw $0x1122,%si
  51. movl $0x112233,%edx
  52. movl $0x80000000, %esi
  53. movl $-0x7fffffff, %edi
  54. #ifdef __x86_64__
  55. mov $0x11223344,%rbx
  56. movq $0x11223344,%rbx
  57. mov $0x1122334455,%rbx
  58. movq $0x1122334455,%rbx
  59. movl $0x11334455,(%rbx)
  60. #endif
  61. mov %eax, 0x12(,%edx,2)
  62. #ifdef __i386__
  63. mov %cr3, %edx
  64. mov %ecx, %cr3
  65. movl %cr3, %eax
  66. movl %tr3, %eax
  67. movl %db3, %ebx
  68. movl %dr6, %eax
  69. #else
  70. mov %cr3, %rdx
  71. mov %rcx, %cr3
  72. movq %cr3, %rax
  73. movq %db3, %rbx
  74. movq %dr6, %rax
  75. mov %cr8, %rsi
  76. mov %rdi, %cr8
  77. #endif
  78. movl %fs, %ecx
  79. movl %ebx, %fs
  80. #ifdef __x86_64__
  81. movq %r8, %r9
  82. movq %r10, %r11
  83. movq %r12, %r13
  84. movq %r14, %r15
  85. movq %rax, %r9
  86. movq %r15, %rsi
  87. inc %r9b
  88. dec %r10w
  89. not %r11d
  90. negq %r12
  91. decb %r13b
  92. incw %r14w
  93. notl %r15d
  94. #endif
  95. movsbl 0x1000, %eax
  96. movsbw 0x1000, %ax
  97. movswl 0x1000, %eax
  98. movzbl 0x1000, %eax
  99. movzbw 0x1000, %ax
  100. movzwl 0x1000, %eax
  101. movzb 0x1000, %eax
  102. movzb 0x1000, %ax
  103. mov $0x12345678,%eax
  104. #ifdef __x86_64__
  105. movzb 0x1000, %rax
  106. movzbq 0x1000, %rbx
  107. movsbq 0x1000, %rdx
  108. movzwq 0x1000, %rdi
  109. movswq 0x1000, %rdx
  110. movslq %eax, %rcx
  111. mov $0x12345678,%rax
  112. mov $0x12345678,%rdx
  113. mov $0x12345678,%r10
  114. mov $0x123456789abcdef0,%rax
  115. mov $0x123456789abcdef0,%rcx
  116. mov $0x123456789abcdef0,%r11
  117. #endif
  118. #ifdef __i386__
  119. pushl %eax
  120. push %eax
  121. push %cs
  122. #else
  123. pushq %rax
  124. push %rax
  125. #endif
  126. pushw %ax
  127. push %gs
  128. push $1
  129. push $100
  130. push 0x42(%eax)
  131. pop 0x43(%esi)
  132. #ifdef __i386__
  133. popl %eax
  134. pop %eax
  135. pop %ds
  136. #else
  137. popq %rax
  138. pop %rax
  139. #endif
  140. popw %ax
  141. pop %fs
  142. xchg %eax, %ecx
  143. xchg %edx, %eax
  144. xchg %bx, 0x10000
  145. xchg 0x10000, %ebx
  146. xchg 0x10000, %dl
  147. in $100, %al
  148. in $100, %ax
  149. in $100, %eax
  150. in %dx, %al
  151. in %dx, %ax
  152. in %dx, %eax
  153. inb %dx
  154. inw %dx
  155. inl %dx
  156. out %al, $100
  157. out %ax, $100
  158. out %eax, $100
  159. /* NOTE: gas is bugged here, so size must be added */
  160. outb %al, %dx
  161. outw %ax, %dx
  162. outl %eax, %dx
  163. leal 0x1000(%ebx), %ecx
  164. lea 0x1000(%ebx), %ecx
  165. #ifdef __i386__
  166. les 0x2000, %eax
  167. lds 0x2000, %ebx
  168. lss 0x2000, %edx
  169. #endif
  170. lfs 0x2000, %ecx
  171. lgs 0x2000, %edx
  172. addl $0x123, %eax
  173. add $0x123, %ebx
  174. add $-16, %ecx
  175. add $-0x123, %esi
  176. add $1, %bx
  177. add $1, %ebx
  178. add $-1, %bx
  179. add $-1, %ebx
  180. add $127, %bx
  181. addl $127, %ebx
  182. addl $-128, %ebx
  183. addl $-128, %ebx
  184. addl $-129, %ebx
  185. addl $128, %ebx
  186. addl $255, %ebx
  187. addl $256, %ebx
  188. andb $0xf, %ah
  189. andb $-15, %cl
  190. xorb $127, %dh
  191. cmpb $42, (%eax)
  192. addl $0x123, 0x100
  193. addl $0x123, 0x100(%ebx)
  194. addl $0x123, 0x100(%ebx,%edx,2)
  195. addl $0x123, 0x100(%esp)
  196. addl $0x123, (3*8)(%esp)
  197. addl $0x123, (%ebp)
  198. addl $0x123, (%esp)
  199. cmpl $0x123, (%esp)
  200. #ifdef __x86_64__
  201. xor %bl,%ah
  202. xor %bl,%r8b
  203. xor %r9b,%bl
  204. xor %sil,%cl
  205. add %eax,(%r8d)
  206. add %ebx,(%r9)
  207. add %edx,(%r10d,%r11d)
  208. add %ecx,(%r12,%r13)
  209. add %esi,(%r14,%r15,4)
  210. add %edi,0x1000(%rbx,%r12,8)
  211. add %r11,0x1000(%ebp,%r9d,8)
  212. movb $12, %ah
  213. movb $13, %bpl
  214. movb $14, %dil
  215. movb $15, %r12b
  216. #endif
  217. add %eax, (%ebx)
  218. add (%ebx), %eax
  219. or %dx, (%ebx)
  220. or (%ebx), %si
  221. add %cl, (%ebx)
  222. add (%ebx), %dl
  223. inc %edx
  224. incl 0x10000
  225. incb 0x10000
  226. dec %dx
  227. test $1, %al
  228. test $1, %cl
  229. testl $1, 0x1000
  230. testb $1, 0x1000
  231. testw $1, 0x1000
  232. test %eax, %ebx
  233. test %eax, 0x1000
  234. test 0x1000, %edx
  235. not %edx
  236. notw 0x10000
  237. notl 0x10000
  238. notb 0x10000
  239. neg %edx
  240. negw 0x10000
  241. negl 0x10000
  242. negb 0x10000
  243. imul %ecx
  244. mul %edx
  245. mulb %cl
  246. imul %eax, %ecx
  247. imul 0x1000, %cx
  248. imul $10, %eax, %ecx
  249. imul $10, %ax, %cx
  250. imul $10, %eax
  251. imul $0x1100000, %eax
  252. imul $1, %eax
  253. idivw 0x1000
  254. div %ecx
  255. div %bl
  256. div %ecx, %eax
  257. and $15,%bx
  258. and $-20,%edx
  259. shl %edx
  260. shl $10, %edx
  261. shl %cl, %edx
  262. shld $1, %eax, %edx
  263. shld %cl, %eax, %edx
  264. shld %eax, %edx
  265. shrd $1, %eax, %edx
  266. shrd %cl, %eax, %edx
  267. shrd %eax, %edx
  268. L4:
  269. call 0x1000
  270. call L4
  271. #ifdef __i386__
  272. call *%eax
  273. #else
  274. call *%rax
  275. #endif
  276. call *0x1000
  277. call func1
  278. .global L5,L6
  279. L5:
  280. L6:
  281. #ifdef __i386__
  282. lcall $0x100, $0x1000
  283. #else
  284. lcall *0x100
  285. lcall *(%rax)
  286. #endif
  287. jmp 0x1000
  288. jmp *(%edi)
  289. #ifdef __i386__
  290. jmp *%eax
  291. #else
  292. jmp *%rax
  293. #endif
  294. jmp *0x1000
  295. #ifdef __i386__
  296. ljmp $0x100, $0x1000
  297. #else
  298. ljmp *0x100
  299. ljmp *(%rdi)
  300. ljmpl *(%esi)
  301. ljmpw *(%esi)
  302. #endif
  303. ret
  304. ret $10
  305. #ifdef __i386__
  306. retl
  307. retl $10
  308. #else
  309. retq
  310. retq $10
  311. #endif
  312. lret
  313. lret $10
  314. enter $1234, $10
  315. L3:
  316. jo 0x1000
  317. jnp 0x1001
  318. jne 0x1002
  319. jg 0x1003
  320. jo L3
  321. jnp L3
  322. jne L3
  323. jg L3
  324. loopne L3
  325. loopnz L3
  326. loope L3
  327. loopz L3
  328. loop L3
  329. jecxz L3
  330. seto %al
  331. setc %al
  332. setcb %al
  333. setnp 0x1000
  334. setl 0xaaaa
  335. setg %dl
  336. fadd
  337. fadd %st(1), %st
  338. fadd %st(0), %st(1)
  339. fadd %st(3)
  340. fmul %st(0),%st(0)
  341. fmul %st(0),%st(1)
  342. faddp %st(5)
  343. faddp
  344. faddp %st(1), %st
  345. fadds 0x1000
  346. fiadds 0x1002
  347. faddl 0x1004
  348. fiaddl 0x1006
  349. fmul
  350. fmul %st(1), %st
  351. fmul %st(3)
  352. fmulp %st(5)
  353. fmulp
  354. fmulp %st(1), %st
  355. fmuls 0x1000
  356. fimuls 0x1002
  357. fmull 0x1004
  358. fimull 0x1006
  359. fsub
  360. fsub %st(1), %st
  361. fsub %st(3)
  362. fsubp %st(5)
  363. fsubp
  364. fsubp %st(1), %st
  365. fsubs 0x1000
  366. fisubs 0x1002
  367. fsubl 0x1004
  368. fisubl 0x1006
  369. fsubr
  370. fsubr %st(1), %st
  371. fsubr %st(3)
  372. fsubrp %st(5)
  373. fsubrp
  374. fsubrp %st(1), %st
  375. fsubrs 0x1000
  376. fisubrs 0x1002
  377. fsubrl 0x1004
  378. fisubrl 0x1006
  379. fdiv
  380. fdiv %st(1), %st
  381. fdiv %st(3)
  382. fdivp %st(5)
  383. fdivp
  384. fdivp %st(1), %st
  385. fdivs 0x1000
  386. fidivs 0x1002
  387. fdivl 0x1004
  388. fidivl 0x1006
  389. fcom %st(3)
  390. fcoms 0x1000
  391. ficoms 0x1002
  392. fcoml 0x1004
  393. ficoml 0x1006
  394. fcomp %st(5)
  395. fcomp
  396. fcompp
  397. fcomps 0x1000
  398. ficomps 0x1002
  399. fcompl 0x1004
  400. ficompl 0x1006
  401. fld %st(5)
  402. fldl 0x1000
  403. flds 0x1002
  404. fildl 0x1004
  405. fst %st(4)
  406. fstp %st(6)
  407. fstpt 0x1006
  408. fbstp 0x1008
  409. fxch
  410. fxch %st(4)
  411. fucom %st(6)
  412. fucomp %st(3)
  413. fucompp
  414. finit
  415. fninit
  416. fldcw 0x1000
  417. fnstcw 0x1002
  418. fstcw 0x1002
  419. fnstsw 0x1004
  420. fnstsw (%eax)
  421. fstsw 0x1004
  422. fstsw (%eax)
  423. fnclex
  424. fclex
  425. fnstenv 0x1000
  426. fstenv 0x1000
  427. fldenv 0x1000
  428. fnsave 0x1002
  429. fsave 0x1000
  430. frstor 0x1000
  431. ffree %st(7)
  432. ffreep %st(6)
  433. ftst
  434. fxam
  435. fld1
  436. fldl2t
  437. fldl2e
  438. fldpi
  439. fldlg2
  440. fldln2
  441. fldz
  442. f2xm1
  443. fyl2x
  444. fptan
  445. fpatan
  446. fxtract
  447. fprem1
  448. fdecstp
  449. fincstp
  450. fprem
  451. fyl2xp1
  452. fsqrt
  453. fsincos
  454. frndint
  455. fscale
  456. fsin
  457. fcos
  458. fchs
  459. fabs
  460. fnop
  461. fwait
  462. bswap %edx
  463. bswapl %ecx
  464. xadd %ecx, %edx
  465. xaddb %dl, 0x1000
  466. xaddw %ax, 0x1000
  467. xaddl %eax, 0x1000
  468. cmpxchg %ecx, %edx
  469. cmpxchgb %dl, 0x1000
  470. cmpxchgw %ax, 0x1000
  471. cmpxchgl %eax, 0x1000
  472. invlpg 0x1000
  473. cmpxchg8b 0x1002
  474. #ifdef __x86_64__
  475. cmpxchg16b (%rax)
  476. cmpxchg16b (%r10,%r11)
  477. #endif
  478. fcmovb %st(5), %st
  479. fcmove %st(5), %st
  480. fcmovbe %st(5), %st
  481. fcmovu %st(5), %st
  482. fcmovnb %st(5), %st
  483. fcmovne %st(5), %st
  484. fcmovnbe %st(5), %st
  485. fcmovnu %st(5), %st
  486. fcomi %st(5), %st
  487. fucomi %st(5), %st
  488. fcomip %st(5), %st
  489. fucomip %st(5), %st
  490. cmovo 0x1000, %eax
  491. cmovs 0x1000, %eax
  492. cmovns %edx, %edi
  493. cmovne %ax, %si
  494. #ifdef __x86_64__
  495. bswapq %rsi
  496. bswapq %r10
  497. cmovz %rdi,%rbx
  498. #endif
  499. int $3
  500. int $0x10
  501. #ifdef __i386__
  502. pusha
  503. popa
  504. #endif
  505. clc # another comment
  506. cld # a comment with embedded ' tick
  507. cli
  508. clts
  509. cmc
  510. lahf
  511. sahf
  512. #ifdef __i386__
  513. pushfl
  514. popfl
  515. #else
  516. pushfq
  517. popfq
  518. #endif
  519. pushf
  520. popf
  521. stc
  522. std
  523. sti
  524. #ifdef __i386__
  525. aaa
  526. aas
  527. daa
  528. das
  529. aad
  530. aam
  531. into
  532. #endif
  533. cbw
  534. cwd
  535. cwde
  536. cdq
  537. cbtw
  538. cwtd
  539. cwtl
  540. cltd
  541. leave
  542. int3
  543. iret
  544. rsm
  545. hlt
  546. wait
  547. nop
  548. /* XXX: handle prefixes */
  549. #if 0
  550. aword
  551. addr16
  552. #endif
  553. lock
  554. rep
  555. repe
  556. repz
  557. repne
  558. repnz
  559. nop
  560. lock ;negl (%eax)
  561. wait ;pushf
  562. rep ;stosb
  563. repe ;lodsb
  564. repz ;cmpsb
  565. repne;movsb
  566. repnz;outsb
  567. /* handle one-line prefix + ops */
  568. lock negl (%eax)
  569. wait pushf
  570. rep stosb
  571. repe lodsb
  572. repz cmpsb
  573. repne movsb
  574. repnz outsb
  575. invd
  576. wbinvd
  577. cpuid
  578. wrmsr
  579. rdtsc
  580. rdmsr
  581. rdpmc
  582. ud2
  583. #ifdef __x86_64__
  584. syscall
  585. sysret
  586. sysretq
  587. lfence
  588. mfence
  589. sfence
  590. prefetchnta 0x18(%rdx)
  591. prefetcht0 (%rcx)
  592. prefetcht1 (%rsi)
  593. prefetcht2 (%rdi)
  594. prefetchw (%rdi)
  595. clflush 0x1000(%rax,%rcx)
  596. fxsaveq (%rdx)
  597. fxsaveq (%r11)
  598. fxrstorq (%rcx)
  599. fxrstorq (%r10)
  600. #endif
  601. lar %ax,%dx
  602. lar %eax,%dx
  603. lar %ax,%edx
  604. lar %eax,%edx
  605. #ifdef __x86_64__
  606. lar %ax,%rdx
  607. lar %eax,%rdx
  608. #endif
  609. emms
  610. movd %edx, %mm3
  611. movd 0x1000, %mm2
  612. movd %mm4, %ecx
  613. movd %mm5, 0x1000
  614. movq 0x1000, %mm2
  615. movq %mm4, 0x1000
  616. pand 0x1000, %mm3
  617. pand %mm4, %mm5
  618. psllw $1, %mm6
  619. psllw 0x1000, %mm7
  620. psllw %mm2, %mm7
  621. xlat
  622. cmpsb
  623. scmpw
  624. insl
  625. outsw
  626. lodsb
  627. slodl
  628. movsb
  629. movsl
  630. smovb
  631. scasb
  632. sscaw
  633. stosw
  634. sstol
  635. bsf 0x1000, %ebx
  636. bsr 0x1000, %ebx
  637. bt %edx, 0x1000
  638. btl $2, 0x1000
  639. btc %edx, 0x1000
  640. btcl $2, 0x1000
  641. btr %edx, 0x1000
  642. btrl $2, 0x1000
  643. bts %edx, 0x1000
  644. btsl $2, 0x1000
  645. #ifdef __i386__
  646. boundl %edx, 0x10000
  647. boundw %bx, 0x1000
  648. arpl %bx, 0x1000
  649. #endif
  650. lar 0x1000, %eax
  651. lgdt 0x1000
  652. lidt 0x1000
  653. lldt 0x1000
  654. sgdt 0x1000
  655. sidt 0x1000
  656. sldt 0x1000
  657. #ifdef __x86_64__
  658. lgdtq 0x1000
  659. lidtq 0x1000
  660. sgdtq 0x1000
  661. sidtq 0x1000
  662. swapgs
  663. str %rdx
  664. str %r9
  665. #endif
  666. lmsw 0x1000
  667. lsl 0x1000, %ecx
  668. ltr 0x1000
  669. ltr %si
  670. smsw 0x1000
  671. str 0x1000
  672. str %ecx
  673. str %dx
  674. verr 0x1000
  675. verw 0x1000
  676. #ifdef __i386__
  677. push %ds
  678. pushw %ds
  679. pushl %ds
  680. pop %ds
  681. popw %ds
  682. popl %ds
  683. #endif
  684. fxsave 1(%ebx)
  685. fxrstor 1(%ecx)
  686. #ifdef __i386__
  687. pushl $1
  688. #else
  689. pushq $1
  690. #endif
  691. pushw $1
  692. push $1
  693. #ifdef __ASSEMBLER__ // should be defined, for S files
  694. inc %eax
  695. #endif
  696. #ifndef _WIN32
  697. ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
  698. xor %eax, %eax
  699. ret
  700. .type ft1,STT_FUNC
  701. .type ft2,@STT_FUNC
  702. .type ft3,%STT_FUNC
  703. .type ft4,"STT_FUNC"
  704. .type ft5,function
  705. .type ft6,@function
  706. .type ft7,%function
  707. .type ft8,"function"
  708. #endif
  709. pause
  710. .rept 6
  711. nop
  712. .endr
  713. .fill 4,1,0x90
  714. .section .text.one,"ax"
  715. nop
  716. .previous
  717. .pushsection .text.one,"ax"
  718. nop
  719. .pushsection .text.two,"ax"
  720. nop
  721. .popsection
  722. .popsection
  723. 1: ud2
  724. .pushsection __bug_table,"a"
  725. .align 8
  726. 2: .long 1b - 2b
  727. .long 0x600000 - 2b
  728. .long 1b + 42
  729. .long 43 + 1b
  730. .long 2b + 144
  731. .long 145 + 2b
  732. .word 164, 0
  733. .org 2b+32
  734. #ifdef __x86_64__
  735. .quad 1b
  736. #else
  737. .long 1b
  738. #endif
  739. .popsection
  740. 3: mov %eax,%ecx
  741. 4:
  742. .pushsection .text.three, "ax"
  743. nop
  744. .skip (-((4b-3b) > 0) * 2) , 0x90
  745. .popsection
  746. .globl overrideme
  747. .weak overrideme
  748. nop
  749. .globl notimplemented
  750. notimplemented:
  751. ret
  752. .set overrideme, notimplemented
  753. overrideme = notimplemented
  754. overrideme:
  755. ret
  756. movd %esi, %mm1
  757. movd %edi, %xmm2
  758. movd (%ebx), %mm3
  759. movd (%ebx), %xmm3
  760. movd %mm1, %esi
  761. movd %xmm2, %edi
  762. movd %mm3, (%edx)
  763. movd %xmm3, (%edx)
  764. #ifdef __x86_64__
  765. movd %rsi, %mm1
  766. movd %rdi, %xmm2
  767. movd (%rbx), %mm3
  768. movd (%rbx), %xmm3
  769. movd %mm1, %r12
  770. movd %xmm2, %rdi
  771. movd %mm3, (%r8)
  772. movd %xmm3, (%r13)
  773. #endif
  774. movq (%ebp), %mm1
  775. movq %mm2, (%edi)
  776. movq (%edi), %xmm3
  777. movq %mm4, %mm5
  778. #ifdef __x86_64__
  779. movq %rcx, %mm1
  780. movq %rdx, %xmm2
  781. movq %r13, %xmm3
  782. /* movq mem64->xmm is encoded as f30f7e by GAS, but as
  783. 660f6e by tcc (which really is a movd and would need
  784. a REX.W prefix to be movq). */
  785. movq (%rsi), %xmm3
  786. movq %mm1, %rdx
  787. movq %xmm3, %rcx
  788. movq %xmm4, (%rsi)
  789. #endif
  790. #define TEST_MMX_SSE(insn) \
  791. insn %mm1, %mm2; \
  792. insn %xmm2, %xmm3; \
  793. insn (%ebx), %xmm3;
  794. #define TEST_MMX_SSE_I8(insn) \
  795. TEST_MMX_SSE(insn) \
  796. insn $0x42, %mm4; \
  797. insn $0x42, %xmm4;
  798. TEST_MMX_SSE(packssdw)
  799. TEST_MMX_SSE(packsswb)
  800. TEST_MMX_SSE(packuswb)
  801. TEST_MMX_SSE(paddb)
  802. TEST_MMX_SSE(paddw)
  803. TEST_MMX_SSE(paddd)
  804. TEST_MMX_SSE(paddsb)
  805. TEST_MMX_SSE(paddsw)
  806. TEST_MMX_SSE(paddusb)
  807. TEST_MMX_SSE(paddusw)
  808. TEST_MMX_SSE(pand)
  809. TEST_MMX_SSE(pandn)
  810. TEST_MMX_SSE(pcmpeqb)
  811. TEST_MMX_SSE(pcmpeqw)
  812. TEST_MMX_SSE(pcmpeqd)
  813. TEST_MMX_SSE(pcmpgtb)
  814. TEST_MMX_SSE(pcmpgtw)
  815. TEST_MMX_SSE(pcmpgtd)
  816. TEST_MMX_SSE(pmaddwd)
  817. TEST_MMX_SSE(pmulhw)
  818. TEST_MMX_SSE(pmullw)
  819. TEST_MMX_SSE(por)
  820. TEST_MMX_SSE(psllw)
  821. TEST_MMX_SSE_I8(psllw)
  822. TEST_MMX_SSE(pslld)
  823. TEST_MMX_SSE_I8(pslld)
  824. TEST_MMX_SSE(psllq)
  825. TEST_MMX_SSE_I8(psllq)
  826. TEST_MMX_SSE(psraw)
  827. TEST_MMX_SSE_I8(psraw)
  828. TEST_MMX_SSE(psrad)
  829. TEST_MMX_SSE_I8(psrad)
  830. TEST_MMX_SSE(psrlw)
  831. TEST_MMX_SSE_I8(psrlw)
  832. TEST_MMX_SSE(psrld)
  833. TEST_MMX_SSE_I8(psrld)
  834. TEST_MMX_SSE(psrlq)
  835. TEST_MMX_SSE_I8(psrlq)
  836. TEST_MMX_SSE(psubb)
  837. TEST_MMX_SSE(psubw)
  838. TEST_MMX_SSE(psubd)
  839. TEST_MMX_SSE(psubsb)
  840. TEST_MMX_SSE(psubsw)
  841. TEST_MMX_SSE(psubusb)
  842. TEST_MMX_SSE(psubusw)
  843. TEST_MMX_SSE(punpckhbw)
  844. TEST_MMX_SSE(punpckhwd)
  845. TEST_MMX_SSE(punpckhdq)
  846. TEST_MMX_SSE(punpcklbw)
  847. TEST_MMX_SSE(punpcklwd)
  848. TEST_MMX_SSE(punpckldq)
  849. TEST_MMX_SSE(pxor)
  850. cvtpi2ps %mm1, %xmm2
  851. cvtpi2ps (%ebx), %xmm2
  852. TEST_MMX_SSE(pmaxsw)
  853. TEST_MMX_SSE(pmaxub)
  854. TEST_MMX_SSE(pminsw)
  855. TEST_MMX_SSE(pminub)