Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 } else if (shift == 0) { | 1138 } else if (shift == 0) { |
| 1139 Move(dst_high, src_high); | 1139 Move(dst_high, src_high); |
| 1140 Move(dst_low, src_low); | 1140 Move(dst_low, src_low); |
| 1141 } else { | 1141 } else { |
| 1142 lsl(dst_high, src_high, Operand(shift)); | 1142 lsl(dst_high, src_high, Operand(shift)); |
| 1143 orr(dst_high, dst_high, Operand(src_low, LSR, 32 - shift)); | 1143 orr(dst_high, dst_high, Operand(src_low, LSR, 32 - shift)); |
| 1144 lsl(dst_low, src_low, Operand(shift)); | 1144 lsl(dst_low, src_low, Operand(shift)); |
| 1145 } | 1145 } |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 void MacroAssembler::LsrPair(Register dst_low, Register dst_high, | |
| 1149 Register src_low, Register src_high, | |
| 1150 Register scratch, Register shift) { | |
| 1151 DCHECK(!AreAliased(dst_low, src_high)); | |
| 1152 DCHECK(!AreAliased(dst_low, shift)); | |
| 1153 | |
| 1154 Label less_than_32; | |
| 1155 Label done; | |
| 1156 cmp_raw_immediate(shift, 32); | |
|
Rodolph Perfetta (ARM)
2016/03/10 14:48:10
If you move the rsb up here you can use it to do t
ahaas
2016/03/10 15:33:35
Thanks, I do the same now for LslPair. If I use Se
ahaas
2016/03/10 18:00:52
Done.
| |
| 1157 b(lt, &less_than_32); | |
| 1158 // If shift >= 32 | |
| 1159 and_(scratch, shift, Operand(0x1f)); | |
| 1160 lsr(dst_low, src_high, Operand(scratch)); | |
| 1161 mov(dst_high, Operand(0)); | |
| 1162 jmp(&done); | |
| 1163 bind(&less_than_32); | |
| 1164 // If shift < 32 | |
| 1165 rsb(scratch, shift, Operand(32)); | |
| 1166 lsr(dst_low, src_low, Operand(shift)); | |
| 1167 orr(dst_low, dst_low, Operand(src_high, LSL, scratch)); | |
| 1168 lsr(dst_high, src_high, Operand(shift)); | |
| 1169 bind(&done); | |
| 1170 } | |
| 1171 | |
| 1172 void MacroAssembler::LsrPair(Register dst_low, Register dst_high, | |
| 1173 Register src_low, Register src_high, | |
| 1174 uint32_t shift) { | |
| 1175 DCHECK(!AreAliased(dst_low, src_high)); | |
| 1176 Label less_than_32; | |
| 1177 Label done; | |
| 1178 if (shift == 32) { | |
| 1179 mov(dst_low, src_high); | |
| 1180 mov(dst_high, Operand(0)); | |
| 1181 } else if (shift > 32) { | |
| 1182 shift &= 0x1f; | |
| 1183 lsr(dst_low, src_high, Operand(shift)); | |
| 1184 mov(dst_high, Operand(0)); | |
| 1185 } else if (shift == 0) { | |
| 1186 Move(dst_low, src_low); | |
| 1187 Move(dst_high, src_high); | |
| 1188 } else { | |
| 1189 lsr(dst_low, src_low, Operand(shift)); | |
| 1190 orr(dst_low, dst_low, Operand(src_high, LSL, 32 - shift)); | |
| 1191 lsr(dst_high, src_high, Operand(shift)); | |
| 1192 } | |
| 1193 } | |
| 1194 | |
| 1195 void MacroAssembler::AsrPair(Register dst_low, Register dst_high, | |
| 1196 Register src_low, Register src_high, | |
| 1197 Register scratch, Register shift) { | |
| 1198 DCHECK(!AreAliased(dst_low, src_high)); | |
| 1199 DCHECK(!AreAliased(dst_low, shift)); | |
| 1200 | |
| 1201 Label less_than_32; | |
| 1202 Label done; | |
| 1203 cmp_raw_immediate(shift, 32); | |
| 1204 b(lt, &less_than_32); | |
| 1205 // If shift >= 32 | |
| 1206 and_(scratch, shift, Operand(0x1f)); | |
| 1207 asr(dst_low, src_high, Operand(scratch)); | |
| 1208 asr(dst_high, src_high, Operand(31)); | |
| 1209 jmp(&done); | |
| 1210 bind(&less_than_32); | |
| 1211 // If shift < 32 | |
| 1212 rsb(scratch, shift, Operand(32)); | |
| 1213 lsr(dst_low, src_low, Operand(shift)); | |
| 1214 orr(dst_low, dst_low, Operand(src_high, LSL, scratch)); | |
| 1215 asr(dst_high, src_high, Operand(shift)); | |
| 1216 bind(&done); | |
| 1217 } | |
| 1218 | |
| 1219 void MacroAssembler::AsrPair(Register dst_low, Register dst_high, | |
| 1220 Register src_low, Register src_high, | |
| 1221 uint32_t shift) { | |
| 1222 DCHECK(!AreAliased(dst_low, src_high)); | |
| 1223 Label less_than_32; | |
| 1224 Label done; | |
| 1225 if (shift == 32) { | |
| 1226 mov(dst_low, src_high); | |
| 1227 asr(dst_high, src_high, Operand(31)); | |
| 1228 } else if (shift > 32) { | |
| 1229 shift &= 0x1f; | |
| 1230 asr(dst_low, src_high, Operand(shift)); | |
| 1231 asr(dst_high, src_high, Operand(31)); | |
| 1232 } else if (shift == 0) { | |
| 1233 Move(dst_low, src_low); | |
| 1234 Move(dst_high, src_high); | |
| 1235 } else { | |
| 1236 lsr(dst_low, src_low, Operand(shift)); | |
| 1237 orr(dst_low, dst_low, Operand(src_high, LSL, 32 - shift)); | |
| 1238 asr(dst_high, src_high, Operand(shift)); | |
| 1239 } | |
| 1240 } | |
| 1241 | |
| 1148 void MacroAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress( | 1242 void MacroAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress( |
| 1149 Register code_target_address) { | 1243 Register code_target_address) { |
| 1150 DCHECK(FLAG_enable_embedded_constant_pool); | 1244 DCHECK(FLAG_enable_embedded_constant_pool); |
| 1151 ldr(pp, MemOperand(code_target_address, | 1245 ldr(pp, MemOperand(code_target_address, |
| 1152 Code::kConstantPoolOffset - Code::kHeaderSize)); | 1246 Code::kConstantPoolOffset - Code::kHeaderSize)); |
| 1153 add(pp, pp, code_target_address); | 1247 add(pp, pp, code_target_address); |
| 1154 } | 1248 } |
| 1155 | 1249 |
| 1156 | 1250 |
| 1157 void MacroAssembler::LoadConstantPoolPointerRegister() { | 1251 void MacroAssembler::LoadConstantPoolPointerRegister() { |
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3836 } | 3930 } |
| 3837 } | 3931 } |
| 3838 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3932 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
| 3839 add(result, result, Operand(dividend, LSR, 31)); | 3933 add(result, result, Operand(dividend, LSR, 31)); |
| 3840 } | 3934 } |
| 3841 | 3935 |
| 3842 } // namespace internal | 3936 } // namespace internal |
| 3843 } // namespace v8 | 3937 } // namespace v8 |
| 3844 | 3938 |
| 3845 #endif // V8_TARGET_ARCH_ARM | 3939 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |