C++ Logo


Advanced search

Re: [std-proposals] SIMD by just operating on 2 arrays

From: samuel ammonius <sfammonius_at_[hidden]>
Date: Wed, 12 Apr 2023 12:42:58 -0230
On Wed, Apr 12, 2023 at 12:20 PM Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> It's also a "language API break" (?) -- at the moment, `a - b` actually
> compiles and yields ptrdiff_t, not float[4]. (But if you actually
> evaluate it, it's UB https://eel.is/c++draft/expr#add-5.3 .)

But that's not what the standard says, that's just what most compilers have
decided to do. If it's already UB then why work to keep it stable?

If the platform doesn't have SIMD then the compiler can just turn it into a
loop. I think that was the plan for the existing SIMD proposal too. The
language change itself isn't that big of a change either. Using math
operations on arrays was never possible (other than how arrays decay to
pointers that can be treated like integers, but that's UB), so this is just
an addition to the language. I think it would also be pretty easy for
compilers to implement since it's just mixing concepts that they already

Received on 2023-04-12 15:13:10