From fa8a8fe1a5ff060ee84f4087e3ddc0caafd6b0cb Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Fri, 18 Aug 2023 15:10:33 -0700 Subject: [PATCH] swift: don't try to use ARM intrinsics on iOS --- swift/crc/CRC32.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/swift/crc/CRC32.swift b/swift/crc/CRC32.swift index 30cb8ea668..8cfe8811fb 100644 --- a/swift/crc/CRC32.swift +++ b/swift/crc/CRC32.swift @@ -1,6 +1,8 @@ import struct Foundation.Data -#if arch(arm) || arch(arm64) +// iOS seems to lack CRC intrinsics +// See also: https://stackoverflow.com/questions/45625725/does-clang-lack-crc32-for-armv8-aarch64 +#if (arch(arm) || arch(arm64)) && !os(iOS) import _Builtin_intrinsics.arm.acle // cspell:disable-line #endif @@ -34,7 +36,7 @@ public struct CRC32 { @inlinable public mutating func update(_ data: UnsafeRawBufferPointer) { - #if arch(arm) || arch(arm64) + #if (arch(arm) || arch(arm64)) && !os(iOS) self.updateARM(data) #else self.update16Byte(data) @@ -93,7 +95,7 @@ public struct CRC32 { } } - #if arch(arm) || arch(arm64) + #if (arch(arm) || arch(arm64)) && !os(iOS) @inlinable internal mutating func updateARM(_ data: UnsafeRawBufferPointer) { var offset = 0