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

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: Bug fix in MIPS10 assembler test 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
1927 void Assembler::sel_s(FPURegister fd, FPURegister fs, FPURegister ft) {
1928 sel(S, fd, fs, ft);
1929 }
1930
1931
1932 void Assembler::sel_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1933 sel(D, fd, fs, ft);
1934 }
1935
1936
1917 void Assembler::seleqz(Register rd, Register rs, Register rt) { 1937 void Assembler::seleqz(Register rd, Register rs, Register rt) {
1918 DCHECK(IsMipsArchVariant(kMips32r6)); 1938 DCHECK(IsMipsArchVariant(kMips32r6));
1919 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S); 1939 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELEQZ_S);
1920 } 1940 }
1921 1941
1922 1942
1923 void Assembler::seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs, 1943 void Assembler::seleqz(SecondaryField fmt, FPURegister fd, FPURegister fs,
1924 FPURegister ft) { 1944 FPURegister ft) {
1925 DCHECK(IsMipsArchVariant(kMips32r6)); 1945 DCHECK(IsMipsArchVariant(kMips32r6));
1926 DCHECK((fmt == D) || (fmt == S)); 1946 DCHECK((fmt == D) || (fmt == S));
1927 GenInstrRegister(COP1, fmt, ft, fs, fd, SELEQZ_C); 1947 GenInstrRegister(COP1, fmt, ft, fs, fd, SELEQZ_C);
1928 } 1948 }
1929 1949
1930 1950
1931 void Assembler::selnez(Register rd, Register rs, Register rt) { 1951 void Assembler::selnez(Register rd, Register rs, Register rt) {
1932 DCHECK(IsMipsArchVariant(kMips32r6)); 1952 DCHECK(IsMipsArchVariant(kMips32r6));
1933 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELNEZ_S); 1953 GenInstrRegister(SPECIAL, rs, rt, rd, 0, SELNEZ_S);
1934 } 1954 }
1935 1955
1936 1956
1937 void Assembler::selnez(SecondaryField fmt, FPURegister fd, FPURegister fs, 1957 void Assembler::selnez(SecondaryField fmt, FPURegister fd, FPURegister fs,
1938 FPURegister ft) { 1958 FPURegister ft) {
1939 DCHECK(IsMipsArchVariant(kMips32r6)); 1959 DCHECK(IsMipsArchVariant(kMips32r6));
1940 DCHECK((fmt == D) || (fmt == S)); 1960 DCHECK((fmt == D) || (fmt == S));
1941 GenInstrRegister(COP1, fmt, ft, fs, fd, SELNEZ_C); 1961 GenInstrRegister(COP1, fmt, ft, fs, fd, SELNEZ_C);
1942 } 1962 }
1943 1963
1944 1964
1965 void Assembler::seleqz_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1966 seleqz(D, fd, fs, ft);
1967 }
1968
1969
1970 void Assembler::seleqz_s(FPURegister fd, FPURegister fs, FPURegister ft) {
1971 seleqz(S, fd, fs, ft);
1972 }
1973
1974
1975 void Assembler::selnez_d(FPURegister fd, FPURegister fs, FPURegister ft) {
1976 selnez(D, fd, fs, ft);
1977 }
1978
1979
1980 void Assembler::selnez_s(FPURegister fd, FPURegister fs, FPURegister ft) {
1981 selnez(S, fd, fs, ft);
1982 }
1983
1984
1985 void Assembler::movz_s(FPURegister fd, FPURegister fs, Register rt) {
1986 DCHECK(IsMipsArchVariant(kMips32r2));
1987 GenInstrRegister(COP1, S, rt, fs, fd, MOVZ_C);
1988 }
1989
1990
1991 void Assembler::movz_d(FPURegister fd, FPURegister fs, Register rt) {
1992 DCHECK(IsMipsArchVariant(kMips32r2));
1993 GenInstrRegister(COP1, D, rt, fs, fd, MOVZ_C);
1994 }
1995
1996
1997 void Assembler::movt_s(FPURegister fd, FPURegister fs, uint16_t cc) {
1998 DCHECK(IsMipsArchVariant(kMips32r2));
1999 FPURegister ft;
2000 ft.code_ = (cc & 0x0007) << 2 | 1;
2001 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
2002 }
2003
2004
2005 void Assembler::movt_d(FPURegister fd, FPURegister fs, uint16_t cc) {
2006 DCHECK(IsMipsArchVariant(kMips32r2));
2007 FPURegister ft;
2008 ft.code_ = (cc & 0x0007) << 2 | 1;
2009 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
2010 }
2011
2012
2013 void Assembler::movf_s(FPURegister fd, FPURegister fs, uint16_t cc) {
2014 DCHECK(IsMipsArchVariant(kMips32r2));
2015 FPURegister ft;
2016 ft.code_ = (cc & 0x0007) << 2 | 0;
2017 GenInstrRegister(COP1, S, ft, fs, fd, MOVF);
2018 }
2019
2020
2021 void Assembler::movf_d(FPURegister fd, FPURegister fs, uint16_t cc) {
2022 DCHECK(IsMipsArchVariant(kMips32r2));
2023 FPURegister ft;
2024 ft.code_ = (cc & 0x0007) << 2 | 0;
2025 GenInstrRegister(COP1, D, ft, fs, fd, MOVF);
2026 }
2027
2028
1945 // Bit twiddling. 2029 // Bit twiddling.
1946 void Assembler::clz(Register rd, Register rs) { 2030 void Assembler::clz(Register rd, Register rs) {
1947 if (!IsMipsArchVariant(kMips32r6)) { 2031 if (!IsMipsArchVariant(kMips32r6)) {
1948 // Clz instr requires same GPR number in 'rd' and 'rt' fields. 2032 // Clz instr requires same GPR number in 'rd' and 'rt' fields.
1949 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ); 2033 GenInstrRegister(SPECIAL2, rs, rd, rd, 0, CLZ);
1950 } else { 2034 } else {
1951 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 1, CLZ_R6); 2035 GenInstrRegister(SPECIAL, rs, zero_reg, rd, 1, CLZ_R6);
1952 } 2036 }
1953 } 2037 }
1954 2038
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 void Assembler::abs_d(FPURegister fd, FPURegister fs) { 2251 void Assembler::abs_d(FPURegister fd, FPURegister fs) {
2168 GenInstrRegister(COP1, D, f0, fs, fd, ABS_D); 2252 GenInstrRegister(COP1, D, f0, fs, fd, ABS_D);
2169 } 2253 }
2170 2254
2171 2255
2172 void Assembler::mov_d(FPURegister fd, FPURegister fs) { 2256 void Assembler::mov_d(FPURegister fd, FPURegister fs) {
2173 GenInstrRegister(COP1, D, f0, fs, fd, MOV_D); 2257 GenInstrRegister(COP1, D, f0, fs, fd, MOV_D);
2174 } 2258 }
2175 2259
2176 2260
2261 void Assembler::mov_s(FPURegister fd, FPURegister fs) {
2262 GenInstrRegister(COP1, S, f0, fs, fd, MOV_D);
2263 }
2264
2265
2177 void Assembler::neg_s(FPURegister fd, FPURegister fs) { 2266 void Assembler::neg_s(FPURegister fd, FPURegister fs) {
2178 GenInstrRegister(COP1, S, f0, fs, fd, NEG_D); 2267 GenInstrRegister(COP1, S, f0, fs, fd, NEG_D);
2179 } 2268 }
2180 2269
2181 2270
2182 void Assembler::neg_d(FPURegister fd, FPURegister fs) { 2271 void Assembler::neg_d(FPURegister fd, FPURegister fs) {
2183 GenInstrRegister(COP1, D, f0, fs, fd, NEG_D); 2272 GenInstrRegister(COP1, D, f0, fs, fd, NEG_D);
2184 } 2273 }
2185 2274
2186 2275
2187 void Assembler::sqrt_s(FPURegister fd, FPURegister fs) { 2276 void Assembler::sqrt_s(FPURegister fd, FPURegister fs) {
2188 GenInstrRegister(COP1, S, f0, fs, fd, SQRT_D); 2277 GenInstrRegister(COP1, S, f0, fs, fd, SQRT_D);
2189 } 2278 }
2190 2279
2191 2280
2192 void Assembler::sqrt_d(FPURegister fd, FPURegister fs) { 2281 void Assembler::sqrt_d(FPURegister fd, FPURegister fs) {
2193 GenInstrRegister(COP1, D, f0, fs, fd, SQRT_D); 2282 GenInstrRegister(COP1, D, f0, fs, fd, SQRT_D);
2194 } 2283 }
2195 2284
2196 2285
2286 void Assembler::rsqrt_s(FPURegister fd, FPURegister fs) {
2287 GenInstrRegister(COP1, S, f0, fs, fd, RSQRT_D);
2288 }
2289
2290
2291 void Assembler::rsqrt_d(FPURegister fd, FPURegister fs) {
paul.l... 2015/05/09 01:07:47 From the manual: "The result of RSQRT.D is UNPREDI
Djordje.Pesic 2015/05/14 13:22:30 Done.
2292 GenInstrRegister(COP1, D, f0, fs, fd, RSQRT_D);
2293 }
2294
2295
2296 void Assembler::recip_d(FPURegister fd, FPURegister fs) {
paul.l... 2015/05/09 01:07:47 From the manual: "The result of RECIP.D is UNPREDI
Djordje.Pesic 2015/05/14 13:22:30 Done.
2297 GenInstrRegister(COP1, D, f0, fs, fd, RECIP);
2298 }
2299
2300
2301 void Assembler::recip_s(FPURegister fd, FPURegister fs) {
2302 GenInstrRegister(COP1, S, f0, fs, fd, RECIP);
2303 }
2304
2305
2197 // Conversions. 2306 // Conversions.
2198 2307
2199 void Assembler::cvt_w_s(FPURegister fd, FPURegister fs) { 2308 void Assembler::cvt_w_s(FPURegister fd, FPURegister fs) {
2200 GenInstrRegister(COP1, S, f0, fs, fd, CVT_W_S); 2309 GenInstrRegister(COP1, S, f0, fs, fd, CVT_W_S);
2201 } 2310 }
2202 2311
2203 2312
2204 void Assembler::cvt_w_d(FPURegister fd, FPURegister fs) { 2313 void Assembler::cvt_w_d(FPURegister fd, FPURegister fs) {
2205 GenInstrRegister(COP1, D, f0, fs, fd, CVT_W_D); 2314 GenInstrRegister(COP1, D, f0, fs, fd, CVT_W_D);
2206 } 2315 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) { 2353 void Assembler::ceil_w_d(FPURegister fd, FPURegister fs) {
2245 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D); 2354 GenInstrRegister(COP1, D, f0, fs, fd, CEIL_W_D);
2246 } 2355 }
2247 2356
2248 2357
2249 void Assembler::rint_s(FPURegister fd, FPURegister fs) { rint(S, fd, fs); } 2358 void Assembler::rint_s(FPURegister fd, FPURegister fs) { rint(S, fd, fs); }
2250 2359
2251 2360
2252 void Assembler::rint(SecondaryField fmt, FPURegister fd, FPURegister fs) { 2361 void Assembler::rint(SecondaryField fmt, FPURegister fd, FPURegister fs) {
2253 DCHECK(IsMipsArchVariant(kMips32r6)); 2362 DCHECK(IsMipsArchVariant(kMips32r6));
2363 DCHECK((fmt == D) || (fmt == S));
2254 GenInstrRegister(COP1, fmt, f0, fs, fd, RINT); 2364 GenInstrRegister(COP1, fmt, f0, fs, fd, RINT);
2255 } 2365 }
2256 2366
2257 2367
2258 void Assembler::rint_d(FPURegister fd, FPURegister fs) { rint(D, fd, fs); } 2368 void Assembler::rint_d(FPURegister fd, FPURegister fs) { rint(D, fd, fs); }
2259 2369
2260 2370
2261 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) { 2371 void Assembler::cvt_l_s(FPURegister fd, FPURegister fs) {
2262 DCHECK(IsMipsArchVariant(kMips32r2)); 2372 DCHECK(IsMipsArchVariant(kMips32r2));
2263 GenInstrRegister(COP1, S, f0, fs, fd, CVT_L_S); 2373 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) { 2993 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) {
2884 // No out-of-line constant pool support. 2994 // No out-of-line constant pool support.
2885 DCHECK(!FLAG_enable_ool_constant_pool); 2995 DCHECK(!FLAG_enable_ool_constant_pool);
2886 return; 2996 return;
2887 } 2997 }
2888 2998
2889 2999
2890 } } // namespace v8::internal 3000 } } // namespace v8::internal
2891 3001
2892 #endif // V8_TARGET_ARCH_MIPS 3002 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips/constants-mips.h » ('j') | src/mips/constants-mips.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698