Re: What exactly is our CRC algorithm?

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Andres Freund <andres(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: What exactly is our CRC algorithm?
Date: 2015-04-02 14:58:23
Message-ID: 551D590F.5010000@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/02/2015 12:39 PM, Abhijit Menon-Sen wrote:
> At 2015-03-25 19:18:51 +0200, hlinnaka(at)iki(dot)fi wrote:
>>
>> I think we'll need a version check there. […]
>>
>> You want to write that or should I?
>
> I'm not familiar with MSVC at all, so it would be nice if you did it.

Thinking more about the configure checks, I think the current approach
of using inline assembly on gcc is not quite right. We're only using
inline assembly to force producing SSE 4.2 code, even when -msse4.2 is
not used. That feels wrong.

And who's to say that the assembler supports the SSE instructions
anyway? At least we'd need a configure check for that too. We have a
buildfarm animal that still uses gcc 2.95.3, which was released in 2001.
I don't have a compiler of that vintage to test with, but I assume an
old enough assembler would not know about the crc32q instruction and
fail to compile.

I believe the GCC way to do this would be to put the SSE4.2-specific
code into a separate source file, and compile that file with "-msse4.2".
And when you compile with -msse4.2, gcc actually also supports the
_mm_crc32_u8/u64 intrinsics.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2015-04-02 15:27:24 Re: What exactly is our CRC algorithm?
Previous Message Robert Haas 2015-04-02 14:46:10 Re: Why SyncRepWakeQueue is not static?