• Marko Mäkelä's avatar
    MDEV-22669 InnoDB lacks CRC-32C acceleration on IA-32 · afdd6b1d
    Marko Mäkelä authored
    In mysql/mysql-server@17e497bdb793bc6b8360aa1c626dcd8bb5cfad1b
    MySQL 5.6.3 introduced innodb_checksum_algorithm=crc32 and
    implemented it for AMD64 using the SSE 4.2 instructions
    (incorrectly advertised as "SSE2" in a startup message).
    It was not implemented on IA-32 or on Windows.
    
    Since MariaDB 10.2.11 commit 2401d14e
    we make use of the SSE4.2 CRC-32C instructions on Windows on both IA-32
    and AMD64.
    
    Let us be consistent and implement CRC-32C for IA-32 on all
    available platforms. GCC 4.8.2 and GCC 4.8.5 complain
    "error: PIC register clobbered by 'ebx' in 'asm'"
    so we will only enable this code for IA-32 starting with GCC 5.
    
    Also, we will clean up the implementation further after
    commit 1312b4eb.
    
    has_sse4_2(): Replaces ut_cpuid().
    
    ut_crc32c_8(): Replaces ut_crc32_8_hw().
    
    ut_crc32c_64(): Replaces ut_crc32_64_low_hw(), ut_crc32_64_hw().
    
    ut_crc32_hw(): Rewrite.
    
    ut_crc32c_8_sw(): Replaces ut_crc32_8_sw().
    
    ut_crc32c_64_sw(): Replaces ut_crc32_64_low_sw(), ut_crc32_64_sw().
    
    ut_crc32_sw(): Rewrite. Avoid code bloat and do not unroll the
    ut_crc32c_64_sw() loop, because no benefit has been demonstrated.
    
    ut_crc32_init(): Only invoke ut_crc32_slice8_table_init()
    if no acceleration is available.
    afdd6b1d
ut0crc32.cc 12.1 KB