[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / MC / X86 / index-operations.s
blob0f9bc91f7ade7578be429e2e77ace578c74a7a22
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
8 lodsb
9 // 64: lodsb (%rsi), %al # encoding: [0xac]
10 // 32: lodsb (%esi), %al # encoding: [0xac]
11 // 16: lodsb (%si), %al # encoding: [0xac]
13 lodsb (%rsi), %al
14 // 64: lodsb (%rsi), %al # encoding: [0xac]
15 // ERR32: 64-bit
16 // ERR16: 64-bit
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]
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]
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]
33 lodsl (%edi), %eax
34 // ERR64: invalid operand
35 // ERR32: invalid operand
36 // ERR16: invalid operand
38 lodsl 44(%edi), %eax
39 // ERR64: invalid operand
40 // ERR32: invalid operand
41 // ERR16: invalid operand
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]
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]
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]
58 stosb %al, %fs:(%edi)
59 // ERR64: invalid operand for instruction
60 // ERR32: invalid operand for instruction
61 // ERR16: invalid operand for instruction
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]
68 stosq
69 // 64: stosq %rax, %es:(%rdi) # encoding: [0x48,0xab]
70 // ERR32: 64-bit
71 // ERR16: 64-bit
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
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]
83 scasq %es:(%edi)
84 // 64: scasq %es:(%edi), %rax # encoding: [0x48,0x67,0xaf]
85 // ERR32: 64-bit
86 // ERR16: 64-bit
88 scasl %es:(%edi), %al
89 // ERR64: invalid operand
90 // ERR32: invalid operand
91 // ERR16: invalid operand
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]
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]
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]
108 cmpsb (%di), (%esi)
109 // ERR64: invalid 16-bit base register
110 // ERR32: mismatching source and destination
111 // ERR16: mismatching source and destination
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]
118 cmpsq (%rdi), (%rsi)
119 // 64: cmpsq %es:(%rdi), (%rsi) # encoding: [0x48,0xa7]
120 // ERR32: 64-bit
121 // ERR16: 64-bit
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]
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]
133 outsb
134 // 64: outsb (%rsi), %dx # encoding: [0x6e]
135 // 32: outsb (%esi), %dx # encoding: [0x6e]
136 // 16: outsb (%si), %dx # encoding: [0x6e]
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]
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]
148 insw %dx, (%bx)
149 // ERR64: invalid 16-bit base register
150 // 32: insw %dx, %es:(%di) # encoding: [0x66,0x67,0x6d]
151 // 16: insw %dx, %es:(%di) # encoding: [0x6d]
153 insw %dx, (%ebx)
154 // 64: insw %dx, %es:(%edi) # encoding: [0x66,0x67,0x6d]
155 // 32: insw %dx, %es:(%edi) # encoding: [0x66,0x6d]
156 // 16: insw %dx, %es:(%edi) # encoding: [0x67,0x6d]
158 insw %dx, (%rbx)
159 // 64: insw %dx, %es:(%rdi) # encoding: [0x66,0x6d]
160 // ERR32: 64-bit
161 // ERR16: 64-bit