git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 638a199) | patch
Use ARMv8 CRC instructions where available.
Wed, 4 Apr 2018 09:22:45 +0000 (12:22 +0300)
Wed, 4 Apr 2018 09:22:45 +0000 (12:22 +0300)
commit f044d71e331d77a0039cec0a11859b5a3c72bc95
Use ARMv8 CRC instructions where available.

ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.

Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.

For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.

Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.

Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
config/c-compiler.m4 diff | blob | blame | history
configure diff | blob | blame | history
configure.in diff | blob | blame | history
src/Makefile.global.in diff | blob | blame | history
src/include/pg_config.h.in diff | blob | blame | history
src/include/port/pg_crc32c.h diff | blob | blame | history
src/port/Makefile diff | blob | blame | history
src/port/pg_crc32c_armv8.c [new file with mode: 0644] blob
src/port/pg_crc32c_armv8_choose.c [new file with mode: 0644] blob
src/port/pg_crc32c_sse42_choose.c [moved from src/port/pg_crc32c_choose.c with 78% similarity] diff | blob | blame | history
src/tools/msvc/Mkvcbuild.pm diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /