s390: Edited Generate_CEntry to correctly return buffer when built with clang

Corrected register calling syntax in assembler-s390.cc and
test-platform.cc.

Generate_CEntry in builtins-s390.cc expects return buffer to be
preserved in r2, but when built with clang r2 isn't preserved, which breaks
300+ tests. It is fixed by writing r2's value into r8 (preserved)
and loading the value back to r2 after the operation.

Change-Id: I184f0111944b6ad8c0ccc8b97407d702dd97d9d8
Reviewed-on: https://chromium-review.googlesource.com/1204530
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55631}
This commit is contained in:
andrew-cc-chen 2018-09-04 13:03:17 -04:00 committed by Commit Bot
parent f3ad6cdb9c
commit 84121f5ac1
3 changed files with 8 additions and 3 deletions

View File

@ -2408,6 +2408,9 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
__ LoadRR(r3, r2);
__ la(r2, MemOperand(sp, (kStackFrameExtraParamSlot + 1) * kPointerSize));
isolate_reg = r5;
// Clang doesn't preserve r2 (result buffer)
// write to r8 (preserved) before entry
__ LoadRR(r8, r2);
}
// Call C built-in.
__ Move(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
@ -2433,6 +2436,7 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,
// If return value is on the stack, pop it to registers.
if (needs_return_buffer) {
__ LoadRR(r2, r8);
__ LoadP(r3, MemOperand(r2, kPointerSize));
__ LoadP(r2, MemOperand(r2));
}

View File

@ -180,13 +180,14 @@ void CpuFeatures::ProbeImpl(bool cross_compile) {
// Bit 45 - Distinct Operands for instructions like ARK, SRK, etc.
// As such, we require only 1 double word
int64_t facilities[3] = {0L};
int16_t reg0;
// LHI sets up GPR0
// STFLE is specified as .insn, as opcode is not recognized.
// We register the instructions kill r0 (LHI) and the CC (STFLE).
asm volatile(
"lhi 0,2\n"
"lhi %%r0,2\n"
".insn s,0xb2b00000,%0\n"
: "=Q"(facilities)
: "=Q"(facilities), "=r"(reg0)
:
: "cc", "r0");

View File

@ -29,7 +29,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) {
#elif V8_HOST_ARCH_MIPS64
__asm__ __volatile__("sd $sp, %0" : "=g"(sp_addr));
#elif defined(__s390x__) || defined(_ARCH_S390X)
__asm__ __volatile__("stg 15, %0" : "=m"(sp_addr));
__asm__ __volatile__("stg %%r15, %0" : "=m"(sp_addr));
#elif defined(__s390__) || defined(_ARCH_S390)
__asm__ __volatile__("st 15, %0" : "=m"(sp_addr));
#elif defined(__PPC64__) || defined(_ARCH_PPC64)