OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |