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

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

Issue 2649113007: s390: TF Codegen Optimization (Closed)
Patch Set: remove 2 unnecessary unreachables Created 3 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 | « src/s390/macro-assembler-s390.h ('k') | src/s390/simulator-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <assert.h> // For assert 5 #include <assert.h> // For assert
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_S390 8 #if V8_TARGET_ARCH_S390
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 UNIMPLEMENTED(); 3263 UNIMPLEMENTED();
3264 } 3264 }
3265 } 3265 }
3266 3266
3267 void MacroAssembler::Mul32(Register dst, Register src1) { msr(dst, src1); } 3267 void MacroAssembler::Mul32(Register dst, Register src1) { msr(dst, src1); }
3268 3268
3269 void MacroAssembler::Mul32(Register dst, const Operand& src1) { 3269 void MacroAssembler::Mul32(Register dst, const Operand& src1) {
3270 msfi(dst, src1); 3270 msfi(dst, src1);
3271 } 3271 }
3272 3272
3273 void MacroAssembler::MulHigh32(Register dst, Register src1,
3274 const MemOperand& src2) {
3275 lgfr(dst, src1);
3276 msgf(dst, src2);
3277 srlg(dst, dst, Operand(32));
3278 }
3279
3280 void MacroAssembler::MulHigh32(Register dst, Register src1, Register src2) {
3281 if (dst.is(src2)) {
3282 std::swap(src1, src2);
3283 }
3284 lgfr(dst, src1);
3285 msgfr(dst, src2);
3286 srlg(dst, dst, Operand(32));
3287 }
3288
3289 void MacroAssembler::MulHigh32(Register dst, Register src1,
3290 const Operand& src2) {
3291 lgfr(dst, src1);
3292 msgfi(dst, src2);
3293 srlg(dst, dst, Operand(32));
3294 }
3295
3296 void MacroAssembler::Mul32WithOverflowIfCCUnequal(Register dst, Register src1,
3297 const MemOperand& src2) {
3298 lgfr(dst, src1);
3299 msgf(dst, src2);
3300 cgfr(dst, dst);
3301 }
3302
3303 void MacroAssembler::Mul32WithOverflowIfCCUnequal(Register dst, Register src1,
3304 Register src2) {
3305 if (dst.is(src2)) {
3306 std::swap(src1, src2);
3307 }
3308 lgfr(dst, src1);
3309 msgfr(dst, src2);
3310 cgfr(dst, dst);
3311 }
3312
3313 void MacroAssembler::Mul32WithOverflowIfCCUnequal(Register dst, Register src1,
3314 const Operand& src2) {
3315 lgfr(dst, src1);
3316 msgfi(dst, src2);
3317 cgfr(dst, dst);
3318 }
3319
3273 void MacroAssembler::Mul64(Register dst, const MemOperand& src1) { 3320 void MacroAssembler::Mul64(Register dst, const MemOperand& src1) {
3274 if (is_int20(src1.offset())) { 3321 if (is_int20(src1.offset())) {
3275 msg(dst, src1); 3322 msg(dst, src1);
3276 } else { 3323 } else {
3277 UNIMPLEMENTED(); 3324 UNIMPLEMENTED();
3278 } 3325 }
3279 } 3326 }
3280 3327
3281 void MacroAssembler::Mul64(Register dst, Register src1) { msgr(dst, src1); } 3328 void MacroAssembler::Mul64(Register dst, Register src1) { msgr(dst, src1); }
3282 3329
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3355 //---------------------------------------------------------------------------- 3402 //----------------------------------------------------------------------------
3356 3403
3357 // Add 32-bit (Register dst = Register dst + Immediate opnd) 3404 // Add 32-bit (Register dst = Register dst + Immediate opnd)
3358 void MacroAssembler::Add32(Register dst, const Operand& opnd) { 3405 void MacroAssembler::Add32(Register dst, const Operand& opnd) {
3359 if (is_int16(opnd.immediate())) 3406 if (is_int16(opnd.immediate()))
3360 ahi(dst, opnd); 3407 ahi(dst, opnd);
3361 else 3408 else
3362 afi(dst, opnd); 3409 afi(dst, opnd);
3363 } 3410 }
3364 3411
3412 // Add 32-bit (Register dst = Register dst + Immediate opnd)
3413 void MacroAssembler::Add32_RI(Register dst, const Operand& opnd) {
3414 // Just a wrapper for above
3415 Add32(dst, opnd);
3416 }
3417
3365 // Add Pointer Size (Register dst = Register dst + Immediate opnd) 3418 // Add Pointer Size (Register dst = Register dst + Immediate opnd)
3366 void MacroAssembler::AddP(Register dst, const Operand& opnd) { 3419 void MacroAssembler::AddP(Register dst, const Operand& opnd) {
3367 #if V8_TARGET_ARCH_S390X 3420 #if V8_TARGET_ARCH_S390X
3368 if (is_int16(opnd.immediate())) 3421 if (is_int16(opnd.immediate()))
3369 aghi(dst, opnd); 3422 aghi(dst, opnd);
3370 else 3423 else
3371 agfi(dst, opnd); 3424 agfi(dst, opnd);
3372 #else 3425 #else
3373 Add32(dst, opnd); 3426 Add32(dst, opnd);
3374 #endif 3427 #endif
3375 } 3428 }
3376 3429
3377 // Add 32-bit (Register dst = Register src + Immediate opnd) 3430 // Add 32-bit (Register dst = Register src + Immediate opnd)
3378 void MacroAssembler::Add32(Register dst, Register src, const Operand& opnd) { 3431 void MacroAssembler::Add32(Register dst, Register src, const Operand& opnd) {
3379 if (!dst.is(src)) { 3432 if (!dst.is(src)) {
3380 if (CpuFeatures::IsSupported(DISTINCT_OPS) && is_int16(opnd.immediate())) { 3433 if (CpuFeatures::IsSupported(DISTINCT_OPS) && is_int16(opnd.immediate())) {
3381 ahik(dst, src, opnd); 3434 ahik(dst, src, opnd);
3382 return; 3435 return;
3383 } 3436 }
3384 lr(dst, src); 3437 lr(dst, src);
3385 } 3438 }
3386 Add32(dst, opnd); 3439 Add32(dst, opnd);
3387 } 3440 }
3388 3441
3442 // Add 32-bit (Register dst = Register src + Immediate opnd)
3443 void MacroAssembler::Add32_RRI(Register dst, Register src,
3444 const Operand& opnd) {
3445 // Just a wrapper for above
3446 Add32(dst, src, opnd);
3447 }
3448
3389 // Add Pointer Size (Register dst = Register src + Immediate opnd) 3449 // Add Pointer Size (Register dst = Register src + Immediate opnd)
3390 void MacroAssembler::AddP(Register dst, Register src, const Operand& opnd) { 3450 void MacroAssembler::AddP(Register dst, Register src, const Operand& opnd) {
3391 if (!dst.is(src)) { 3451 if (!dst.is(src)) {
3392 if (CpuFeatures::IsSupported(DISTINCT_OPS) && is_int16(opnd.immediate())) { 3452 if (CpuFeatures::IsSupported(DISTINCT_OPS) && is_int16(opnd.immediate())) {
3393 AddPImm_RRI(dst, src, opnd); 3453 AddPImm_RRI(dst, src, opnd);
3394 return; 3454 return;
3395 } 3455 }
3396 LoadRR(dst, src); 3456 LoadRR(dst, src);
3397 } 3457 }
3398 AddP(dst, opnd); 3458 AddP(dst, opnd);
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 4187
4128 // works the same as mov 4188 // works the same as mov
4129 void MacroAssembler::Load(Register dst, const Operand& opnd) { 4189 void MacroAssembler::Load(Register dst, const Operand& opnd) {
4130 intptr_t value = opnd.immediate(); 4190 intptr_t value = opnd.immediate();
4131 if (is_int16(value)) { 4191 if (is_int16(value)) {
4132 #if V8_TARGET_ARCH_S390X 4192 #if V8_TARGET_ARCH_S390X
4133 lghi(dst, opnd); 4193 lghi(dst, opnd);
4134 #else 4194 #else
4135 lhi(dst, opnd); 4195 lhi(dst, opnd);
4136 #endif 4196 #endif
4137 } else { 4197 } else if (is_int32(value)) {
4138 #if V8_TARGET_ARCH_S390X 4198 #if V8_TARGET_ARCH_S390X
4139 lgfi(dst, opnd); 4199 lgfi(dst, opnd);
4140 #else 4200 #else
4141 iilf(dst, opnd); 4201 iilf(dst, opnd);
4142 #endif 4202 #endif
4203 } else if (is_uint32(value)) {
4204 #if V8_TARGET_ARCH_S390X
4205 llilf(dst, opnd);
4206 #else
4207 iilf(dst, opnd);
4208 #endif
4209 } else {
4210 int32_t hi_32 = static_cast<int64_t>(value) >> 32;
4211 int32_t lo_32 = static_cast<int32_t>(value);
4212
4213 iihf(dst, Operand(hi_32));
4214 iilf(dst, Operand(lo_32));
4143 } 4215 }
4144 } 4216 }
4145 4217
4146 void MacroAssembler::Load(Register dst, const MemOperand& opnd) { 4218 void MacroAssembler::Load(Register dst, const MemOperand& opnd) {
4147 DCHECK(is_int20(opnd.offset())); 4219 DCHECK(is_int20(opnd.offset()));
4148 #if V8_TARGET_ARCH_S390X 4220 #if V8_TARGET_ARCH_S390X
4149 lgf(dst, opnd); // 64<-32 4221 lgf(dst, opnd); // 64<-32
4150 #else 4222 #else
4151 if (is_uint12(opnd.offset())) { 4223 if (is_uint12(opnd.offset())) {
4152 l(dst, opnd); 4224 l(dst, opnd);
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
5138 } 5210 }
5139 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); 5211 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift));
5140 ExtractBit(r0, dividend, 31); 5212 ExtractBit(r0, dividend, 31);
5141 AddP(result, r0); 5213 AddP(result, r0);
5142 } 5214 }
5143 5215
5144 } // namespace internal 5216 } // namespace internal
5145 } // namespace v8 5217 } // namespace v8
5146 5218
5147 #endif // V8_TARGET_ARCH_S390 5219 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | src/s390/simulator-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698