aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore/ix86_64/ix86_3dnow.c
blob: 8fd42333f23451b39b244f1d3c1522b47f238fde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// stop compiling if NORECBUILD build (only for Visual Studio)
#if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))

#include "ix86-64.h"

/**********************/
/* 3DNOW instructions */
/**********************/

/* femms */
void FEMMS( void ) 
{
	write16( 0x0E0F );
}

void PFCMPEQMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0xB0 );
}

void PFCMPGTMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0xA0 );
}

void PFCMPGEMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x90 );
}

void PFADDMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x9E );
}

void PFADDRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from );
	write8( 0x9E );
}

void PFSUBMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x9A );
}

void PFSUBRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0x9A );
}

void PFMULMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0xB4 );
}

void PFMULRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0xB4 );
}

void PFRCPMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x96 );
}

void PFRCPRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0x96 );
}

void PFRCPIT1RtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0xA6 );
}

void PFRCPIT2RtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0xB6 );
}

void PFRSQRTRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0x97 );
}

void PFRSQIT1RtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0xA7 );
}

void PF2IDMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x1D );
}

void PF2IDRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0x1D );
}

void PI2FDMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x0D );
}

void PI2FDRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0x0D );
}

void PFMAXMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0xA4 );
}

void PFMAXRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from ); 
	write8( 0xA4 );
}

void PFMINMtoR( x86IntRegType to, uptr from )
{
	MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
	write8( 0x94 );
}

void PFMINRtoR( x86IntRegType to, x86IntRegType from )
{
	RexRB(0, to, from);
	write16( 0x0F0F );
	ModRM( 3, to, from );
	write8( 0x94 );
}

#endif