From c5e3fb5d12e07da28f5c91fc85b84c547aa2d513 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 26 Jan 2025 17:57:06 -0700 Subject: [PATCH] [hvgl/simd] Reduce alignment requirement Speeds up a bit. --- src/hb-aat-var-hvgl-table.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-aat-var-hvgl-table.cc b/src/hb-aat-var-hvgl-table.cc index 0c1b5f7be..47ae576d2 100644 --- a/src/hb-aat-var-hvgl-table.cc +++ b/src/hb-aat-var-hvgl-table.cc @@ -95,8 +95,8 @@ PartShape::get_path_at (const struct hvgl &hvgl, // APPLE SIMD unsigned rows_count = v.length; - bool src_aligned = (uintptr_t) (deltas.get_matrix (axisCount, segmentCount).arrayZ) % 16 == 0; - bool dest_aligned = (uintptr_t) (v.arrayZ) % 16 == 0; + bool src_aligned = (uintptr_t) (deltas.get_matrix (axisCount, segmentCount).arrayZ) % 8 == 0; + bool dest_aligned = (uintptr_t) (v.arrayZ) % 8 == 0; for (; axis_index + 4 <= axis_count; axis_index += 4) { @@ -120,10 +120,10 @@ PartShape::get_path_at (const struct hvgl &hvgl, simd_double4x4 matrix; if (src_aligned) { - const auto &src0 = * (const simd_double4 *) (void *) (delta0 + i); - const auto &src1 = * (const simd_double4 *) (void *) (delta1 + i); - const auto &src2 = * (const simd_double4 *) (void *) (delta2 + i); - const auto &src3 = * (const simd_double4 *) (void *) (delta3 + i); + const auto &src0 = * (const simd_packed_double4 *) (void *) (delta0 + i); + const auto &src1 = * (const simd_packed_double4 *) (void *) (delta1 + i); + const auto &src2 = * (const simd_packed_double4 *) (void *) (delta2 + i); + const auto &src3 = * (const simd_packed_double4 *) (void *) (delta3 + i); matrix = simd_matrix (src0, src1, src2, src3); } else @@ -136,7 +136,7 @@ PartShape::get_path_at (const struct hvgl &hvgl, } if (dest_aligned) - * (simd_double4 *) (void *) (v.arrayZ + i) += simd_mul (matrix, scalar4); + * (simd_packed_double4 *) (void *) (v.arrayZ + i) += simd_mul (matrix, scalar4); else { auto *dest = v.arrayZ + i;