coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cksum: Use pclmul hardware instruction for CRC32 calculation


From: Jeffrey Walton
Subject: Re: [PATCH] cksum: Use pclmul hardware instruction for CRC32 calculation
Date: Sun, 14 Mar 2021 23:48:48 -0400

On Sun, Mar 14, 2021 at 11:07 PM Kaz Kylheku (Coreutils)
<962-396-1872@kylheku.com> wrote:
>
> On 2021-03-14 12:55, Jeffrey Walton wrote:
> > The underlying problem is GCC, Clang and friends conflate the user's
> > ISA with ISA the compiler uses. They are not the same - they are
> > distinct. Unfortunately, GCC and Clang never addressed the underlying
> > problem.
>
> Sorry, what does that mean?

It means GCC and Clang will generate for the ISA the developer is
using without guarding it.

A developer may do something like:

  if (cpu_has_avx())
  {
    do_crc32_avx();
  }
  else
  {
    do_crc32();
  }

While Clang and GCC will not guard the code. GCC and Clang will hijack
the developer's ISA and generate code that SIGILL's.

Using Clang I had it happen to me on x86. Clang generated AVX code to
zero a structure because I was using AVX (properly guarded).

Using GCC I had it happen to me on POWER7. GCC used POWER8 in some
prologue because I had some POWER8 code paths (properly guarded).

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]