diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-04-14 17:05:03 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-04-14 17:05:03 +0300 |
commit | 3dc2d62d0486325bf263655c2d9a96aee0b02abe (patch) | |
tree | 47336185d9126f14d8a3943503706023d05fe4b7 /src/port/Makefile | |
parent | 4f700bcd20c087f60346cb8aefd0e269be8e2157 (diff) | |
download | postgresql-3dc2d62d0486325bf263655c2d9a96aee0b02abe.tar.gz |
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.
Diffstat (limited to 'src/port/Makefile')
-rw-r--r-- | src/port/Makefile | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/port/Makefile b/src/port/Makefile index d1c9c8a987..bc9b63add0 100644 --- a/src/port/Makefile +++ b/src/port/Makefile @@ -30,10 +30,10 @@ include $(top_builddir)/src/Makefile.global override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS) LIBS += $(PTHREAD_LIBS) -OBJS = $(LIBOBJS) chklocale.o erand48.o inet_net_ntop.o \ +OBJS = $(LIBOBJS) $(PG_CRC32C_OBJS) chklocale.o erand48.o inet_net_ntop.o \ noblock.o path.o pgcheckdir.o pgmkdirp.o pgsleep.o \ pgstrcasecmp.o pqsignal.o \ - qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o pg_crc32c_sb8.o + qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o # foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND OBJS_SRV = $(OBJS:%.o=%_srv.o) @@ -57,6 +57,10 @@ libpgport.a: $(OBJS) # thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not) thread.o: CFLAGS+=$(PTHREAD_CFLAGS) +# pg_crc32c_sse42.o and its _srv.o version need CFLAGS_SSE42 +pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_SSE42) +pg_crc32c_sse42_srv.o: CFLAGS+=$(CFLAGS_SSE42) + # # Server versions of object files # |