[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 15:55:35 -0400 |
On Sun, Mar 14, 2021 at 9:36 AM Kristoffer Brånemyr via GNU coreutils
General Discussion <coreutils@gnu.org> wrote:
>
> Hi,
> Ok, good to know it's progressing!
> I think that it would be best not to compile the main cksum.c with the -mavx
> .. flags. With those flags I think the compiler is free to insert AVX
> instructions in the main cksum.o file, which would fail on a CPU not
> supporting it. Think for instance of a package maintainer of a linux
> distributions, the compiler that person used would support -mavx so the flag
> is enabled by autoconf, but another person using the resulting binary might
> have a CPU not supporting AVX. That's what I tried to avoid by only having
> the cksum_pclmul.c enabling the compiler flags, plus runtime detection.
+1. Do the per-object file thing.
Clang will even use AVX to zero memory buffers when AVX is in effect
via -mavx. That's speaking from experience from a SIGILL crash on a
Core2 machine.
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.
Only Microsoft compilers got it right. MS compilers allow a user to
use any ISA the compiler supports without options. If an option is
present, like /arch:AVX2, that signals the compiler it can use the
ISA, too.
Jeff