]> granicus.if.org Git - postgresql/commit
Further improve code for probing the availability of ARM CRC instructions.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 May 2018 15:32:57 +0000 (11:32 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 May 2018 15:32:57 +0000 (11:32 -0400)
commita7a7387575b87a7ae551307a24835f549d530d14
tree6b36dc2d648335523fd7974a68a2b087b7f0e449
parent30c66e77be1d890c3cca766259c0bec80bcac1b5
Further improve code for probing the availability of ARM CRC instructions.

Andrew Gierth pointed out that commit 1c72ec6f4 would yield the wrong
answer on big-endian ARM systems, because the data being CRC'd would be
different.  To fix that, and avoid the rather unsightly hard-wired
constant, simply compare the hardware and software implementations'
results.

While we're at it, also log the resulting decision at DEBUG1, and error
out if the hw and sw results unexpectedly differ.  Also, since this
file must compile for both frontend and backend, avoid incorrect
dependencies on backend-only headers.

In passing, add a comment to postmaster.c about when the CRC function
pointer will get initialized.

Thomas Munro, based on complaints from Andrew Gierth and Tom Lane

Discussion: https://postgr.es/m/HE1PR0801MB1323D171938EABC04FFE7FA9E3110@HE1PR0801MB1323.eurprd08.prod.outlook.com
src/backend/postmaster/postmaster.c
src/port/pg_crc32c_armv8_choose.c