Re: What exactly is our CRC algorithm?

Поиск
Список
Период
Сортировка
От Abhijit Menon-Sen
Тема Re: What exactly is our CRC algorithm?
Дата
Msg-id 20150402152724.GA20512@toroid.org
обсуждение исходный текст
Ответ на Re: What exactly is our CRC algorithm?  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: What exactly is our CRC algorithm?  (Andres Freund <andres@anarazel.de>)
Re: What exactly is our CRC algorithm?  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
At 2015-04-02 17:58:23 +0300, hlinnaka@iki.fi wrote:
>
> We're only using inline assembly to force producing SSE 4.2 code, even
> when -msse4.2 is not used. That feels wrong.

Why? It feels OK to me (and to Andres, per earlier discussions about
exactly this topic). Doing it this way allows the binary to run on a
non-SSE4.2 platform (and not use the CRC instructions).

Also, -msse4.2 was added to the compiler later than support for the
instructions was added to the assembler.

> 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.

GCC from <2002 wouldn't support the symbolic operand names in inline
assembly. binutils from <2007 (IIRC) wouldn't support the assembler
instructions themselves.

We could work around the latter by using the appropriate sequence of
bytes. We could work around the former by using the old syntax for
operands.

> 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.

I have no objection to this.

Building only that file with -msse4.2 would resolve the problem of the
output binary requiring SSE4.2; and the only compilers to be excluded
are old enough to be uninteresting at least to me personally.

Have you done/are you doing this already, or do you want me to? I could
use advice on how to add build flags to only one file, since I don't
know of any precendent for that.

-- Abhijit



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: What exactly is our CRC algorithm?
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: Tables cannot have INSTEAD OF triggers