Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: src/x87/assembler-x87.cc

Issue 293743005: Introduce x87 port (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 18 matching lines...) Expand all
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 // OF THE POSSIBILITY OF SUCH DAMAGE. 31 // OF THE POSSIBILITY OF SUCH DAMAGE.
32 32
33 // The original source code covered by the above license above has been modified 33 // The original source code covered by the above license above has been modified
34 // significantly by Google Inc. 34 // significantly by Google Inc.
35 // Copyright 2012 the V8 project authors. All rights reserved. 35 // Copyright 2012 the V8 project authors. All rights reserved.
36 36
37 #include "v8.h" 37 #include "v8.h"
38 38
39 #if V8_TARGET_ARCH_IA32 39 #if V8_TARGET_ARCH_X87
40 40
41 #include "disassembler.h" 41 #include "disassembler.h"
42 #include "macro-assembler.h" 42 #include "macro-assembler.h"
43 #include "serialize.h" 43 #include "serialize.h"
44 44
45 namespace v8 { 45 namespace v8 {
46 namespace internal { 46 namespace internal {
47 47
48 // ----------------------------------------------------------------------------- 48 // -----------------------------------------------------------------------------
49 // Implementation of CpuFeatures 49 // Implementation of CpuFeatures
50 50
51 void CpuFeatures::ProbeImpl(bool cross_compile) { 51 void CpuFeatures::ProbeImpl(bool cross_compile) {
52 CPU cpu; 52 CPU cpu;
53 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. 53 // SAHF must be available in compat/legacy mode.
54 CHECK(cpu.has_cmov()); // CMOV support is mandatory. 54 CHECK(cpu.has_sahf());
55 CHECK(cpu.has_sahf()); // SAHF must be available in compat/legacy mode.
56 supported_ |= 1u << SAHF; 55 supported_ |= 1u << SAHF;
57 supported_ |= OS::CpuFeaturesImpliedByPlatform(); 56 supported_ |= OS::CpuFeaturesImpliedByPlatform();
58 57
59 // Only use statically determined features for cross compile (snapshot). 58 // Only use statically determined features for cross compile (snapshot).
60 if (cross_compile) return; 59 if (cross_compile) return;
61
62 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1;
63 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3;
64 } 60 }
65 61
66 62
67 void CpuFeatures::PrintTarget() { } 63 void CpuFeatures::PrintTarget() { }
68 void CpuFeatures::PrintFeatures() { } 64 void CpuFeatures::PrintFeatures() { }
69 65
70 66
71 // ----------------------------------------------------------------------------- 67 // -----------------------------------------------------------------------------
72 // Implementation of Displacement 68 // Implementation of Displacement
73 69
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 while (*a == 0x66) a++; 281 while (*a == 0x66) a++;
286 if (*a == 0x90) return true; 282 if (*a == 0x90) return true;
287 if (a[0] == 0xf && a[1] == 0x1f) return true; 283 if (a[0] == 0xf && a[1] == 0x1f) return true;
288 return false; 284 return false;
289 } 285 }
290 286
291 287
292 void Assembler::Nop(int bytes) { 288 void Assembler::Nop(int bytes) {
293 EnsureSpace ensure_space(this); 289 EnsureSpace ensure_space(this);
294 290
295 // Multi byte nops from http://support.amd.com/us/Processor_TechDocs/40546.pdf 291 // Older CPUs that do not support SSE2 may not support multibyte NOP
296 while (bytes > 0) { 292 // instructions.
297 switch (bytes) { 293 for (; bytes > 0; bytes--) {
298 case 2: 294 EMIT(0x90);
299 EMIT(0x66);
300 case 1:
301 EMIT(0x90);
302 return;
303 case 3:
304 EMIT(0xf);
305 EMIT(0x1f);
306 EMIT(0);
307 return;
308 case 4:
309 EMIT(0xf);
310 EMIT(0x1f);
311 EMIT(0x40);
312 EMIT(0);
313 return;
314 case 6:
315 EMIT(0x66);
316 case 5:
317 EMIT(0xf);
318 EMIT(0x1f);
319 EMIT(0x44);
320 EMIT(0);
321 EMIT(0);
322 return;
323 case 7:
324 EMIT(0xf);
325 EMIT(0x1f);
326 EMIT(0x80);
327 EMIT(0);
328 EMIT(0);
329 EMIT(0);
330 EMIT(0);
331 return;
332 default:
333 case 11:
334 EMIT(0x66);
335 bytes--;
336 case 10:
337 EMIT(0x66);
338 bytes--;
339 case 9:
340 EMIT(0x66);
341 bytes--;
342 case 8:
343 EMIT(0xf);
344 EMIT(0x1f);
345 EMIT(0x84);
346 EMIT(0);
347 EMIT(0);
348 EMIT(0);
349 EMIT(0);
350 EMIT(0);
351 bytes -= 8;
352 }
353 } 295 }
296 return;
354 } 297 }
355 298
356 299
357 void Assembler::CodeTargetAlign() { 300 void Assembler::CodeTargetAlign() {
358 Align(16); // Preferred alignment of jump targets on ia32. 301 Align(16); // Preferred alignment of jump targets on ia32.
359 } 302 }
360 303
361 304
362 void Assembler::cpuid() { 305 void Assembler::cpuid() {
363 EnsureSpace ensure_space(this); 306 EnsureSpace ensure_space(this);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 526
584 527
585 void Assembler::movzx_w(Register dst, const Operand& src) { 528 void Assembler::movzx_w(Register dst, const Operand& src) {
586 EnsureSpace ensure_space(this); 529 EnsureSpace ensure_space(this);
587 EMIT(0x0F); 530 EMIT(0x0F);
588 EMIT(0xB7); 531 EMIT(0xB7);
589 emit_operand(dst, src); 532 emit_operand(dst, src);
590 } 533 }
591 534
592 535
593 void Assembler::cmov(Condition cc, Register dst, const Operand& src) {
594 EnsureSpace ensure_space(this);
595 // Opcode: 0f 40 + cc /r.
596 EMIT(0x0F);
597 EMIT(0x40 + cc);
598 emit_operand(dst, src);
599 }
600
601
602 void Assembler::cld() { 536 void Assembler::cld() {
603 EnsureSpace ensure_space(this); 537 EnsureSpace ensure_space(this);
604 EMIT(0xFC); 538 EMIT(0xFC);
605 } 539 }
606 540
607 541
608 void Assembler::rep_movs() { 542 void Assembler::rep_movs() {
609 EnsureSpace ensure_space(this); 543 EnsureSpace ensure_space(this);
610 EMIT(0xF3); 544 EMIT(0xF3);
611 EMIT(0xA5); 545 EMIT(0xA5);
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 1810
1877 void Assembler::setcc(Condition cc, Register reg) { 1811 void Assembler::setcc(Condition cc, Register reg) {
1878 ASSERT(reg.is_byte_register()); 1812 ASSERT(reg.is_byte_register());
1879 EnsureSpace ensure_space(this); 1813 EnsureSpace ensure_space(this);
1880 EMIT(0x0F); 1814 EMIT(0x0F);
1881 EMIT(0x90 | cc); 1815 EMIT(0x90 | cc);
1882 EMIT(0xC0 | reg.code()); 1816 EMIT(0xC0 | reg.code());
1883 } 1817 }
1884 1818
1885 1819
1886 void Assembler::cvttss2si(Register dst, const Operand& src) {
1887 EnsureSpace ensure_space(this);
1888 EMIT(0xF3);
1889 EMIT(0x0F);
1890 EMIT(0x2C);
1891 emit_operand(dst, src);
1892 }
1893
1894
1895 void Assembler::cvttsd2si(Register dst, const Operand& src) {
1896 EnsureSpace ensure_space(this);
1897 EMIT(0xF2);
1898 EMIT(0x0F);
1899 EMIT(0x2C);
1900 emit_operand(dst, src);
1901 }
1902
1903
1904 void Assembler::cvtsd2si(Register dst, XMMRegister src) {
1905 EnsureSpace ensure_space(this);
1906 EMIT(0xF2);
1907 EMIT(0x0F);
1908 EMIT(0x2D);
1909 emit_sse_operand(dst, src);
1910 }
1911
1912
1913 void Assembler::cvtsi2sd(XMMRegister dst, const Operand& src) {
1914 EnsureSpace ensure_space(this);
1915 EMIT(0xF2);
1916 EMIT(0x0F);
1917 EMIT(0x2A);
1918 emit_sse_operand(dst, src);
1919 }
1920
1921
1922 void Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) {
1923 EnsureSpace ensure_space(this);
1924 EMIT(0xF3);
1925 EMIT(0x0F);
1926 EMIT(0x5A);
1927 emit_sse_operand(dst, src);
1928 }
1929
1930
1931 void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) {
1932 EnsureSpace ensure_space(this);
1933 EMIT(0xF2);
1934 EMIT(0x0F);
1935 EMIT(0x5A);
1936 emit_sse_operand(dst, src);
1937 }
1938
1939
1940 void Assembler::addsd(XMMRegister dst, XMMRegister src) {
1941 EnsureSpace ensure_space(this);
1942 EMIT(0xF2);
1943 EMIT(0x0F);
1944 EMIT(0x58);
1945 emit_sse_operand(dst, src);
1946 }
1947
1948
1949 void Assembler::addsd(XMMRegister dst, const Operand& src) {
1950 EnsureSpace ensure_space(this);
1951 EMIT(0xF2);
1952 EMIT(0x0F);
1953 EMIT(0x58);
1954 emit_sse_operand(dst, src);
1955 }
1956
1957
1958 void Assembler::mulsd(XMMRegister dst, XMMRegister src) {
1959 EnsureSpace ensure_space(this);
1960 EMIT(0xF2);
1961 EMIT(0x0F);
1962 EMIT(0x59);
1963 emit_sse_operand(dst, src);
1964 }
1965
1966
1967 void Assembler::mulsd(XMMRegister dst, const Operand& src) {
1968 EnsureSpace ensure_space(this);
1969 EMIT(0xF2);
1970 EMIT(0x0F);
1971 EMIT(0x59);
1972 emit_sse_operand(dst, src);
1973 }
1974
1975
1976 void Assembler::subsd(XMMRegister dst, XMMRegister src) {
1977 EnsureSpace ensure_space(this);
1978 EMIT(0xF2);
1979 EMIT(0x0F);
1980 EMIT(0x5C);
1981 emit_sse_operand(dst, src);
1982 }
1983
1984
1985 void Assembler::divsd(XMMRegister dst, XMMRegister src) {
1986 EnsureSpace ensure_space(this);
1987 EMIT(0xF2);
1988 EMIT(0x0F);
1989 EMIT(0x5E);
1990 emit_sse_operand(dst, src);
1991 }
1992
1993
1994 void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
1995 EnsureSpace ensure_space(this);
1996 EMIT(0x66);
1997 EMIT(0x0F);
1998 EMIT(0x57);
1999 emit_sse_operand(dst, src);
2000 }
2001
2002
2003 void Assembler::andps(XMMRegister dst, const Operand& src) {
2004 EnsureSpace ensure_space(this);
2005 EMIT(0x0F);
2006 EMIT(0x54);
2007 emit_sse_operand(dst, src);
2008 }
2009
2010
2011 void Assembler::orps(XMMRegister dst, const Operand& src) {
2012 EnsureSpace ensure_space(this);
2013 EMIT(0x0F);
2014 EMIT(0x56);
2015 emit_sse_operand(dst, src);
2016 }
2017
2018
2019 void Assembler::xorps(XMMRegister dst, const Operand& src) {
2020 EnsureSpace ensure_space(this);
2021 EMIT(0x0F);
2022 EMIT(0x57);
2023 emit_sse_operand(dst, src);
2024 }
2025
2026
2027 void Assembler::addps(XMMRegister dst, const Operand& src) {
2028 EnsureSpace ensure_space(this);
2029 EMIT(0x0F);
2030 EMIT(0x58);
2031 emit_sse_operand(dst, src);
2032 }
2033
2034
2035 void Assembler::subps(XMMRegister dst, const Operand& src) {
2036 EnsureSpace ensure_space(this);
2037 EMIT(0x0F);
2038 EMIT(0x5C);
2039 emit_sse_operand(dst, src);
2040 }
2041
2042
2043 void Assembler::mulps(XMMRegister dst, const Operand& src) {
2044 EnsureSpace ensure_space(this);
2045 EMIT(0x0F);
2046 EMIT(0x59);
2047 emit_sse_operand(dst, src);
2048 }
2049
2050
2051 void Assembler::divps(XMMRegister dst, const Operand& src) {
2052 EnsureSpace ensure_space(this);
2053 EMIT(0x0F);
2054 EMIT(0x5E);
2055 emit_sse_operand(dst, src);
2056 }
2057
2058
2059 void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
2060 EnsureSpace ensure_space(this);
2061 EMIT(0xF2);
2062 EMIT(0x0F);
2063 EMIT(0x51);
2064 emit_sse_operand(dst, src);
2065 }
2066
2067
2068 void Assembler::andpd(XMMRegister dst, XMMRegister src) {
2069 EnsureSpace ensure_space(this);
2070 EMIT(0x66);
2071 EMIT(0x0F);
2072 EMIT(0x54);
2073 emit_sse_operand(dst, src);
2074 }
2075
2076
2077 void Assembler::orpd(XMMRegister dst, XMMRegister src) {
2078 EnsureSpace ensure_space(this);
2079 EMIT(0x66);
2080 EMIT(0x0F);
2081 EMIT(0x56);
2082 emit_sse_operand(dst, src);
2083 }
2084
2085
2086 void Assembler::ucomisd(XMMRegister dst, const Operand& src) {
2087 EnsureSpace ensure_space(this);
2088 EMIT(0x66);
2089 EMIT(0x0F);
2090 EMIT(0x2E);
2091 emit_sse_operand(dst, src);
2092 }
2093
2094
2095 void Assembler::roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode) {
2096 ASSERT(IsEnabled(SSE4_1));
2097 EnsureSpace ensure_space(this);
2098 EMIT(0x66);
2099 EMIT(0x0F);
2100 EMIT(0x3A);
2101 EMIT(0x0B);
2102 emit_sse_operand(dst, src);
2103 // Mask precision exeption.
2104 EMIT(static_cast<byte>(mode) | 0x8);
2105 }
2106
2107
2108 void Assembler::movmskpd(Register dst, XMMRegister src) {
2109 EnsureSpace ensure_space(this);
2110 EMIT(0x66);
2111 EMIT(0x0F);
2112 EMIT(0x50);
2113 emit_sse_operand(dst, src);
2114 }
2115
2116
2117 void Assembler::movmskps(Register dst, XMMRegister src) {
2118 EnsureSpace ensure_space(this);
2119 EMIT(0x0F);
2120 EMIT(0x50);
2121 emit_sse_operand(dst, src);
2122 }
2123
2124
2125 void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) {
2126 EnsureSpace ensure_space(this);
2127 EMIT(0x66);
2128 EMIT(0x0F);
2129 EMIT(0x76);
2130 emit_sse_operand(dst, src);
2131 }
2132
2133
2134 void Assembler::cmpltsd(XMMRegister dst, XMMRegister src) {
2135 EnsureSpace ensure_space(this);
2136 EMIT(0xF2);
2137 EMIT(0x0F);
2138 EMIT(0xC2);
2139 emit_sse_operand(dst, src);
2140 EMIT(1); // LT == 1
2141 }
2142
2143
2144 void Assembler::movaps(XMMRegister dst, XMMRegister src) {
2145 EnsureSpace ensure_space(this);
2146 EMIT(0x0F);
2147 EMIT(0x28);
2148 emit_sse_operand(dst, src);
2149 }
2150
2151
2152 void Assembler::shufps(XMMRegister dst, XMMRegister src, byte imm8) {
2153 ASSERT(is_uint8(imm8));
2154 EnsureSpace ensure_space(this);
2155 EMIT(0x0F);
2156 EMIT(0xC6);
2157 emit_sse_operand(dst, src);
2158 EMIT(imm8);
2159 }
2160
2161
2162 void Assembler::movdqa(const Operand& dst, XMMRegister src) {
2163 EnsureSpace ensure_space(this);
2164 EMIT(0x66);
2165 EMIT(0x0F);
2166 EMIT(0x7F);
2167 emit_sse_operand(src, dst);
2168 }
2169
2170
2171 void Assembler::movdqa(XMMRegister dst, const Operand& src) {
2172 EnsureSpace ensure_space(this);
2173 EMIT(0x66);
2174 EMIT(0x0F);
2175 EMIT(0x6F);
2176 emit_sse_operand(dst, src);
2177 }
2178
2179
2180 void Assembler::movdqu(const Operand& dst, XMMRegister src ) {
2181 EnsureSpace ensure_space(this);
2182 EMIT(0xF3);
2183 EMIT(0x0F);
2184 EMIT(0x7F);
2185 emit_sse_operand(src, dst);
2186 }
2187
2188
2189 void Assembler::movdqu(XMMRegister dst, const Operand& src) {
2190 EnsureSpace ensure_space(this);
2191 EMIT(0xF3);
2192 EMIT(0x0F);
2193 EMIT(0x6F);
2194 emit_sse_operand(dst, src);
2195 }
2196
2197
2198 void Assembler::movntdqa(XMMRegister dst, const Operand& src) {
2199 ASSERT(IsEnabled(SSE4_1));
2200 EnsureSpace ensure_space(this);
2201 EMIT(0x66);
2202 EMIT(0x0F);
2203 EMIT(0x38);
2204 EMIT(0x2A);
2205 emit_sse_operand(dst, src);
2206 }
2207
2208
2209 void Assembler::movntdq(const Operand& dst, XMMRegister src) {
2210 EnsureSpace ensure_space(this);
2211 EMIT(0x66);
2212 EMIT(0x0F);
2213 EMIT(0xE7);
2214 emit_sse_operand(src, dst);
2215 }
2216
2217
2218 void Assembler::prefetch(const Operand& src, int level) {
2219 ASSERT(is_uint2(level));
2220 EnsureSpace ensure_space(this);
2221 EMIT(0x0F);
2222 EMIT(0x18);
2223 // Emit hint number in Reg position of RegR/M.
2224 XMMRegister code = XMMRegister::from_code(level);
2225 emit_sse_operand(code, src);
2226 }
2227
2228
2229 void Assembler::movsd(const Operand& dst, XMMRegister src ) {
2230 EnsureSpace ensure_space(this);
2231 EMIT(0xF2); // double
2232 EMIT(0x0F);
2233 EMIT(0x11); // store
2234 emit_sse_operand(src, dst);
2235 }
2236
2237
2238 void Assembler::movsd(XMMRegister dst, const Operand& src) {
2239 EnsureSpace ensure_space(this);
2240 EMIT(0xF2); // double
2241 EMIT(0x0F);
2242 EMIT(0x10); // load
2243 emit_sse_operand(dst, src);
2244 }
2245
2246
2247 void Assembler::movss(const Operand& dst, XMMRegister src ) {
2248 EnsureSpace ensure_space(this);
2249 EMIT(0xF3); // float
2250 EMIT(0x0F);
2251 EMIT(0x11); // store
2252 emit_sse_operand(src, dst);
2253 }
2254
2255
2256 void Assembler::movss(XMMRegister dst, const Operand& src) {
2257 EnsureSpace ensure_space(this);
2258 EMIT(0xF3); // float
2259 EMIT(0x0F);
2260 EMIT(0x10); // load
2261 emit_sse_operand(dst, src);
2262 }
2263
2264
2265 void Assembler::movd(XMMRegister dst, const Operand& src) {
2266 EnsureSpace ensure_space(this);
2267 EMIT(0x66);
2268 EMIT(0x0F);
2269 EMIT(0x6E);
2270 emit_sse_operand(dst, src);
2271 }
2272
2273
2274 void Assembler::movd(const Operand& dst, XMMRegister src) {
2275 EnsureSpace ensure_space(this);
2276 EMIT(0x66);
2277 EMIT(0x0F);
2278 EMIT(0x7E);
2279 emit_sse_operand(src, dst);
2280 }
2281
2282
2283 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) {
2284 ASSERT(IsEnabled(SSE4_1));
2285 ASSERT(is_uint8(imm8));
2286 EnsureSpace ensure_space(this);
2287 EMIT(0x66);
2288 EMIT(0x0F);
2289 EMIT(0x3A);
2290 EMIT(0x17);
2291 emit_sse_operand(src, dst);
2292 EMIT(imm8);
2293 }
2294
2295
2296 void Assembler::pand(XMMRegister dst, XMMRegister src) {
2297 EnsureSpace ensure_space(this);
2298 EMIT(0x66);
2299 EMIT(0x0F);
2300 EMIT(0xDB);
2301 emit_sse_operand(dst, src);
2302 }
2303
2304
2305 void Assembler::pxor(XMMRegister dst, XMMRegister src) {
2306 EnsureSpace ensure_space(this);
2307 EMIT(0x66);
2308 EMIT(0x0F);
2309 EMIT(0xEF);
2310 emit_sse_operand(dst, src);
2311 }
2312
2313
2314 void Assembler::por(XMMRegister dst, XMMRegister src) {
2315 EnsureSpace ensure_space(this);
2316 EMIT(0x66);
2317 EMIT(0x0F);
2318 EMIT(0xEB);
2319 emit_sse_operand(dst, src);
2320 }
2321
2322
2323 void Assembler::ptest(XMMRegister dst, XMMRegister src) {
2324 ASSERT(IsEnabled(SSE4_1));
2325 EnsureSpace ensure_space(this);
2326 EMIT(0x66);
2327 EMIT(0x0F);
2328 EMIT(0x38);
2329 EMIT(0x17);
2330 emit_sse_operand(dst, src);
2331 }
2332
2333
2334 void Assembler::psllq(XMMRegister reg, int8_t shift) {
2335 EnsureSpace ensure_space(this);
2336 EMIT(0x66);
2337 EMIT(0x0F);
2338 EMIT(0x73);
2339 emit_sse_operand(esi, reg); // esi == 6
2340 EMIT(shift);
2341 }
2342
2343
2344 void Assembler::psllq(XMMRegister dst, XMMRegister src) {
2345 EnsureSpace ensure_space(this);
2346 EMIT(0x66);
2347 EMIT(0x0F);
2348 EMIT(0xF3);
2349 emit_sse_operand(dst, src);
2350 }
2351
2352
2353 void Assembler::psrlq(XMMRegister reg, int8_t shift) {
2354 EnsureSpace ensure_space(this);
2355 EMIT(0x66);
2356 EMIT(0x0F);
2357 EMIT(0x73);
2358 emit_sse_operand(edx, reg); // edx == 2
2359 EMIT(shift);
2360 }
2361
2362
2363 void Assembler::psrlq(XMMRegister dst, XMMRegister src) {
2364 EnsureSpace ensure_space(this);
2365 EMIT(0x66);
2366 EMIT(0x0F);
2367 EMIT(0xD3);
2368 emit_sse_operand(dst, src);
2369 }
2370
2371
2372 void Assembler::pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
2373 EnsureSpace ensure_space(this);
2374 EMIT(0x66);
2375 EMIT(0x0F);
2376 EMIT(0x70);
2377 emit_sse_operand(dst, src);
2378 EMIT(shuffle);
2379 }
2380
2381
2382 void Assembler::pextrd(const Operand& dst, XMMRegister src, int8_t offset) {
2383 ASSERT(IsEnabled(SSE4_1));
2384 EnsureSpace ensure_space(this);
2385 EMIT(0x66);
2386 EMIT(0x0F);
2387 EMIT(0x3A);
2388 EMIT(0x16);
2389 emit_sse_operand(src, dst);
2390 EMIT(offset);
2391 }
2392
2393
2394 void Assembler::pinsrd(XMMRegister dst, const Operand& src, int8_t offset) {
2395 ASSERT(IsEnabled(SSE4_1));
2396 EnsureSpace ensure_space(this);
2397 EMIT(0x66);
2398 EMIT(0x0F);
2399 EMIT(0x3A);
2400 EMIT(0x22);
2401 emit_sse_operand(dst, src);
2402 EMIT(offset);
2403 }
2404
2405
2406 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) {
2407 Register ireg = { reg.code() };
2408 emit_operand(ireg, adr);
2409 }
2410
2411
2412 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) {
2413 EMIT(0xC0 | dst.code() << 3 | src.code());
2414 }
2415
2416
2417 void Assembler::emit_sse_operand(Register dst, XMMRegister src) {
2418 EMIT(0xC0 | dst.code() << 3 | src.code());
2419 }
2420
2421
2422 void Assembler::emit_sse_operand(XMMRegister dst, Register src) {
2423 EMIT(0xC0 | (dst.code() << 3) | src.code());
2424 }
2425
2426
2427 void Assembler::Print() { 1820 void Assembler::Print() {
2428 Disassembler::Decode(isolate(), stdout, buffer_, pc_); 1821 Disassembler::Decode(isolate(), stdout, buffer_, pc_);
2429 } 1822 }
2430 1823
2431 1824
2432 void Assembler::RecordJSReturn() { 1825 void Assembler::RecordJSReturn() {
2433 positions_recorder()->WriteRecordedPositions(); 1826 positions_recorder()->WriteRecordedPositions();
2434 EnsureSpace ensure_space(this); 1827 EnsureSpace ensure_space(this);
2435 RecordRelocInfo(RelocInfo::JS_RETURN); 1828 RecordRelocInfo(RelocInfo::JS_RETURN);
2436 } 1829 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 void Assembler::dd(uint32_t data) { 1973 void Assembler::dd(uint32_t data) {
2581 EnsureSpace ensure_space(this); 1974 EnsureSpace ensure_space(this);
2582 emit(data); 1975 emit(data);
2583 } 1976 }
2584 1977
2585 1978
2586 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { 1979 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
2587 ASSERT(!RelocInfo::IsNone(rmode)); 1980 ASSERT(!RelocInfo::IsNone(rmode));
2588 // Don't record external references unless the heap will be serialized. 1981 // Don't record external references unless the heap will be serialized.
2589 if (rmode == RelocInfo::EXTERNAL_REFERENCE && 1982 if (rmode == RelocInfo::EXTERNAL_REFERENCE &&
2590 !serializer_enabled() && !emit_debug_code()) { 1983 !Serializer::enabled(isolate()) && !emit_debug_code()) {
2591 return; 1984 return;
2592 } 1985 }
2593 RelocInfo rinfo(pc_, rmode, data, NULL); 1986 RelocInfo rinfo(pc_, rmode, data, NULL);
2594 reloc_info_writer.Write(&rinfo); 1987 reloc_info_writer.Write(&rinfo);
2595 } 1988 }
2596 1989
2597 1990
2598 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { 1991 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) {
2599 // No out-of-line constant pool support. 1992 // No out-of-line constant pool support.
2600 ASSERT(!FLAG_enable_ool_constant_pool); 1993 ASSERT(!FLAG_enable_ool_constant_pool);
2601 return isolate->factory()->empty_constant_pool_array(); 1994 return isolate->factory()->empty_constant_pool_array();
(...skipping 27 matching lines...) Expand all
2629 if (coverage_log != NULL) { 2022 if (coverage_log != NULL) {
2630 fprintf(coverage_log, "%s\n", file_line); 2023 fprintf(coverage_log, "%s\n", file_line);
2631 fflush(coverage_log); 2024 fflush(coverage_log);
2632 } 2025 }
2633 } 2026 }
2634 2027
2635 #endif 2028 #endif
2636 2029
2637 } } // namespace v8::internal 2030 } } // namespace v8::internal
2638 2031
2639 #endif // V8_TARGET_ARCH_IA32 2032 #endif // V8_TARGET_ARCH_X87
OLDNEW
« src/x87/OWNERS ('K') | « src/x87/assembler-x87.h ('k') | src/x87/assembler-x87-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698