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

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

Issue 166273020: MIPS: Fix clz implementation of the simulator. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 default: 1919 default:
1920 UNREACHABLE(); 1920 UNREACHABLE();
1921 }; 1921 };
1922 break; 1922 break;
1923 case SPECIAL2: 1923 case SPECIAL2:
1924 switch (instr->FunctionFieldRaw()) { 1924 switch (instr->FunctionFieldRaw()) {
1925 case MUL: 1925 case MUL:
1926 alu_out = rs_u * rt_u; // Only the lower 32 bits are kept. 1926 alu_out = rs_u * rt_u; // Only the lower 32 bits are kept.
1927 break; 1927 break;
1928 case CLZ: 1928 case CLZ:
1929 alu_out = __builtin_clz(rs_u); 1929 // MIPS32 spec: If no bits were set in GPR rs, the result written to
1930 // GPR rd is 32.
1931 // GCC __builtin_clz: If input is 0, the result is undefined.
1932 alu_out =
1933 rs_u == 0 ? 32 : CompilerIntrinsics::CountLeadingZeros(rs_u);
1930 break; 1934 break;
1931 default: 1935 default:
1932 UNREACHABLE(); 1936 UNREACHABLE();
1933 }; 1937 };
1934 break; 1938 break;
1935 case SPECIAL3: 1939 case SPECIAL3:
1936 switch (instr->FunctionFieldRaw()) { 1940 switch (instr->FunctionFieldRaw()) {
1937 case INS: { // Mips32r2 instruction. 1941 case INS: { // Mips32r2 instruction.
1938 // Interpret rd field as 5-bit msb of insert. 1942 // Interpret rd field as 5-bit msb of insert.
1939 uint16_t msb = rd_reg; 1943 uint16_t msb = rd_reg;
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 } 2938 }
2935 2939
2936 2940
2937 #undef UNSUPPORTED 2941 #undef UNSUPPORTED
2938 2942
2939 } } // namespace v8::internal 2943 } } // namespace v8::internal
2940 2944
2941 #endif // USE_SIMULATOR 2945 #endif // USE_SIMULATOR
2942 2946
2943 #endif // V8_TARGET_ARCH_MIPS 2947 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698