1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. 4848b8605Smrg * 5848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 6848b8605Smrg * copy of this software and associated documentation files (the "Software"), 7848b8605Smrg * to deal in the Software without restriction, including without limitation 8848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 10848b8605Smrg * Software is furnished to do so, subject to the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice shall be included 13848b8605Smrg * in all copies or substantial portions of the Software. 14848b8605Smrg * 15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 22848b8605Smrg * 23848b8605Smrg **************************************************************************/ 24848b8605Smrg 25848b8605Smrg#ifndef _RTASM_X86SSE_H_ 26848b8605Smrg#define _RTASM_X86SSE_H_ 27848b8605Smrg 28848b8605Smrg#include "pipe/p_compiler.h" 29848b8605Smrg#include "pipe/p_config.h" 30848b8605Smrg 31848b8605Smrg#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) 32848b8605Smrg 33848b8605Smrg/* It is up to the caller to ensure that instructions issued are 34848b8605Smrg * suitable for the host cpu. There are no checks made in this module 35848b8605Smrg * for mmx/sse/sse2 support on the cpu. 36848b8605Smrg */ 37848b8605Smrgstruct x86_reg { 38848b8605Smrg unsigned file:2; 39848b8605Smrg unsigned idx:4; 40848b8605Smrg unsigned mod:2; /* mod_REG if this is just a register */ 41848b8605Smrg int disp:24; /* only +/- 23bits of offset - should be enough... */ 42848b8605Smrg}; 43848b8605Smrg 44848b8605Smrg#define X86_MMX 1 45848b8605Smrg#define X86_MMX2 2 46848b8605Smrg#define X86_SSE 4 47848b8605Smrg#define X86_SSE2 8 48848b8605Smrg#define X86_SSE3 0x10 49848b8605Smrg#define X86_SSE4_1 0x20 50848b8605Smrg 51848b8605Smrgstruct x86_function { 52848b8605Smrg unsigned caps; 53848b8605Smrg unsigned size; 54848b8605Smrg unsigned char *store; 55848b8605Smrg unsigned char *csr; 56848b8605Smrg 57848b8605Smrg unsigned stack_offset:16; 58848b8605Smrg unsigned need_emms:8; 59848b8605Smrg int x87_stack:8; 60848b8605Smrg 61848b8605Smrg unsigned char error_overflow[4]; 62848b8605Smrg}; 63848b8605Smrg 64848b8605Smrgenum x86_reg_file { 65848b8605Smrg file_REG32, 66848b8605Smrg file_MMX, 67848b8605Smrg file_XMM, 68848b8605Smrg file_x87 69848b8605Smrg}; 70848b8605Smrg 71848b8605Smrg/* Values for mod field of modr/m byte 72848b8605Smrg */ 73848b8605Smrgenum x86_reg_mod { 74848b8605Smrg mod_INDIRECT, 75848b8605Smrg mod_DISP8, 76848b8605Smrg mod_DISP32, 77848b8605Smrg mod_REG 78848b8605Smrg}; 79848b8605Smrg 80848b8605Smrgenum x86_reg_name { 81848b8605Smrg reg_AX, 82848b8605Smrg reg_CX, 83848b8605Smrg reg_DX, 84848b8605Smrg reg_BX, 85848b8605Smrg reg_SP, 86848b8605Smrg reg_BP, 87848b8605Smrg reg_SI, 88848b8605Smrg reg_DI, 89848b8605Smrg reg_R8, 90848b8605Smrg reg_R9, 91848b8605Smrg reg_R10, 92848b8605Smrg reg_R11, 93848b8605Smrg reg_R12, 94848b8605Smrg reg_R13, 95848b8605Smrg reg_R14, 96848b8605Smrg reg_R15 97848b8605Smrg}; 98848b8605Smrg 99848b8605Smrg 100848b8605Smrgenum x86_cc { 101848b8605Smrg cc_O, /* overflow */ 102848b8605Smrg cc_NO, /* not overflow */ 103848b8605Smrg cc_NAE, /* not above or equal / carry */ 104848b8605Smrg cc_AE, /* above or equal / not carry */ 105848b8605Smrg cc_E, /* equal / zero */ 106848b8605Smrg cc_NE /* not equal / not zero */ 107848b8605Smrg}; 108848b8605Smrg 109848b8605Smrgenum sse_cc { 110848b8605Smrg cc_Equal, 111848b8605Smrg cc_LessThan, 112848b8605Smrg cc_LessThanEqual, 113848b8605Smrg cc_Unordered, 114848b8605Smrg cc_NotEqual, 115848b8605Smrg cc_NotLessThan, 116848b8605Smrg cc_NotLessThanEqual, 117848b8605Smrg cc_Ordered 118848b8605Smrg}; 119848b8605Smrg 120848b8605Smrg#define cc_Z cc_E 121848b8605Smrg#define cc_NZ cc_NE 122848b8605Smrg 123848b8605Smrg 124848b8605Smrg/** generic pointer to function */ 125848b8605Smrgtypedef void (*x86_func)(void); 126848b8605Smrg 127848b8605Smrg 128848b8605Smrg/* Begin/end/retrieve function creation: 129848b8605Smrg */ 130848b8605Smrg 131848b8605Smrgenum x86_target 132848b8605Smrg{ 133848b8605Smrg X86_32, 134848b8605Smrg X86_64_STD_ABI, 135848b8605Smrg X86_64_WIN64_ABI 136848b8605Smrg}; 137848b8605Smrg 138848b8605Smrg/* make this read a member of x86_function if target != host is desired */ 139b8e80941Smrgstatic inline enum x86_target x86_target( struct x86_function* p ) 140848b8605Smrg{ 141848b8605Smrg#ifdef PIPE_ARCH_X86 142848b8605Smrg return X86_32; 143848b8605Smrg#elif (defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_WINDOWS)) && defined(PIPE_ARCH_X86_64) 144848b8605Smrg return X86_64_WIN64_ABI; 145848b8605Smrg#elif defined(PIPE_ARCH_X86_64) 146848b8605Smrg return X86_64_STD_ABI; 147848b8605Smrg#endif 148848b8605Smrg} 149848b8605Smrg 150b8e80941Smrgstatic inline unsigned x86_target_caps( struct x86_function* p ) 151848b8605Smrg{ 152848b8605Smrg return p->caps; 153848b8605Smrg} 154848b8605Smrg 155848b8605Smrgvoid x86_init_func( struct x86_function *p ); 156848b8605Smrgvoid x86_init_func_size( struct x86_function *p, unsigned code_size ); 157848b8605Smrgvoid x86_release_func( struct x86_function *p ); 158848b8605Smrgx86_func x86_get_func( struct x86_function *p ); 159848b8605Smrg 160848b8605Smrg/* Debugging: 161848b8605Smrg */ 162848b8605Smrgvoid x86_print_reg( struct x86_reg reg ); 163848b8605Smrg 164848b8605Smrg 165848b8605Smrg/* Create and manipulate registers and regmem values: 166848b8605Smrg */ 167848b8605Smrgstruct x86_reg x86_make_reg( enum x86_reg_file file, 168848b8605Smrg enum x86_reg_name idx ); 169848b8605Smrg 170848b8605Smrgstruct x86_reg x86_make_disp( struct x86_reg reg, 171848b8605Smrg int disp ); 172848b8605Smrg 173848b8605Smrgstruct x86_reg x86_deref( struct x86_reg reg ); 174848b8605Smrg 175848b8605Smrgstruct x86_reg x86_get_base_reg( struct x86_reg reg ); 176848b8605Smrg 177848b8605Smrg 178848b8605Smrg/* Labels, jumps and fixup: 179848b8605Smrg */ 180848b8605Smrgint x86_get_label( struct x86_function *p ); 181848b8605Smrg 182848b8605Smrgvoid x64_rexw(struct x86_function *p); 183848b8605Smrg 184848b8605Smrgvoid x86_jcc( struct x86_function *p, 185848b8605Smrg enum x86_cc cc, 186848b8605Smrg int label ); 187848b8605Smrg 188848b8605Smrgint x86_jcc_forward( struct x86_function *p, 189848b8605Smrg enum x86_cc cc ); 190848b8605Smrg 191848b8605Smrgint x86_jmp_forward( struct x86_function *p); 192848b8605Smrg 193848b8605Smrgint x86_call_forward( struct x86_function *p); 194848b8605Smrg 195848b8605Smrgvoid x86_fixup_fwd_jump( struct x86_function *p, 196848b8605Smrg int fixup ); 197848b8605Smrg 198848b8605Smrgvoid x86_jmp( struct x86_function *p, int label ); 199848b8605Smrg 200848b8605Smrg/* void x86_call( struct x86_function *p, void (*label)() ); */ 201848b8605Smrgvoid x86_call( struct x86_function *p, struct x86_reg reg); 202848b8605Smrg 203848b8605Smrgvoid x86_mov_reg_imm( struct x86_function *p, struct x86_reg dst, int imm ); 204848b8605Smrgvoid x86_add_imm( struct x86_function *p, struct x86_reg dst, int imm ); 205848b8605Smrgvoid x86_or_imm( struct x86_function *p, struct x86_reg dst, int imm ); 206848b8605Smrgvoid x86_and_imm( struct x86_function *p, struct x86_reg dst, int imm ); 207848b8605Smrgvoid x86_sub_imm( struct x86_function *p, struct x86_reg dst, int imm ); 208848b8605Smrgvoid x86_xor_imm( struct x86_function *p, struct x86_reg dst, int imm ); 209848b8605Smrgvoid x86_cmp_imm( struct x86_function *p, struct x86_reg dst, int imm ); 210848b8605Smrg 211848b8605Smrg 212848b8605Smrg/* Macro for sse_shufps() and sse2_pshufd(): 213848b8605Smrg */ 214848b8605Smrg#define SHUF(_x,_y,_z,_w) (((_x)<<0) | ((_y)<<2) | ((_z)<<4) | ((_w)<<6)) 215848b8605Smrg#define SHUF_NOOP RSW(0,1,2,3) 216848b8605Smrg#define GET_SHUF(swz, idx) (((swz) >> ((idx)*2)) & 0x3) 217848b8605Smrg 218848b8605Smrgvoid mmx_emms( struct x86_function *p ); 219848b8605Smrgvoid mmx_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 220848b8605Smrgvoid mmx_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 221848b8605Smrgvoid mmx_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 222848b8605Smrgvoid mmx_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 223848b8605Smrg 224848b8605Smrgvoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 225848b8605Smrgvoid sse2_movq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 226848b8605Smrgvoid sse2_movdqu( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 227848b8605Smrgvoid sse2_movdqa( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 228848b8605Smrgvoid sse2_movsd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 229848b8605Smrgvoid sse2_movupd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 230848b8605Smrgvoid sse2_movapd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 231848b8605Smrg 232848b8605Smrgvoid sse2_cvtps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 233848b8605Smrgvoid sse2_cvttps2dq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 234848b8605Smrgvoid sse2_cvtdq2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 235848b8605Smrgvoid sse2_cvtsd2ss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 236848b8605Smrgvoid sse2_cvtpd2ps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 237848b8605Smrg 238848b8605Smrgvoid sse2_movd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 239848b8605Smrgvoid sse2_packssdw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 240848b8605Smrgvoid sse2_packsswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 241848b8605Smrgvoid sse2_packuswb( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 242848b8605Smrgvoid sse2_pshufd( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, 243848b8605Smrg unsigned char shuf ); 244848b8605Smrgvoid sse2_pshuflw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, 245848b8605Smrg unsigned char shuf ); 246848b8605Smrgvoid sse2_pshufhw( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, 247848b8605Smrg unsigned char shuf ); 248848b8605Smrgvoid sse2_rcpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 249848b8605Smrgvoid sse2_rcpss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 250848b8605Smrg 251848b8605Smrgvoid sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 252848b8605Smrgvoid sse2_punpcklwd( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 253848b8605Smrgvoid sse2_punpckldq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 254848b8605Smrgvoid sse2_punpcklqdq( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 255848b8605Smrg 256848b8605Smrgvoid sse2_psllw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 257848b8605Smrgvoid sse2_pslld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 258848b8605Smrgvoid sse2_psllq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 259848b8605Smrg 260848b8605Smrgvoid sse2_psrlw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 261848b8605Smrgvoid sse2_psrld_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 262848b8605Smrgvoid sse2_psrlq_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 263848b8605Smrg 264848b8605Smrgvoid sse2_psraw_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 265848b8605Smrgvoid sse2_psrad_imm( struct x86_function *p, struct x86_reg dst, unsigned imm ); 266848b8605Smrg 267848b8605Smrgvoid sse2_por( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 268848b8605Smrg 269848b8605Smrgvoid sse2_pshuflw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); 270848b8605Smrgvoid sse2_pshufhw( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); 271848b8605Smrgvoid sse2_pshufd( struct x86_function *p, struct x86_reg dst, struct x86_reg src, uint8_t imm ); 272848b8605Smrg 273848b8605Smrgvoid sse_prefetchnta( struct x86_function *p, struct x86_reg ptr); 274848b8605Smrgvoid sse_prefetch0( struct x86_function *p, struct x86_reg ptr); 275848b8605Smrgvoid sse_prefetch1( struct x86_function *p, struct x86_reg ptr); 276848b8605Smrg 277848b8605Smrgvoid sse_movntps( struct x86_function *p, struct x86_reg dst, struct x86_reg src); 278848b8605Smrg 279848b8605Smrgvoid sse_addps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 280848b8605Smrgvoid sse_addss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 281848b8605Smrgvoid sse_cvtps2pi( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 282848b8605Smrgvoid sse_divss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 283848b8605Smrgvoid sse_andnps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 284848b8605Smrgvoid sse_andps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 285848b8605Smrgvoid sse_cmpps( struct x86_function *p, struct x86_reg dst, struct x86_reg src, 286848b8605Smrg enum sse_cc cc ); 287848b8605Smrgvoid sse_maxps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 288848b8605Smrgvoid sse_maxss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 289848b8605Smrgvoid sse_minps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 290848b8605Smrgvoid sse_movaps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 291848b8605Smrgvoid sse_movhlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 292848b8605Smrgvoid sse_movhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 293848b8605Smrgvoid sse_movlhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 294848b8605Smrgvoid sse_movlps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 295848b8605Smrgvoid sse_movss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 296848b8605Smrgvoid sse_movups( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 297848b8605Smrgvoid sse_mulps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 298848b8605Smrgvoid sse_mulss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 299848b8605Smrgvoid sse_orps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 300848b8605Smrgvoid sse_xorps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 301848b8605Smrgvoid sse_subps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 302848b8605Smrgvoid sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 303848b8605Smrgvoid sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 304848b8605Smrgvoid sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0, 305848b8605Smrg unsigned char shuf ); 306848b8605Smrgvoid sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 307848b8605Smrgvoid sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 308848b8605Smrgvoid sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src ); 309848b8605Smrgvoid sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg src); 310848b8605Smrg 311848b8605Smrgvoid x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 312848b8605Smrgvoid x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 313848b8605Smrgvoid x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc ); 314848b8605Smrgvoid x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 315848b8605Smrgvoid x86_dec( struct x86_function *p, struct x86_reg reg ); 316848b8605Smrgvoid x86_inc( struct x86_function *p, struct x86_reg reg ); 317848b8605Smrgvoid x86_lea( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 318848b8605Smrgvoid x86_mov( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 319848b8605Smrgvoid x64_mov64( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 320848b8605Smrgvoid x86_mov8( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 321848b8605Smrgvoid x86_mov16( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 322848b8605Smrgvoid x86_movzx8(struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 323848b8605Smrgvoid x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 324848b8605Smrgvoid x86_mov_imm(struct x86_function *p, struct x86_reg dst, int imm ); 325848b8605Smrgvoid x86_mov8_imm(struct x86_function *p, struct x86_reg dst, uint8_t imm ); 326848b8605Smrgvoid x86_mov16_imm(struct x86_function *p, struct x86_reg dst, uint16_t imm ); 327848b8605Smrgvoid x86_mul( struct x86_function *p, struct x86_reg src ); 328848b8605Smrgvoid x86_imul( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 329848b8605Smrgvoid x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 330848b8605Smrgvoid x86_pop( struct x86_function *p, struct x86_reg reg ); 331848b8605Smrgvoid x86_push( struct x86_function *p, struct x86_reg reg ); 332848b8605Smrgvoid x86_push_imm32( struct x86_function *p, int imm ); 333848b8605Smrgvoid x86_ret( struct x86_function *p ); 334848b8605Smrgvoid x86_retw( struct x86_function *p, unsigned short imm ); 335848b8605Smrgvoid x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 336848b8605Smrgvoid x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 337848b8605Smrgvoid x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src ); 338848b8605Smrgvoid x86_sahf( struct x86_function *p ); 339848b8605Smrgvoid x86_div( struct x86_function *p, struct x86_reg src ); 340848b8605Smrgvoid x86_bswap( struct x86_function *p, struct x86_reg src ); 341848b8605Smrgvoid x86_shr_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); 342848b8605Smrgvoid x86_sar_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); 343848b8605Smrgvoid x86_shl_imm( struct x86_function *p, struct x86_reg reg, unsigned imm ); 344848b8605Smrg 345848b8605Smrgvoid x86_cdecl_caller_push_regs( struct x86_function *p ); 346848b8605Smrgvoid x86_cdecl_caller_pop_regs( struct x86_function *p ); 347848b8605Smrg 348848b8605Smrgvoid x87_assert_stack_empty( struct x86_function *p ); 349848b8605Smrg 350848b8605Smrgvoid x87_f2xm1( struct x86_function *p ); 351848b8605Smrgvoid x87_fabs( struct x86_function *p ); 352848b8605Smrgvoid x87_fadd( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 353848b8605Smrgvoid x87_faddp( struct x86_function *p, struct x86_reg dst ); 354848b8605Smrgvoid x87_fchs( struct x86_function *p ); 355848b8605Smrgvoid x87_fclex( struct x86_function *p ); 356848b8605Smrgvoid x87_fcmovb( struct x86_function *p, struct x86_reg src ); 357848b8605Smrgvoid x87_fcmovbe( struct x86_function *p, struct x86_reg src ); 358848b8605Smrgvoid x87_fcmove( struct x86_function *p, struct x86_reg src ); 359848b8605Smrgvoid x87_fcmovnb( struct x86_function *p, struct x86_reg src ); 360848b8605Smrgvoid x87_fcmovnbe( struct x86_function *p, struct x86_reg src ); 361848b8605Smrgvoid x87_fcmovne( struct x86_function *p, struct x86_reg src ); 362848b8605Smrgvoid x87_fcom( struct x86_function *p, struct x86_reg dst ); 363848b8605Smrgvoid x87_fcomi( struct x86_function *p, struct x86_reg dst ); 364848b8605Smrgvoid x87_fcomip( struct x86_function *p, struct x86_reg dst ); 365848b8605Smrgvoid x87_fcomp( struct x86_function *p, struct x86_reg dst ); 366848b8605Smrgvoid x87_fcos( struct x86_function *p ); 367848b8605Smrgvoid x87_fdiv( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 368848b8605Smrgvoid x87_fdivp( struct x86_function *p, struct x86_reg dst ); 369848b8605Smrgvoid x87_fdivr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 370848b8605Smrgvoid x87_fdivrp( struct x86_function *p, struct x86_reg dst ); 371848b8605Smrgvoid x87_fild( struct x86_function *p, struct x86_reg arg ); 372848b8605Smrgvoid x87_fist( struct x86_function *p, struct x86_reg dst ); 373848b8605Smrgvoid x87_fistp( struct x86_function *p, struct x86_reg dst ); 374848b8605Smrgvoid x87_fld( struct x86_function *p, struct x86_reg arg ); 375848b8605Smrgvoid x87_fld1( struct x86_function *p ); 376848b8605Smrgvoid x87_fldcw( struct x86_function *p, struct x86_reg arg ); 377848b8605Smrgvoid x87_fldl2e( struct x86_function *p ); 378848b8605Smrgvoid x87_fldln2( struct x86_function *p ); 379848b8605Smrgvoid x87_fldz( struct x86_function *p ); 380848b8605Smrgvoid x87_fmul( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 381848b8605Smrgvoid x87_fmulp( struct x86_function *p, struct x86_reg dst ); 382848b8605Smrgvoid x87_fnclex( struct x86_function *p ); 383848b8605Smrgvoid x87_fprndint( struct x86_function *p ); 384848b8605Smrgvoid x87_fpop( struct x86_function *p ); 385848b8605Smrgvoid x87_fscale( struct x86_function *p ); 386848b8605Smrgvoid x87_fsin( struct x86_function *p ); 387848b8605Smrgvoid x87_fsincos( struct x86_function *p ); 388848b8605Smrgvoid x87_fsqrt( struct x86_function *p ); 389848b8605Smrgvoid x87_fst( struct x86_function *p, struct x86_reg dst ); 390848b8605Smrgvoid x87_fstp( struct x86_function *p, struct x86_reg dst ); 391848b8605Smrgvoid x87_fsub( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 392848b8605Smrgvoid x87_fsubp( struct x86_function *p, struct x86_reg dst ); 393848b8605Smrgvoid x87_fsubr( struct x86_function *p, struct x86_reg dst, struct x86_reg arg ); 394848b8605Smrgvoid x87_fsubrp( struct x86_function *p, struct x86_reg dst ); 395848b8605Smrgvoid x87_ftst( struct x86_function *p ); 396848b8605Smrgvoid x87_fxch( struct x86_function *p, struct x86_reg dst ); 397848b8605Smrgvoid x87_fxtract( struct x86_function *p ); 398848b8605Smrgvoid x87_fyl2x( struct x86_function *p ); 399848b8605Smrgvoid x87_fyl2xp1( struct x86_function *p ); 400848b8605Smrgvoid x87_fwait( struct x86_function *p ); 401848b8605Smrgvoid x87_fnstcw( struct x86_function *p, struct x86_reg dst ); 402848b8605Smrgvoid x87_fnstsw( struct x86_function *p, struct x86_reg dst ); 403848b8605Smrgvoid x87_fucompp( struct x86_function *p ); 404848b8605Smrgvoid x87_fucomp( struct x86_function *p, struct x86_reg arg ); 405848b8605Smrgvoid x87_fucom( struct x86_function *p, struct x86_reg arg ); 406848b8605Smrg 407848b8605Smrg 408848b8605Smrg 409848b8605Smrg/* Retrieve a reference to one of the function arguments, taking into 410848b8605Smrg * account any push/pop activity. Note - doesn't track explicit 411848b8605Smrg * manipulation of ESP by other instructions. 412848b8605Smrg */ 413848b8605Smrgstruct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg ); 414848b8605Smrg 415848b8605Smrg#endif 416848b8605Smrg#endif 417