• G
    Rework SSE42 implementation and runtime logic to be more similar to PostgreSQL 9.5 · 6c025b52
    Garrett Thornburg 提交于
    This patch merges the PostgreSQL 9.5 implementation of SSE4.2 into GPDB.
    The SSE4.2 implementation was lifted right out of PostgreSQL without
    change to make merging later PostgreSQL releases easier.
    
    Update win32 configuration to support SSE4.2 runtime checks
    
    This change was pulled from "src/include/pg_config.h.win32" from the
    commits below.
    
    configure.in changes, determining if cpu instruction for perfomring runtime
    checks are availible, and moving some of the code to port SSE4.2 came from the
    following PostgreSQL commits:
    
    commit 3dc2d62d
    Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
    Date:   Tue Apr 14 17:05:03 2015 +0300
    
        Use Intel SSE 4.2 CRC instructions where available.
    
        Modern x86 and x86-64 processors with SSE 4.2 support have special
        instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
        speed up CRC calculation.
    
        Whether the instructions can be used or not depends on the compiler and the
        target architecture. If generation of SSE 4.2 instructions is allowed for
        the target (-msse4.2 flag on gcc and clang), use them. If they are not
        allowed by default, but the compiler supports the -msse4.2 flag to enable
        them, compile just the CRC-32C function with -msse4.2 flag, and check at
        runtime whether the processor we're running on supports it. If it doesn't,
        fall back to the slicing-by-8 algorithm. (With the common defaults on
        current operating systems, the runtime-check variant is what you get in
        practice.)
    
        Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
    
    commit b4eb2d16
    Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
    Date:   Tue Apr 14 19:56:00 2015 +0300
    	On gcc and clang, the _mm_crc32_u8 and _mm_crc32_u64 intrinsics are not
    	defined at all, when not building with -msse4.2. But on icc, they are.
    	So we cannot assume that if those intrinsics are defined, we can always use
    	them safely, we might still need the runtime check.
    
    	To fix, check if the __SSE_4_2__ preprocessor symbol is defined. That's
    	supposed to be defined only when the compiler is targeting a processor that
    	has SSE 4.2 support.
    
    	Per buildfarm members fulmar and okapi.
    6c025b52
Makefile.global.in 19.5 KB