chromium/chromium-91-pcscan-vector-t...

48 lines
2.2 KiB
Diff

From 429e6f78a88473208e96689afa2f6e91f07a4f8c Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Sat, 10 Apr 2021 17:02:49 +0000
Subject: [PATCH] GCC: fix vector types in pcscan
* _mm_cmpeq_epi64 result is __m128i
* maybe_ptrs is __m128i already and doesn't require cast
Bug: 819294
Change-Id: I3f8c6cc327191827838e80aea1431ac09315fe88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2817544
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#871265}
---
diff --git a/base/allocator/partition_allocator/starscan/pcscan.cc b/base/allocator/partition_allocator/starscan/pcscan.cc
index c7854ff..d5c0aea 100644
--- a/base/allocator/partition_allocator/starscan/pcscan.cc
+++ b/base/allocator/partition_allocator/starscan/pcscan.cc
@@ -1143,7 +1143,7 @@
const __m128i maybe_ptrs =
_mm_loadu_si128(reinterpret_cast<__m128i*>(payload));
const __m128i vand = _mm_and_si128(maybe_ptrs, cage_mask);
- const __m128d vcmp = _mm_cmpeq_epi64(vand, vbase);
+ const __m128i vcmp = _mm_cmpeq_epi64(vand, vbase);
const int mask = _mm_movemask_pd(_mm_castsi128_pd(vcmp));
if (LIKELY(!mask))
continue;
@@ -1153,15 +1153,14 @@
if (mask & 0b01) {
quarantine_size +=
pcscan_task_.TryMarkObjectInNormalBuckets<GigaCageLookupPolicy>(
- _mm_cvtsi128_si64(_mm_castpd_si128(maybe_ptrs)));
+ _mm_cvtsi128_si64(maybe_ptrs));
}
if (mask & 0b10) {
// Extraction intrinsics for qwords are only supported in SSE4.1, so
// instead we reshuffle dwords with pshufd. The mask is used to move the
// 4th and 3rd dwords into the second and first position.
static constexpr int kSecondWordMask = (3 << 2) | (2 << 0);
- const __m128i shuffled =
- _mm_shuffle_epi32(_mm_castpd_si128(maybe_ptrs), kSecondWordMask);
+ const __m128i shuffled = _mm_shuffle_epi32(maybe_ptrs, kSecondWordMask);
quarantine_size +=
pcscan_task_.TryMarkObjectInNormalBuckets<GigaCageLookupPolicy>(
_mm_cvtsi128_si64(shuffled));