1.psize 0
2.text
3#test jumps and calls
41:	jmp	1b
5	jmp	xxx
6	jmp	*xxx
7	jmp	xxx(,1)
8	jmp	*%edi
9	jmp	%edi
10	jmp	*(%edi)
11	jmp	(%edi)
12	ljmp	*xxx(,%edi,4)
13	ljmp	xxx(,%edi,4)
14	ljmp	*xxx
15	ljmp	xxx(,1)
16	ljmp	$0x1234,$xxx
17
18	call	1b
19	call	xxx
20	call	*xxx
21	call	xxx(,1)
22	call	*%edi
23	call	%edi
24	call	*(%edi)
25	call	(%edi)
26	lcall	*xxx(,%edi,4)
27	lcall	xxx(,%edi,4)
28	lcall	*xxx
29	lcall	xxx(,1)
30	lcall	$0x1234,$xxx
31
32# test various segment reg insns
33	push	%ds
34	pushl	%ds
35	pop	%ds
36	popl	%ds
37	mov	%ds,%eax
38	movl	%ds,%eax
39	movl	%ds,%ebx
40	mov	%eax,%ds
41	movl	%ebx,%ds
42	movl	%eax,%ds
43
44	pushw	%ds
45	popw	%ds
46	mov	%ds,%ax
47	movw	%ds,%ax
48	movw	%ds,%di
49	mov	%ax,%ds
50	movw	%ax,%ds
51	movw	%di,%ds
52
53# test various pushes
54	pushl	$10
55	pushw	$10
56	push	$10
57	pushl	$1000
58	pushw	$1000
59	push	$1000
60	pushl	1f
61	pushw	1f
62	push	1f
63	push	(1f-.)(%ebx)
64	push	1f-.
65# these, and others like them should have no operand size prefix
661:	lldt	%cx
67	lmsw	%ax
68
69# Just to make sure these don't become illegal due to over-enthusiastic
70# register checking
71	movsbw	%al,%di
72	movsbl	%al,%ecx
73	movswl	%ax,%ecx
74	movzbw	%al,%di
75	movzbl	%al,%ecx
76	movzwl	%ax,%ecx
77
78	in	%dx,%al
79	in	%dx,%ax
80	in	%dx,%eax
81	in	(%dx),%al
82	in	(%dx),%ax
83	in	(%dx),%eax
84	inb	%dx,%al
85	inw	%dx,%ax
86	inl	%dx,%eax
87	inb	%dx
88	inw	%dx
89	inl	%dx
90	inb	$255
91	inw	$2
92	inl	$4
93	in	$13, %ax
94	out	%al,%dx
95	out	%ax,%dx
96	out	%eax,%dx
97	out	%al,(%dx)
98	out	%ax,(%dx)
99	out	%eax,(%dx)
100	outb	%al,%dx
101	outw	%ax,%dx
102	outl	%eax,%dx
103	outb	%dx
104	outw	%dx
105	outl	%dx
106	outb	$255
107	outw	$2
108	outl	$4
109	out	%ax, $13
110# These are used in AIX.
111	inw	(%dx)
112	outw	(%dx)
113
114	movsb
115	cmpsw
116	scasl
117	xlatb
118	movsl	%cs:(%esi),%es:(%edi)
119	setae	(%ebx)
120	setaeb	(%ebx)
121	setae	%al
122
123	orb	$1,%al
124	orl	$0x100,%eax
125	orb	$1,%bl
126
127#these should give warnings
128	fldl	%st(1)
129	fstl	%st(2)
130	fstpl	%st(3)
131	fcoml	%st(4)
132	fcompl	%st(5)
133	faddp	%st(1),%st
134	fmulp	%st(2),%st
135	fsub	%st(3),%st
136	fsubr	%st(4),%st
137	fdiv	%st(5),%st
138	fdivr	%st(6),%st
139	fadd
140	fsub
141	fmul
142	fdiv
143	fsubr
144	fdivr
145#these should all be legal
146	btl	%edx, 0x123456
147	btl	%edx, %eax
148	orb	$1,%al
149	orb	$1,%bl
150	movl	17,%eax
151	mov	17,%eax
152	inw	%dx,%ax
153	inl	%dx,%eax
154	inw	(%dx),%ax
155	inl	(%dx),%eax
156	in	(%dx),%al
157	in	(%dx),%ax
158	in	(%dx),%eax
159	movzbl	(%edi,%esi),%edx
160	movzbl	28(%ebp),%eax
161	movzbl	%al,%eax
162	movzbl	%cl,%esi
163	xlat	%es:(%ebx)
164	xlat
165	xlatb
1661:	fstp	%st(0)
167	loop	1b
168	divb    %cl
169	divw    %cx
170	divl    %ecx
171	div	%cl
172	div	%cx
173	div	%ecx
174	div	%cl,%al
175	div	%cx,%ax
176	div	%ecx,%eax
177	mov	%si,%ds
178	movl	%edi,%ds
179	pushl	%ds
180	push	%ds
181	mov	0,%al
182	mov	0x10000,%ax
183	mov	%eax,%ebx
184	pushf
185	pushfl
186	pushfw
187	popf
188	popfl
189	popfw
190	mov	%esi,(,%ebx,1)
191	andb	$~0x80,foo
192
193	and	$0xfffe,%ax
194	and	$0xff00,%ax
195	and	$0xfffe,%eax
196	and	$0xff00,%eax
197	and	$0xfffffffe,%eax
198
199.code16
200	and	$0xfffe,%ax
201	and	$0xff00,%ax
202	and	$0xfffe,%eax
203	and	$0xff00,%eax
204	and	$0xfffffffe,%eax
205
206#check 16-bit code auto address prefix
207.code16gcc
208	leal	-256(%ebp),%edx
209	mov	%al,-129(%ebp)
210	mov	%ah,-128(%ebp)
211	leal	-1760(%ebp),%ebx
212	movl	%eax,140(%esp)
213
214.code32
215# Make sure that we won't remove movzb by accident.
216	movzb	%al,%di
217	movzb	%al,%ecx
218
219.code16gcc
220# Except for IRET use 32-bit implicit stack accesses by default.
221	call	.
222	call	*(%bx)
223	enter	$0,$0
224	iret
225	lcall	*(%bx)
226	lcall	$0,$0
227	leave
228	lret
229	lret	$0
230	push	$0
231	push	$0x1234
232	push	(%bx)
233	push	%es
234	push	%fs
235	pusha
236	pushf
237	pop	(%bx)
238	pop	%es
239	pop	%fs
240	popa
241	popf
242	ret
243	ret	$0
244
245# However use 16-bit branches not accessing the stack by default.
246	ja	.
247	ja	.+0x1234
248	jcxz	.
249	jmp	.
250	jmp	.+0x1234
251	jmp	*(%bx)
252	ljmp	*(%bx)
253	ljmp	$0,$0
254	loop	.
255	syscall
256	sysenter
257	sysexit
258	sysret
259	xbegin	.
260
261# Use 16-bit layout by default for fldenv.
262	fldenv	(%eax)
263	fldenvs	(%eax)
264	fldenvl	(%eax)
265
266	# Force a good alignment.
267	.p2align	4,0
268