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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 8361030: Fix CountLeadingZeros on non-ARMv5 hardware. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« 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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 Register source, // Input. 3144 Register source, // Input.
3145 Register scratch) { 3145 Register scratch) {
3146 ASSERT(!zeros.is(source) || !source.is(scratch)); 3146 ASSERT(!zeros.is(source) || !source.is(scratch));
3147 ASSERT(!zeros.is(scratch)); 3147 ASSERT(!zeros.is(scratch));
3148 ASSERT(!scratch.is(ip)); 3148 ASSERT(!scratch.is(ip));
3149 ASSERT(!source.is(ip)); 3149 ASSERT(!source.is(ip));
3150 ASSERT(!zeros.is(ip)); 3150 ASSERT(!zeros.is(ip));
3151 #ifdef CAN_USE_ARMV5_INSTRUCTIONS 3151 #ifdef CAN_USE_ARMV5_INSTRUCTIONS
3152 clz(zeros, source); // This instruction is only supported after ARM5. 3152 clz(zeros, source); // This instruction is only supported after ARM5.
3153 #else 3153 #else
3154 // Order of the next two lines is important: zeros register
3155 // can be the same as source register.
3156 Move(scratch, source);
3154 mov(zeros, Operand(0, RelocInfo::NONE)); 3157 mov(zeros, Operand(0, RelocInfo::NONE));
3155 Move(scratch, source);
3156 // Top 16. 3158 // Top 16.
3157 tst(scratch, Operand(0xffff0000)); 3159 tst(scratch, Operand(0xffff0000));
3158 add(zeros, zeros, Operand(16), LeaveCC, eq); 3160 add(zeros, zeros, Operand(16), LeaveCC, eq);
3159 mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq); 3161 mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq);
3160 // Top 8. 3162 // Top 8.
3161 tst(scratch, Operand(0xff000000)); 3163 tst(scratch, Operand(0xff000000));
3162 add(zeros, zeros, Operand(8), LeaveCC, eq); 3164 add(zeros, zeros, Operand(8), LeaveCC, eq);
3163 mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq); 3165 mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq);
3164 // Top 4. 3166 // Top 4.
3165 tst(scratch, Operand(0xf0000000)); 3167 tst(scratch, Operand(0xf0000000));
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 void CodePatcher::EmitCondition(Condition cond) { 3657 void CodePatcher::EmitCondition(Condition cond) {
3656 Instr instr = Assembler::instr_at(masm_.pc_); 3658 Instr instr = Assembler::instr_at(masm_.pc_);
3657 instr = (instr & ~kCondMask) | cond; 3659 instr = (instr & ~kCondMask) | cond;
3658 masm_.emit(instr); 3660 masm_.emit(instr);
3659 } 3661 }
3660 3662
3661 3663
3662 } } // namespace v8::internal 3664 } } // namespace v8::internal
3663 3665
3664 #endif // V8_TARGET_ARCH_ARM 3666 #endif // V8_TARGET_ARCH_ARM
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