14a49301eSmrg/**************************************************************************
24a49301eSmrg *
34a49301eSmrg * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
44a49301eSmrg *
54a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
64a49301eSmrg * copy of this software and associated documentation files (the "Software"),
74a49301eSmrg * to deal in the Software without restriction, including without limitation
84a49301eSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
94a49301eSmrg * and/or sell copies of the Software, and to permit persons to whom the
104a49301eSmrg * Software is furnished to do so, subject to the following conditions:
114a49301eSmrg *
124a49301eSmrg * The above copyright notice and this permission notice shall be included
134a49301eSmrg * in all copies or substantial portions of the Software.
144a49301eSmrg *
154a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
164a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
174a49301eSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
224a49301eSmrg *
234a49301eSmrg **************************************************************************/
244a49301eSmrg
254a49301eSmrg#ifndef _RTASM_X86SSE_H_
264a49301eSmrg#define _RTASM_X86SSE_H_
274a49301eSmrg
283464ebd5Sriastradh#include "pipe/p_compiler.h"
294a49301eSmrg#include "pipe/p_config.h"
304a49301eSmrg
313464ebd5Sriastradh#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
324a49301eSmrg
334a49301eSmrg/* It is up to the caller to ensure that instructions issued are
344a49301eSmrg * suitable for the host cpu.  There are no checks made in this module
354a49301eSmrg * for mmx/sse/sse2 support on the cpu.
364a49301eSmrg */
374a49301eSmrgstruct x86_reg {
383464ebd5Sriastradh   unsigned file:2;
393464ebd5Sriastradh   unsigned idx:4;
404a49301eSmrg   unsigned mod:2;		/* mod_REG if this is just a register */
414a49301eSmrg   int      disp:24;		/* only +/- 23bits of offset - should be enough... */
424a49301eSmrg};
434a49301eSmrg
443464ebd5Sriastradh#define X86_MMX 1
453464ebd5Sriastradh#define X86_MMX2 2
463464ebd5Sriastradh#define X86_SSE 4
473464ebd5Sriastradh#define X86_SSE2 8
483464ebd5Sriastradh#define X86_SSE3 0x10
493464ebd5Sriastradh#define X86_SSE4_1 0x20
503464ebd5Sriastradh
514a49301eSmrgstruct x86_function {
523464ebd5Sriastradh   unsigned caps;
534a49301eSmrg   unsigned size;
544a49301eSmrg   unsigned char *store;
554a49301eSmrg   unsigned char *csr;
564a49301eSmrg
574a49301eSmrg   unsigned stack_offset:16;
584a49301eSmrg   unsigned need_emms:8;
594a49301eSmrg   int x87_stack:8;
604a49301eSmrg
614a49301eSmrg   unsigned char error_overflow[4];
624a49301eSmrg};
634a49301eSmrg
644a49301eSmrgenum x86_reg_file {
654a49301eSmrg   file_REG32,
664a49301eSmrg   file_MMX,
674a49301eSmrg   file_XMM,
684a49301eSmrg   file_x87
694a49301eSmrg};
704a49301eSmrg
714a49301eSmrg/* Values for mod field of modr/m byte
724a49301eSmrg */
734a49301eSmrgenum x86_reg_mod {
744a49301eSmrg   mod_INDIRECT,
754a49301eSmrg   mod_DISP8,
764a49301eSmrg   mod_DISP32,
774a49301eSmrg   mod_REG
784a49301eSmrg};
794a49301eSmrg
804a49301eSmrgenum x86_reg_name {
814a49301eSmrg   reg_AX,
824a49301eSmrg   reg_CX,
834a49301eSmrg   reg_DX,
844a49301eSmrg   reg_BX,
854a49301eSmrg   reg_SP,
864a49301eSmrg   reg_BP,
874a49301eSmrg   reg_SI,
883464ebd5Sriastradh   reg_DI,
893464ebd5Sriastradh   reg_R8,
903464ebd5Sriastradh   reg_R9,
913464ebd5Sriastradh   reg_R10,
923464ebd5Sriastradh   reg_R11,
933464ebd5Sriastradh   reg_R12,
943464ebd5Sriastradh   reg_R13,
953464ebd5Sriastradh   reg_R14,
963464ebd5Sriastradh   reg_R15
974a49301eSmrg};
984a49301eSmrg
994a49301eSmrg
1004a49301eSmrgenum x86_cc {
1014a49301eSmrg   cc_O,			/* overflow */
1024a49301eSmrg   cc_NO,			/* not overflow */
1034a49301eSmrg   cc_NAE,			/* not above or equal / carry */
1044a49301eSmrg   cc_AE,			/* above or equal / not carry */
1054a49301eSmrg   cc_E,			/* equal / zero */
1064a49301eSmrg   cc_NE			/* not equal / not zero */
1074a49301eSmrg};
1084a49301eSmrg
1094a49301eSmrgenum sse_cc {
1104a49301eSmrg   cc_Equal,
1114a49301eSmrg   cc_LessThan,
1124a49301eSmrg   cc_LessThanEqual,
1134a49301eSmrg   cc_Unordered,
1144a49301eSmrg   cc_NotEqual,
1154a49301eSmrg   cc_NotLessThan,
1164a49301eSmrg   cc_NotLessThanEqual,
1174a49301eSmrg   cc_Ordered
1184a49301eSmrg};
1194a49301eSmrg
1204a49301eSmrg#define cc_Z  cc_E
1214a49301eSmrg#define cc_NZ cc_NE
1224a49301eSmrg
1233464ebd5Sriastradh
1243464ebd5Sriastradh/** generic pointer to function */
1253464ebd5Sriastradhtypedef void (*x86_func)(void);
1263464ebd5Sriastradh
1273464ebd5Sriastradh
1283464ebd5Sriastradh/* Begin/end/retrieve function creation:
1294a49301eSmrg */
1304a49301eSmrg
1313464ebd5Sriastradhenum x86_target
1323464ebd5Sriastradh{
1333464ebd5Sriastradh   X86_32,
1343464ebd5Sriastradh   X86_64_STD_ABI,
1353464ebd5Sriastradh   X86_64_WIN64_ABI
1363464ebd5Sriastradh};
1373464ebd5Sriastradh
1383464ebd5Sriastradh/* make this read a member of x86_function if target != host is desired */
13901e04c3fSmrgstatic inline enum x86_target x86_target( struct x86_function* p )
1403464ebd5Sriastradh{
1413464ebd5Sriastradh#ifdef PIPE_ARCH_X86
1423464ebd5Sriastradh   return X86_32;
143af69d88dSmrg#elif (defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_WINDOWS)) && defined(PIPE_ARCH_X86_64)
1443464ebd5Sriastradh   return X86_64_WIN64_ABI;
1453464ebd5Sriastradh#elif defined(PIPE_ARCH_X86_64)
1463464ebd5Sriastradh   return X86_64_STD_ABI;
1473464ebd5Sriastradh#endif
1483464ebd5Sriastradh}
1493464ebd5Sriastradh
15001e04c3fSmrgstatic inline unsigned x86_target_caps( struct x86_function* p )
1513464ebd5Sriastradh{
1523464ebd5Sriastradh   return p->caps;
1533464ebd5Sriastradh}
1544a49301eSmrg
1554a49301eSmrgvoid x86_init_func( struct x86_function *p );
1564a49301eSmrgvoid x86_init_func_size( struct x86_function *p, unsigned code_size );
1574a49301eSmrgvoid x86_release_func( struct x86_function *p );
1583464ebd5Sriastradhx86_func x86_get_func( struct x86_function *p );
1594a49301eSmrg
1604a49301eSmrg/* Debugging:
1614a49301eSmrg */
1624a49301eSmrgvoid x86_print_reg( struct x86_reg reg );
1634a49301eSmrg
1644a49301eSmrg
1654a49301eSmrg/* Create and manipulate registers and regmem values:
1664a49301eSmrg */
1674a49301eSmrgstruct x86_reg x86_make_reg( enum x86_reg_file file,
1684a49301eSmrg			     enum x86_reg_name idx );
1694a49301eSmrg
1704a49301eSmrgstruct x86_reg x86_make_disp( struct x86_reg reg,
1714a49301eSmrg			      int disp );
1724a49301eSmrg
1734a49301eSmrgstruct x86_reg x86_deref( struct x86_reg reg );
1744a49301eSmrg
1754a49301eSmrgstruct x86_reg x86_get_base_reg( struct x86_reg reg );
1764a49301eSmrg
1774a49301eSmrg
1784a49301eSmrg/* Labels, jumps and fixup:
1794a49301eSmrg */
1804a49301eSmrgint x86_get_label( struct x86_function *p );
1814a49301eSmrg
1823464ebd5Sriastradhvoid x64_rexw(struct x86_function *p);
1833464ebd5Sriastradh
1844a49301eSmrgvoid x86_jcc( struct x86_function *p,
1854a49301eSmrg	      enum x86_cc cc,
1864a49301eSmrg	      int label );
1874a49301eSmrg
1884a49301eSmrgint x86_jcc_forward( struct x86_function *p,
1894a49301eSmrg			  enum x86_cc cc );
1904a49301eSmrg
1914a49301eSmrgint x86_jmp_forward( struct x86_function *p);
1924a49301eSmrg
1934a49301eSmrgint x86_call_forward( struct x86_function *p);
1944a49301eSmrg
1954a49301eSmrgvoid x86_fixup_fwd_jump( struct x86_function *p,
1964a49301eSmrg			 int fixup );
1974a49301eSmrg
1984a49301eSmrgvoid x86_jmp( struct x86_function *p, int label );
1994a49301eSmrg
2004a49301eSmrg/* void x86_call( struct x86_function *p, void (*label)() ); */
2014a49301eSmrgvoid x86_call( struct x86_function *p, struct x86_reg reg);
2024a49301eSmrg
2034a49301eSmrgvoid x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm );
2044a49301eSmrgvoid x86_add_imm( struct x86_function *p, struct x86_reg dst, int imm );
2054a49301eSmrgvoid x86_or_imm( struct x86_function *p, struct x86_reg dst, int imm );
2064a49301eSmrgvoid x86_and_imm( struct x86_function *p, struct x86_reg dst, int imm );
2074a49301eSmrgvoid x86_sub_imm( struct x86_function *p, struct x86_reg dst, int imm );
2084a49301eSmrgvoid x86_xor_imm( struct x86_function *p, struct x86_reg dst, int imm );
2094a49301eSmrgvoid x86_cmp_imm( struct x86_function *p, struct x86_reg dst, int imm );
2104a49301eSmrg
2114a49301eSmrg
2124a49301eSmrg/* Macro for sse_shufps() and sse2_pshufd():
2134a49301eSmrg */
2144a49301eSmrg#define SHUF(_x,_y,_z,_w)       (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6))
2154a49301eSmrg#define SHUF_NOOP               RSW(0,1,2,3)
2164a49301eSmrg#define GET_SHUF(swz, idx)      (((swz) >> ((idx)*2)) & 0x3)
2174a49301eSmrg
2184a49301eSmrgvoid mmx_emms( struct x86_function *p );
2194a49301eSmrgvoid mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2204a49301eSmrgvoid mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2214a49301eSmrgvoid mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2224a49301eSmrgvoid mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2234a49301eSmrg
2243464ebd5Sriastradhvoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2253464ebd5Sriastradhvoid sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2263464ebd5Sriastradhvoid sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2273464ebd5Sriastradhvoid sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2283464ebd5Sriastradhvoid sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2293464ebd5Sriastradhvoid sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2303464ebd5Sriastradhvoid sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2313464ebd5Sriastradh
2324a49301eSmrgvoid sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2334a49301eSmrgvoid sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2344a49301eSmrgvoid sse2_cvtdq2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2353464ebd5Sriastradhvoid sse2_cvtsd2ss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2363464ebd5Sriastradhvoid sse2_cvtpd2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2373464ebd5Sriastradh
2384a49301eSmrgvoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2394a49301eSmrgvoid sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2404a49301eSmrgvoid sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2414a49301eSmrgvoid sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2424a49301eSmrgvoid sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
2434a49301eSmrg                  unsigned char shuf );
2443464ebd5Sriastradhvoid sse2_pshuflw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
2453464ebd5Sriastradh                  unsigned char shuf );
2463464ebd5Sriastradhvoid sse2_pshufhw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
2473464ebd5Sriastradh                  unsigned char shuf );
2484a49301eSmrgvoid sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2494a49301eSmrgvoid sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2504a49301eSmrg
2513464ebd5Sriastradhvoid sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2523464ebd5Sriastradhvoid sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2533464ebd5Sriastradhvoid sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2543464ebd5Sriastradhvoid sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2553464ebd5Sriastradh
2563464ebd5Sriastradhvoid sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2573464ebd5Sriastradhvoid sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2583464ebd5Sriastradhvoid sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2593464ebd5Sriastradh
2603464ebd5Sriastradhvoid sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2613464ebd5Sriastradhvoid sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2623464ebd5Sriastradhvoid sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2633464ebd5Sriastradh
2643464ebd5Sriastradhvoid sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2653464ebd5Sriastradhvoid sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm );
2663464ebd5Sriastradh
2673464ebd5Sriastradhvoid sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2683464ebd5Sriastradh
2693464ebd5Sriastradhvoid sse2_pshuflw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
2703464ebd5Sriastradhvoid sse2_pshufhw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
2713464ebd5Sriastradhvoid sse2_pshufd( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm );
2724a49301eSmrg
2734a49301eSmrgvoid sse_prefetchnta( struct x86_function *p, struct x86_reg ptr);
2744a49301eSmrgvoid sse_prefetch0( struct x86_function *p, struct x86_reg ptr);
2754a49301eSmrgvoid sse_prefetch1( struct x86_function *p, struct x86_reg ptr);
2764a49301eSmrg
2774a49301eSmrgvoid sse_movntps( struct x86_function *p, struct x86_reg dst, struct x86_reg src);
2784a49301eSmrg
2794a49301eSmrgvoid sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2804a49301eSmrgvoid sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2814a49301eSmrgvoid sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2824a49301eSmrgvoid sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2834a49301eSmrgvoid sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2844a49301eSmrgvoid sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2854a49301eSmrgvoid sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src,
2864a49301eSmrg                enum sse_cc cc );
2874a49301eSmrgvoid sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2884a49301eSmrgvoid sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2894a49301eSmrgvoid sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2904a49301eSmrgvoid sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2914a49301eSmrgvoid sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2924a49301eSmrgvoid sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2934a49301eSmrgvoid sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2944a49301eSmrgvoid sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2954a49301eSmrgvoid sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2964a49301eSmrgvoid sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2974a49301eSmrgvoid sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2984a49301eSmrgvoid sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
2994a49301eSmrgvoid sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3004a49301eSmrgvoid sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3014a49301eSmrgvoid sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3024a49301eSmrgvoid sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3034a49301eSmrgvoid sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3044a49301eSmrgvoid sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
3054a49301eSmrg                 unsigned char shuf );
3064a49301eSmrgvoid sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3074a49301eSmrgvoid sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3084a49301eSmrgvoid sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src );
3094a49301eSmrgvoid sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg src);
3104a49301eSmrg
3114a49301eSmrgvoid x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3124a49301eSmrgvoid x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3133464ebd5Sriastradhvoid x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc );
3144a49301eSmrgvoid x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3154a49301eSmrgvoid x86_dec( struct x86_function *p, struct x86_reg reg );
3164a49301eSmrgvoid x86_inc( struct x86_function *p, struct x86_reg reg );
3174a49301eSmrgvoid x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3184a49301eSmrgvoid x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3193464ebd5Sriastradhvoid x64_mov64( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3203464ebd5Sriastradhvoid x86_mov8( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3213464ebd5Sriastradhvoid x86_mov16( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3223464ebd5Sriastradhvoid x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3233464ebd5Sriastradhvoid x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3243464ebd5Sriastradhvoid x86_mov_imm(struct x86_function *p, struct x86_reg dst, int imm );
3253464ebd5Sriastradhvoid x86_mov8_imm(struct x86_function *p, struct x86_reg dst, uint8_t imm );
3263464ebd5Sriastradhvoid x86_mov16_imm(struct x86_function *p, struct x86_reg dst, uint16_t imm );
3274a49301eSmrgvoid x86_mul( struct x86_function *p, struct x86_reg src );
3284a49301eSmrgvoid x86_imul( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3294a49301eSmrgvoid x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3304a49301eSmrgvoid x86_pop( struct x86_function *p, struct x86_reg reg );
3314a49301eSmrgvoid x86_push( struct x86_function *p, struct x86_reg reg );
3324a49301eSmrgvoid x86_push_imm32( struct x86_function *p, int imm );
3334a49301eSmrgvoid x86_ret( struct x86_function *p );
3344a49301eSmrgvoid x86_retw( struct x86_function *p, unsigned short imm );
3354a49301eSmrgvoid x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3364a49301eSmrgvoid x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3374a49301eSmrgvoid x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
3384a49301eSmrgvoid x86_sahf( struct x86_function *p );
339cdc920a0Smrgvoid x86_div( struct x86_function *p, struct x86_reg src );
3403464ebd5Sriastradhvoid x86_bswap( struct x86_function *p, struct x86_reg src );
3413464ebd5Sriastradhvoid x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm );
3423464ebd5Sriastradhvoid x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm );
3433464ebd5Sriastradhvoid x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm  );
3444a49301eSmrg
3454a49301eSmrgvoid x86_cdecl_caller_push_regs( struct x86_function *p );
3464a49301eSmrgvoid x86_cdecl_caller_pop_regs( struct x86_function *p );
3474a49301eSmrg
3484a49301eSmrgvoid x87_assert_stack_empty( struct x86_function *p );
3494a49301eSmrg
3504a49301eSmrgvoid x87_f2xm1( struct x86_function *p );
3514a49301eSmrgvoid x87_fabs( struct x86_function *p );
3524a49301eSmrgvoid x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3534a49301eSmrgvoid x87_faddp( struct x86_function *p, struct x86_reg dst );
3544a49301eSmrgvoid x87_fchs( struct x86_function *p );
3554a49301eSmrgvoid x87_fclex( struct x86_function *p );
3564a49301eSmrgvoid x87_fcmovb( struct x86_function *p, struct x86_reg src );
3574a49301eSmrgvoid x87_fcmovbe( struct x86_function *p, struct x86_reg src );
3584a49301eSmrgvoid x87_fcmove( struct x86_function *p, struct x86_reg src );
3594a49301eSmrgvoid x87_fcmovnb( struct x86_function *p, struct x86_reg src );
3604a49301eSmrgvoid x87_fcmovnbe( struct x86_function *p, struct x86_reg src );
3614a49301eSmrgvoid x87_fcmovne( struct x86_function *p, struct x86_reg src );
3624a49301eSmrgvoid x87_fcom( struct x86_function *p, struct x86_reg dst );
3634a49301eSmrgvoid x87_fcomi( struct x86_function *p, struct x86_reg dst );
3644a49301eSmrgvoid x87_fcomip( struct x86_function *p, struct x86_reg dst );
3654a49301eSmrgvoid x87_fcomp( struct x86_function *p, struct x86_reg dst );
3664a49301eSmrgvoid x87_fcos( struct x86_function *p );
3674a49301eSmrgvoid x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3684a49301eSmrgvoid x87_fdivp( struct x86_function *p, struct x86_reg dst );
3694a49301eSmrgvoid x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3704a49301eSmrgvoid x87_fdivrp( struct x86_function *p, struct x86_reg dst );
3714a49301eSmrgvoid x87_fild( struct x86_function *p, struct x86_reg arg );
3724a49301eSmrgvoid x87_fist( struct x86_function *p, struct x86_reg dst );
3734a49301eSmrgvoid x87_fistp( struct x86_function *p, struct x86_reg dst );
3744a49301eSmrgvoid x87_fld( struct x86_function *p, struct x86_reg arg );
3754a49301eSmrgvoid x87_fld1( struct x86_function *p );
3764a49301eSmrgvoid x87_fldcw( struct x86_function *p, struct x86_reg arg );
3774a49301eSmrgvoid x87_fldl2e( struct x86_function *p );
3784a49301eSmrgvoid x87_fldln2( struct x86_function *p );
3794a49301eSmrgvoid x87_fldz( struct x86_function *p );
3804a49301eSmrgvoid x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3814a49301eSmrgvoid x87_fmulp( struct x86_function *p, struct x86_reg dst );
3824a49301eSmrgvoid x87_fnclex( struct x86_function *p );
3834a49301eSmrgvoid x87_fprndint( struct x86_function *p );
3844a49301eSmrgvoid x87_fpop( struct x86_function *p );
3854a49301eSmrgvoid x87_fscale( struct x86_function *p );
3864a49301eSmrgvoid x87_fsin( struct x86_function *p );
3874a49301eSmrgvoid x87_fsincos( struct x86_function *p );
3884a49301eSmrgvoid x87_fsqrt( struct x86_function *p );
3894a49301eSmrgvoid x87_fst( struct x86_function *p, struct x86_reg dst );
3904a49301eSmrgvoid x87_fstp( struct x86_function *p, struct x86_reg dst );
3914a49301eSmrgvoid x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3924a49301eSmrgvoid x87_fsubp( struct x86_function *p, struct x86_reg dst );
3934a49301eSmrgvoid x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg );
3944a49301eSmrgvoid x87_fsubrp( struct x86_function *p, struct x86_reg dst );
3954a49301eSmrgvoid x87_ftst( struct x86_function *p );
3964a49301eSmrgvoid x87_fxch( struct x86_function *p, struct x86_reg dst );
3974a49301eSmrgvoid x87_fxtract( struct x86_function *p );
3984a49301eSmrgvoid x87_fyl2x( struct x86_function *p );
3994a49301eSmrgvoid x87_fyl2xp1( struct x86_function *p );
4004a49301eSmrgvoid x87_fwait( struct x86_function *p );
4014a49301eSmrgvoid x87_fnstcw( struct x86_function *p, struct x86_reg dst );
4024a49301eSmrgvoid x87_fnstsw( struct x86_function *p, struct x86_reg dst );
4034a49301eSmrgvoid x87_fucompp( struct x86_function *p );
4044a49301eSmrgvoid x87_fucomp( struct x86_function *p, struct x86_reg arg );
4054a49301eSmrgvoid x87_fucom( struct x86_function *p, struct x86_reg arg );
4064a49301eSmrg
4074a49301eSmrg
4084a49301eSmrg
4093464ebd5Sriastradh/* Retrieve a reference to one of the function arguments, taking into
4103464ebd5Sriastradh * account any push/pop activity.  Note - doesn't track explicit
4114a49301eSmrg * manipulation of ESP by other instructions.
4124a49301eSmrg */
4134a49301eSmrgstruct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg );
4144a49301eSmrg
4154a49301eSmrg#endif
4164a49301eSmrg#endif
417