Commit 8a1bf76f authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

S390: sign extend result of atomic ops after reversing

Fix is applied to some of halfword signed ops.

Change-Id: Idad3cfe9b66d39cb991974c959d447e5c4eccad3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3327722Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78340}
parent fd50badb
...@@ -2404,15 +2404,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2404,15 +2404,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ ShiftRightU32(value_, value_, Operand(16)); __ ShiftRightU32(value_, value_, Operand(16));
} }
__ AtomicExchangeU16(r1, value_, output, r0); __ AtomicExchangeU16(r1, value_, output, r0);
if (reverse_bytes) {
__ lrvr(output, output);
__ ShiftRightU32(output, output, Operand(16));
}
if (opcode == kAtomicExchangeInt16) { if (opcode == kAtomicExchangeInt16) {
__ lghr(output, output); __ lghr(output, output);
} else { } else {
__ llghr(output, output); __ llghr(output, output);
} }
if (reverse_bytes) {
__ lrvr(output, output);
__ ShiftRightU32(output, output, Operand(16));
}
break; break;
} }
case kAtomicExchangeWord32: { case kAtomicExchangeWord32: {
...@@ -2473,11 +2473,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -2473,11 +2473,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_ATOMIC_BINOP_HALFWORD(inst, [&]() { \ ASSEMBLE_ATOMIC_BINOP_HALFWORD(inst, [&]() { \
intptr_t shift_right = static_cast<intptr_t>(shift_amount); \ intptr_t shift_right = static_cast<intptr_t>(shift_amount); \
__ srlk(result, prev, Operand(shift_right)); \ __ srlk(result, prev, Operand(shift_right)); \
__ LoadS16(result, result); \
if (is_wasm_on_be(info()->IsWasm())) { \ if (is_wasm_on_be(info()->IsWasm())) { \
__ lrvr(result, result); \ __ lrvr(result, result); \
__ ShiftRightS32(result, result, Operand(16)); \ __ ShiftRightS32(result, result, Operand(16)); \
} \ } \
__ LoadS16(result, result); \
}); \ }); \
break; \ break; \
case kAtomic##op##Uint16: \ case kAtomic##op##Uint16: \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment