Re:86 GB/s bitpacking with ARM SIMD (single thread)
by ashtonsix on Sunday October 05, 2025 @12:15PM
(#45482738)
Not having (1 << k) - 1 as a single instruction sucks when it HAS to be in a hot loop, but you can usually hoist this to the loop prolougue: my stuff uses dummy inline assembly hints to force compilers to do this `asm volatile("" : "+w"(m));`.
I personally think calibrating ARM's ISA on smaller VL was a good choice: you get much better IPC.
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by TinkersW on Sunday October 05, 2025 @01:08PM
(#45483272)
8 bit is not absent in x86 SIMD, it is a slightly less covered than 32 & 16 bit, but you can fully implement all the common 8 bit ops and most are 1 instruction(with AVX2). There are even various horizontal ops on 8 bit values(avg, dot etc).
Also AVX512 is way more common than SVE2, all Zen4 & Zen5 support it.
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by dzaima on Sunday October 05, 2025 @01:59PM
(#45483714)
More specifically, basically the only absent 8-bit ops that have 32-bit equivalents in AVX2 are shifts and multiplies. Shifts are quite annoying (though, with a uniform shift they can be emulated on AVX-512 via GFNI abuse in 1 instr), multiplies are rather rare (though note that there is vpmaddubsw for an 8-bit→16-bit multiply-add). There's even a case of the opposite - saturating add/sub exist for 8-bit and 16-bit ints, but not wider.
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by namibj on Sunday October 05, 2025 @06:38PM
(#45485919)
GFNI is distinct from AVX-512; it was merely introduced in cores that also had AVX-512.
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by Sesse__ on Sunday October 05, 2025 @02:55PM
(#45484172)
Does _any_ SIMD instruction set have (1 << k) - 1 as a single instruction?
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by camel-cdr on Sunday October 05, 2025 @03:35PM
(#45484505)
Not sure in which context this is used, but you can do -1 << k in most ISAs but that still requires a bit-not.
But if you want to use the value in a bitwise instruction, then there are often variants that can invert the input operand.
E.g. in RVV instead of vand.vv(a, vadd.vi(vsll.vv(1,k),-1)) you could do vandn.vv(vsll.vv(-1,k))
AVX-512 can do this with any binary or ternary bitwise logic function via vpternlog
Re:86 GB/s bitpacking with ARM SIMD (single thread)
by Sesse__ on Sunday October 05, 2025 @05:18PM
(#45485368)
I don't know either; I was talking about the lack of PMOVMSKB in NEON and then the comment I replied to started talking about (1 << k) - 1 not being a single instruction sucks. Which I don't think it is in any non-NEON set either.
NEON in general is a bit sad, really; it's built around the idea of being implementable with a 64-bit ALU, and it shows. And SVE support is pretty much non-existent on the client.