diff options
author | 2024-07-05 15:13:28 +0100 | |
---|---|---|
committer | 2024-07-08 08:18:31 +0000 | |
commit | 342fef74762b2e827a638286d4b81a821b4c2b07 (patch) | |
tree | 79ff611f62796c47c98a4bc65bbb3a0498b52628 | |
parent | d685b0e5d8f3b38b3e492ffc1989e188885edda0 (diff) |
Fix code generation of Unsafe.putByte in x86 and x64.
We were not using the right instruction.
Test: serial benchmark
Bug: 339571886
Change-Id: Ice38a8c34acdb65908e3c41cebb3aad26a774beb
-rw-r--r-- | compiler/optimizing/intrinsics_x86.cc | 5 | ||||
-rw-r--r-- | compiler/optimizing/intrinsics_x86_64.cc | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index 63dd963a9f..b752493a0f 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -2013,8 +2013,11 @@ static void GenUnsafePut(LocationSummary* locations, __ movl(temp, value_loc.AsRegister<Register>()); __ PoisonHeapReference(temp); __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), temp); - } else { + } else if (type == DataType::Type::kInt32 || type == DataType::Type::kReference) { __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), value_loc.AsRegister<Register>()); + } else { + CHECK_EQ(type, DataType::Type::kInt8) << "Unimplemented GenUnsafePut data type"; + __ movb(Address(base, offset, ScaleFactor::TIMES_1, 0), value_loc.AsRegister<ByteRegister>()); } if (is_volatile) { diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index 131460d605..0a60e9c642 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -2080,8 +2080,11 @@ static void GenUnsafePut(LocationSummary* locations, DataType::Type type, bool i __ movl(temp, value); __ PoisonHeapReference(temp); __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), temp); - } else { + } else if (type == DataType::Type::kInt32 || type == DataType::Type::kReference) { __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), value); + } else { + CHECK_EQ(type, DataType::Type::kInt8) << "Unimplemented GenUnsafePut data type"; + __ movb(Address(base, offset, ScaleFactor::TIMES_1, 0), value); } if (is_volatile) { |