1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
4bf215546Sopenharmony_ci *
5bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
6bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
7bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
8bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
10bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci *
12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included
13bf215546Sopenharmony_ci * in all copies or substantial portions of the Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
22bf215546Sopenharmony_ci *
23bf215546Sopenharmony_ci **************************************************************************/
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci#ifndef _RTASM_X86SSE_H_
26bf215546Sopenharmony_ci#define _RTASM_X86SSE_H_
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
29bf215546Sopenharmony_ci#include "pipe/p_config.h"
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci/* It is up to the caller to ensure that instructions issued are
34bf215546Sopenharmony_ci * suitable for the host cpu.  There are no checks made in this module
35bf215546Sopenharmony_ci * for mmx/sse/sse2 support on the cpu.
36bf215546Sopenharmony_ci */
37bf215546Sopenharmony_cistruct x86_reg {
38bf215546Sopenharmony_ci   unsigned file:2;
39bf215546Sopenharmony_ci   unsigned idx:4;
40bf215546Sopenharmony_ci   unsigned mod:2;		/* mod_REG if this is just a register */
41bf215546Sopenharmony_ci   int      disp:24;		/* only +/- 23bits of offset - should be enough... */
42bf215546Sopenharmony_ci};
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_ci#define X86_MMX 1
45bf215546Sopenharmony_ci#define X86_MMX2 2
46bf215546Sopenharmony_ci#define X86_SSE 4
47bf215546Sopenharmony_ci#define X86_SSE2 8
48bf215546Sopenharmony_ci#define X86_SSE3 0x10
49bf215546Sopenharmony_ci#define X86_SSE4_1 0x20
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_cistruct x86_function {
52bf215546Sopenharmony_ci   unsigned caps;
53bf215546Sopenharmony_ci   unsigned size;
54bf215546Sopenharmony_ci   unsigned char *store;
55bf215546Sopenharmony_ci   unsigned char *csr;
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_ci   unsigned stack_offset:16;
58bf215546Sopenharmony_ci   unsigned need_emms:8;
59bf215546Sopenharmony_ci   int x87_stack:8;
60bf215546Sopenharmony_ci
61bf215546Sopenharmony_ci   unsigned char error_overflow[4];
62bf215546Sopenharmony_ci};
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_cienum x86_reg_file {
65bf215546Sopenharmony_ci   file_REG32,
66bf215546Sopenharmony_ci   file_MMX,
67bf215546Sopenharmony_ci   file_XMM,
68bf215546Sopenharmony_ci   file_x87
69bf215546Sopenharmony_ci};
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ci/* Values for mod field of modr/m byte
72bf215546Sopenharmony_ci */
73bf215546Sopenharmony_cienum x86_reg_mod {
74bf215546Sopenharmony_ci   mod_INDIRECT,
75bf215546Sopenharmony_ci   mod_DISP8,
76bf215546Sopenharmony_ci   mod_DISP32,
77bf215546Sopenharmony_ci   mod_REG
78bf215546Sopenharmony_ci};
79bf215546Sopenharmony_ci
80bf215546Sopenharmony_cienum x86_reg_name {
81bf215546Sopenharmony_ci   reg_AX,
82bf215546Sopenharmony_ci   reg_CX,
83bf215546Sopenharmony_ci   reg_DX,
84bf215546Sopenharmony_ci   reg_BX,
85bf215546Sopenharmony_ci   reg_SP,
86bf215546Sopenharmony_ci   reg_BP,
87bf215546Sopenharmony_ci   reg_SI,
88bf215546Sopenharmony_ci   reg_DI,
89bf215546Sopenharmony_ci   reg_R8,
90bf215546Sopenharmony_ci   reg_R9,
91bf215546Sopenharmony_ci   reg_R10,
92bf215546Sopenharmony_ci   reg_R11,
93bf215546Sopenharmony_ci   reg_R12,
94bf215546Sopenharmony_ci   reg_R13,
95bf215546Sopenharmony_ci   reg_R14,
96bf215546Sopenharmony_ci   reg_R15
97bf215546Sopenharmony_ci};
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ci
100bf215546Sopenharmony_cienum x86_cc {
101bf215546Sopenharmony_ci   cc_O,			/* overflow */
102bf215546Sopenharmony_ci   cc_NO,			/* not overflow */
103bf215546Sopenharmony_ci   cc_NAE,			/* not above or equal / carry */
104bf215546Sopenharmony_ci   cc_AE,			/* above or equal / not carry */
105bf215546Sopenharmony_ci   cc_E,			/* equal / zero */
106bf215546Sopenharmony_ci   cc_NE			/* not equal / not zero */
107bf215546Sopenharmony_ci};
108bf215546Sopenharmony_ci
109bf215546Sopenharmony_cienum sse_cc {
110bf215546Sopenharmony_ci   cc_Equal,
111bf215546Sopenharmony_ci   cc_LessThan,
112bf215546Sopenharmony_ci   cc_LessThanEqual,
113bf215546Sopenharmony_ci   cc_Unordered,
114bf215546Sopenharmony_ci   cc_NotEqual,
115bf215546Sopenharmony_ci   cc_NotLessThan,
116bf215546Sopenharmony_ci   cc_NotLessThanEqual,
117bf215546Sopenharmony_ci   cc_Ordered
118bf215546Sopenharmony_ci};
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ci#define cc_Z  cc_E
121bf215546Sopenharmony_ci#define cc_NZ cc_NE
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_ci/** generic pointer to function */
125bf215546Sopenharmony_citypedef void (*x86_func)(void);
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ci/* Begin/end/retrieve function creation:
129bf215546Sopenharmony_ci */
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_cienum x86_target
132bf215546Sopenharmony_ci{
133bf215546Sopenharmony_ci   X86_32,
134bf215546Sopenharmony_ci   X86_64_STD_ABI,
135bf215546Sopenharmony_ci   X86_64_WIN64_ABI
136bf215546Sopenharmony_ci};
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ci/* make this read a member of x86_function if target != host is desired */
139bf215546Sopenharmony_cistatic inline enum x86_target x86_target( struct x86_function* p )
140bf215546Sopenharmony_ci{
141bf215546Sopenharmony_ci#ifdef PIPE_ARCH_X86
142bf215546Sopenharmony_ci   return X86_32;
143bf215546Sopenharmony_ci#elif (defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_WINDOWS)) && defined(PIPE_ARCH_X86_64)
144bf215546Sopenharmony_ci   return X86_64_WIN64_ABI;
145bf215546Sopenharmony_ci#elif defined(PIPE_ARCH_X86_64)
146bf215546Sopenharmony_ci   return X86_64_STD_ABI;
147bf215546Sopenharmony_ci#endif
148bf215546Sopenharmony_ci}
149bf215546Sopenharmony_ci
150bf215546Sopenharmony_cistatic inline unsigned x86_target_caps( struct x86_function* p )
151bf215546Sopenharmony_ci{
152bf215546Sopenharmony_ci   return p->caps;
153bf215546Sopenharmony_ci}
154bf215546Sopenharmony_ci
155bf215546Sopenharmony_civoid x86_init_func( struct x86_function *p );
156bf215546Sopenharmony_civoid x86_init_func_size( struct x86_function *p, unsigned code_size );
157bf215546Sopenharmony_civoid x86_release_func( struct x86_function *p );
158bf215546Sopenharmony_cix86_func x86_get_func( struct x86_function *p );
159bf215546Sopenharmony_ci
160bf215546Sopenharmony_ci/* Debugging:
161bf215546Sopenharmony_ci */
162bf215546Sopenharmony_civoid x86_print_reg( struct x86_reg reg );
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci
165bf215546Sopenharmony_ci/* Create and manipulate registers and regmem values:
166bf215546Sopenharmony_ci */
167bf215546Sopenharmony_cistruct x86_reg x86_make_reg( enum x86_reg_file file,
168bf215546Sopenharmony_ci			     enum x86_reg_name idx );
169bf215546Sopenharmony_ci
170bf215546Sopenharmony_cistruct x86_reg x86_make_disp( struct x86_reg reg,
171bf215546Sopenharmony_ci			      int disp );
172bf215546Sopenharmony_ci
173bf215546Sopenharmony_cistruct x86_reg x86_deref( struct x86_reg reg );
174bf215546Sopenharmony_ci
175bf215546Sopenharmony_cistruct x86_reg x86_get_base_reg( struct x86_reg reg );
176bf215546Sopenharmony_ci
177bf215546Sopenharmony_ci
178bf215546Sopenharmony_ci/* Labels, jumps and fixup:
179bf215546Sopenharmony_ci */
180bf215546Sopenharmony_ciint x86_get_label( struct x86_function *p );
181bf215546Sopenharmony_ci
182bf215546Sopenharmony_civoid x64_rexw(struct x86_function *p);
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_civoid x86_jcc( struct x86_function *p,
185bf215546Sopenharmony_ci	      enum x86_cc cc,
186bf215546Sopenharmony_ci	      int label );
187bf215546Sopenharmony_ci
188bf215546Sopenharmony_ciint x86_jcc_forward( struct x86_function *p,
189bf215546Sopenharmony_ci			  enum x86_cc cc );
190bf215546Sopenharmony_ci
191bf215546Sopenharmony_ciint x86_jmp_forward( struct x86_function *p);
192bf215546Sopenharmony_ci
193bf215546Sopenharmony_ciint x86_call_forward( struct x86_function *p);
194bf215546Sopenharmony_ci
195bf215546Sopenharmony_civoid x86_fixup_fwd_jump( struct x86_function *p,
196bf215546Sopenharmony_ci			 int fixup );
197bf215546Sopenharmony_ci
198bf215546Sopenharmony_civoid x86_jmp( struct x86_function *p, int label );
199bf215546Sopenharmony_ci
200bf215546Sopenharmony_ci/* void x86_call( struct x86_function *p, void (*label)() ); */
201bf215546Sopenharmony_civoid x86_call( struct x86_function *p, struct x86_reg reg);
202bf215546Sopenharmony_ci
203bf215546Sopenharmony_civoid x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm );
204bf215546Sopenharmony_civoid x86_add_imm( struct x86_function *p, struct x86_reg dst, int imm );
205bf215546Sopenharmony_civoid x86_or_imm( struct x86_function *p, struct x86_reg dst, int imm );
206bf215546Sopenharmony_civoid x86_and_imm( struct x86_function *p, struct x86_reg dst, int imm );
207bf215546Sopenharmony_civoid x86_sub_imm( struct x86_function *p, struct x86_reg dst, int imm );
208bf215546Sopenharmony_civoid x86_xor_imm( struct x86_function *p, struct x86_reg dst, int imm );
209bf215546Sopenharmony_civoid x86_cmp_imm( struct x86_function *p, struct x86_reg dst, int imm );
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci/* Macro for sse_shufps() and sse2_pshufd():
213bf215546Sopenharmony_ci */
214bf215546Sopenharmony_ci#define SHUF(_x,_y,_z,_w)       (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6))
215bf215546Sopenharmony_ci#define SHUF_NOOP               RSW(0,1,2,3)
216bf215546Sopenharmony_ci#define GET_SHUF(swz, idx)      (((swz) >> ((idx)*2)) & 0x3)
217bf215546Sopenharmony_ci
218bf215546Sopenharmony_civoid mmx_emms( struct x86_function *p );
219bf215546Sopenharmony_civoid mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
220bf215546Sopenharmony_civoid mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
221bf215546Sopenharmony_civoid mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
222bf215546Sopenharmony_civoid mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
223bf215546Sopenharmony_ci
224bf215546Sopenharmony_civoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
225bf215546Sopenharmony_civoid sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
226bf215546Sopenharmony_civoid sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
227bf215546Sopenharmony_civoid sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
228bf215546Sopenharmony_civoid sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
229bf215546Sopenharmony_civoid sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
230bf215546Sopenharmony_civoid sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_civoid sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
233bf215546Sopenharmony_civoid sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
234bf215546Sopenharmony_civoid sse2_cvtdq2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
235bf215546Sopenharmony_civoid sse2_cvtsd2ss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
236bf215546Sopenharmony_civoid sse2_cvtpd2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
237bf215546Sopenharmony_ci
238bf215546Sopenharmony_civoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
239bf215546Sopenharmony_civoid sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
240bf215546Sopenharmony_civoid sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
241bf215546Sopenharmony_civoid sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
242bf215546Sopenharmony_civoid sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
243bf215546Sopenharmony_ci                  unsigned char shuf );
244bf215546Sopenharmony_civoid sse2_pshuflw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
245bf215546Sopenharmony_ci                  unsigned char shuf );
246bf215546Sopenharmony_civoid sse2_pshufhw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
247bf215546Sopenharmony_ci                  unsigned char shuf );
248bf215546Sopenharmony_civoid sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
249bf215546Sopenharmony_civoid sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_civoid sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
252bf215546Sopenharmony_civoid sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
253bf215546Sopenharmony_civoid sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
254bf215546Sopenharmony_civoid sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
255bf215546Sopenharmony_ci
256bf215546Sopenharmony_civoid sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
257bf215546Sopenharmony_civoid sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
258bf215546Sopenharmony_civoid sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
259bf215546Sopenharmony_ci
260bf215546Sopenharmony_civoid sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
261bf215546Sopenharmony_civoid sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
262bf215546Sopenharmony_civoid sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
263bf215546Sopenharmony_ci
264bf215546Sopenharmony_civoid sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
265bf215546Sopenharmony_civoid sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_civoid sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
268bf215546Sopenharmony_ci
269bf215546Sopenharmony_civoid sse2_pshuflw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
270bf215546Sopenharmony_civoid sse2_pshufhw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
271bf215546Sopenharmony_civoid sse2_pshufd( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
272bf215546Sopenharmony_ci
273bf215546Sopenharmony_civoid sse2_pcmpgtd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
274bf215546Sopenharmony_ci
275bf215546Sopenharmony_civoid sse_prefetchnta( struct x86_function *p, struct x86_reg ptr);
276bf215546Sopenharmony_civoid sse_prefetch0( struct x86_function *p, struct x86_reg ptr);
277bf215546Sopenharmony_civoid sse_prefetch1( struct x86_function *p, struct x86_reg ptr);
278bf215546Sopenharmony_ci
279bf215546Sopenharmony_civoid sse_movntps( struct x86_function *p, struct x86_reg dst, struct x86_reg src);
280bf215546Sopenharmony_ci
281bf215546Sopenharmony_civoid sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
282bf215546Sopenharmony_civoid sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
283bf215546Sopenharmony_civoid sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
284bf215546Sopenharmony_civoid sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
285bf215546Sopenharmony_civoid sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
286bf215546Sopenharmony_civoid sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
287bf215546Sopenharmony_civoid sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src,
288bf215546Sopenharmony_ci                enum sse_cc cc );
289bf215546Sopenharmony_civoid sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
290bf215546Sopenharmony_civoid sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
291bf215546Sopenharmony_civoid sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
292bf215546Sopenharmony_civoid sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
293bf215546Sopenharmony_civoid sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
294bf215546Sopenharmony_civoid sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
295bf215546Sopenharmony_civoid sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
296bf215546Sopenharmony_civoid sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
297bf215546Sopenharmony_civoid sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
298bf215546Sopenharmony_civoid sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
299bf215546Sopenharmony_civoid sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
300bf215546Sopenharmony_civoid sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
301bf215546Sopenharmony_civoid sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
302bf215546Sopenharmony_civoid sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
303bf215546Sopenharmony_civoid sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
304bf215546Sopenharmony_civoid sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
305bf215546Sopenharmony_civoid sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
306bf215546Sopenharmony_civoid sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
307bf215546Sopenharmony_ci                 unsigned char shuf );
308bf215546Sopenharmony_civoid sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
309bf215546Sopenharmony_civoid sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
310bf215546Sopenharmony_civoid sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src );
311bf215546Sopenharmony_civoid sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg src);
312bf215546Sopenharmony_ci
313bf215546Sopenharmony_civoid x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
314bf215546Sopenharmony_civoid x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
315bf215546Sopenharmony_civoid x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc );
316bf215546Sopenharmony_civoid x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
317bf215546Sopenharmony_civoid x86_dec( struct x86_function *p, struct x86_reg reg );
318bf215546Sopenharmony_civoid x86_inc( struct x86_function *p, struct x86_reg reg );
319bf215546Sopenharmony_civoid x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
320bf215546Sopenharmony_civoid x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
321bf215546Sopenharmony_civoid x64_mov64( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
322bf215546Sopenharmony_civoid x86_mov8( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
323bf215546Sopenharmony_civoid x86_mov16( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
324bf215546Sopenharmony_civoid x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src );
325bf215546Sopenharmony_civoid x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src );
326bf215546Sopenharmony_civoid x86_mov_imm(struct x86_function *p, struct x86_reg dst, int imm );
327bf215546Sopenharmony_civoid x86_mov8_imm(struct x86_function *p, struct x86_reg dst, uint8_t imm );
328bf215546Sopenharmony_civoid x86_mov16_imm(struct x86_function *p, struct x86_reg dst, uint16_t imm );
329bf215546Sopenharmony_civoid x86_mul( struct x86_function *p, struct x86_reg src );
330bf215546Sopenharmony_civoid x86_imul( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
331bf215546Sopenharmony_civoid x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
332bf215546Sopenharmony_civoid x86_pop( struct x86_function *p, struct x86_reg reg );
333bf215546Sopenharmony_civoid x86_push( struct x86_function *p, struct x86_reg reg );
334bf215546Sopenharmony_civoid x86_push_imm32( struct x86_function *p, int imm );
335bf215546Sopenharmony_civoid x86_ret( struct x86_function *p );
336bf215546Sopenharmony_civoid x86_retw( struct x86_function *p, unsigned short imm );
337bf215546Sopenharmony_civoid x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
338bf215546Sopenharmony_civoid x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
339bf215546Sopenharmony_civoid x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
340bf215546Sopenharmony_civoid x86_sahf( struct x86_function *p );
341bf215546Sopenharmony_civoid x86_div( struct x86_function *p, struct x86_reg src );
342bf215546Sopenharmony_civoid x86_bswap( struct x86_function *p, struct x86_reg src );
343bf215546Sopenharmony_civoid x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm );
344bf215546Sopenharmony_civoid x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm );
345bf215546Sopenharmony_civoid x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm  );
346bf215546Sopenharmony_ci
347bf215546Sopenharmony_civoid x86_cdecl_caller_push_regs( struct x86_function *p );
348bf215546Sopenharmony_civoid x86_cdecl_caller_pop_regs( struct x86_function *p );
349bf215546Sopenharmony_ci
350bf215546Sopenharmony_civoid x87_assert_stack_empty( struct x86_function *p );
351bf215546Sopenharmony_ci
352bf215546Sopenharmony_civoid x87_f2xm1( struct x86_function *p );
353bf215546Sopenharmony_civoid x87_fabs( struct x86_function *p );
354bf215546Sopenharmony_civoid x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
355bf215546Sopenharmony_civoid x87_faddp( struct x86_function *p, struct x86_reg dst );
356bf215546Sopenharmony_civoid x87_fchs( struct x86_function *p );
357bf215546Sopenharmony_civoid x87_fclex( struct x86_function *p );
358bf215546Sopenharmony_civoid x87_fcmovb( struct x86_function *p, struct x86_reg src );
359bf215546Sopenharmony_civoid x87_fcmovbe( struct x86_function *p, struct x86_reg src );
360bf215546Sopenharmony_civoid x87_fcmove( struct x86_function *p, struct x86_reg src );
361bf215546Sopenharmony_civoid x87_fcmovnb( struct x86_function *p, struct x86_reg src );
362bf215546Sopenharmony_civoid x87_fcmovnbe( struct x86_function *p, struct x86_reg src );
363bf215546Sopenharmony_civoid x87_fcmovne( struct x86_function *p, struct x86_reg src );
364bf215546Sopenharmony_civoid x87_fcom( struct x86_function *p, struct x86_reg dst );
365bf215546Sopenharmony_civoid x87_fcomi( struct x86_function *p, struct x86_reg dst );
366bf215546Sopenharmony_civoid x87_fcomip( struct x86_function *p, struct x86_reg dst );
367bf215546Sopenharmony_civoid x87_fcomp( struct x86_function *p, struct x86_reg dst );
368bf215546Sopenharmony_civoid x87_fcos( struct x86_function *p );
369bf215546Sopenharmony_civoid x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
370bf215546Sopenharmony_civoid x87_fdivp( struct x86_function *p, struct x86_reg dst );
371bf215546Sopenharmony_civoid x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
372bf215546Sopenharmony_civoid x87_fdivrp( struct x86_function *p, struct x86_reg dst );
373bf215546Sopenharmony_civoid x87_fild( struct x86_function *p, struct x86_reg arg );
374bf215546Sopenharmony_civoid x87_fist( struct x86_function *p, struct x86_reg dst );
375bf215546Sopenharmony_civoid x87_fistp( struct x86_function *p, struct x86_reg dst );
376bf215546Sopenharmony_civoid x87_fld( struct x86_function *p, struct x86_reg arg );
377bf215546Sopenharmony_civoid x87_fld1( struct x86_function *p );
378bf215546Sopenharmony_civoid x87_fldcw( struct x86_function *p, struct x86_reg arg );
379bf215546Sopenharmony_civoid x87_fldl2e( struct x86_function *p );
380bf215546Sopenharmony_civoid x87_fldln2( struct x86_function *p );
381bf215546Sopenharmony_civoid x87_fldz( struct x86_function *p );
382bf215546Sopenharmony_civoid x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
383bf215546Sopenharmony_civoid x87_fmulp( struct x86_function *p, struct x86_reg dst );
384bf215546Sopenharmony_civoid x87_fnclex( struct x86_function *p );
385bf215546Sopenharmony_civoid x87_fprndint( struct x86_function *p );
386bf215546Sopenharmony_civoid x87_fpop( struct x86_function *p );
387bf215546Sopenharmony_civoid x87_fscale( struct x86_function *p );
388bf215546Sopenharmony_civoid x87_fsin( struct x86_function *p );
389bf215546Sopenharmony_civoid x87_fsincos( struct x86_function *p );
390bf215546Sopenharmony_civoid x87_fsqrt( struct x86_function *p );
391bf215546Sopenharmony_civoid x87_fst( struct x86_function *p, struct x86_reg dst );
392bf215546Sopenharmony_civoid x87_fstp( struct x86_function *p, struct x86_reg dst );
393bf215546Sopenharmony_civoid x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
394bf215546Sopenharmony_civoid x87_fsubp( struct x86_function *p, struct x86_reg dst );
395bf215546Sopenharmony_civoid x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
396bf215546Sopenharmony_civoid x87_fsubrp( struct x86_function *p, struct x86_reg dst );
397bf215546Sopenharmony_civoid x87_ftst( struct x86_function *p );
398bf215546Sopenharmony_civoid x87_fxch( struct x86_function *p, struct x86_reg dst );
399bf215546Sopenharmony_civoid x87_fxtract( struct x86_function *p );
400bf215546Sopenharmony_civoid x87_fyl2x( struct x86_function *p );
401bf215546Sopenharmony_civoid x87_fyl2xp1( struct x86_function *p );
402bf215546Sopenharmony_civoid x87_fwait( struct x86_function *p );
403bf215546Sopenharmony_civoid x87_fnstcw( struct x86_function *p, struct x86_reg dst );
404bf215546Sopenharmony_civoid x87_fnstsw( struct x86_function *p, struct x86_reg dst );
405bf215546Sopenharmony_civoid x87_fucompp( struct x86_function *p );
406bf215546Sopenharmony_civoid x87_fucomp( struct x86_function *p, struct x86_reg arg );
407bf215546Sopenharmony_civoid x87_fucom( struct x86_function *p, struct x86_reg arg );
408bf215546Sopenharmony_ci
409bf215546Sopenharmony_ci
410bf215546Sopenharmony_ci
411bf215546Sopenharmony_ci/* Retrieve a reference to one of the function arguments, taking into
412bf215546Sopenharmony_ci * account any push/pop activity.  Note - doesn't track explicit
413bf215546Sopenharmony_ci * manipulation of ESP by other instructions.
414bf215546Sopenharmony_ci */
415bf215546Sopenharmony_cistruct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg );
416bf215546Sopenharmony_ci
417bf215546Sopenharmony_ci#endif
418bf215546Sopenharmony_ci#endif
419