Home | History | Annotate | Download | only in X86
      1 // RUN: not llvm-mc -triple x86_64-unknown-unknown --show-encoding %s 2> %t.err | FileCheck --check-prefix=64 %s
      2 // RUN: FileCheck --check-prefix=ERR64 < %t.err %s
      3 // RUN: not llvm-mc -triple i386-unknown-unknown --show-encoding %s 2> %t.err | FileCheck --check-prefix=32 %s
      4 // RUN: FileCheck --check-prefix=ERR32 < %t.err %s
      5 // RUN: not llvm-mc -triple i386-unknown-unknown-code16 --show-encoding %s 2> %t.err | FileCheck --check-prefix=16 %s
      6 // RUN: FileCheck --check-prefix=ERR16 < %t.err %s
      7 
      8 lodsb
      9 // 64: lodsb (%rsi), %al # encoding: [0xac]
     10 // 32: lodsb (%esi), %al # encoding: [0xac]
     11 // 16: lodsb (%si), %al # encoding: [0xac]
     12 
     13 lodsb (%rsi), %al
     14 // 64: lodsb (%rsi), %al # encoding: [0xac]
     15 // ERR32: 64-bit
     16 // ERR16: 64-bit
     17 
     18 lodsb (%esi), %al
     19 // 64: lodsb (%esi), %al # encoding: [0x67,0xac]
     20 // 32: lodsb (%esi), %al # encoding: [0xac]
     21 // 16: lodsb (%esi), %al # encoding: [0x67,0xac]
     22 
     23 lodsb (%si), %al
     24 // ERR64: invalid 16-bit base register
     25 // 32: lodsb (%si), %al # encoding: [0x67,0xac]
     26 // 16: lodsb (%si), %al # encoding: [0xac]
     27 
     28 lodsl %gs:(%esi)
     29 // 64: lodsl %gs:(%esi), %eax # encoding: [0x65,0x67,0xad]
     30 // 32: lodsl %gs:(%esi), %eax # encoding: [0x65,0xad]
     31 // 16: lodsl %gs:(%esi), %eax # encoding: [0x66,0x65,0x67,0xad]
     32 
     33 lodsl (%edi), %eax
     34 // ERR64: invalid operand
     35 // ERR32: invalid operand
     36 // ERR16: invalid operand
     37 
     38 lodsl 44(%edi), %eax
     39 // ERR64: invalid operand
     40 // ERR32: invalid operand
     41 // ERR16: invalid operand
     42 
     43 lods (%esi), %ax
     44 // 64: lodsw (%esi), %ax # encoding: [0x66,0x67,0xad]
     45 // 32: lodsw (%esi), %ax # encoding: [0x66,0xad]
     46 // 16: lodsw (%esi), %ax # encoding: [0x67,0xad]
     47 
     48 stosw
     49 // 64: stosw %ax, %es:(%rdi) # encoding: [0x66,0xab]
     50 // 32: stosw %ax, %es:(%edi) # encoding: [0x66,0xab]
     51 // 16: stosw %ax, %es:(%di) # encoding: [0xab]
     52 
     53 stos %eax, (%edi)
     54 // 64: stosl %eax, %es:(%edi) # encoding: [0x67,0xab]
     55 // 32: stosl %eax, %es:(%edi) # encoding: [0xab]
     56 // 16: stosl %eax, %es:(%edi) # encoding: [0x66,0x67,0xab]
     57 
     58 stosb %al, %fs:(%edi)
     59 // ERR64: invalid operand for instruction
     60 // ERR32: invalid operand for instruction
     61 // ERR16: invalid operand for instruction
     62 
     63 stosb %al, %es:(%edi)
     64 // 64: stosb %al, %es:(%edi) # encoding: [0x67,0xaa]
     65 // 32: stosb %al, %es:(%edi) # encoding: [0xaa]
     66 // 16: stosb %al, %es:(%edi) # encoding: [0x67,0xaa]
     67 
     68 stosq
     69 // 64: stosq %rax, %es:(%rdi) # encoding: [0x48,0xab]
     70 // ERR32: 64-bit
     71 // ERR16: 64-bit
     72 
     73 stos %rax, (%edi)
     74 // 64: 	stosq %rax, %es:(%edi) # encoding: [0x48,0x67,0xab]
     75 // ERR32: only available in 64-bit mode
     76 // ERR16: only available in 64-bit mode
     77 
     78 scas %es:(%edi), %al
     79 // 64: scasb %es:(%edi), %al # encoding: [0x67,0xae]
     80 // 32: scasb %es:(%edi), %al # encoding: [0xae]
     81 // 16: scasb %es:(%edi), %al # encoding: [0x67,0xae]
     82 
     83 scasq %es:(%edi)
     84 // 64: scasq %es:(%edi), %rax # encoding: [0x48,0x67,0xaf]
     85 // ERR32: 64-bit
     86 // ERR16: 64-bit
     87 
     88 scasl %es:(%edi), %al
     89 // ERR64: invalid operand
     90 // ERR32: invalid operand
     91 // ERR16: invalid operand
     92 
     93 scas %es:(%di), %ax
     94 // ERR64: invalid 16-bit base register
     95 // 16: scasw %es:(%di), %ax # encoding: [0xaf]
     96 // 32: scasw %es:(%di), %ax # encoding: [0x66,0x67,0xaf]
     97 
     98 cmpsb
     99 // 64: cmpsb %es:(%rdi), (%rsi) # encoding: [0xa6]
    100 // 32: cmpsb %es:(%edi), (%esi) # encoding: [0xa6]
    101 // 16: cmpsb %es:(%di), (%si) # encoding: [0xa6]
    102 
    103 cmpsw (%edi), (%esi)
    104 // 64: cmpsw %es:(%edi), (%esi) # encoding: [0x66,0x67,0xa7]
    105 // 32: cmpsw %es:(%edi), (%esi) # encoding: [0x66,0xa7]
    106 // 16: cmpsw %es:(%edi), (%esi) # encoding: [0x67,0xa7]
    107 
    108 cmpsb (%di), (%esi)
    109 // ERR64: invalid 16-bit base register
    110 // ERR32: mismatching source and destination
    111 // ERR16: mismatching source and destination
    112 
    113 cmpsl %es:(%edi), %ss:(%esi)
    114 // 64: cmpsl %es:(%edi), %ss:(%esi) # encoding: [0x36,0x67,0xa7]
    115 // 32: cmpsl %es:(%edi), %ss:(%esi) # encoding: [0x36,0xa7]
    116 // 16: cmpsl %es:(%edi), %ss:(%esi) # encoding: [0x66,0x36,0x67,0xa7]
    117 
    118 cmpsq (%rdi), (%rsi)
    119 // 64: cmpsq %es:(%rdi), (%rsi) # encoding: [0x48,0xa7]
    120 // ERR32: 64-bit
    121 // ERR16: 64-bit
    122 
    123 movsb (%esi), (%edi)
    124 // 64: movsb (%esi), %es:(%edi) # encoding: [0x67,0xa4]
    125 // 32: movsb (%esi), %es:(%edi) # encoding: [0xa4]
    126 // 16: movsb (%esi), %es:(%edi) # encoding: [0x67,0xa4]
    127 
    128 movsl %gs:(%esi), (%edi)
    129 // 64: movsl %gs:(%esi), %es:(%edi) # encoding: [0x65,0x67,0xa5]
    130 // 32: movsl %gs:(%esi), %es:(%edi) # encoding: [0x65,0xa5]
    131 // 16: movsl %gs:(%esi), %es:(%edi) # encoding: [0x66,0x65,0x67,0xa5]
    132 
    133 outsb
    134 // 64: outsb (%rsi), %dx # encoding: [0x6e]
    135 // 32: outsb (%esi), %dx # encoding: [0x6e]
    136 // 16: outsb (%si), %dx # encoding: [0x6e]
    137 
    138 outsw %fs:(%esi), %dx
    139 // 64: outsw %fs:(%esi), %dx # encoding: [0x66,0x64,0x67,0x6f]
    140 // 32: outsw %fs:(%esi), %dx # encoding: [0x66,0x64,0x6f]
    141 // 16: outsw %fs:(%esi), %dx # encoding: [0x64,0x67,0x6f]
    142 
    143 insw %dx, (%edi)
    144 // 64: insw %dx, %es:(%edi) # encoding: [0x66,0x67,0x6d]
    145 // 32: insw %dx, %es:(%edi) # encoding: [0x66,0x6d]
    146 // 16: insw %dx, %es:(%edi) # encoding: [0x67,0x6d]
    147