improve ARM feature detection
[pcsx_rearmed.git] / libpcsxcore / ix86_64 / ix86_3dnow.c
1 // stop compiling if NORECBUILD build (only for Visual Studio)
2 #if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
3
4 #include "ix86-64.h"
5
6 /**********************/
7 /* 3DNOW instructions */
8 /**********************/
9
10 /* femms */
11 void FEMMS( void ) 
12 {
13         write16( 0x0E0F );
14 }
15
16 void PFCMPEQMtoR( x86IntRegType to, uptr from )
17 {
18         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
19         write8( 0xB0 );
20 }
21
22 void PFCMPGTMtoR( x86IntRegType to, uptr from )
23 {
24         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
25         write8( 0xA0 );
26 }
27
28 void PFCMPGEMtoR( x86IntRegType to, uptr from )
29 {
30         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
31         write8( 0x90 );
32 }
33
34 void PFADDMtoR( x86IntRegType to, uptr from )
35 {
36         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
37         write8( 0x9E );
38 }
39
40 void PFADDRtoR( x86IntRegType to, x86IntRegType from )
41 {
42         RexRB(0, to, from);
43         write16( 0x0F0F );
44         ModRM( 3, to, from );
45         write8( 0x9E );
46 }
47
48 void PFSUBMtoR( x86IntRegType to, uptr from )
49 {
50         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
51         write8( 0x9A );
52 }
53
54 void PFSUBRtoR( x86IntRegType to, x86IntRegType from )
55 {
56         RexRB(0, to, from);
57         write16( 0x0F0F );
58         ModRM( 3, to, from ); 
59         write8( 0x9A );
60 }
61
62 void PFMULMtoR( x86IntRegType to, uptr from )
63 {
64         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
65         write8( 0xB4 );
66 }
67
68 void PFMULRtoR( x86IntRegType to, x86IntRegType from )
69 {
70         RexRB(0, to, from);
71         write16( 0x0F0F );
72         ModRM( 3, to, from ); 
73         write8( 0xB4 );
74 }
75
76 void PFRCPMtoR( x86IntRegType to, uptr from )
77 {
78         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
79         write8( 0x96 );
80 }
81
82 void PFRCPRtoR( x86IntRegType to, x86IntRegType from )
83 {
84         RexRB(0, to, from);
85         write16( 0x0F0F );
86         ModRM( 3, to, from ); 
87         write8( 0x96 );
88 }
89
90 void PFRCPIT1RtoR( x86IntRegType to, x86IntRegType from )
91 {
92         RexRB(0, to, from);
93         write16( 0x0F0F );
94         ModRM( 3, to, from ); 
95         write8( 0xA6 );
96 }
97
98 void PFRCPIT2RtoR( x86IntRegType to, x86IntRegType from )
99 {
100         RexRB(0, to, from);
101         write16( 0x0F0F );
102         ModRM( 3, to, from ); 
103         write8( 0xB6 );
104 }
105
106 void PFRSQRTRtoR( x86IntRegType to, x86IntRegType from )
107 {
108         RexRB(0, to, from);
109         write16( 0x0F0F );
110         ModRM( 3, to, from ); 
111         write8( 0x97 );
112 }
113
114 void PFRSQIT1RtoR( x86IntRegType to, x86IntRegType from )
115 {
116         RexRB(0, to, from);
117         write16( 0x0F0F );
118         ModRM( 3, to, from ); 
119         write8( 0xA7 );
120 }
121
122 void PF2IDMtoR( x86IntRegType to, uptr from )
123 {
124         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
125         write8( 0x1D );
126 }
127
128 void PF2IDRtoR( x86IntRegType to, x86IntRegType from )
129 {
130         RexRB(0, to, from);
131         write16( 0x0F0F );
132         ModRM( 3, to, from ); 
133         write8( 0x1D );
134 }
135
136 void PI2FDMtoR( x86IntRegType to, uptr from )
137 {
138         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
139         write8( 0x0D );
140 }
141
142 void PI2FDRtoR( x86IntRegType to, x86IntRegType from )
143 {
144         RexRB(0, to, from);
145         write16( 0x0F0F );
146         ModRM( 3, to, from ); 
147         write8( 0x0D );
148 }
149
150 void PFMAXMtoR( x86IntRegType to, uptr from )
151 {
152         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
153         write8( 0xA4 );
154 }
155
156 void PFMAXRtoR( x86IntRegType to, x86IntRegType from )
157 {
158         RexRB(0, to, from);
159         write16( 0x0F0F );
160         ModRM( 3, to, from ); 
161         write8( 0xA4 );
162 }
163
164 void PFMINMtoR( x86IntRegType to, uptr from )
165 {
166         MEMADDR_OP(0, VAROP2(0x0F, 0x0F), true, to, from, 1);
167         write8( 0x94 );
168 }
169
170 void PFMINRtoR( x86IntRegType to, x86IntRegType from )
171 {
172         RexRB(0, to, from);
173         write16( 0x0F0F );
174         ModRM( 3, to, from );
175         write8( 0x94 );
176 }
177
178 #endif