Skip to content
Snippets Groups Projects
  • Adenilson Cavalcanti's avatar
    Using ARMv8 CRC32 specific instruction · d7601c23
    Adenilson Cavalcanti authored
    CRC32 affects performance for both image decompression (PNG)
    as also in general browsing while accessing websites that serve
    content using compression (i.e. Content-Encoding: gzip).
    
    This patch implements an optimized CRC32 function using the
    dedicated instruction available in ARMv8. This instruction is available
    in new Android devices featuring an ARMv8 SoC, like Nexus 5x and
    Google Pixel.
    
    It should be between 6x (A53: 116ms X 22ms for a 4Kx4Kx4 buffer) to
    10x faster (A72: 91ms x 9ms) than the C implementation currently used
    by zlib.
    
    PNG decoding performance gains should be around 5-9%.
    
    Finally it also introduces code to perform the ARM CPU features detection
    using getauxval()@Linux/CrOS or android_getCpuFeatures(). We pre-built
    and link the CRC32 instruction dependent code but will decide if to
    use it at run time.
    
    If the feature is not supported, we fallback to the C implementation.
    
    This approach allows to use the instruction in both 32bits and 64bits
    builds and works fine either in ARMv7 or ARMv8 processor. I tested the
    generated Chromium apk in both a ARMv7 (Nexus 4 and 6) and ARMv8 (Nexus 5x and
    Google Pixel).
    
    Change-Id: I069408ebc06c49a3c2be4ba3253319e025ee09d7
    Bug: 709716
    Reviewed-on: https://chromium-review.googlesource.com/612629
    
    
    Reviewed-by: default avatarChris Blume <cblume@chromium.org>
    Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
    Cr-Original-Commit-Position: refs/heads/master@{#520377}
    Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
    Cr-Mirrored-Commit: 35988c821c051a57e30c76f9fcd87b7b677bd9bd
    d7601c23