1 # RUN: llvm-mc --disassemble %s -triple=x86_64 | FileCheck %s 2 3 # CHECK: rep insb %dx, %es:(%rdi) 4 0xf3 0x6c #rep ins 5 # CHECK: rep insl %dx, %es:(%rdi) 6 0xf3 0x6d #rep ins 7 # CHECK: rep movsb (%rsi), %es:(%rdi) 8 0xf3 0xa4 #rep movs 9 # CHECK: rep movsl (%rsi), %es:(%rdi) 10 0xf3 0xa5 #rep movs 11 # CHECK: rep outsb (%rsi), %dx 12 0xf3 0x6e #rep outs 13 # CHECK: rep outsl (%rsi), %dx 14 0xf3 0x6f #rep outs 15 # CHECK: rep lodsb (%rsi), %al 16 0xf3 0xac #rep lods 17 # CHECK: rep lodsl (%rsi), %eax 18 0xf3 0xad #rep lods 19 # CHECK: rep stosb %al, %es:(%rdi) 20 0xf3 0xaa #rep stos 21 # CHECK: rep stosl %eax, %es:(%rdi) 22 0xf3 0xab #rep stos 23 # CHECK: rep cmpsb %es:(%rdi), (%rsi) 24 0xf3 0xa6 #rep cmps 25 # CHECK: rep cmpsl %es:(%rdi), (%rsi) 26 0xf3 0xa7 #repe cmps 27 # CHECK: rep scasb %es:(%rdi), %al 28 0xf3 0xae #repe scas 29 # CHECK: rep scasl %es:(%rdi), %eax 30 0xf3 0xaf #repe scas 31 # CHECK: repne cmpsb %es:(%rdi), (%rsi) 32 0xf2 0xa6 #repne cmps 33 # CHECK: repne cmpsl %es:(%rdi), (%rsi) 34 0xf2 0xa7 #repne cmps 35 # CHECK: repne scasb %es:(%rdi), %al 36 0xf2 0xae #repne scas 37 # CHECK: repne scasl %es:(%rdi), %eax 38 0xf2 0xaf #repne scas 39 40 # CHECK: repne scasw %es:(%rdi), %ax 41 # CHECK: repne scasw %es:(%rdi), %ax 42 0x66 0xF2 0xAF 0xF2 0x66 0xAF 43 44 # CHECK: lock 45 # CHECK-NEXT: orl $16, %fs:776 46 0xf0 0x64 0x83 0x0c 0x25 0x08 0x03 0x00 0x00 0x10 47 48 # CHECK: movq %fs:768, %rdi 49 0x64 0x48 0x8b 0x3c 0x25 0x00 0x03 0x00 0x00 50 51 # CHECK: rep stosq %rax, %es:(%rdi) 52 0xf3 0x48 0xab 53 54 # CHECK: rep stosq %rax, %es:(%edi) 55 0xf3 0x67 0x48 0xab 56 57 # CHECK: movl 32(%rbp), %eax 58 0x8b 0x45 0x20 59 60 # CHECK: movl %es:32(%rbp), %eax 61 0x26 0x8b 0x45 0x20 62 63 # CHECK: movl %es:32(%rbp), %eax 64 0x2e 0x26 0x8b 0x45 0x20 65 66 # Test that multiple prefixes stack. 67 # (todo- the correct disassembly is actually more like "es movl %cs:32(%rbp), %eax" 68 # but we don't support that) 69 # CHECK: movl %cs:32(%rbp), %eax 70 0x26 0x2e 0x8b 0x45 0x20 71 72 # Test that 0xf3 as part of the opcode works. 73 # CHECK: cvtdq2pd (%rax), %xmm0 74 0xf3 0x0f 0xe6 0x00 75 76 # CHECK: pause 77 0xf3 0x90 78 79 # CHECK: nop 80 0x90 81 82 # CHECK: lock 83 # CHECK-NEXT: nop 84 0xf0 0x90 85 86 # Test that immediate is printed correctly within opsize prefix 87 # CHECK: addw $-12, %ax 88 0x66,0x83,0xc0,0xf4 89 90 # Test that multiple redundant prefixes work (redundant, but valid x86). 91 # CHECK: rep stosq 92 0xf3 0xf3 0x48 0xab 93 94 # Test that we can disassembler control registers above CR8 95 # CHECK: movq %cr15, %rax 96 0x44 0x0f 0x20 0xf8 97 # CHECK: movq %dr15, %rax 98 0x44 0x0f 0x21 0xf8 99 100 # Test that MMX ignore REX.R and REX.B. 101 # CHECK: movq %mm0, %mm1 102 0x46 0x0f 0x7f 0xc1 103 104 # Test that lock prefix is not dropped if it's not the first prefix 105 # CHECK: lock cmpxchgw %di, (%rcx) 106 0x66 0xf0 0x0f 0xb1 0x39 107 108 # Test that a prefix on it's own works. It's debatable as to if this is 109 # something that is considered valid, but however as LLVM's own disassembler 110 # has decided to disassemble prefixes as being separate opcodes, it therefore 111 # should be capable of re-consuming it's own output. 112 # CHECK: rep 113 0xf3 114 # ***IMPORTANT ^-- this must be at the end of the file to be a valid test *** 115