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

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

Issue 1119203003: MIPS: Add float instructions and test coverage, part one (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 } 1896 }
1897 1897
1898 1898
1899 void Assembler::movf(Register rd, Register rs, uint16_t cc) { 1899 void Assembler::movf(Register rd, Register rs, uint16_t cc) {
1900 Register rt; 1900 Register rt;
1901 rt.code_ = (cc & 0x0007) << 2 | 0; 1901 rt.code_ = (cc & 0x0007) << 2 | 0;
1902 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI); 1902 GenInstrRegister(SPECIAL, rs, rt, rd, 0, MOVCI);
1903 } 1903 }
1904 1904
1905 1905
1906 void Assembler::movn_s(FPURegister fd, FPURegister fs, Register rt) {
1907 DCHECK(IsMipsArchVariant(kMips32r2));
1908 GenInstrRegister(COP1, S, rt, fs, fd, MOVN_C);
1909 }
1910
1911
1912 void Assembler::movn_d(FPURegister fd, FPURegister fs, Register rt) {
1913 DCHECK(IsMipsArchVariant(kMips32r2));
1914 GenInstrRegister(COP1, D, rt, fs, fd, MOVN_C);
1915 }
1916
1917
1906 void Assembler::sel(SecondaryField fmt, FPURegister fd, FPURegister fs, 1918 void Assembler::sel(SecondaryField fmt, FPURegister fd, FPURegister fs,
1907 FPURegister ft) { 1919 FPURegister ft) {
1908 DCHECK(IsMipsArchVariant(kMips32r6)); 1920 DCHECK(IsMipsArchVariant(kMips32r6));
1909 DCHECK((fmt == D) || (fmt == S)); 1921 DCHECK((fmt == D) || (fmt == S));
1910 1922
1911 Instr instr = COP1 | fmt << kRsShift | ft.code() << kFtShift | 1923 GenInstrRegister(COP1, fmt, ft, fs, fd, SEL);
1912 fs.code() << kFsShift | fd.code() << kFdShift | SEL;
1913 emit(instr);
1914 } 1924 }
1915 1925
1916 1926
1917 void Assembler::seleqz(Register rd, Register rs, Register rt) { 1927 void Assembler::seleqz(Register rd, Register rs, Register rt) {
1918 DCHECK(IsMipsArchVariant(kMips32r6)); 1928 DCHECK(IsMipsArchVariant(kMips32r6));
1919 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S); 1929 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S);
1920 } 1930 }
1921 1931
1922 1932
1923 void Assembler::seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs, 1933 void Assembler::seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs,
(...skipping 11 matching lines...) Expand all
1935 1945
1936 1946
1937 void Assembler::selnez(SecondaryField fmt, FPURegister fd, FPURegister fs, 1947 void Assembler::selnez(SecondaryField fmt, FPURegister fd, FPURegister fs,
1938 FPURegister ft) { 1948 FPURegister ft) {
1939 DCHECK(IsMipsArchVariant(kMips32r6)); 1949 DCHECK(IsMipsArchVariant(kMips32r6));
1940 DCHECK((fmt == D) || (fmt == S)); 1950 DCHECK((fmt == D) || (fmt == S));
1941 GenInstrRegister(COP1, fmt, ft, fs, fd, SELNEZ_C); 1951 GenInstrRegister(COP1, fmt, ft, fs, fd, SELNEZ_C);
1942 } 1952 }
1943 1953
1944 1954
1955 void Assembler::movz_s(FPURegister fd, FPURegister fs, Register rt) {
1956 DCHECK(IsMipsArchVariant(kMips32r2));
1957 GenInstrRegister(COP1, S, rt, fs, fd, MOVZ_C);
1958 }
1959
1960
1961 void Assembler::movz_d(FPURegister fd, FPURegister fs, Register rt) {
1962 DCHECK(IsMipsArchVariant(kMips32r2));
1963 GenInstrRegister(COP1, D, rt, fs, fd, MOVZ_C);
1964 }
1965
1966
1967 void Assembler::movt_s(FPURegister fd, FPURegister fs, uint16_t cc) {
1968 DCHECK(IsMipsArchVariant(kMips32r2));
1969 FPURegister ft;
1970 ft.code_ = (cc & 0x0007) << 2 | 1;
1971 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
1972 }
1973
1974
1975 void Assembler::movt_d(FPURegister fd, FPURegister fs, uint16_t cc) {
1976 DCHECK(IsMipsArchVariant(kMips32r2));
1977 FPURegister ft;
1978 ft.code_ = (cc & 0x0007) << 2 | 1;
1979 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
1980 }
1981
1982
1983 void Assembler::movf_s(FPURegister fd, FPURegister fs, uint16_t cc) {
1984 DCHECK(IsMipsArchVariant(kMips32r2));
1985 FPURegister ft;
1986 ft.code_ = (cc & 0x0007) << 2 | 0;
1987 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
1988 }
1989
1990
1991 void Assembler::movf_d(FPURegister fd, FPURegister fs, uint16_t cc) {
1992 DCHECK(IsMipsArchVariant(kMips32r2));
1993 FPURegister ft;
1994 ft.code_ = (cc & 0x0007) << 2 | 0;
1995 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
1996 }
1997
1998
1945 // Bit twiddling. 1999 // Bit twiddling.
1946 void Assembler::clz(Register rd, Register rs) { 2000 void Assembler::clz(Register rd, Register rs) {
1947 if (!IsMipsArchVariant(kMips32r6)) { 2001 if (!IsMipsArchVariant(kMips32r6)) {
1948 // Clz instr requires same GPR number in 'rd' and 'rt' fields. 2002 // Clz instr requires same GPR number in 'rd' and 'rt' fields.
1949 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ); 2003 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ);
1950 } else { 2004 } else {
1951 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 1, CLZ_R6); 2005 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 1, CLZ_R6);
1952 } 2006 }
1953 } 2007 }
1954 2008
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 void Assembler::abs_d(FPURegister fd, FPURegister fs) { 2221 void Assembler::abs_d(FPURegister fd, FPURegister fs) {
2168 GenInstrRegister(COP1, D, f0, fs, fd, ABS_D); 2222 GenInstrRegister(COP1, D, f0, fs, fd, ABS_D);
2169 } 2223 }
2170 2224
2171 2225
2172 void Assembler::mov_d(FPURegister fd, FPURegister fs) { 2226 void Assembler::mov_d(FPURegister fd, FPURegister fs) {
2173 GenInstrRegister(COP1, D, f0, fs, fd, MOV_D); 2227 GenInstrRegister(COP1, D, f0, fs, fd, MOV_D);
2174 } 2228 }
2175 2229
2176 2230
2231 void Assembler::mov_s(FPURegister fd, FPURegister fs) {
2232 GenInstrRegister(COP1, S, f0, fs, fd, MOV_D);
2233 }
2234
2235
2177 void Assembler::neg_s(FPURegister fd, FPURegister fs) { 2236 void Assembler::neg_s(FPURegister fd, FPURegister fs) {
2178 GenInstrRegister(COP1, S, f0, fs, fd, NEG_D); 2237 GenInstrRegister(COP1, S, f0, fs, fd, NEG_D);
2179 } 2238 }
2180 2239
2181 2240
2182 void Assembler::neg_d(FPURegister fd, FPURegister fs) { 2241 void Assembler::neg_d(FPURegister fd, FPURegister fs) {
2183 GenInstrRegister(COP1, D, f0, fs, fd, NEG_D); 2242 GenInstrRegister(COP1, D, f0, fs, fd, NEG_D);
2184 } 2243 }
2185 2244
2186 2245
2187 void Assembler::sqrt_s(FPURegister fd, FPURegister fs) { 2246 void Assembler::sqrt_s(FPURegister fd, FPURegister fs) {
2188 GenInstrRegister(COP1, S, f0, fs, fd, SQRT_D); 2247 GenInstrRegister(COP1, S, f0, fs, fd, SQRT_D);
2189 } 2248 }
2190 2249
2191 2250
2192 void Assembler::sqrt_d(FPURegister fd, FPURegister fs) { 2251 void Assembler::sqrt_d(FPURegister fd, FPURegister fs) {
2193 GenInstrRegister(COP1, D, f0, fs, fd, SQRT_D); 2252 GenInstrRegister(COP1, D, f0, fs, fd, SQRT_D);
2194 } 2253 }
2195 2254
2196 2255
2256 void Assembler::rsqrt_s(FPURegister fd, FPURegister fs) {
2257 GenInstrRegister(COP1, S, f0, fs, fd, RSQRT_D);
2258 }
2259
2260
2261 void Assembler::rsqrt_d(FPURegister fd, FPURegister fs) {
2262 GenInstrRegister(COP1, D, f0, fs, fd, RSQRT_D);
2263 }
2264
2265
2266 void Assembler::recip_d(FPURegister fd, FPURegister fs) {
2267 GenInstrRegister(COP1, D, f0, fs, fd, RECIP);
2268 }
2269
2270
2271 void Assembler::recip_s(FPURegister fd, FPURegister fs) {
2272 GenInstrRegister(COP1, S, f0, fs, fd, RECIP);
2273 }
2274
2275
2197 // Conversions. 2276 // Conversions.
2198 2277
2199 void Assembler::cvt_w_s(FPURegister fd, FPURegister fs) { 2278 void Assembler::cvt_w_s(FPURegister fd, FPURegister fs) {
2200 GenInstrRegister(COP1, S, f0, fs, fd, CVT_W_S); 2279 GenInstrRegister(COP1, S, f0, fs, fd, CVT_W_S);
2201 } 2280 }
2202 2281
2203 2282
2204 void Assembler::cvt_w_d(FPURegister fd, FPURegister fs) { 2283 void Assembler::cvt_w_d(FPURegister fd, FPURegister fs) {
2205 GenInstrRegister(COP1, D, f0, fs, fd, CVT_W_D); 2284 GenInstrRegister(COP1, D, f0, fs, fd, CVT_W_D);
2206 } 2285 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) { 2323 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) {
2245 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D); 2324 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D);
2246 } 2325 }
2247 2326
2248 2327
2249 void Assembler::rint_s(FPURegister fd, FPURegister fs) { rint(S, fd, fs); } 2328 void Assembler::rint_s(FPURegister fd, FPURegister fs) { rint(S, fd, fs); }
2250 2329
2251 2330
2252 void Assembler::rint(SecondaryField fmt, FPURegister fd, FPURegister fs) { 2331 void Assembler::rint(SecondaryField fmt, FPURegister fd, FPURegister fs) {
2253 DCHECK(IsMipsArchVariant(kMips32r6)); 2332 DCHECK(IsMipsArchVariant(kMips32r6));
2333 DCHECK((fmt == D) || (fmt == S));
2254 GenInstrRegister(COP1, fmt, f0, fs, fd, RINT); 2334 GenInstrRegister(COP1, fmt, f0, fs, fd, RINT);
2255 } 2335 }
2256 2336
2257 2337
2258 void Assembler::rint_d(FPURegister fd, FPURegister fs) { rint(D, fd, fs); } 2338 void Assembler::rint_d(FPURegister fd, FPURegister fs) { rint(D, fd, fs); }
2259 2339
2260 2340
2261 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) { 2341 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) {
2262 DCHECK(IsMipsArchVariant(kMips32r2)); 2342 DCHECK(IsMipsArchVariant(kMips32r2));
2263 GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S); 2343 GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S);
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { 2963 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) {
2884 // No out-of-line constant pool support. 2964 // No out-of-line constant pool support.
2885 DCHECK(!FLAG_enable_ool_constant_pool); 2965 DCHECK(!FLAG_enable_ool_constant_pool);
2886 return; 2966 return;
2887 } 2967 }
2888 2968
2889 2969
2890 } } // namespace v8::internal 2970 } } // namespace v8::internal
2891 2971
2892 #endif // V8_TARGET_ARCH_MIPS 2972 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698