News for hackers. Stuff that matters.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by bruce343434 on Wednesday June 07, 2023 @03:23AM (#36223899)
Software compiled to be "portable" uses a reduced subset. You actually have to bully GCC into using the full CPU instruction set with -march=native (you can also put another target CPU arch there).

In short, distributed binaries tend to use "least common denominator" instructions.

I believe one of the pros touted of Gentoo, where everything is compiled locally, is that all the software uses the CPU to it's fullest potential.

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by ZiiS on Wednesday June 07, 2023 @03:39AM (#36224010)
Lots of speed sensitive programs also ship multiple implementations they can choose at run time so they can more fully utilize a CPU without recompiling.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by jart on Wednesday June 07, 2023 @03:35AM (#36223992)
You can also dispatch at runtime based on CPUID (x86) or getauxval(AT_HWCAP) for ARM. Also Clang and GCC seem to be moving in the direction of removing -march=native which is sad since grokking all the different microarchitectures isn't easy.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by TekMol on Wednesday June 07, 2023 @03:28AM (#36223937)
Afaik, Debian runs on the 386? And I think that came out in the 80s?

So all new CPU instructions of the last 40 years are pretty much used by nobody?

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by Arnt on Wednesday June 07, 2023 @03:41AM (#36224024)
The new instructions are used often or seldom depending on whether you count invocations or occurences.

There are new instructions that can be used to write a constant-time SHA-256 hash function. A program that contains megabytes of code, more than a million instructions, may reasonably contain only a few of those instructions, because it contains only one or two small hash functions. The instructions are important and effective, but occur only a handful of times among a million instructions.

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by stephen_g on Wednesday June 07, 2023 @03:33AM (#36223966)
No, according to this [1], Debian's i386 architecture dropped support for the 386 and 486 in versions Sarge and Squeeze respectively. Pretty amazing that it did work on the first Pentium (released 1993!) up to 2018. In Debian version after Jessie the Pentium (i586) has been dropped too [2].

Of course, I don't think many people are using i386 builds anymore - most people would have switched to the more modern x86_64 long ago.

1. https://www.debian.org/releases/jessie/i386/ch02s01.html.en

2. https://www.debian.org/releases/stretch/i386/ch02s01.html.en

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by pjc50 on Wednesday June 07, 2023 @04:09AM (#36224230)
The dirty secret is: yes, many of the new instructions aren't used very often. They only come into play in certain cases: encryption, signal processing, CPU graphics (e.g. paint packages), video/jpeg decoding (when not done on GPU) and so on, most of which are packaged inside libraries which may or may not have multi-CPU implementations.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by rerdavies on Wednesday June 07, 2023 @07:08AM (#36225382)
I think the default configuration for GCC x64 is SSE 4.0 instructions enabled, AVX2 instructions enabled, AVX512 and SSE 4.2 disabled. And I think MSVC defaults to processors of a roughly similar age (10 to 15 years old). So instructions in the 40-to-15 year old range get used a lot.

If you're running software that's heavily math intensive, or ever gets benchmarked, it's a fairly good bet that they will have either conditionally-installed or conditional-executed code that targets more modern processors.

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by Denvercoder9 on Wednesday June 07, 2023 @01:16PM (#36229895)
The baseline amd64 System V ABI, which is what Debian targets, only includes SSE and SSE2; not SSE3, SSE4 or AVX2.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by msla on Wednesday June 07, 2023 @10:08AM (#36226967)
The Linux kernel dropped support for the original 80386 in December 2012, with kernel 3.8

Debian dropped support with sarge in 2005

https://en.wikipedia.org/wiki/I386

Re:“csinc”, the AArch64 instruction you didn’t know you wanted by another2another on Wednesday June 07, 2023 @05:58AM (#36224887)
Probably one of the biggest Bang for your Buck (on Linux) would be to recompile your libc and OpenSSL with -march=native. Then at least all software that depends on those libs (probably the majority) would get some benefit from your local processors extensions.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by trelane on Wednesday June 07, 2023 @08:29AM (#36225946)
Or you can use Gentoo.
Re:“csinc”, the AArch64 instruction you didn’t know you wanted by Sesse__ on Thursday June 08, 2023 @08:11AM (#36240548)
glibc and OpenSSL both have runtime detection of CPU features to switch between hand-coded versions of hot functions, so those two are probably the packages that will get the _least_ benefit from a recompilation.