 Chromium Code Reviews
 Chromium Code Reviews Issue 1939763003:
  S390X: Prevent upper 32bit corruption in 32bit ops  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1939763003:
  S390X: Prevent upper 32bit corruption in 32bit ops  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/compiler/s390/code-generator-s390.cc | 
| diff --git a/src/compiler/s390/code-generator-s390.cc b/src/compiler/s390/code-generator-s390.cc | 
| index dfe390aa62bda7e33eb958eafe9f6d3f274de495..8d928d7531c29981bce0ade9e370dfdb0db8cf0c 100644 | 
| --- a/src/compiler/s390/code-generator-s390.cc | 
| +++ b/src/compiler/s390/code-generator-s390.cc | 
| @@ -808,7 +808,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| break; | 
| case kS390_ShiftLeft32: | 
| if (HasRegisterInput(instr, 1)) { | 
| - if (i.OutputRegister().is(i.InputRegister(1))) { | 
| + if (i.OutputRegister().is(i.InputRegister(1)) && | 
| 
JoranSiu
2016/05/02 18:22:22
ShiftLeft masm shoudl really handle all of these c
 | 
| + !CpuFeatures::IsSupported(DISTINCT_OPS)) { | 
| __ LoadRR(kScratchReg, i.InputRegister(1)); | 
| __ ShiftLeft(i.OutputRegister(), i.InputRegister(0), kScratchReg); | 
| } else { | 
| @@ -828,7 +829,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| #endif | 
| case kS390_ShiftRight32: | 
| if (HasRegisterInput(instr, 1)) { | 
| - if (i.OutputRegister().is(i.InputRegister(1))) { | 
| + if (i.OutputRegister().is(i.InputRegister(1)) && | 
| + !CpuFeatures::IsSupported(DISTINCT_OPS)) { | 
| __ LoadRR(kScratchReg, i.InputRegister(1)); | 
| __ ShiftRight(i.OutputRegister(), i.InputRegister(0), kScratchReg); | 
| } else { | 
| @@ -848,7 +850,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| #endif | 
| case kS390_ShiftRightArith32: | 
| if (HasRegisterInput(instr, 1)) { | 
| - if (i.OutputRegister().is(i.InputRegister(1))) { | 
| + if (i.OutputRegister().is(i.InputRegister(1)) && | 
| + !CpuFeatures::IsSupported(DISTINCT_OPS)) { | 
| __ LoadRR(kScratchReg, i.InputRegister(1)); | 
| __ ShiftRightArith(i.OutputRegister(), i.InputRegister(0), | 
| kScratchReg); | 
| @@ -858,6 +861,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| } else { | 
| ASSEMBLE_BINOP(ShiftRightArith, ShiftRightArith); | 
| } | 
| +#if V8_TARGET_ARCH_S390X | 
| + __ lgfr(i.OutputRegister(), i.OutputRegister()); | 
| +#endif | 
| break; | 
| #if V8_TARGET_ARCH_S390X | 
| case kS390_ShiftRightArith64: | 
| @@ -1093,12 +1099,20 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| case kS390_MulHigh32: | 
| __ LoadRR(r1, i.InputRegister(0)); | 
| __ mr_z(r0, i.InputRegister(1)); | 
| +#if V8_TARGET_ARCH_S390X | 
| 
JoranSiu
2016/05/02 18:22:22
We should introduce a Load_ExtendSrc() in masm so
 | 
| + __ lgfr(i.OutputRegister(), r0); | 
| +#else | 
| __ LoadRR(i.OutputRegister(), r0); | 
| +#endif | 
| break; | 
| case kS390_MulHighU32: | 
| __ LoadRR(r1, i.InputRegister(0)); | 
| __ mlr(r0, i.InputRegister(1)); | 
| +#if V8_TARGET_ARCH_S390X | 
| + __ lgfr(i.OutputRegister(), r0); | 
| +#else | 
| __ LoadRR(i.OutputRegister(), r0); | 
| +#endif | 
| break; | 
| case kS390_MulFloat: | 
| // Ensure we don't clobber right | 
| @@ -1131,7 +1145,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| __ LoadRR(r0, i.InputRegister(0)); | 
| __ srda(r0, Operand(32)); | 
| __ dr(r0, i.InputRegister(1)); | 
| - __ ltr(i.OutputRegister(), r1); | 
| +#if V8_TARGET_ARCH_S390X | 
| 
JoranSiu
2016/05/02 18:22:22
I believe this is the same as : LoadAndTestP_Exten
 | 
| + __ ltgfr(i.OutputRegister(), r1); // Copy R1: Quotient to output | 
| +#else | 
| + __ ltr(i.OutputRegister(), r1); // Copy R1: Quotient to output | 
| +#endif | 
| break; | 
| #if V8_TARGET_ARCH_S390X | 
| case kS390_DivU64: | 
| @@ -1145,7 +1163,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 
| __ LoadRR(r0, i.InputRegister(0)); | 
| __ srdl(r0, Operand(32)); | 
| __ dlr(r0, i.InputRegister(1)); // R0:R1: Dividend | 
| +#if V8_TARGET_ARCH_S390X | 
| + __ ltgfr(i.OutputRegister(), r1); | 
| +#else | 
| __ ltr(i.OutputRegister(), r1); // Copy R1: Quotient to output | 
| +#endif | 
| break; | 
| case kS390_DivFloat: |