x86-64.s revision 9b8b830f3fa6dca2275dcd86bdaf0d78ab1651a1
1// RUN: llvm-mc -triple x86_64-unknown-unknown -show-encoding %s > %t 2> %t.err 2// RUN: FileCheck < %t %s 3// RUN: FileCheck --check-prefix=CHECK-STDERR < %t.err %s 4 5 monitor 6// CHECK: monitor 7// CHECK: encoding: [0x0f,0x01,0xc8] 8 monitor %rax, %rcx, %rdx 9// CHECK: monitor 10// CHECK: encoding: [0x0f,0x01,0xc8] 11 mwait 12// CHECK: mwait 13// CHECK: encoding: [0x0f,0x01,0xc9] 14 mwait %rax, %rcx 15// CHECK: mwait 16// CHECK: encoding: [0x0f,0x01,0xc9] 17 18// Suffix inference: 19 20// CHECK: addl $0, %eax 21 add $0, %eax 22// CHECK: addb $255, %al 23 add $0xFF, %al 24// CHECK: orq %rax, %rdx 25 or %rax, %rdx 26// CHECK: shlq $3, %rax 27 shl $3, %rax 28 29 30// CHECK: subb %al, %al 31 subb %al, %al 32 33// CHECK: addl $24, %eax 34 addl $24, %eax 35 36// CHECK: movl %eax, 10(%ebp) 37 movl %eax, 10(%ebp) 38// CHECK: movl %eax, 10(%ebp,%ebx) 39 movl %eax, 10(%ebp, %ebx) 40// CHECK: movl %eax, 10(%ebp,%ebx,4) 41 movl %eax, 10(%ebp, %ebx, 4) 42// CHECK: movl %eax, 10(,%ebx,4) 43 movl %eax, 10(, %ebx, 4) 44 45// CHECK: movl 0, %eax 46 movl 0, %eax 47// CHECK: movl $0, %eax 48 movl $0, %eax 49 50// CHECK: ret 51 ret 52 53// CHECK: retw 54 retw 55 56// FIXME: Check that this matches SUB32ri8 57// CHECK: subl $1, %eax 58 subl $1, %eax 59 60// FIXME: Check that this matches SUB32ri8 61// CHECK: subl $-1, %eax 62 subl $-1, %eax 63 64// FIXME: Check that this matches SUB32ri 65// CHECK: subl $256, %eax 66 subl $256, %eax 67 68// FIXME: Check that this matches XOR64ri8 69// CHECK: xorq $1, %rax 70 xorq $1, %rax 71 72// FIXME: Check that this matches XOR64ri32 73// CHECK: xorq $256, %rax 74 xorq $256, %rax 75 76// FIXME: Check that this matches SUB8rr 77// CHECK: subb %al, %bl 78 subb %al, %bl 79 80// FIXME: Check that this matches SUB16rr 81// CHECK: subw %ax, %bx 82 subw %ax, %bx 83 84// FIXME: Check that this matches SUB32rr 85// CHECK: subl %eax, %ebx 86 subl %eax, %ebx 87 88// FIXME: Check that this matches the correct instruction. 89// CHECK: callq *%rax 90 call *%rax 91 92// FIXME: Check that this matches the correct instruction. 93// CHECK: shldl %cl, %eax, %ebx 94 shldl %cl, %eax, %ebx 95 96// CHECK: shll $2, %eax 97 shll $2, %eax 98 99// CHECK: shll $2, %eax 100 sall $2, %eax 101 102// CHECK: rep 103// CHECK: insb 104 rep;insb 105 106// CHECK: rep 107// CHECK: outsb 108 rep;outsb 109 110// CHECK: rep 111// CHECK: movsb 112 rep;movsb 113 114 115// rdar://8470918 116smovb // CHECK: movsb 117smovw // CHECK: movsw 118smovl // CHECK: movsl 119smovq // CHECK: movsq 120 121// rdar://8456361 122// CHECK: rep 123// CHECK: movsl 124 rep movsd 125 126// CHECK: rep 127// CHECK: lodsb 128 rep;lodsb 129 130// CHECK: rep 131// CHECK: stosb 132 rep;stosb 133 134// NOTE: repz and repe have the same opcode as rep 135// CHECK: rep 136// CHECK: cmpsb 137 repz;cmpsb 138 139// NOTE: repnz has the same opcode as repne 140// CHECK: repne 141// CHECK: cmpsb 142 repnz;cmpsb 143 144// NOTE: repe and repz have the same opcode as rep 145// CHECK: rep 146// CHECK: scasb 147 repe;scasb 148 149// CHECK: repne 150// CHECK: scasb 151 repne;scasb 152 153// CHECK: lock 154// CHECK: cmpxchgb %al, (%ebx) 155 lock;cmpxchgb %al, 0(%ebx) 156 157// CHECK: cs 158// CHECK: movb (%eax), %al 159 cs;movb 0(%eax), %al 160 161// CHECK: ss 162// CHECK: movb (%eax), %al 163 ss;movb 0(%eax), %al 164 165// CHECK: ds 166// CHECK: movb (%eax), %al 167 ds;movb 0(%eax), %al 168 169// CHECK: es 170// CHECK: movb (%eax), %al 171 es;movb 0(%eax), %al 172 173// CHECK: fs 174// CHECK: movb (%eax), %al 175 fs;movb 0(%eax), %al 176 177// CHECK: gs 178// CHECK: movb (%eax), %al 179 gs;movb 0(%eax), %al 180 181// CHECK: fadd %st(0) 182// CHECK: fadd %st(1) 183// CHECK: fadd %st(7) 184 185fadd %st(0) 186fadd %st(1) 187fadd %st(7) 188 189// CHECK: leal 0, %eax 190 leal 0, %eax 191 192// rdar://7986634 - Insensitivity on opcodes. 193// CHECK: int3 194INT3 195 196// rdar://8735979 - int $3 -> int3 197// CHECK: int3 198int $3 199 200 201// Allow scale factor without index register. 202// CHECK: movaps %xmm3, (%esi) 203// CHECK-STDERR: warning: scale factor without index register is ignored 204movaps %xmm3, (%esi, 2) 205 206// CHECK: imull $12, %eax, %eax 207imul $12, %eax 208 209// CHECK: imull %ecx, %eax 210imull %ecx, %eax 211 212 213// rdar://8208481 214// CHECK: outb %al, $161 215outb %al, $161 216// CHECK: outw %ax, $128 217outw %ax, $128 218// CHECK: inb $161, %al 219inb $161, %al 220 221// rdar://8017621 222// CHECK: pushq $1 223push $1 224 225// rdar://9716860 226pushq $1 227// CHECK: encoding: [0x6a,0x01] 228pushq $1111111 229// CHECK: encoding: [0x68,0x47,0xf4,0x10,0x00] 230 231// rdar://8017530 232// CHECK: sldtw 4 233sldt 4 234 235// rdar://8208499 236// CHECK: cmovnew %bx, %ax 237cmovnz %bx, %ax 238// CHECK: cmovneq %rbx, %rax 239cmovnzq %rbx, %rax 240 241 242// rdar://8407928 243// CHECK: inb $127, %al 244// CHECK: inw %dx, %ax 245// CHECK: outb %al, $127 246// CHECK: outw %ax, %dx 247// CHECK: inl %dx, %eax 248inb $0x7f 249inw %dx 250outb $0x7f 251outw %dx 252inl %dx 253 254 255// PR8114 256// CHECK: outb %al, %dx 257// CHECK: outb %al, %dx 258// CHECK: outw %ax, %dx 259// CHECK: outw %ax, %dx 260// CHECK: outl %eax, %dx 261// CHECK: outl %eax, %dx 262 263out %al, (%dx) 264outb %al, (%dx) 265out %ax, (%dx) 266outw %ax, (%dx) 267out %eax, (%dx) 268outl %eax, (%dx) 269 270// CHECK: inb %dx, %al 271// CHECK: inb %dx, %al 272// CHECK: inw %dx, %ax 273// CHECK: inw %dx, %ax 274// CHECK: inl %dx, %eax 275// CHECK: inl %dx, %eax 276 277in (%dx), %al 278inb (%dx), %al 279in (%dx), %ax 280inw (%dx), %ax 281in (%dx), %eax 282inl (%dx), %eax 283 284// rdar://8431422 285 286// CHECK: fxch 287// CHECK: fucom 288// CHECK: fucomp 289// CHECK: faddp 290// CHECK: faddp %st(0) 291// CHECK: fsubp 292// CHECK: fsubrp 293// CHECK: fmulp 294// CHECK: fdivp 295// CHECK: fdivrp 296 297fxch 298fucom 299fucomp 300faddp 301faddp %st 302fsubp 303fsubrp 304fmulp 305fdivp 306fdivrp 307 308// CHECK: fcomi 309// CHECK: fcomi %st(2) 310// CHECK: fucomi 311// CHECK: fucomi %st(2) 312// CHECK: fucomi %st(2) 313 314fcomi 315fcomi %st(2) 316fucomi 317fucomi %st(2) 318fucomi %st(2), %st 319 320// CHECK: fnstsw 321// CHECK: fnstsw 322// CHECK: fnstsw 323// CHECK: fnstsw 324 325fnstsw 326fnstsw %ax 327fnstsw %eax 328fnstsw %al 329 330// rdar://8431880 331// CHECK: rclb %bl 332// CHECK: rcll 3735928559(%ebx,%ecx,8) 333// CHECK: rcrl %ecx 334// CHECK: rcrl 305419896 335rcl %bl 336rcll 0xdeadbeef(%ebx,%ecx,8) 337rcr %ecx 338rcrl 0x12345678 339 340rclb %bl // CHECK: rclb %bl # encoding: [0xd0,0xd3] 341rclb $1, %bl // CHECK: rclb %bl # encoding: [0xd0,0xd3] 342rclb $2, %bl // CHECK: rclb $2, %bl # encoding: [0xc0,0xd3,0x02] 343 344// rdar://8418316 345// PR12173 346// CHECK: shldw %cl, %bx, %dx 347// CHECK: shldw %cl, %bx, %dx 348// CHECK: shldw $1, %bx, %dx 349// CHECK: shldw %cl, %bx, (%rax) 350// CHECK: shldw %cl, %bx, (%rax) 351// CHECK: shrdw %cl, %bx, %dx 352// CHECK: shrdw %cl, %bx, %dx 353// CHECK: shrdw $1, %bx, %dx 354// CHECK: shrdw %cl, %bx, (%rax) 355// CHECK: shrdw %cl, %bx, (%rax) 356 357shld %bx, %dx 358shld %cl, %bx, %dx 359shld $1, %bx, %dx 360shld %bx, (%rax) 361shld %cl, %bx, (%rax) 362shrd %bx, %dx 363shrd %cl, %bx, %dx 364shrd $1, %bx, %dx 365shrd %bx, (%rax) 366shrd %cl, %bx, (%rax) 367 368// CHECK: sldtl %ecx 369// CHECK: encoding: [0x0f,0x00,0xc1] 370// CHECK: sldtw %cx 371// CHECK: encoding: [0x66,0x0f,0x00,0xc1] 372 373sldt %ecx 374sldt %cx 375 376// CHECK: lcalll *3135175374 377// CHECK: ljmpl *3135175374 378lcall *0xbadeface 379ljmp *0xbadeface 380 381 382// rdar://8444631 383// CHECK: enter $31438, $0 384// CHECK: encoding: [0xc8,0xce,0x7a,0x00] 385// CHECK: enter $31438, $1 386// CHECK: encoding: [0xc8,0xce,0x7a,0x01] 387// CHECK: enter $31438, $127 388// CHECK: encoding: [0xc8,0xce,0x7a,0x7f] 389enter $0x7ace,$0 390enter $0x7ace,$1 391enter $0x7ace,$0x7f 392 393 394// rdar://8456364 395// CHECK: movw %cs, %ax 396mov %CS, %ax 397 398// rdar://8456391 399fcmovb %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0) 400fcmove %st(1), %st(0) // CHECK: fcmove %st(1), %st(0) 401fcmovbe %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0) 402fcmovu %st(1), %st(0) // CHECK: fcmovu %st(1), %st(0) 403 404fcmovnb %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0) 405fcmovne %st(1), %st(0) // CHECK: fcmovne %st(1), %st(0) 406fcmovnbe %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0) 407fcmovnu %st(1), %st(0) // CHECK: fcmovnu %st(1), %st(0) 408 409fcmovnae %st(1), %st(0) // CHECK: fcmovb %st(1), %st(0) 410fcmovna %st(1), %st(0) // CHECK: fcmovbe %st(1), %st(0) 411 412fcmovae %st(1), %st(0) // CHECK: fcmovnb %st(1), %st(0) 413fcmova %st(1), %st(0) // CHECK: fcmovnbe %st(1), %st(0) 414 415// rdar://8456417 416.byte 88 + 1 & 15 // CHECK: .byte 9 417 418// rdar://8456412 419mov %rdx, %cr0 420// CHECK: movq %rdx, %cr0 421// CHECK: encoding: [0x0f,0x22,0xc2] 422mov %rdx, %cr4 423// CHECK: movq %rdx, %cr4 424// CHECK: encoding: [0x0f,0x22,0xe2] 425mov %rdx, %cr8 426// CHECK: movq %rdx, %cr8 427// CHECK: encoding: [0x44,0x0f,0x22,0xc2] 428mov %rdx, %cr15 429// CHECK: movq %rdx, %cr15 430// CHECK: encoding: [0x44,0x0f,0x22,0xfa] 431 432// rdar://8456371 - Handle commutable instructions written backward. 433// CHECK: faddp %st(1) 434// CHECK: fmulp %st(2) 435faddp %st, %st(1) 436fmulp %st, %st(2) 437 438// rdar://8468087 - Encode these accurately, they are not synonyms. 439// CHECK: fmul %st(0), %st(1) 440// CHECK: encoding: [0xdc,0xc9] 441// CHECK: fmul %st(1) 442// CHECK: encoding: [0xd8,0xc9] 443fmul %st, %st(1) 444fmul %st(1), %st 445 446// CHECK: fadd %st(0), %st(1) 447// CHECK: encoding: [0xdc,0xc1] 448// CHECK: fadd %st(1) 449// CHECK: encoding: [0xd8,0xc1] 450fadd %st, %st(1) 451fadd %st(1), %st 452 453 454// rdar://8416805 455// CHECK: xorb %al, %al 456// CHECK: encoding: [0x30,0xc0] 457// CHECK: xorw %di, %di 458// CHECK: encoding: [0x66,0x31,0xff] 459// CHECK: xorl %esi, %esi 460// CHECK: encoding: [0x31,0xf6] 461// CHECK: xorq %rsi, %rsi 462// CHECK: encoding: [0x48,0x31,0xf6] 463clrb %al 464clr %di 465clr %esi 466clr %rsi 467 468// rdar://8456378 469cltq // CHECK: cltq 470cdqe // CHECK: cltq 471cwde // CHECK: cwtl 472cwtl // CHECK: cwtl 473 474// rdar://8416805 475cbw // CHECK: cbtw 476cwd // CHECK: cwtd 477cdq // CHECK: cltd 478cqo // CHECK: cqto 479 480// rdar://8456378 and PR7557 - fstsw 481fstsw %ax 482// CHECK: wait 483// CHECK: fnstsw 484fstsw (%rax) 485// CHECK: wait 486// CHECK: fnstsw (%rax) 487 488// PR8259 489fstcw (%rsp) 490// CHECK: wait 491// CHECK: fnstcw (%rsp) 492 493// PR8259 494fstcw (%rsp) 495// CHECK: wait 496// CHECK: fnstcw (%rsp) 497 498// PR8258 499finit 500// CHECK: wait 501// CHECK: fninit 502 503fsave 32493 504// CHECK: wait 505// CHECK: fnsave 32493 506 507 508// rdar://8456382 - cvtsd2si support. 509cvtsd2si %xmm1, %rax 510// CHECK: cvtsd2si %xmm1, %rax 511// CHECK: encoding: [0xf2,0x48,0x0f,0x2d,0xc1] 512cvtsd2si %xmm1, %eax 513// CHECK: cvtsd2si %xmm1, %eax 514// CHECK: encoding: [0xf2,0x0f,0x2d,0xc1] 515 516cvtsd2siq %xmm0, %rax // CHECK: cvtsd2si %xmm0, %rax 517cvtsd2sil %xmm0, %eax // CHECK: cvtsd2si %xmm0, %eax 518cvtsd2si %xmm0, %rax // CHECK: cvtsd2si %xmm0, %rax 519 520 521cvttpd2dq %xmm1, %xmm0 // CHECK: cvttpd2dq %xmm1, %xmm0 522cvttpd2dq (%rax), %xmm0 // CHECK: cvttpd2dq (%rax), %xmm0 523 524cvttps2dq %xmm1, %xmm0 // CHECK: cvttps2dq %xmm1, %xmm0 525cvttps2dq (%rax), %xmm0 // CHECK: cvttps2dq (%rax), %xmm0 526 527// rdar://8456376 - llvm-mc rejects 'roundss' 528roundss $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0a,0xc0,0x0e] 529roundps $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x08,0xc0,0x0e] 530roundsd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x0b,0xc0,0x0e] 531roundpd $0xE, %xmm0, %xmm0 // CHECK: encoding: [0x66,0x0f,0x3a,0x09,0xc0,0x0e] 532 533 534// rdar://8482675 - 32-bit mem operand support in 64-bit mode (0x67 prefix) 535leal 8(%eax), %esi 536// CHECK: leal 8(%eax), %esi 537// CHECK: encoding: [0x67,0x8d,0x70,0x08] 538leaq 8(%eax), %rsi 539// CHECK: leaq 8(%eax), %rsi 540// CHECK: encoding: [0x67,0x48,0x8d,0x70,0x08] 541leaq 8(%rax), %rsi 542// CHECK: leaq 8(%rax), %rsi 543// CHECK: encoding: [0x48,0x8d,0x70,0x08] 544 545 546cvttpd2dq 0xdeadbeef(%ebx,%ecx,8),%xmm5 547// CHECK: cvttpd2dq 3735928559(%ebx,%ecx,8), %xmm5 548// CHECK: encoding: [0x67,0x66,0x0f,0xe6,0xac,0xcb,0xef,0xbe,0xad,0xde] 549 550// rdar://8490728 - llvm-mc rejects 'movmskpd' 551movmskpd %xmm6, %rax 552// CHECK: movmskpd %xmm6, %rax 553// CHECK: encoding: [0x66,0x48,0x0f,0x50,0xc6] 554movmskpd %xmm6, %eax 555// CHECK: movmskpd %xmm6, %eax 556// CHECK: encoding: [0x66,0x0f,0x50,0xc6] 557 558// rdar://8491845 - Gas supports commuted forms of non-commutable instructions. 559fdivrp %st(0), %st(1) // CHECK: encoding: [0xde,0xf9] 560fdivrp %st(1), %st(0) // CHECK: encoding: [0xde,0xf9] 561 562fsubrp %ST(0), %ST(1) // CHECK: encoding: [0xde,0xe9] 563fsubrp %ST(1), %ST(0) // CHECK: encoding: [0xde,0xe9] 564 565// also PR8861 566fdivp %st(0), %st(1) // CHECK: encoding: [0xde,0xf1] 567fdivp %st(1), %st(0) // CHECK: encoding: [0xde,0xf1] 568 569 570movl foo(%rip), %eax 571// CHECK: movl foo(%rip), %eax 572// CHECK: encoding: [0x8b,0x05,A,A,A,A] 573// CHECK: fixup A - offset: 2, value: foo-4, kind: reloc_riprel_4byte 574 575movb $12, foo(%rip) 576// CHECK: movb $12, foo(%rip) 577// CHECK: encoding: [0xc6,0x05,A,A,A,A,0x0c] 578// CHECK: fixup A - offset: 2, value: foo-5, kind: reloc_riprel_4byte 579 580movw $12, foo(%rip) 581// CHECK: movw $12, foo(%rip) 582// CHECK: encoding: [0x66,0xc7,0x05,A,A,A,A,0x0c,0x00] 583// CHECK: fixup A - offset: 3, value: foo-6, kind: reloc_riprel_4byte 584 585movl $12, foo(%rip) 586// CHECK: movl $12, foo(%rip) 587// CHECK: encoding: [0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00] 588// CHECK: fixup A - offset: 2, value: foo-8, kind: reloc_riprel_4byte 589 590movq $12, foo(%rip) 591// CHECK: movq $12, foo(%rip) 592// CHECK: encoding: [0x48,0xc7,0x05,A,A,A,A,0x0c,0x00,0x00,0x00] 593// CHECK: fixup A - offset: 3, value: foo-8, kind: reloc_riprel_4byte 594 595// CHECK: addq $-424, %rax 596// CHECK: encoding: [0x48,0x05,0x58,0xfe,0xff,0xff] 597addq $-424, %rax 598 599 600// CHECK: movq _foo@GOTPCREL(%rip), %rax 601// CHECK: encoding: [0x48,0x8b,0x05,A,A,A,A] 602// CHECK: fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load 603movq _foo@GOTPCREL(%rip), %rax 604 605// CHECK: movq _foo@GOTPCREL(%rip), %r14 606// CHECK: encoding: [0x4c,0x8b,0x35,A,A,A,A] 607// CHECK: fixup A - offset: 3, value: _foo@GOTPCREL-4, kind: reloc_riprel_4byte_movq_load 608movq _foo@GOTPCREL(%rip), %r14 609 610 611// CHECK: movq (%r13,%rax,8), %r13 612// CHECK: encoding: [0x4d,0x8b,0x6c,0xc5,0x00] 613movq 0x00(%r13,%rax,8),%r13 614 615// CHECK: testq %rax, %rbx 616// CHECK: encoding: [0x48,0x85,0xd8] 617testq %rax, %rbx 618 619// CHECK: cmpq %rbx, %r14 620// CHECK: encoding: [0x49,0x39,0xde] 621 cmpq %rbx, %r14 622 623// rdar://7947167 624 625movsq 626// CHECK: movsq 627// CHECK: encoding: [0x48,0xa5] 628 629movsl 630// CHECK: movsl 631// CHECK: encoding: [0xa5] 632 633stosq 634// CHECK: stosq 635// CHECK: encoding: [0x48,0xab] 636stosl 637// CHECK: stosl 638// CHECK: encoding: [0xab] 639 640 641// Not moffset forms of moves, they are x86-32 only! rdar://7947184 642movb 0, %al // CHECK: movb 0, %al # encoding: [0x8a,0x04,0x25,0x00,0x00,0x00,0x00] 643movw 0, %ax // CHECK: movw 0, %ax # encoding: [0x66,0x8b,0x04,0x25,0x00,0x00,0x00,0x00] 644movl 0, %eax // CHECK: movl 0, %eax # encoding: [0x8b,0x04,0x25,0x00,0x00,0x00,0x00] 645 646// CHECK: pushfq # encoding: [0x9c] 647 pushf 648// CHECK: pushfq # encoding: [0x9c] 649 pushfq 650// CHECK: popfq # encoding: [0x9d] 651 popf 652// CHECK: popfq # encoding: [0x9d] 653 popfq 654 655// CHECK: movabsq $-281474976710654, %rax 656// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff] 657 movabsq $0xFFFF000000000002, %rax 658 659// CHECK: movabsq $-281474976710654, %rax 660// CHECK: encoding: [0x48,0xb8,0x02,0x00,0x00,0x00,0x00,0x00,0xff,0xff] 661 movq $0xFFFF000000000002, %rax 662 663// CHECK: movq $-65536, %rax 664// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0x00,0xff,0xff] 665 movq $0xFFFFFFFFFFFF0000, %rax 666 667// CHECK: movq $-256, %rax 668// CHECK: encoding: [0x48,0xc7,0xc0,0x00,0xff,0xff,0xff] 669 movq $0xFFFFFFFFFFFFFF00, %rax 670 671// CHECK: movq $10, %rax 672// CHECK: encoding: [0x48,0xc7,0xc0,0x0a,0x00,0x00,0x00] 673 movq $10, %rax 674 675// CHECK: movabsb -6066930261531658096, %al 676// CHECK: encoding: [0xa0,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 677 movabsb 0xabcdef1234567890,%al 678 679// CHECK: movabsw -6066930261531658096, %ax 680// CHECK: encoding: [0x66,0xa1,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 681 movabsw 0xabcdef1234567890,%ax 682 683// CHECK: movabsl -6066930261531658096, %eax 684// CHECK: encoding: [0xa1,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 685 movabsl 0xabcdef1234567890,%eax 686 687// CHECK: movabsq -6066930261531658096, %rax 688// CHECK: encoding: [0x48,0xa1,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 689 movabsq 0xabcdef1234567890, %rax 690 691// CHECK: movabsb %al, -6066930261531658096 692// CHECK: encoding: [0xa2,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 693 movabsb %al,0xabcdef1234567890 694 695// CHECK: movabsw %ax, -6066930261531658096 696// CHECK: encoding: [0x66,0xa3,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 697 movabsw %ax,0xabcdef1234567890 698 699// CHECK: movabsl %eax, -6066930261531658096 700// CHECK: encoding: [0xa3,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 701 movabsl %eax,0xabcdef1234567890 702 703// CHECK: movabsq %rax, -6066930261531658096 704// CHECK: encoding: [0x48,0xa3,0x90,0x78,0x56,0x34,0x12,0xef,0xcd,0xab] 705 movabsq %rax,0xabcdef1234567890 706 707// rdar://8014869 708// 709// CHECK: ret 710// CHECK: encoding: [0xc3] 711 retq 712 713// CHECK: sete %al 714// CHECK: encoding: [0x0f,0x94,0xc0] 715 setz %al 716 717// CHECK: setne %al 718// CHECK: encoding: [0x0f,0x95,0xc0] 719 setnz %al 720 721// CHECK: je 0 722// CHECK: encoding: [0x74,A] 723 jz 0 724 725// CHECK: jne 726// CHECK: encoding: [0x75,A] 727 jnz 0 728 729// PR9264 730btl $1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01] 731bt $1, 0 // CHECK: btl $1, 0 # encoding: [0x0f,0xba,0x24,0x25,0x00,0x00,0x00,0x00,0x01] 732 733// rdar://8017515 734btq $0x01,%rdx 735// CHECK: btq $1, %rdx 736// CHECK: encoding: [0x48,0x0f,0xba,0xe2,0x01] 737 738//rdar://8017633 739// CHECK: movzbl %al, %esi 740// CHECK: encoding: [0x0f,0xb6,0xf0] 741 movzx %al, %esi 742 743// CHECK: movzbq %al, %rsi 744// CHECK: encoding: [0x48,0x0f,0xb6,0xf0] 745 movzx %al, %rsi 746 747// CHECK: movsbw %al, %ax 748// CHECK: encoding: [0x66,0x0f,0xbe,0xc0] 749movsx %al, %ax 750 751// CHECK: movsbl %al, %eax 752// CHECK: encoding: [0x0f,0xbe,0xc0] 753movsx %al, %eax 754 755// CHECK: movswl %ax, %eax 756// CHECK: encoding: [0x0f,0xbf,0xc0] 757movsx %ax, %eax 758 759// CHECK: movsbq %bl, %rax 760// CHECK: encoding: [0x48,0x0f,0xbe,0xc3] 761movsx %bl, %rax 762 763// CHECK: movswq %cx, %rax 764// CHECK: encoding: [0x48,0x0f,0xbf,0xc1] 765movsx %cx, %rax 766 767// CHECK: movslq %edi, %rax 768// CHECK: encoding: [0x48,0x63,0xc7] 769movsx %edi, %rax 770 771// CHECK: movzbw %al, %ax 772// CHECK: encoding: [0x66,0x0f,0xb6,0xc0] 773movzx %al, %ax 774 775// CHECK: movzbl %al, %eax 776// CHECK: encoding: [0x0f,0xb6,0xc0] 777movzx %al, %eax 778 779// CHECK: movzwl %ax, %eax 780// CHECK: encoding: [0x0f,0xb7,0xc0] 781movzx %ax, %eax 782 783// CHECK: movzbq %bl, %rax 784// CHECK: encoding: [0x48,0x0f,0xb6,0xc3] 785movzx %bl, %rax 786 787// CHECK: movzwq %cx, %rax 788// CHECK: encoding: [0x48,0x0f,0xb7,0xc1] 789movzx %cx, %rax 790 791// CHECK: movsbw (%rax), %ax 792// CHECK: encoding: [0x66,0x0f,0xbe,0x00] 793movsx (%rax), %ax 794 795// CHECK: movzbw (%rax), %ax 796// CHECK: encoding: [0x66,0x0f,0xb6,0x00] 797movzx (%rax), %ax 798 799 800// rdar://7873482 801// CHECK: [0x65,0x8b,0x04,0x25,0x7c,0x00,0x00,0x00] 802 movl %gs:124, %eax 803 804// CHECK: jmpq *8(%rax) 805// CHECK: encoding: [0xff,0x60,0x08] 806 jmp *8(%rax) 807 808// CHECK: btq $61, -216(%rbp) 809// CHECK: encoding: [0x48,0x0f,0xba,0xa5,0x28,0xff,0xff,0xff,0x3d] 810 btq $61, -216(%rbp) 811 812 813// rdar://8061602 814L1: 815 jecxz L1 816// CHECK: jecxz L1 817// CHECK: encoding: [0x67,0xe3,A] 818 jrcxz L1 819// CHECK: jrcxz L1 820// CHECK: encoding: [0xe3,A] 821 822// PR8061 823xchgl 368(%rax),%ecx 824// CHECK: xchgl %ecx, 368(%rax) 825xchgl %ecx, 368(%rax) 826// CHECK: xchgl %ecx, 368(%rax) 827 828// rdar://8407548 829xchg 0xdeadbeef(%rbx,%rcx,8),%bl 830// CHECK: xchgb %bl, 3735928559(%rbx,%rcx,8) 831 832 833 834// PR7254 835lock incl 1(%rsp) 836// CHECK: lock 837// CHECK: incl 1(%rsp) 838 839// rdar://8741045 840lock/incl 1(%rsp) 841// CHECK: lock 842// CHECK: incl 1(%rsp) 843 844// rdar://8033482 845rep movsl 846// CHECK: rep 847// CHECK: encoding: [0xf3] 848// CHECK: movsl 849// CHECK: encoding: [0xa5] 850 851 852// rdar://8403974 853iret 854// CHECK: iretl 855// CHECK: encoding: [0xcf] 856iretw 857// CHECK: iretw 858// CHECK: encoding: [0x66,0xcf] 859iretl 860// CHECK: iretl 861// CHECK: encoding: [0xcf] 862iretq 863// CHECK: iretq 864// CHECK: encoding: [0x48,0xcf] 865 866// rdar://8416805 867// CHECK: retw $31438 868// CHECK: encoding: [0x66,0xc2,0xce,0x7a] 869 retw $0x7ace 870 871// CHECK: lretw $31438 872// CHECK: encoding: [0x66,0xca,0xce,0x7a] 873 lretw $0x7ace 874 875// PR8592 876lretq // CHECK: lretq # encoding: [0x48,0xcb] 877lretl // CHECK: lretl # encoding: [0xcb] 878lret // CHECK: lretl # encoding: [0xcb] 879lretw // CHECK: lretw # encoding: [0x66,0xcb] 880 881// rdar://8403907 882sysret 883// CHECK: sysretl 884// CHECK: encoding: [0x0f,0x07] 885sysretl 886// CHECK: sysretl 887// CHECK: encoding: [0x0f,0x07] 888sysretq 889// CHECK: sysretq 890// CHECK: encoding: [0x48,0x0f,0x07] 891 892// rdar://8407242 893push %fs 894// CHECK: pushq %fs 895// CHECK: encoding: [0x0f,0xa0] 896push %gs 897// CHECK: pushq %gs 898// CHECK: encoding: [0x0f,0xa8] 899 900pushw %fs 901// CHECK: pushw %fs 902// CHECK: encoding: [0x66,0x0f,0xa0] 903pushw %gs 904// CHECK: pushw %gs 905// CHECK: encoding: [0x66,0x0f,0xa8] 906 907 908pop %fs 909// CHECK: popq %fs 910// CHECK: encoding: [0x0f,0xa1] 911pop %gs 912// CHECK: popq %gs 913// CHECK: encoding: [0x0f,0xa9] 914 915popw %fs 916// CHECK: popw %fs 917// CHECK: encoding: [0x66,0x0f,0xa1] 918popw %gs 919// CHECK: popw %gs 920// CHECK: encoding: [0x66,0x0f,0xa9] 921 922// rdar://8438816 923fildq -8(%rsp) 924fildll -8(%rsp) 925// CHECK: fildll -8(%rsp) 926// CHECK: encoding: [0xdf,0x6c,0x24,0xf8] 927// CHECK: fildll -8(%rsp) 928// CHECK: encoding: [0xdf,0x6c,0x24,0xf8] 929 930// CHECK: callq a 931 callq a 932 933// CHECK: leaq -40(%rbp), %r15 934 leaq -40(%rbp), %r15 935 936 937 938// rdar://8013734 - Alias dr6=db6 939mov %dr6, %rax 940mov %db6, %rax 941// CHECK: movq %dr6, %rax 942// CHECK: movq %dr6, %rax 943 944 945// INC/DEC encodings. 946incb %al // CHECK: incb %al # encoding: [0xfe,0xc0] 947incw %ax // CHECK: incw %ax # encoding: [0x66,0xff,0xc0] 948incl %eax // CHECK: incl %eax # encoding: [0xff,0xc0] 949decb %al // CHECK: decb %al # encoding: [0xfe,0xc8] 950decw %ax // CHECK: decw %ax # encoding: [0x66,0xff,0xc8] 951decl %eax // CHECK: decl %eax # encoding: [0xff,0xc8] 952 953// rdar://8416805 954// CHECK: lgdt 4(%rax) 955// CHECK: encoding: [0x0f,0x01,0x50,0x04] 956 lgdt 4(%rax) 957 958// CHECK: lgdt 4(%rax) 959// CHECK: encoding: [0x0f,0x01,0x50,0x04] 960 lgdtq 4(%rax) 961 962// CHECK: lidt 4(%rax) 963// CHECK: encoding: [0x0f,0x01,0x58,0x04] 964 lidt 4(%rax) 965 966// CHECK: lidt 4(%rax) 967// CHECK: encoding: [0x0f,0x01,0x58,0x04] 968 lidtq 4(%rax) 969 970// CHECK: sgdt 4(%rax) 971// CHECK: encoding: [0x0f,0x01,0x40,0x04] 972 sgdt 4(%rax) 973 974// CHECK: sgdt 4(%rax) 975// CHECK: encoding: [0x0f,0x01,0x40,0x04] 976 sgdtq 4(%rax) 977 978// CHECK: sidt 4(%rax) 979// CHECK: encoding: [0x0f,0x01,0x48,0x04] 980 sidt 4(%rax) 981 982// CHECK: sidt 4(%rax) 983// CHECK: encoding: [0x0f,0x01,0x48,0x04] 984 sidtq 4(%rax) 985 986 987// rdar://8208615 988mov (%rsi), %gs // CHECK: movl (%rsi), %gs # encoding: [0x8e,0x2e] 989mov %gs, (%rsi) // CHECK: movl %gs, (%rsi) # encoding: [0x8c,0x2e] 990 991 992// rdar://8431864 993 div %bl,%al 994 div %bx,%ax 995 div %ecx,%eax 996 div 0xdeadbeef(%ebx,%ecx,8),%eax 997 div 0x45,%eax 998 div 0x7eed,%eax 999 div 0xbabecafe,%eax 1000 div 0x12345678,%eax 1001 idiv %bl,%al 1002 idiv %bx,%ax 1003 idiv %ecx,%eax 1004 idiv 0xdeadbeef(%ebx,%ecx,8),%eax 1005 idiv 0x45,%eax 1006 idiv 0x7eed,%eax 1007 idiv 0xbabecafe,%eax 1008 idiv 0x12345678,%eax 1009 1010// PR8524 1011movd %rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8] 1012movd %mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb] 1013movq %rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8] 1014movq %mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb] 1015 1016rex64 // CHECK: rex64 # encoding: [0x48] 1017data16 // CHECK: data16 # encoding: [0x66] 1018 1019// PR8855 1020movq 18446744073709551615,%rbx // CHECK: movq -1, %rbx 1021 1022// PR8946 1023movdqu %xmm0, %xmm1 // CHECK: movdqu %xmm0, %xmm1 # encoding: [0xf3,0x0f,0x6f,0xc8] 1024 1025// PR8935 1026xgetbv // CHECK: xgetbv # encoding: [0x0f,0x01,0xd0] 1027xsetbv // CHECK: xsetbv # encoding: [0x0f,0x01,0xd1] 1028 1029// CHECK: loope 0 1030// CHECK: encoding: [0xe1,A] 1031 loopz 0 1032 1033// CHECK: loopne 0 1034// CHECK: encoding: [0xe0,A] 1035 loopnz 0 1036 1037// CHECK: outsb # encoding: [0x6e] 1038// CHECK: outsb 1039// CHECK: outsb 1040 outsb 1041 outsb %ds:(%rsi), %dx 1042 outsb (%rsi), %dx 1043 1044// CHECK: outsw # encoding: [0x66,0x6f] 1045// CHECK: outsw 1046// CHECK: outsw 1047 outsw 1048 outsw %ds:(%rsi), %dx 1049 outsw (%rsi), %dx 1050 1051// CHECK: outsl # encoding: [0x6f] 1052// CHECK: outsl 1053 outsl 1054 outsl %ds:(%rsi), %dx 1055 outsl (%rsi), %dx 1056 1057// CHECK: insb # encoding: [0x6c] 1058// CHECK: insb 1059 insb 1060 insb %dx, %es:(%rdi) 1061 1062// CHECK: insw # encoding: [0x66,0x6d] 1063// CHECK: insw 1064 insw 1065 insw %dx, %es:(%rdi) 1066 1067// CHECK: insl # encoding: [0x6d] 1068// CHECK: insl 1069 insl 1070 insl %dx, %es:(%rdi) 1071 1072// CHECK: movsb # encoding: [0xa4] 1073// CHECK: movsb 1074// CHECK: movsb 1075 movsb 1076 movsb %ds:(%rsi), %es:(%rdi) 1077 movsb (%rsi), %es:(%rdi) 1078 1079// CHECK: movsw # encoding: [0x66,0xa5] 1080// CHECK: movsw 1081// CHECK: movsw 1082 movsw 1083 movsw %ds:(%rsi), %es:(%rdi) 1084 movsw (%rsi), %es:(%rdi) 1085 1086// CHECK: movsl # encoding: [0xa5] 1087// CHECK: movsl 1088// CHECK: movsl 1089 movsl 1090 movsl %ds:(%rsi), %es:(%rdi) 1091 movsl (%rsi), %es:(%rdi) 1092// rdar://10883092 1093// CHECK: movsl 1094 movsl (%rsi), (%rdi) 1095 1096// CHECK: movsq # encoding: [0x48,0xa5] 1097// CHECK: movsq 1098// CHECK: movsq 1099 movsq 1100 movsq %ds:(%rsi), %es:(%rdi) 1101 movsq (%rsi), %es:(%rdi) 1102 1103// CHECK: lodsb # encoding: [0xac] 1104// CHECK: lodsb 1105// CHECK: lodsb 1106// CHECK: lodsb 1107// CHECK: lodsb 1108 lodsb 1109 lodsb %ds:(%rsi), %al 1110 lodsb (%rsi), %al 1111 lods %ds:(%rsi), %al 1112 lods (%rsi), %al 1113 1114// CHECK: lodsw # encoding: [0x66,0xad] 1115// CHECK: lodsw 1116// CHECK: lodsw 1117// CHECK: lodsw 1118// CHECK: lodsw 1119 lodsw 1120 lodsw %ds:(%rsi), %ax 1121 lodsw (%rsi), %ax 1122 lods %ds:(%rsi), %ax 1123 lods (%rsi), %ax 1124 1125// CHECK: lodsl # encoding: [0xad] 1126// CHECK: lodsl 1127// CHECK: lodsl 1128// CHECK: lodsl 1129// CHECK: lodsl 1130 lodsl 1131 lodsl %ds:(%rsi), %eax 1132 lodsl (%rsi), %eax 1133 lods %ds:(%rsi), %eax 1134 lods (%rsi), %eax 1135 1136// CHECK: lodsq # encoding: [0x48,0xad] 1137// CHECK: lodsq 1138// CHECK: lodsq 1139// CHECK: lodsq 1140// CHECK: lodsq 1141 lodsq 1142 lodsq %ds:(%rsi), %rax 1143 lodsq (%rsi), %rax 1144 lods %ds:(%rsi), %rax 1145 lods (%rsi), %rax 1146 1147// CHECK: stosb # encoding: [0xaa] 1148// CHECK: stosb 1149// CHECK: stosb 1150 stosb 1151 stosb %al, %es:(%rdi) 1152 stos %al, %es:(%rdi) 1153 1154// CHECK: stosw # encoding: [0x66,0xab] 1155// CHECK: stosw 1156// CHECK: stosw 1157 stosw 1158 stosw %ax, %es:(%rdi) 1159 stos %ax, %es:(%rdi) 1160 1161// CHECK: stosl # encoding: [0xab] 1162// CHECK: stosl 1163// CHECK: stosl 1164 stosl 1165 stosl %eax, %es:(%rdi) 1166 stos %eax, %es:(%rdi) 1167 1168// CHECK: stosq # encoding: [0x48,0xab] 1169// CHECK: stosq 1170// CHECK: stosq 1171 stosq 1172 stosq %rax, %es:(%rdi) 1173 stos %rax, %es:(%rdi) 1174 1175// CHECK: strw 1176// CHECK: encoding: [0x66,0x0f,0x00,0xc8] 1177 str %ax 1178 1179// CHECK: strl 1180// CHECK: encoding: [0x0f,0x00,0xc8] 1181 str %eax 1182 1183// CHECK: strw 1184// CHECK: encoding: [0x66,0x0f,0x00,0xc8] 1185 str %ax 1186 1187// CHECK: strq 1188// CHECK: encoding: [0x48,0x0f,0x00,0xc8] 1189 str %rax 1190 1191// CHECK: movd %rdi, %xmm0 1192// CHECK: encoding: [0x66,0x48,0x0f,0x6e,0xc7] 1193 movq %rdi,%xmm0 1194 1195// CHECK: movd %rdi, %xmm0 1196// CHECK: encoding: [0x66,0x48,0x0f,0x6e,0xc7] 1197 movd %rdi,%xmm0 1198 1199// CHECK: movd %xmm0, %rax 1200// CHECK: encoding: [0x66,0x48,0x0f,0x7e,0xc0] 1201 movd %xmm0, %rax 1202 1203// CHECK: movntil %eax, (%rdi) 1204// CHECK: encoding: [0x0f,0xc3,0x07] 1205// CHECK: movntil 1206movntil %eax, (%rdi) 1207movnti %eax, (%rdi) 1208 1209// CHECK: movntiq %rax, (%rdi) 1210// CHECK: encoding: [0x48,0x0f,0xc3,0x07] 1211// CHECK: movntiq 1212movntiq %rax, (%rdi) 1213movnti %rax, (%rdi) 1214 1215// CHECK: pclmulqdq $17, %xmm0, %xmm1 1216// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0xc8,0x11] 1217pclmulhqhqdq %xmm0, %xmm1 1218 1219// CHECK: pclmulqdq $1, %xmm0, %xmm1 1220// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0xc8,0x01] 1221pclmulqdq $1, %xmm0, %xmm1 1222 1223// CHECK: pclmulqdq $16, (%rdi), %xmm1 1224// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0x0f,0x10] 1225pclmullqhqdq (%rdi), %xmm1 1226 1227// CHECK: pclmulqdq $0, (%rdi), %xmm1 1228// CHECK: encoding: [0x66,0x0f,0x3a,0x44,0x0f,0x00] 1229pclmulqdq $0, (%rdi), %xmm1 1230 1231// PR10345 1232// CHECK: xchgq %rax, %rax 1233// CHECK: encoding: [0x48,0x90] 1234xchgq %rax, %rax 1235 1236// CHECK: xchgl %eax, %eax 1237// CHECK: encoding: [0x87,0xc0] 1238xchgl %eax, %eax 1239 1240// CHECK: xchgw %ax, %ax 1241// CHECK: encoding: [0x66,0x90] 1242xchgw %ax, %ax 1243 1244// CHECK: xchgl %ecx, %eax 1245// CHECK: encoding: [0x91] 1246xchgl %ecx, %eax 1247 1248// CHECK: xchgl %ecx, %eax 1249// CHECK: encoding: [0x91] 1250xchgl %eax, %ecx 1251 1252// CHECK: sysexit 1253// CHECK: encoding: [0x0f,0x35] 1254sysexit 1255 1256// CHECK: sysexitl 1257// CHECK: encoding: [0x0f,0x35] 1258sysexitl 1259 1260// CHECK: sysexitq 1261// CHECK: encoding: [0x48,0x0f,0x35] 1262sysexitq 1263 1264// CHECK: clac 1265// CHECK: encoding: [0x0f,0x01,0xca] 1266clac 1267 1268// CHECK: stac 1269// CHECK: encoding: [0x0f,0x01,0xcb] 1270stac 1271