summaryrefslogtreecommitdiff
path: root/mysys/crc32
Commit message (Collapse)AuthorAgeFilesLines
* Fix building crc32_arm64 on NetBSD/aarch64nia2021-07-221-4/+2
| | | | | | pmull_supported is not necessarily defined before crc32c_aarch64 Signed-off-by: Nia Alarie <nia@NetBSD.org>
* CRC32 on OpenBSD/powerpc64.Brad Smith2021-05-261-2/+2
| | | | closes #1828
* MDEV-24745 Generic CRC-32C computation wrongly uses SSE4.2 instructionsMarko Mäkelä2021-04-133-847/+847
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit d25f806d73d9984f0c9f2a346dcebb01a0eaa109 (MDEV-22749) the CRC-32C implementation of MariaDB was broken on some IA-32 and AMD64 builds, depending on the compiler version and build options. This was verified for IA-32 on GCC 10.2.1. Even though we try to identify the SSE4.2 extensions and the availaibility of the PCLMULQDQ instruction by executing CPUID, the fall-back code could be generated with extended instructions, because the entire file mysys/crc32/crc32c.c was being compiled with -msse4.2 -mpclmul. This would cause SIGILL on a PINSRD instruction on affected IA-32 targets (such as some Intel Atom processors). This might also affect old AMD64 processors (predating the 2007 Intel Nehalem microarchitecture), if some compiler chose to emit the offending instructions. While it is fine to pass a target-specific option to a target-specific compilation unit (like -mpclmul to a PCLMUL-specific compilation unit), that is not safe for mixed-architecture compilation units. For mixed-architecture compilation units, the correct way is to set target attributes on the target-specific functions. There does not seem to be a way to pass target attributes to function template instantiation. Hence, we must replace the ExtendImpl template with plain functions crc32_sse42() and crc32_slow(). We will also remove some inconsistency between my_crc32_implementation() and mysys_namespace::crc32::Choose_Extend(). The function crc32_pclmul_enabled() will be moved to mysys/crc32/crc32c.cc so that the detection code will be compiled without -msse4.2 -mpclmul. The AMD64 PCLMUL accelerated crc32c_3way() will be moved to a new file crc32c_amd64.cc. In this way, only a few functions that depend on -msse4.2 in mysys/crc32/crc32c.cc can be declared with __attribute__((target("sse4.2"))), and most of the file can be compiled for the generic target. Last, the file mysys/crc32ieee.cc will be omitted on 64-bit POWER, because it was dead code (no symbols were exported). Reviewed by: Vladislav Vaintroub
* crc32c: Fix AIX compulation - ALIGN definedDaniel Black2021-03-181-0/+4
| | | | | | | | | | | | ALIGN was defined already: mysys/crc32/crc32c.cc:390: warning: "ALIGN" redefined #define ALIGN(n, m) ((n + ((1 << m) - 1)) & ~((1 << m) - 1)) In file included from /root/aix/build/include/my_global.h:543, from /root/aix/build/mysys/crc32/crc32c.cc:22: /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8/include-fixed/sys/socket.h:788: note: this is the location of the previous definition #define ALIGN(p) (ulong)((caddr_t)(p) + MACHINE_ALIGNMENT - 1 - \
* CRC32 on AIXEtienne Guesnet2021-03-181-0/+11
|
* Mac M1 build support proposal (minus rocksdb option) (#1743)David CARLIER2021-01-301-0/+24
|
* msys: detects crc/cryptosupport on FreeBSD/armDavid Carlier2021-01-151-3/+13
| | | | | | closes #1737 Reviewers: Marko Mäkelä, Krunal Bauskar
* Implement CPU feature checks for FreeBSD/powerpc64bb-10.5-danielblack-pr1710-freebsd-powerpc64pkubaj2021-01-151-0/+15
| | | | | | Fixes build on powerpc64 and powerpc64le. Closes: #1710
* Fixed compiler warnings from crc32c.ccMonty2020-11-261-6/+7
|
* MDEV-19935 Create unified CRC-32 interfaceVladislav Vaintroub2020-09-176-678/+1961
| | | | | | | Add CRC32C code to mysys. The x86-64 implementation uses PCMULQDQ in addition to CRC32 instruction after Intel whitepaper, and is ported from rocksdb code. Optimized ARM and POWER CRC32 were already present in mysys.
* MDEV-23680 Assertion `data' failed in crcr32_calc_pclmulqdqVladislav Vaintroub2020-09-071-1/+1
| | | | Fix DBUG_ASSERT
* MDEV-22749 Implement portable PCLMUL accelerated crc32() with Intel intrinsicsVladislav Vaintroub2020-09-041-497/+313
| | | | | | | | | Removed some inine assembly, replaced by code from https://github.com/intel/soft-crc Also,replace GCC inline assembly for cpuid in ut0crc32 with __cpuid, to fix "PIC register clobbered by 'ebx' in 'asm'. This enables fast CRC32C on 32bit Intel processors with GCC.
* MDEV-23585: Fix HAVE_CLMUL_INSTRUCTIONMarko Mäkelä2020-08-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | MDEV-22641 in commit dec3f8ca69e5eb19a4be7a175d3834874c4d880b refactored a SIMD implementation of CRC-32 for the ISO 3309 polynomial that uses the IA-32/AMD64 carry-less multiplication (pclmul) instructions. The code was previously only available in Mariabackup; it was changed to be a general replacement of the zlib crc32(). There exist AMD64 systems where CMAKE_SYSTEM_PROCESSOR matches the pattern i[36]86 but not x86_64 or amd64. This would cause a link failure, because mysys/checksum.c would basically assume that the compiler support for instruction is always available on GCC-compatible compilers on AMD64. Furthermore, we were unnecessarily disabling the SIMD acceleration for 32-bit executables. Note: Until MDEV-22749 has been implemented, the PCLMUL instruction will not be used on Microsoft Windows. Closes: #1660
* MDEV-23495: Refine Arm64 PMULL runtime check in MariaDBYuqi Gu2020-08-211-239/+189
| | | | | | | | | | | | | | | | | Raspberry Pi 4 supports crc32 but doesn't support pmull (MDEV-23030). The PR #1645 offers a solution to fix this issue. But it does not consider the condition that the target platform does support crc32 but not support PMULL. In this condition, it should leverage the Arm64 crc32 instruction (__crc32c) and just only skip parallel computation (pmull/vmull) rather than skip all hardware crc32 instruction of computation. The PR also removes unnecessary CRC32_ZERO branch in 'crc32c_aarch64' for MariaDB, formats the indent and coding style. Change-Id: I76371a6bd767b4985600e8cca10983d71b7e9459 Signed-off-by: Yuqi Gu <yuqi.gu@arm.com>
* MDEV-23030: ARM crash on Raspberry Pi 4Krunal Bauskar2020-07-301-0/+13
| | | | | | | | | | | | | MariaDB adopted a hardware optimized crc32c approach on ARM64 starting 10.5. Said implementation of crc32c needs support from target hardware for crc32 and pmull instructions. Existing logic is checking only for crc32 support from target hardware through a runtime check and so if target hardware doesn't support pmull it would cause things to fail/crash. Expanded runtime check to ensure pmull support is also checked on the target hardware along with existing crc32. Thanks to Marko and Daniel for review.
* MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558)mysqlonarm2020-06-016-0/+4053
Existing implementation used my_checksum (from mysys) for calculating table checksum and binlog checksum. This implementation was optimized for powerpc only and lacked SIMD implementation for x86 (using clmul) and ARM (using ACLE) instead used zlib-crc32. mariabackup had its own copy of the crc32 implementation using hardware optimized implementation only for x86 and lagged hardware based implementation for powerpc and ARM. Patch helps unifies all such calls and help aggregate all of them using an unified interface my_checksum(). Said unification also enables hardware optimized calls for all architecture viz. x86, ARM, POWERPC. Default always fallback to zlib crc32. Thanks to Daniel Black for reviewing, fixing and testing PowerPC changes. Thanks to Marko and Daniel for early code feedback.